rolldown 0.13.2 → 0.14.0

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 (54) hide show
  1. package/LICENSE +1 -1
  2. package/dist/cjs/cli.cjs +388 -95
  3. package/dist/cjs/experimental-index.cjs +2 -3
  4. package/dist/cjs/index.cjs +2 -13
  5. package/dist/cjs/parallel-plugin-worker.cjs +2 -2
  6. package/dist/esm/cli.mjs +387 -94
  7. package/dist/esm/experimental-index.mjs +1 -2
  8. package/dist/esm/index.mjs +2 -14
  9. package/dist/esm/parallel-plugin-worker.mjs +1 -1
  10. package/dist/shared/{consola.36c0034f-eps_ogJv.cjs → consola.36c0034f-HcmWcfPe.cjs} +2 -2
  11. package/dist/shared/{consola.36c0034f-m5cABVv4.mjs → consola.36c0034f-Xyw7SC_7.mjs} +1 -1
  12. package/dist/shared/{prompt-Ah5G71p-.cjs → prompt-9Ij3R3TG.cjs} +2 -2
  13. package/dist/shared/{prompt-9VjtYvi_.mjs → prompt-hoPhcrA-.mjs} +1 -1
  14. package/dist/shared/rolldown-binding.wasi.cjs +82 -73
  15. package/dist/shared/src_index-3pqhEViJ.cjs +2785 -0
  16. package/dist/shared/src_index-ywYMd4vB.mjs +2786 -0
  17. package/dist/shared/watcher-worker.js +1 -0
  18. package/dist/types/binding.d.ts +154 -66
  19. package/dist/types/cli/arguments/alias.d.ts +1 -0
  20. package/dist/types/cli/arguments/index.d.ts +1 -1
  21. package/dist/types/cli/arguments/normalize.d.ts +1 -0
  22. package/dist/types/cli/arguments/schema.d.ts +120 -35
  23. package/dist/types/constants/plugin.d.ts +1 -1
  24. package/dist/types/constants/types.d.ts +1 -0
  25. package/dist/types/experimental-index.d.ts +1 -0
  26. package/dist/types/index.d.ts +6 -5
  27. package/dist/types/log/logger.d.ts +9 -2
  28. package/dist/types/options/input-options.d.ts +241 -13
  29. package/dist/types/options/normalized-alias-plugin-config.d.ts +0 -2
  30. package/dist/types/options/normalized-output-options.d.ts +1 -1
  31. package/dist/types/options/output-options.d.ts +52 -54
  32. package/dist/types/options/watch-option.d.ts +5 -0
  33. package/dist/types/plugin/bindingify-hook-filter.d.ts +2 -0
  34. package/dist/types/plugin/bindingify-output-hooks.d.ts +1 -0
  35. package/dist/types/plugin/bindingify-watch-hooks.d.ts +7 -0
  36. package/dist/types/plugin/hook-filter.d.ts +48 -0
  37. package/dist/types/plugin/index.d.ts +9 -15
  38. package/dist/types/plugin/plugin-context-data.d.ts +1 -1
  39. package/dist/types/plugin/plugin-context.d.ts +2 -6
  40. package/dist/types/plugin/plugin-driver.d.ts +1 -0
  41. package/dist/types/rolldown-build.d.ts +1 -1
  42. package/dist/types/rolldown.d.ts +3 -0
  43. package/dist/types/types/utils.d.ts +1 -0
  44. package/dist/types/utils/create-bundler.d.ts +3 -2
  45. package/dist/types/utils/transform-to-rollup-output.d.ts +8 -3
  46. package/dist/types/watcher.d.ts +31 -0
  47. package/package.json +19 -17
  48. package/dist/shared/package-8qJYyGdm.cjs +0 -11
  49. package/dist/shared/package-unZcnfG9.mjs +0 -9
  50. package/dist/shared/plugin-context-data-F1I9ytXp.cjs +0 -1435
  51. package/dist/shared/plugin-context-data-iKSAvmTX.mjs +0 -1442
  52. package/dist/shared/rolldown-ESzFTeqV.cjs +0 -1087
  53. package/dist/shared/rolldown-Hf7txSlh.mjs +0 -1071
  54. /package/dist/shared/{chunk-gQ4GMlVi.cjs → chunk-JoMxl5V2.cjs} +0 -0
package/dist/esm/cli.mjs CHANGED
@@ -1,10 +1,8 @@
1
1
  import __node_module__ from 'node:module';
2
2
  const require = __node_module__.createRequire(import.meta.url)
3
- import { LogLevelOptionSchema, LogLevelSchema, LogLevelWithErrorSchema, RollupLogSchema, RollupLogWithStringSchema, __export, arraify } from "../shared/plugin-context-data-iKSAvmTX.mjs";
4
- import { rolldown } from "../shared/rolldown-Hf7txSlh.mjs";
5
- import { description, version } from "../shared/package-unZcnfG9.mjs";
6
- import { createConsola } from "../shared/consola.36c0034f-m5cABVv4.mjs";
7
- import { default as nodePath } from "node:path";
3
+ import { LogLevelOptionSchema, LogLevelSchema, LogLevelWithErrorSchema, RollupLogSchema, RollupLogWithStringSchema, __export, arraify, description, rolldown, version, watch } from "../shared/src_index-ywYMd4vB.mjs";
4
+ import { createConsola } from "../shared/consola.36c0034f-Xyw7SC_7.mjs";
5
+ import { default as nodePath, default as path } from "node:path";
8
6
  import { ZodFirstPartyTypeKind, ZodFirstPartyTypeKind as ZodFirstPartyTypeKind$1, ZodFirstPartyTypeKind as ZodFirstPartyTypeKind$2, z, z as z$1, z as z$2, z as z$3 } from "zod";
9
7
  import { default as process$1, env } from "node:process";
10
8
  import { performance } from "node:perf_hooks";
@@ -114,6 +112,205 @@ __export(colors_ns, {
114
112
  });
115
113
  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});
116
114
 
115
+ //#endregion
116
+ //#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
117
+ const signals = [];
118
+ signals.push("SIGHUP", "SIGINT", "SIGTERM");
119
+ if (process.platform !== "win32") {
120
+ signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
121
+ }
122
+ if (process.platform === "linux") {
123
+ signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
124
+ }
125
+
126
+ //#endregion
127
+ //#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
128
+ const processOk = (process$3) => !!process$3 && typeof process$3 === "object" && typeof process$3.removeListener === "function" && typeof process$3.emit === "function" && typeof process$3.reallyExit === "function" && typeof process$3.listeners === "function" && typeof process$3.kill === "function" && typeof process$3.pid === "number" && typeof process$3.on === "function";
129
+ const kExitEmitter = Symbol.for("signal-exit emitter");
130
+ const global = globalThis;
131
+ const ObjectDefineProperty = Object.defineProperty.bind(Object);
132
+ class Emitter {
133
+ emitted = {
134
+ afterExit: false,
135
+ exit: false
136
+ };
137
+ listeners = {
138
+ afterExit: [],
139
+ exit: []
140
+ };
141
+ count = 0;
142
+ id = Math.random();
143
+ constructor() {
144
+ if (global[kExitEmitter]) {
145
+ return global[kExitEmitter];
146
+ }
147
+ ObjectDefineProperty(global, kExitEmitter, {
148
+ value: this,
149
+ writable: false,
150
+ enumerable: false,
151
+ configurable: false
152
+ });
153
+ }
154
+ on(ev, fn) {
155
+ this.listeners[ev].push(fn);
156
+ }
157
+ removeListener(ev, fn) {
158
+ const list = this.listeners[ev];
159
+ const i = list.indexOf(fn);
160
+ if (i === -1) {
161
+ return;
162
+ }
163
+ if (i === 0 && list.length === 1) {
164
+ list.length = 0;
165
+ } else {
166
+ list.splice(i, 1);
167
+ }
168
+ }
169
+ emit(ev, code, signal) {
170
+ if (this.emitted[ev]) {
171
+ return false;
172
+ }
173
+ this.emitted[ev] = true;
174
+ let ret = false;
175
+ for (const fn of this.listeners[ev]) {
176
+ ret = fn(code, signal) === true || ret;
177
+ }
178
+ if (ev === "exit") {
179
+ ret = this.emit("afterExit", code, signal) || ret;
180
+ }
181
+ return ret;
182
+ }
183
+ }
184
+ class SignalExitBase {}
185
+ const signalExitWrap = (handler) => {
186
+ return {
187
+ onExit(cb, opts) {
188
+ return handler.onExit(cb, opts);
189
+ },
190
+ load() {
191
+ return handler.load();
192
+ },
193
+ unload() {
194
+ return handler.unload();
195
+ }
196
+ };
197
+ };
198
+ class SignalExitFallback extends SignalExitBase {
199
+ onExit() {
200
+ return () => {};
201
+ }
202
+ load() {}
203
+ unload() {}
204
+ }
205
+ class SignalExit extends SignalExitBase {
206
+ #hupSig = process$2.platform === "win32" ? "SIGINT" : "SIGHUP";
207
+ #emitter = new Emitter();
208
+ #process;
209
+ #originalProcessEmit;
210
+ #originalProcessReallyExit;
211
+ #sigListeners = {};
212
+ #loaded = false;
213
+ constructor(process$3) {
214
+ super();
215
+ this.#process = process$3;
216
+ this.#sigListeners = {};
217
+ for (const sig of signals) {
218
+ this.#sigListeners[sig] = () => {
219
+ const listeners = this.#process.listeners(sig);
220
+ let { count: count } = this.#emitter;
221
+ const p = process$3;
222
+ if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
223
+ count += p.__signal_exit_emitter__.count;
224
+ }
225
+ if (listeners.length === count) {
226
+ this.unload();
227
+ const ret = this.#emitter.emit("exit", null, sig);
228
+ const s = sig === "SIGHUP" ? this.#hupSig : sig;
229
+ if (!ret) process$3.kill(process$3.pid, s);
230
+ }
231
+ };
232
+ }
233
+ this.#originalProcessReallyExit = process$3.reallyExit;
234
+ this.#originalProcessEmit = process$3.emit;
235
+ }
236
+ onExit(cb, opts) {
237
+ if (!processOk(this.#process)) {
238
+ return () => {};
239
+ }
240
+ if (this.#loaded === false) {
241
+ this.load();
242
+ }
243
+ const ev = opts?.alwaysLast ? "afterExit" : "exit";
244
+ this.#emitter.on(ev, cb);
245
+ return () => {
246
+ this.#emitter.removeListener(ev, cb);
247
+ if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
248
+ this.unload();
249
+ }
250
+ };
251
+ }
252
+ load() {
253
+ if (this.#loaded) {
254
+ return;
255
+ }
256
+ this.#loaded = true;
257
+ this.#emitter.count += 1;
258
+ for (const sig of signals) {
259
+ try {
260
+ const fn = this.#sigListeners[sig];
261
+ if (fn) this.#process.on(sig, fn);
262
+ } catch (_) {}
263
+ }
264
+ this.#process.emit = (ev, ...a) => {
265
+ return this.#processEmit(ev, ...a);
266
+ };
267
+ this.#process.reallyExit = (code) => {
268
+ return this.#processReallyExit(code);
269
+ };
270
+ }
271
+ unload() {
272
+ if (!this.#loaded) {
273
+ return;
274
+ }
275
+ this.#loaded = false;
276
+ signals.forEach((sig) => {
277
+ const listener = this.#sigListeners[sig];
278
+ if (!listener) {
279
+ throw new Error("Listener not defined for signal: " + sig);
280
+ }
281
+ try {
282
+ this.#process.removeListener(sig, listener);
283
+ } catch (_) {}
284
+ });
285
+ this.#process.emit = this.#originalProcessEmit;
286
+ this.#process.reallyExit = this.#originalProcessReallyExit;
287
+ this.#emitter.count -= 1;
288
+ }
289
+ #processReallyExit(code) {
290
+ if (!processOk(this.#process)) {
291
+ return 0;
292
+ }
293
+ this.#process.exitCode = code || 0;
294
+ this.#emitter.emit("exit", this.#process.exitCode, null);
295
+ return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
296
+ }
297
+ #processEmit(ev, ...args) {
298
+ const og = this.#originalProcessEmit;
299
+ if (ev === "exit" && processOk(this.#process)) {
300
+ if (typeof args[0] === "number") {
301
+ this.#process.exitCode = args[0];
302
+ }
303
+ const ret = og.call(this.#process, ev, ...args);
304
+ this.#emitter.emit("exit", this.#process.exitCode, null);
305
+ return ret;
306
+ } else {
307
+ return og.call(this.#process, ev, ...args);
308
+ }
309
+ }
310
+ }
311
+ const process$2 = globalThis.process;
312
+ const { onExit: onExit, load: load, unload: unload } = signalExitWrap(processOk(process$2) ? new SignalExit(process$2) : new SignalExitFallback());
313
+
117
314
  //#endregion
118
315
  //#region src/cli/commands/bundle.ts
119
316
  async function bundleWithConfig(configPath, cliOptions) {
@@ -124,13 +321,13 @@ async function bundleWithConfig(configPath, cliOptions) {
124
321
  }
125
322
  const configList = arraify(config);
126
323
  for (const config$1 of configList) {
127
- await bundleInner(config$1, cliOptions);
324
+ cliOptions.watch ? await watchInner(config$1, cliOptions) : bundleInner(config$1, cliOptions);
128
325
  }
129
326
  }
130
327
  async function bundleWithCliOptions(cliOptions) {
131
328
  if (cliOptions.output.dir) {
132
- await bundleInner({}, cliOptions);
133
- } else {
329
+ cliOptions.watch ? await watchInner({}, cliOptions) : await bundleInner({}, cliOptions);
330
+ } else if (!cliOptions.watch) {
134
331
  const build = await rolldown(cliOptions.input);
135
332
  const { output: output } = await build.generate(cliOptions.output);
136
333
  if (output.length > 1) {
@@ -142,8 +339,42 @@ async function bundleWithCliOptions(cliOptions) {
142
339
  } else {
143
340
  logger.log(output[0].code);
144
341
  }
342
+ } else {
343
+ logger.error("You must specify `output.dir` to use watch mode");
344
+ process.exit(1);
145
345
  }
146
346
  }
347
+ async function watchInner(options$1, cliOptions) {
348
+ const watcher = await watch({
349
+ ...options$1,
350
+ ...cliOptions.input
351
+ });
352
+ onExit((code) => {
353
+ (Promise.resolve(watcher.close())).finally(() => {
354
+ process.exit(typeof code === "number" ? code : 0);
355
+ });
356
+ return true;
357
+ });
358
+ const changedFile = [];
359
+ watcher.on("change", (id, event) => {
360
+ if (event.event === "update") {
361
+ changedFile.push(id);
362
+ }
363
+ });
364
+ watcher.on("event", (event) => {
365
+ switch (event.code) {
366
+ case "BUNDLE_START":
367
+ logger.log(`Found ${bold((changedFile.map(relativeId)).join(", "))} changed, rebuilding...`);
368
+ changedFile.length = 0;
369
+ break;
370
+ case "BUNDLE_END":
371
+ logger.success(`Rebuilt ${bold(relativeId(event.output[0]))} in ${bold(ms(event.duration))}.`);
372
+ break;
373
+ default: break;
374
+ }
375
+ });
376
+ logger.log(`Waiting for changes...`);
377
+ }
147
378
  async function bundleInner(options$1, cliOptions) {
148
379
  const startTime = performance.now();
149
380
  const build = await rolldown({
@@ -158,8 +389,7 @@ async function bundleInner(options$1, cliOptions) {
158
389
  printBundleOutputPretty(bundleOutput);
159
390
  logger.log(``);
160
391
  const duration = endTime - startTime;
161
- const spent = duration < 1000 ? `${duration.toFixed(2)} ms` : `${(duration / 1000).toFixed(2)} s`;
162
- logger.success(`Finished in ${bold(spent)}`);
392
+ logger.success(`Finished in ${bold(ms(duration))}`);
163
393
  }
164
394
  function printBundleOutputPretty(output) {
165
395
  const outputEntries = collectOutputEntries(output.output);
@@ -220,15 +450,22 @@ function printOutputEntries(entries, sizeAdjustment, distPath) {
220
450
  }
221
451
  }
222
452
  }
223
- function withTrailingSlash(path) {
224
- if (path[path.length - 1] !== "/") {
225
- return `${path}/`;
453
+ function withTrailingSlash(path$1) {
454
+ if (path$1[path$1.length - 1] !== "/") {
455
+ return `${path$1}/`;
226
456
  }
227
- return path;
457
+ return path$1;
458
+ }
459
+ function ms(duration) {
460
+ return duration < 1000 ? `${duration.toFixed(2)} ms` : `${(duration / 1000).toFixed(2)} s`;
461
+ }
462
+ function relativeId(id) {
463
+ if (!path.isAbsolute(id)) return id;
464
+ return path.relative(path.resolve(), id);
228
465
  }
229
466
 
230
467
  //#endregion
231
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/Options.js
468
+ //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/Options.js
232
469
  const ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
233
470
  const defaultOptions = {
234
471
  name: undefined,
@@ -260,7 +497,7 @@ const getDefaultOptions = (options$1) => typeof options$1 === "string" ? {
260
497
  };
261
498
 
262
499
  //#endregion
263
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/Refs.js
500
+ //#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
264
501
  const getRefs = (options$1) => {
265
502
  const _options = getDefaultOptions(options$1);
266
503
  const currentPath = _options.name !== undefined ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
@@ -277,7 +514,7 @@ const getRefs = (options$1) => {
277
514
  };
278
515
 
279
516
  //#endregion
280
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/errorMessages.js
517
+ //#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
281
518
  function addErrorMessage(res, key, errorMessage, refs) {
282
519
  if (!refs?.errorMessages) return;
283
520
  if (errorMessage) {
@@ -293,16 +530,16 @@ function setResponseValueAndErrors(res, key, value, errorMessage, refs) {
293
530
  }
294
531
 
295
532
  //#endregion
296
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/any.js
533
+ //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/any.js
297
534
  function parseAnyDef() {
298
535
  return {};
299
536
  }
300
537
 
301
538
  //#endregion
302
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/array.js
539
+ //#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
303
540
  function parseArrayDef(def, refs) {
304
541
  const res = {type: "array"};
305
- if (def.type?._def?.typeName !== ZodFirstPartyTypeKind$2.ZodAny) {
542
+ if (def.type?._def && def.type?._def?.typeName !== ZodFirstPartyTypeKind$2.ZodAny) {
306
543
  res.items = parseDef(def.type._def, {
307
544
  ...refs,
308
545
  currentPath: [...refs.currentPath, "items"]
@@ -322,7 +559,7 @@ function parseArrayDef(def, refs) {
322
559
  }
323
560
 
324
561
  //#endregion
325
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js
562
+ //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js
326
563
  function parseBigintDef(def, refs) {
327
564
  const res = {
328
565
  type: "integer",
@@ -368,25 +605,25 @@ function parseBigintDef(def, refs) {
368
605
  }
369
606
 
370
607
  //#endregion
371
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js
608
+ //#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
372
609
  function parseBooleanDef() {
373
610
  return {type: "boolean"};
374
611
  }
375
612
 
376
613
  //#endregion
377
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js
614
+ //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js
378
615
  function parseBrandedDef(_def, refs) {
379
616
  return parseDef(_def.type._def, refs);
380
617
  }
381
618
 
382
619
  //#endregion
383
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
620
+ //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
384
621
  const parseCatchDef = (def, refs) => {
385
622
  return parseDef(def.innerType._def, refs);
386
623
  };
387
624
 
388
625
  //#endregion
389
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/date.js
626
+ //#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
390
627
  function parseDateDef(def, refs, overrideDateStrategy) {
391
628
  const strategy = overrideDateStrategy ?? refs.dateStrategy;
392
629
  if (Array.isArray(strategy)) {
@@ -427,7 +664,7 @@ const integerDateParser = (def, refs) => {
427
664
  };
428
665
 
429
666
  //#endregion
430
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/default.js
667
+ //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/default.js
431
668
  function parseDefaultDef(_def, refs) {
432
669
  return {
433
670
  ...parseDef(_def.innerType._def, refs),
@@ -436,13 +673,13 @@ function parseDefaultDef(_def, refs) {
436
673
  }
437
674
 
438
675
  //#endregion
439
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
676
+ //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
440
677
  function parseEffectsDef(_def, refs) {
441
678
  return refs.effectStrategy === "input" ? parseDef(_def.schema._def, refs) : {};
442
679
  }
443
680
 
444
681
  //#endregion
445
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js
682
+ //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js
446
683
  function parseEnumDef(def) {
447
684
  return {
448
685
  type: "string",
@@ -451,7 +688,7 @@ function parseEnumDef(def) {
451
688
  }
452
689
 
453
690
  //#endregion
454
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
691
+ //#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
455
692
  const isJsonSchema7AllOfType = (type) => {
456
693
  if ("type"in type && type.type === "string") return false;
457
694
  return "allOf"in type;
@@ -490,7 +727,7 @@ function parseIntersectionDef(def, refs) {
490
727
  }
491
728
 
492
729
  //#endregion
493
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
730
+ //#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
494
731
  function parseLiteralDef(def, refs) {
495
732
  const parsedType = typeof def.value;
496
733
  if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") {
@@ -509,7 +746,7 @@ function parseLiteralDef(def, refs) {
509
746
  }
510
747
 
511
748
  //#endregion
512
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
749
+ //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
513
750
  let emojiRegex;
514
751
  const zodPatterns = {
515
752
  cuid: /^[cC][^\s-]{8,}$/,
@@ -765,7 +1002,7 @@ const processRegExp = (regexOrFunction, refs) => {
765
1002
  };
766
1003
 
767
1004
  //#endregion
768
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/record.js
1005
+ //#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
769
1006
  function parseRecordDef(def, refs) {
770
1007
  if (refs.target === "openApi3" && def.keyType?._def.typeName === ZodFirstPartyTypeKind$1.ZodEnum) {
771
1008
  return {
@@ -792,10 +1029,7 @@ function parseRecordDef(def, refs) {
792
1029
  return schema$1;
793
1030
  }
794
1031
  if (def.keyType?._def.typeName === ZodFirstPartyTypeKind$1.ZodString && def.keyType._def.checks?.length) {
795
- const keyType = (Object.entries(parseStringDef(def.keyType._def, refs))).reduce((acc, [key, value]) => key === "type" ? acc : {
796
- ...acc,
797
- [key]: value
798
- }, {});
1032
+ const { type: type,...keyType } = parseStringDef(def.keyType._def, refs);
799
1033
  return {
800
1034
  ...schema$1,
801
1035
  propertyNames: keyType
@@ -805,12 +1039,18 @@ function parseRecordDef(def, refs) {
805
1039
  ...schema$1,
806
1040
  propertyNames: {enum: def.keyType._def.values}
807
1041
  };
1042
+ } 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) {
1043
+ const { type: type,...keyType } = parseBrandedDef(def.keyType._def, refs);
1044
+ return {
1045
+ ...schema$1,
1046
+ propertyNames: keyType
1047
+ };
808
1048
  }
809
1049
  return schema$1;
810
1050
  }
811
1051
 
812
1052
  //#endregion
813
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/map.js
1053
+ //#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
814
1054
  function parseMapDef(def, refs) {
815
1055
  if (refs.mapStrategy === "record") {
816
1056
  return parseRecordDef(def, refs);
@@ -836,7 +1076,7 @@ function parseMapDef(def, refs) {
836
1076
  }
837
1077
 
838
1078
  //#endregion
839
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
1079
+ //#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
840
1080
  function parseNativeEnumDef(def) {
841
1081
  const object = def.values;
842
1082
  const actualKeys = (Object.keys(def.values)).filter((key) => {
@@ -851,13 +1091,13 @@ function parseNativeEnumDef(def) {
851
1091
  }
852
1092
 
853
1093
  //#endregion
854
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/never.js
1094
+ //#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
855
1095
  function parseNeverDef() {
856
1096
  return {not: {}};
857
1097
  }
858
1098
 
859
1099
  //#endregion
860
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/null.js
1100
+ //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/null.js
861
1101
  function parseNullDef(refs) {
862
1102
  return refs.target === "openApi3" ? {
863
1103
  enum: ["null"],
@@ -866,7 +1106,7 @@ function parseNullDef(refs) {
866
1106
  }
867
1107
 
868
1108
  //#endregion
869
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/union.js
1109
+ //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/union.js
870
1110
  const primitiveMappings = {
871
1111
  ZodString: "string",
872
1112
  ZodNumber: "number",
@@ -924,7 +1164,7 @@ const asAnyOf = (def, refs) => {
924
1164
  };
925
1165
 
926
1166
  //#endregion
927
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js
1167
+ //#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
928
1168
  function parseNullableDef(def, refs) {
929
1169
  if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(def.innerType._def.typeName) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
930
1170
  if (refs.target === "openApi3") {
@@ -957,7 +1197,7 @@ function parseNullableDef(def, refs) {
957
1197
  }
958
1198
 
959
1199
  //#endregion
960
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/number.js
1200
+ //#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
961
1201
  function parseNumberDef(def, refs) {
962
1202
  const res = {type: "number"};
963
1203
  if (!def.checks) return res;
@@ -1004,7 +1244,7 @@ function parseNumberDef(def, refs) {
1004
1244
  }
1005
1245
 
1006
1246
  //#endregion
1007
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/object.js
1247
+ //#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
1008
1248
  function decideAdditionalProperties(def, refs) {
1009
1249
  if (refs.removeAdditionalStrategy === "strict") {
1010
1250
  return def.catchall._def.typeName === "ZodNever" ? def.unknownKeys !== "strict" : parseDef(def.catchall._def, {
@@ -1047,7 +1287,7 @@ function parseObjectDef(def, refs) {
1047
1287
  }
1048
1288
 
1049
1289
  //#endregion
1050
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js
1290
+ //#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
1051
1291
  const parseOptionalDef = (def, refs) => {
1052
1292
  if (refs.currentPath.toString() === refs.propertyPath?.toString()) {
1053
1293
  return parseDef(def.innerType._def, refs);
@@ -1060,7 +1300,7 @@ const parseOptionalDef = (def, refs) => {
1060
1300
  };
1061
1301
 
1062
1302
  //#endregion
1063
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js
1303
+ //#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
1064
1304
  const parsePipelineDef = (def, refs) => {
1065
1305
  if (refs.pipeStrategy === "input") {
1066
1306
  return parseDef(def.in._def, refs);
@@ -1079,13 +1319,13 @@ const parsePipelineDef = (def, refs) => {
1079
1319
  };
1080
1320
 
1081
1321
  //#endregion
1082
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
1322
+ //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
1083
1323
  function parsePromiseDef(def, refs) {
1084
1324
  return parseDef(def.type._def, refs);
1085
1325
  }
1086
1326
 
1087
1327
  //#endregion
1088
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/set.js
1328
+ //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/set.js
1089
1329
  function parseSetDef(def, refs) {
1090
1330
  const items = parseDef(def.valueType._def, {
1091
1331
  ...refs,
@@ -1106,7 +1346,7 @@ function parseSetDef(def, refs) {
1106
1346
  }
1107
1347
 
1108
1348
  //#endregion
1109
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
1349
+ //#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
1110
1350
  function parseTupleDef(def, refs) {
1111
1351
  if (def.rest) {
1112
1352
  return {
@@ -1135,25 +1375,25 @@ function parseTupleDef(def, refs) {
1135
1375
  }
1136
1376
 
1137
1377
  //#endregion
1138
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js
1378
+ //#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
1139
1379
  function parseUndefinedDef() {
1140
1380
  return {not: {}};
1141
1381
  }
1142
1382
 
1143
1383
  //#endregion
1144
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js
1384
+ //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js
1145
1385
  function parseUnknownDef() {
1146
1386
  return {};
1147
1387
  }
1148
1388
 
1149
1389
  //#endregion
1150
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js
1390
+ //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js
1151
1391
  const parseReadonlyDef = (def, refs) => {
1152
1392
  return parseDef(def.innerType._def, refs);
1153
1393
  };
1154
1394
 
1155
1395
  //#endregion
1156
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parseDef.js
1396
+ //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parseDef.js
1157
1397
  function parseDef(def, refs, forceResolution = false) {
1158
1398
  const seenItem = refs.seen.get(def);
1159
1399
  if (refs.override) {
@@ -1254,7 +1494,7 @@ const addMeta = (def, refs, jsonSchema) => {
1254
1494
  };
1255
1495
 
1256
1496
  //#endregion
1257
- //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.2_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
1497
+ //#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
1258
1498
  const zodToJsonSchema = (schema$1, options$1) => {
1259
1499
  const refs = getRefs(options$1);
1260
1500
  const definitions = typeof options$1 === "object" && options$1.definitions ? (Object.entries(options$1.definitions)).reduce((acc, [name$1, schema$2]) => ({
@@ -1308,7 +1548,27 @@ const voidNullable = () => {
1308
1548
  //#region src/options/input-options.ts
1309
1549
  const inputOptionSchema = ((z$2.string()).or((z$2.string()).array())).or(z$2.record(z$2.string()));
1310
1550
  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())));
1311
- 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")));
1551
+ 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")));
1552
+ const jsxOptionsSchema = z$2.strictObject({
1553
+ mode: (((z$2.literal("classic")).or(z$2.literal("automatic"))).describe("Jsx transformation mode")).optional(),
1554
+ factory: ((z$2.string()).describe("Jsx element transformation")).optional(),
1555
+ fragment: ((z$2.string()).describe("Jsx fragment transformation")).optional(),
1556
+ importSource: ((z$2.string()).describe("Import the factory of element and fragment if mode is classic")).optional(),
1557
+ jsxImportSource: ((z$2.string()).describe("Import the factory of element and fragment if mode is automatic")).optional(),
1558
+ refresh: ((z$2.boolean()).describe("React refresh transformation")).optional(),
1559
+ development: ((z$2.boolean()).describe("Development specific information")).optional()
1560
+ });
1561
+ const stringOrRegExpSchema = (stringOrRegExp()).or((stringOrRegExp()).array());
1562
+ const watchOptionsSchema = z$2.strictObject({
1563
+ skipWrite: ((z$2.boolean()).describe("Skip the bundle.write() step")).optional(),
1564
+ notify: ((z$2.strictObject({
1565
+ pollInterval: (z$2.number()).optional(),
1566
+ compareContents: (z$2.boolean()).optional()
1567
+ })).describe("Notify options")).optional(),
1568
+ include: stringOrRegExpSchema.optional(),
1569
+ exclude: stringOrRegExpSchema.optional(),
1570
+ chokidar: (z$2.any()).optional()
1571
+ });
1312
1572
  const inputOptionsSchema = z$2.strictObject({
1313
1573
  input: inputOptionSchema.optional(),
1314
1574
  plugins: ((phantom()).array()).optional(),
@@ -1317,6 +1577,7 @@ const inputOptionsSchema = z$2.strictObject({
1317
1577
  alias: (z$2.record(z$2.string())).optional(),
1318
1578
  aliasFields: (z$2.array(z$2.array(z$2.string()))).optional(),
1319
1579
  conditionNames: optionalStringArray(),
1580
+ extensionAlias: (z$2.record(z$2.string(), z$2.array(z$2.string()))).optional(),
1320
1581
  exportsFields: (z$2.array(z$2.array(z$2.string()))).optional(),
1321
1582
  extensions: optionalStringArray(),
1322
1583
  mainFields: optionalStringArray(),
@@ -1333,9 +1594,16 @@ const inputOptionsSchema = z$2.strictObject({
1333
1594
  onLog: ((z$2.function()).args(LogLevelSchema, RollupLogSchema, (z$2.function()).args(LogLevelWithErrorSchema, RollupLogWithStringSchema))).optional(),
1334
1595
  onwarn: ((z$2.function()).args(RollupLogSchema, (z$2.function()).args(RollupLogWithStringSchema.or((z$2.function()).returns(RollupLogWithStringSchema))))).optional(),
1335
1596
  moduleTypes: (moduleTypesSchema.describe("module types for customized extensions.")).optional(),
1336
- experimental: (z$2.strictObject({enableComposingJsPlugins: (z$2.boolean()).optional()})).optional(),
1597
+ experimental: (z$2.strictObject({
1598
+ enableComposingJsPlugins: (z$2.boolean()).optional(),
1599
+ strictExecutionOrder: (z$2.boolean()).optional(),
1600
+ disableLiveBindings: (z$2.boolean()).optional()
1601
+ })).optional(),
1337
1602
  define: ((z$2.record(z$2.string())).describe("define global variables")).optional(),
1338
- inject: (z$2.record((z$2.string()).or(z$2.tuple([z$2.string(), z$2.string()])))).optional()
1603
+ inject: (z$2.record((z$2.string()).or(z$2.tuple([z$2.string(), z$2.string()])))).optional(),
1604
+ profilerNames: (z$2.boolean()).optional(),
1605
+ jsx: jsxOptionsSchema.optional(),
1606
+ watch: (watchOptionsSchema.or(z$2.literal(false))).optional()
1339
1607
  });
1340
1608
  const inputCliOptionsSchema = (inputOptionsSchema.extend({
1341
1609
  external: ((z$2.array(z$2.string())).describe("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`")).optional(),
@@ -1347,16 +1615,19 @@ const inputCliOptionsSchema = (inputOptionsSchema.extend({
1347
1615
  onwarn: true,
1348
1616
  onLog: true,
1349
1617
  resolve: true,
1350
- experimental: true
1618
+ experimental: true,
1619
+ profilerNames: true,
1620
+ watch: true
1351
1621
  });
1352
1622
 
1353
1623
  //#endregion
1354
1624
  //#region src/options/output-options.ts
1355
- 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"))).describe(`output format of the generated bundle (supports ${underline("esm")}, cjs, and iife).`)).optional();
1625
+ 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();
1356
1626
  const addonFunctionSchema = ((z$1.function()).args(phantom())).returns((z$1.string()).or(z$1.promise(z$1.string())));
1357
1627
  const chunkFileNamesFunctionSchema = ((z$1.function()).args(phantom())).returns(z$1.string());
1358
1628
  const outputOptionsSchema = z$1.strictObject({
1359
- dir: ((z$1.string()).describe("Output directory, defaults to `dist`.")).optional(),
1629
+ dir: ((z$1.string()).describe("Output directory, defaults to `dist` if `file` is not set.")).optional(),
1630
+ file: ((z$1.string()).describe("Single output file")).optional(),
1360
1631
  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(),
1361
1632
  format: ModuleFormatSchema,
1362
1633
  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(),
@@ -1366,22 +1637,22 @@ const outputOptionsSchema = z$1.strictObject({
1366
1637
  footer: ((z$1.string()).or(addonFunctionSchema)).optional(),
1367
1638
  intro: ((z$1.string()).or(addonFunctionSchema)).optional(),
1368
1639
  outro: ((z$1.string()).or(addonFunctionSchema)).optional(),
1369
- extend: ((z$1.boolean()).describe("extend global variable defined by name in IIFE or UMD formats")).optional(),
1640
+ extend: ((z$1.boolean()).describe("extend global variable defined by name in IIFE / UMD formats")).optional(),
1370
1641
  esModule: ((z$1.literal("if-default-prop")).or(z$1.boolean())).optional(),
1371
1642
  entryFileNames: ((z$1.string()).or(chunkFileNamesFunctionSchema)).optional(),
1372
1643
  chunkFileNames: ((z$1.string()).or(chunkFileNamesFunctionSchema)).optional(),
1373
1644
  assetFileNames: (z$1.string()).optional(),
1374
1645
  minify: ((z$1.boolean()).describe("minify the bundled file.")).optional(),
1375
1646
  name: ((z$1.string()).describe("name for UMD / IIFE format outputs")).optional(),
1376
- globals: ((z$1.record(z$1.string())).describe("Comma-separated list of `module-id:global` pairs (`<module-id>:<global>,...`)")).optional(),
1377
- externalLiveBindings: (((z$1.boolean()).describe("use external live bindings")).default(true)).optional(),
1647
+ globals: ((z$1.record(z$1.string())).describe("global variable of UMD / IIFE dependencies (syntax: `key=value`)")).optional(),
1648
+ externalLiveBindings: (((z$1.boolean()).describe("external live bindings")).default(true)).optional(),
1378
1649
  inlineDynamicImports: (((z$1.boolean()).describe("inline dynamic imports")).default(false)).optional(),
1379
1650
  advancedChunks: (z$1.strictObject({
1380
1651
  minSize: (z$1.number()).optional(),
1381
1652
  minShareCount: (z$1.number()).optional(),
1382
1653
  groups: (z$1.array(z$1.strictObject({
1383
1654
  name: z$1.string(),
1384
- test: (z$1.string()).optional(),
1655
+ test: ((z$1.string()).or(z$1.instanceof(RegExp))).optional(),
1385
1656
  priority: (z$1.number()).optional(),
1386
1657
  minSize: (z$1.number()).optional(),
1387
1658
  minShareCount: (z$1.number()).optional()
@@ -1397,16 +1668,22 @@ const outputCliOptionsSchema = (outputOptionsSchema.extend({
1397
1668
  intro: ((z$1.string()).describe(getAddonDescription("top", "inside"))).optional(),
1398
1669
  outro: ((z$1.string()).describe(getAddonDescription("bottom", "inside"))).optional(),
1399
1670
  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(),
1400
- sourcemapIgnoreList: (z$1.boolean()).optional(),
1401
- sourcemapPathTransform: (z$1.undefined()).optional()
1402
- })).omit({sourcemapPathTransform: true});
1671
+ advancedChunks: (z$1.strictObject({
1672
+ minSize: ((z$1.number()).describe("minimum size of the chunk")).optional(),
1673
+ minShareCount: ((z$1.number()).describe("minimum share count of the chunk")).optional()
1674
+ })).optional()
1675
+ })).omit({
1676
+ sourcemapPathTransform: true,
1677
+ sourcemapIgnoreList: true
1678
+ });
1403
1679
 
1404
1680
  //#endregion
1405
1681
  //#region src/cli/arguments/schema.ts
1406
1682
  const cliOptionsSchema = ((z.strictObject({
1407
- config: (((z.string()).or(z.boolean())).describe("Path to the config file (default: `rollup.config.js`)")).optional(),
1683
+ config: (((z.string()).or(z.boolean())).describe("Path to the config file (default: `rolldown.config.js`)")).optional(),
1408
1684
  help: ((z.boolean()).describe("Show help")).optional(),
1409
- version: ((z.boolean()).describe("Show version number")).optional()
1685
+ version: ((z.boolean()).describe("Show version number")).optional(),
1686
+ watch: ((z.boolean()).describe("Watch files in bundle and rebuild on changes")).optional()
1410
1687
  })).merge(inputCliOptionsSchema)).merge(outputCliOptionsSchema);
1411
1688
  const schema = zodToJsonSchema(cliOptionsSchema);
1412
1689
 
@@ -1415,12 +1692,12 @@ const schema = zodToJsonSchema(cliOptionsSchema);
1415
1692
  const alias = {
1416
1693
  config: {
1417
1694
  abbreviation: "c",
1418
- description: "Use config file",
1419
1695
  hint: "filename",
1420
1696
  default: "rolldown.config.js"
1421
1697
  },
1422
1698
  help: {abbreviation: "h"},
1423
1699
  version: {abbreviation: "v"},
1700
+ watch: {abbreviation: "w"},
1424
1701
  dir: {abbreviation: "d"},
1425
1702
  external: {abbreviation: "e"},
1426
1703
  format: {abbreviation: "f"},
@@ -1428,24 +1705,27 @@ const alias = {
1428
1705
  globals: {abbreviation: "g"},
1429
1706
  sourcemap: {
1430
1707
  abbreviation: "s",
1431
- default: false
1708
+ default: true
1432
1709
  },
1433
1710
  minify: {abbreviation: "m"},
1434
1711
  platform: {abbreviation: "p"},
1435
1712
  assetFileNames: {hint: "name"},
1436
1713
  chunkFileNames: {hint: "name"},
1437
1714
  entryFileNames: {hint: "name"},
1438
- externalLiveBindings: {default: true},
1439
- treeshake: {default: true},
1715
+ externalLiveBindings: {
1716
+ default: true,
1717
+ reverse: true
1718
+ },
1719
+ treeshake: {
1720
+ default: true,
1721
+ reverse: true
1722
+ },
1440
1723
  moduleTypes: {hint: "types"}
1441
1724
  };
1442
1725
 
1443
1726
  //#endregion
1444
1727
  //#region src/cli/arguments/utils.ts
1445
1728
  function getSchemaType(schema$1) {
1446
- if ("type"in schema$1) {
1447
- return schema$1.type;
1448
- }
1449
1729
  if ("anyOf"in schema$1) {
1450
1730
  const types = schema$1.anyOf.map((s) => getSchemaType(s));
1451
1731
  if (types.includes("object")) return "object";
@@ -1454,6 +1734,9 @@ else if (types.includes("string")) return "string";
1454
1734
  else if (types.includes("number")) return "number";
1455
1735
  else if (types.includes("boolean")) return "boolean";
1456
1736
  }
1737
+ if ("type"in schema$1) {
1738
+ return schema$1.type;
1739
+ }
1457
1740
  return "object";
1458
1741
  }
1459
1742
  function flattenSchema(schema$1, base = {}, parent = "") {
@@ -1471,8 +1754,8 @@ function flattenSchema(schema$1, base = {}, parent = "") {
1471
1754
  }
1472
1755
  return base;
1473
1756
  }
1474
- function setNestedProperty(obj, path, value) {
1475
- const keys = path.split(".");
1757
+ function setNestedProperty(obj, path$1, value) {
1758
+ const keys = path$1.split(".");
1476
1759
  let current = obj;
1477
1760
  for (let i = 0; i < keys.length - 1; i++) {
1478
1761
  if (!current[keys[i]]) {
@@ -1502,7 +1785,7 @@ function normalizeCliOptions(cliOptions, positionals) {
1502
1785
  const options$1 = parsed.data ?? {};
1503
1786
  if (!parsed.success) {
1504
1787
  parsed.error.errors.forEach((error) => {
1505
- logger.error(`Invalid value for option: ${error.path.join(", ")}. ${error.message}. You can use \`rolldown -h\` to see the help.`);
1788
+ logger.error(`Invalid value for option ${error.path.join(", ")}. You can use \`rolldown -h\` to see the help.`);
1506
1789
  });
1507
1790
  process.exit(1);
1508
1791
  }
@@ -1510,12 +1793,13 @@ function normalizeCliOptions(cliOptions, positionals) {
1510
1793
  input: {},
1511
1794
  output: {},
1512
1795
  help: options$1.help ?? false,
1513
- version: options$1.version ?? false
1796
+ version: options$1.version ?? false,
1797
+ watch: options$1.watch ?? false
1514
1798
  };
1515
1799
  if (typeof options$1.config === "string") {
1516
1800
  result.config = options$1.config ? options$1.config : "rolldown.config.js";
1517
1801
  }
1518
- const reservedKeys = ["help", "version", "config"];
1802
+ const reservedKeys = ["help", "version", "config", "watch"];
1519
1803
  const keysOfInput = (inputCliOptionsSchema.keyof())._def.values;
1520
1804
  const keysOfOutput = (outputCliOptionsSchema.keyof())._def.values;
1521
1805
  for (let [key, value] of Object.entries(options$1)) {
@@ -1550,8 +1834,15 @@ const options = Object.fromEntries((Object.entries(flattenedSchema)).map(([key,
1550
1834
  if (config && config?.abbreviation) {
1551
1835
  result.short = config?.abbreviation;
1552
1836
  }
1837
+ if (config && config.reverse) {
1838
+ if (result.description.startsWith("enable")) {
1839
+ result.description = result.description.replace("enable", "disable");
1840
+ } else {
1841
+ result.description = `disable ${result.description}`;
1842
+ }
1843
+ }
1553
1844
  key = camelCaseToKebabCase(key);
1554
- return [typeof config?.default === "boolean" && config?.default ? `no-${key}` : key, result,];
1845
+ return [config?.reverse ? `no-${key}` : key, result];
1555
1846
  }));
1556
1847
  function parseCliArguments() {
1557
1848
  const { values: values, tokens: tokens, positionals: positionals } = parseArgs({
@@ -1574,12 +1865,21 @@ function parseCliArguments() {
1574
1865
  option.name = kebabCaseToCamelCase(option.name);
1575
1866
  let originalType = flattenedSchema[option.name];
1576
1867
  if (!originalType) {
1577
- logger.warn(`Invalid option: ${option.rawName}. We will ignore this option.`);
1578
- return;
1868
+ logger.error(`Invalid option: ${option.rawName}. We will ignore this option.`);
1869
+ process.exit(1);
1579
1870
  }
1580
1871
  let type = getSchemaType(originalType);
1581
- if (type === "object" && typeof option.value === "string") {
1582
- const [key, value] = ((option.value?.split(",")).map((x) => x.split("=")))[0];
1872
+ if (type === "string" && typeof option.value !== "string") {
1873
+ let opt = option;
1874
+ let defaultValue = (Object.getOwnPropertyDescriptor(alias, opt.name))?.value;
1875
+ Object.defineProperty(values, opt.name, {
1876
+ value: defaultValue.default ?? "",
1877
+ enumerable: true,
1878
+ configurable: true,
1879
+ writable: true
1880
+ });
1881
+ } else if (type === "object" && typeof option.value === "string") {
1882
+ const [key, value] = ((option.value.split(",")).map((x) => x.split("=")))[0];
1583
1883
  if (!values[option.name]) {
1584
1884
  Object.defineProperty(values, option.name, {
1585
1885
  value: {},
@@ -1665,15 +1965,8 @@ function showHelp() {
1665
1965
  }
1666
1966
  return a.localeCompare(b);
1667
1967
  })).map(([option, { type: type, short: short, hint: hint, description: description$1 }]) => {
1668
- let optionStr = " ";
1669
- const config = (Object.getOwnPropertyDescriptor(alias, option) ?? {}).value ?? {};
1968
+ let optionStr = ` --${option} `;
1670
1969
  option = camelCaseToKebabCase(option);
1671
- if (typeof config.default === "boolean" && type === "boolean" && config.default) {
1672
- optionStr += `--no-${option}`;
1673
- description$1 = `Do not ${description$1}`;
1674
- } else {
1675
- optionStr += `--${option} `;
1676
- }
1677
1970
  if (short) {
1678
1971
  optionStr += `-${short}, `;
1679
1972
  }