@rolldown/browser 1.0.0-beta.16 → 1.0.0-beta.18

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 (47) hide show
  1. package/dist/cli.cjs +6 -6
  2. package/dist/cli.mjs +1042 -1083
  3. package/dist/config.cjs +3 -3
  4. package/dist/config.d.cts +2 -2
  5. package/dist/config.d.mts +2 -2
  6. package/dist/config.mjs +4 -6
  7. package/dist/experimental-index.browser.mjs +3 -3
  8. package/dist/experimental-index.cjs +3 -3
  9. package/dist/experimental-index.d.cts +2 -2
  10. package/dist/experimental-index.d.mts +2 -2
  11. package/dist/experimental-index.mjs +5 -17
  12. package/dist/filter-index.d.cts +2 -2
  13. package/dist/filter-index.d.mts +2 -2
  14. package/dist/filter-index.mjs +1 -6
  15. package/dist/index.browser.mjs +1 -1
  16. package/dist/index.cjs +2 -2
  17. package/dist/index.d.cts +2 -2
  18. package/dist/index.d.mts +2 -2
  19. package/dist/index.mjs +3 -4
  20. package/dist/parallel-plugin-worker.cjs +2 -2
  21. package/dist/parallel-plugin-worker.mjs +27 -33
  22. package/dist/parallel-plugin.d.cts +2 -2
  23. package/dist/parallel-plugin.d.mts +2 -2
  24. package/dist/parse-ast-index.cjs +1 -1
  25. package/dist/parse-ast-index.d.cts +1 -1
  26. package/dist/parse-ast-index.d.mts +1 -1
  27. package/dist/parse-ast-index.mjs +1 -2
  28. package/dist/rolldown-binding.wasi-browser.js +3 -2
  29. package/dist/rolldown-binding.wasi.cjs +2 -1
  30. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  31. package/dist/shared/{binding--Y47JZSL.d.cts → binding-D__94uwg.d.cts} +13 -462
  32. package/dist/shared/{binding-C_9au5Eg.d.mts → binding-DwMf_OTa.d.mts} +13 -462
  33. package/dist/shared/{define-config-CFPAmfEQ.d.mts → define-config-CXjwrGWr.d.cts} +69 -9
  34. package/dist/shared/{define-config-CAyC9-af.d.cts → define-config-DaQ-joKc.d.mts} +69 -9
  35. package/dist/shared/dist-BoWaIc-K.mjs +147 -0
  36. package/dist/shared/{load-config-CHic6lPj.mjs → load-config-BwSSRqdO.mjs} +14 -19
  37. package/dist/shared/{load-config-CKPqlbjH.cjs → load-config-CbF4BrKX.cjs} +1 -1
  38. package/dist/shared/{parse-ast-index-BjSB6ZTb.mjs → parse-ast-index-BHw-MFh6.mjs} +10 -28
  39. package/dist/shared/{parse-ast-index-X4pECV1E.cjs → parse-ast-index-DQhRVBEm.cjs} +1 -1
  40. package/dist/shared/prompt-C5jz26Zn.mjs +852 -0
  41. package/dist/shared/{src-Cw7MpyXh.cjs → src-BP3CtG4Q.cjs} +21 -18
  42. package/dist/shared/{src-C_ps7iS5.mjs → src-D1ozKBtx.mjs} +1144 -1367
  43. package/dist/{src-UXJBOke0.js → src-CEdhd_Z1.js} +21 -18
  44. package/package.json +3 -2
  45. package/dist/shared/chunk-DSsiIF1Z.mjs +0 -30
  46. package/dist/shared/dist-DeDsdiza.mjs +0 -153
  47. package/dist/shared/prompt-C14hEutp.mjs +0 -854
@@ -1,14 +1,39 @@
1
- import { __commonJS, __esm, __toESM } from "./chunk-DSsiIF1Z.mjs";
2
- import { and, arraify, code, exclude, id, include, init_dist, init_misc, isNullish, moduleType, noop, or, unimplemented, unreachable, unsupported } from "./dist-DeDsdiza.mjs";
3
- import { augmentCodeLocation, error, init_logs, init_parse_ast_index, logCycleLoading, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-BjSB6ZTb.mjs";
4
- import { BindingAttachDebugInfo, BindingCallableBuiltinPlugin, BindingHookSideEffects, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingWatcher, Bundler, ParallelJsPluginRegistry, shutdownAsyncRuntime, startAsyncRuntime } from "../rolldown-binding.wasi.cjs";
1
+ import { and, arraify, code, exclude, id, include, isNullish, moduleType, noop, or, unimplemented, unreachable, unsupported } from "./dist-BoWaIc-K.mjs";
2
+ import { augmentCodeLocation, error, logCycleLoading, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-BHw-MFh6.mjs";
3
+ import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingHookSideEffects, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingWatcher, ParallelJsPluginRegistry, shutdownAsyncRuntime, startAsyncRuntime } from "../rolldown-binding.wasi.cjs";
5
4
  import path from "node:path";
6
5
  import { fileURLToPath } from "node:url";
7
6
  import os from "node:os";
8
7
  import { Worker } from "node:worker_threads";
9
8
 
9
+ //#region rolldown:runtime
10
+ var __create = Object.create;
11
+ var __defProp = Object.defineProperty;
12
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
+ var __getOwnPropNames = Object.getOwnPropertyNames;
14
+ var __getProtoOf = Object.getPrototypeOf;
15
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
16
+ var __commonJS = (cb, mod) => function() {
17
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
18
+ };
19
+ var __copyProps = (to, from, except, desc) => {
20
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i$2 = 0, n$1 = keys.length, key; i$2 < n$1; i$2++) {
21
+ key = keys[i$2];
22
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
23
+ get: ((k) => from[k]).bind(null, key),
24
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
25
+ });
26
+ }
27
+ return to;
28
+ };
29
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
30
+ value: mod,
31
+ enumerable: true
32
+ }) : target, mod));
33
+
34
+ //#endregion
10
35
  //#region package.json
11
- var version = "1.0.0-beta.16";
36
+ var version = "1.0.0-beta.18";
12
37
  var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
13
38
 
14
39
  //#endregion
@@ -27,10 +52,15 @@ function bindingifyBuiltInPlugin(plugin) {
27
52
  options: plugin._options
28
53
  };
29
54
  }
30
- var init_utils = __esm({ "src/builtin-plugin/utils.ts"() {} });
31
55
 
32
56
  //#endregion
33
57
  //#region src/builtin-plugin/constructors.ts
58
+ var BuiltinPlugin = class {
59
+ constructor(name, _options) {
60
+ this.name = name;
61
+ this._options = _options;
62
+ }
63
+ };
34
64
  function modulePreloadPolyfillPlugin(config) {
35
65
  return new BuiltinPlugin("builtin:module-preload-polyfill", config);
36
66
  }
@@ -100,36 +130,24 @@ function webWorkerPostPlugin() {
100
130
  function oxcRuntimePlugin(config) {
101
131
  return new BuiltinPlugin("builtin:oxc-runtime", config);
102
132
  }
103
- var BuiltinPlugin;
104
- var init_constructors = __esm({ "src/builtin-plugin/constructors.ts"() {
105
- init_utils();
106
- BuiltinPlugin = class {
107
- constructor(name, _options) {
108
- this.name = name;
109
- this._options = _options;
110
- }
111
- };
112
- } });
113
133
 
114
134
  //#endregion
115
135
  //#region src/log/logging.ts
116
- var LOG_LEVEL_SILENT, LOG_LEVEL_ERROR, LOG_LEVEL_WARN, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, logLevelPriority;
117
- var init_logging = __esm({ "src/log/logging.ts"() {
118
- LOG_LEVEL_SILENT = "silent";
119
- LOG_LEVEL_ERROR = "error";
120
- LOG_LEVEL_WARN = "warn";
121
- LOG_LEVEL_INFO = "info";
122
- LOG_LEVEL_DEBUG = "debug";
123
- logLevelPriority = {
124
- [LOG_LEVEL_DEBUG]: 0,
125
- [LOG_LEVEL_INFO]: 1,
126
- [LOG_LEVEL_WARN]: 2,
127
- [LOG_LEVEL_SILENT]: 3
128
- };
129
- } });
136
+ const LOG_LEVEL_SILENT = "silent";
137
+ const LOG_LEVEL_ERROR = "error";
138
+ const LOG_LEVEL_WARN = "warn";
139
+ const LOG_LEVEL_INFO = "info";
140
+ const LOG_LEVEL_DEBUG = "debug";
141
+ const logLevelPriority = {
142
+ [LOG_LEVEL_DEBUG]: 0,
143
+ [LOG_LEVEL_INFO]: 1,
144
+ [LOG_LEVEL_WARN]: 2,
145
+ [LOG_LEVEL_SILENT]: 3
146
+ };
130
147
 
131
148
  //#endregion
132
149
  //#region src/log/log-handler.ts
150
+ const normalizeLog = (log) => typeof log === "string" ? { message: log } : typeof log === "function" ? normalizeLog(log()) : log;
133
151
  function getLogHandler(level, code$1, logger, pluginName, logLevel) {
134
152
  if (logLevelPriority[level] < logLevelPriority[logLevel]) return noop;
135
153
  return (log, pos) => {
@@ -141,13 +159,6 @@ function getLogHandler(level, code$1, logger, pluginName, logLevel) {
141
159
  logger(level, log);
142
160
  };
143
161
  }
144
- var normalizeLog;
145
- var init_log_handler = __esm({ "src/log/log-handler.ts"() {
146
- init_misc();
147
- init_logging();
148
- init_logs();
149
- normalizeLog = (log) => typeof log === "string" ? { message: log } : typeof log === "function" ? normalizeLog(log()) : log;
150
- } });
151
162
 
152
163
  //#endregion
153
164
  //#region src/log/logger.ts
@@ -183,55 +194,47 @@ function getLogger(plugins, onLog, logLevel, watchMode) {
183
194
  };
184
195
  return logger;
185
196
  }
197
+ const getOnLog = (config, logLevel, printLog = defaultPrintLog) => {
198
+ const { onwarn, onLog } = config;
199
+ const defaultOnLog = getDefaultOnLog(printLog, onwarn);
200
+ if (onLog) {
201
+ const minimalPriority = logLevelPriority[logLevel];
202
+ return (level, log) => onLog(level, addLogToString(log), (level$1, handledLog) => {
203
+ if (level$1 === LOG_LEVEL_ERROR) return error(normalizeLog(handledLog));
204
+ if (logLevelPriority[level$1] >= minimalPriority) defaultOnLog(level$1, normalizeLog(handledLog));
205
+ });
206
+ }
207
+ return defaultOnLog;
208
+ };
209
+ const getDefaultOnLog = (printLog, onwarn) => onwarn ? (level, log) => {
210
+ if (level === LOG_LEVEL_WARN) onwarn(addLogToString(log), (warning) => printLog(LOG_LEVEL_WARN, normalizeLog(warning)));
211
+ else printLog(level, log);
212
+ } : printLog;
213
+ const addLogToString = (log) => {
214
+ Object.defineProperty(log, "toString", {
215
+ value: () => getExtendedLogMessage(log),
216
+ writable: true
217
+ });
218
+ return log;
219
+ };
220
+ const defaultPrintLog = (level, log) => {
221
+ const message = getExtendedLogMessage(log);
222
+ switch (level) {
223
+ case LOG_LEVEL_WARN: return console.warn(message);
224
+ case LOG_LEVEL_DEBUG: return console.debug(message);
225
+ default: return console.info(message);
226
+ }
227
+ };
228
+ const getExtendedLogMessage = (log) => {
229
+ let prefix = "";
230
+ if (log.plugin) prefix += `(${log.plugin} plugin) `;
231
+ if (log.loc) prefix += `${relativeId(log.loc.file)} (${log.loc.line}:${log.loc.column}) `;
232
+ return prefix + log.message;
233
+ };
186
234
  function relativeId(id$1) {
187
235
  if (!path.isAbsolute(id$1)) return id$1;
188
236
  return path.relative(path.resolve(), id$1);
189
237
  }
190
- var getOnLog, getDefaultOnLog, addLogToString, defaultPrintLog, getExtendedLogMessage;
191
- var init_logger = __esm({ "src/log/logger.ts"() {
192
- init_src();
193
- init_plugin_driver();
194
- init_log_handler();
195
- init_logging();
196
- init_logs();
197
- getOnLog = (config, logLevel, printLog = defaultPrintLog) => {
198
- const { onwarn, onLog } = config;
199
- const defaultOnLog = getDefaultOnLog(printLog, onwarn);
200
- if (onLog) {
201
- const minimalPriority = logLevelPriority[logLevel];
202
- return (level, log) => onLog(level, addLogToString(log), (level$1, handledLog) => {
203
- if (level$1 === LOG_LEVEL_ERROR) return error(normalizeLog(handledLog));
204
- if (logLevelPriority[level$1] >= minimalPriority) defaultOnLog(level$1, normalizeLog(handledLog));
205
- });
206
- }
207
- return defaultOnLog;
208
- };
209
- getDefaultOnLog = (printLog, onwarn) => onwarn ? (level, log) => {
210
- if (level === LOG_LEVEL_WARN) onwarn(addLogToString(log), (warning) => printLog(LOG_LEVEL_WARN, normalizeLog(warning)));
211
- else printLog(level, log);
212
- } : printLog;
213
- addLogToString = (log) => {
214
- Object.defineProperty(log, "toString", {
215
- value: () => getExtendedLogMessage(log),
216
- writable: true
217
- });
218
- return log;
219
- };
220
- defaultPrintLog = (level, log) => {
221
- const message = getExtendedLogMessage(log);
222
- switch (level) {
223
- case LOG_LEVEL_WARN: return console.warn(message);
224
- case LOG_LEVEL_DEBUG: return console.debug(message);
225
- default: return console.info(message);
226
- }
227
- };
228
- getExtendedLogMessage = (log) => {
229
- let prefix = "";
230
- if (log.plugin) prefix += `(${log.plugin} plugin) `;
231
- if (log.loc) prefix += `${relativeId(log.loc.file)} (${log.loc.line}:${log.loc.column}) `;
232
- return prefix + log.message;
233
- };
234
- } });
235
238
 
236
239
  //#endregion
237
240
  //#region src/utils/normalize-hook.ts
@@ -251,71 +254,75 @@ function normalizeHook(hook) {
251
254
  }
252
255
  unreachable("Invalid hook type");
253
256
  }
254
- var init_normalize_hook = __esm({ "src/utils/normalize-hook.ts"() {
255
- init_misc();
256
- } });
257
257
 
258
258
  //#endregion
259
259
  //#region src/constants/plugin.ts
260
- var ENUMERATED_INPUT_PLUGIN_HOOK_NAMES, ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES, ENUMERATED_PLUGIN_HOOK_NAMES, DEFINED_HOOK_NAMES;
261
- var init_plugin$1 = __esm({ "src/constants/plugin.ts"() {
262
- ENUMERATED_INPUT_PLUGIN_HOOK_NAMES = [
263
- "options",
264
- "buildStart",
265
- "resolveId",
266
- "load",
267
- "transform",
268
- "moduleParsed",
269
- "buildEnd",
270
- "onLog",
271
- "resolveDynamicImport",
272
- "closeBundle",
273
- "closeWatcher",
274
- "watchChange"
275
- ];
276
- ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES = [
277
- "augmentChunkHash",
278
- "outputOptions",
279
- "renderChunk",
280
- "renderStart",
281
- "renderError",
282
- "writeBundle",
283
- "generateBundle"
284
- ];
285
- ENUMERATED_PLUGIN_HOOK_NAMES = [
286
- ...ENUMERATED_INPUT_PLUGIN_HOOK_NAMES,
287
- ...ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES,
288
- "footer",
289
- "banner",
290
- "intro",
291
- "outro"
292
- ];
293
- DEFINED_HOOK_NAMES = {
294
- [ENUMERATED_PLUGIN_HOOK_NAMES[0]]: ENUMERATED_PLUGIN_HOOK_NAMES[0],
295
- [ENUMERATED_PLUGIN_HOOK_NAMES[1]]: ENUMERATED_PLUGIN_HOOK_NAMES[1],
296
- [ENUMERATED_PLUGIN_HOOK_NAMES[2]]: ENUMERATED_PLUGIN_HOOK_NAMES[2],
297
- [ENUMERATED_PLUGIN_HOOK_NAMES[3]]: ENUMERATED_PLUGIN_HOOK_NAMES[3],
298
- [ENUMERATED_PLUGIN_HOOK_NAMES[4]]: ENUMERATED_PLUGIN_HOOK_NAMES[4],
299
- [ENUMERATED_PLUGIN_HOOK_NAMES[5]]: ENUMERATED_PLUGIN_HOOK_NAMES[5],
300
- [ENUMERATED_PLUGIN_HOOK_NAMES[6]]: ENUMERATED_PLUGIN_HOOK_NAMES[6],
301
- [ENUMERATED_PLUGIN_HOOK_NAMES[7]]: ENUMERATED_PLUGIN_HOOK_NAMES[7],
302
- [ENUMERATED_PLUGIN_HOOK_NAMES[8]]: ENUMERATED_PLUGIN_HOOK_NAMES[8],
303
- [ENUMERATED_PLUGIN_HOOK_NAMES[9]]: ENUMERATED_PLUGIN_HOOK_NAMES[9],
304
- [ENUMERATED_PLUGIN_HOOK_NAMES[10]]: ENUMERATED_PLUGIN_HOOK_NAMES[10],
305
- [ENUMERATED_PLUGIN_HOOK_NAMES[11]]: ENUMERATED_PLUGIN_HOOK_NAMES[11],
306
- [ENUMERATED_PLUGIN_HOOK_NAMES[12]]: ENUMERATED_PLUGIN_HOOK_NAMES[12],
307
- [ENUMERATED_PLUGIN_HOOK_NAMES[13]]: ENUMERATED_PLUGIN_HOOK_NAMES[13],
308
- [ENUMERATED_PLUGIN_HOOK_NAMES[14]]: ENUMERATED_PLUGIN_HOOK_NAMES[14],
309
- [ENUMERATED_PLUGIN_HOOK_NAMES[15]]: ENUMERATED_PLUGIN_HOOK_NAMES[15],
310
- [ENUMERATED_PLUGIN_HOOK_NAMES[16]]: ENUMERATED_PLUGIN_HOOK_NAMES[16],
311
- [ENUMERATED_PLUGIN_HOOK_NAMES[17]]: ENUMERATED_PLUGIN_HOOK_NAMES[17],
312
- [ENUMERATED_PLUGIN_HOOK_NAMES[18]]: ENUMERATED_PLUGIN_HOOK_NAMES[18],
313
- [ENUMERATED_PLUGIN_HOOK_NAMES[19]]: ENUMERATED_PLUGIN_HOOK_NAMES[19],
314
- [ENUMERATED_PLUGIN_HOOK_NAMES[20]]: ENUMERATED_PLUGIN_HOOK_NAMES[20],
315
- [ENUMERATED_PLUGIN_HOOK_NAMES[21]]: ENUMERATED_PLUGIN_HOOK_NAMES[21],
316
- [ENUMERATED_PLUGIN_HOOK_NAMES[22]]: ENUMERATED_PLUGIN_HOOK_NAMES[22]
317
- };
318
- } });
260
+ const ENUMERATED_INPUT_PLUGIN_HOOK_NAMES = [
261
+ "options",
262
+ "buildStart",
263
+ "resolveId",
264
+ "load",
265
+ "transform",
266
+ "moduleParsed",
267
+ "buildEnd",
268
+ "onLog",
269
+ "resolveDynamicImport",
270
+ "closeBundle",
271
+ "closeWatcher",
272
+ "watchChange"
273
+ ];
274
+ const ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES = [
275
+ "augmentChunkHash",
276
+ "outputOptions",
277
+ "renderChunk",
278
+ "renderStart",
279
+ "renderError",
280
+ "writeBundle",
281
+ "generateBundle"
282
+ ];
283
+ const ENUMERATED_PLUGIN_HOOK_NAMES = [
284
+ ...ENUMERATED_INPUT_PLUGIN_HOOK_NAMES,
285
+ ...ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES,
286
+ "footer",
287
+ "banner",
288
+ "intro",
289
+ "outro"
290
+ ];
291
+ /**
292
+ * Names of all defined hooks. It's like
293
+ * ```js
294
+ * const DEFINED_HOOK_NAMES ={
295
+ * options: 'options',
296
+ * buildStart: 'buildStart',
297
+ * ...
298
+ * }
299
+ * ```
300
+ */
301
+ const DEFINED_HOOK_NAMES = {
302
+ [ENUMERATED_PLUGIN_HOOK_NAMES[0]]: ENUMERATED_PLUGIN_HOOK_NAMES[0],
303
+ [ENUMERATED_PLUGIN_HOOK_NAMES[1]]: ENUMERATED_PLUGIN_HOOK_NAMES[1],
304
+ [ENUMERATED_PLUGIN_HOOK_NAMES[2]]: ENUMERATED_PLUGIN_HOOK_NAMES[2],
305
+ [ENUMERATED_PLUGIN_HOOK_NAMES[3]]: ENUMERATED_PLUGIN_HOOK_NAMES[3],
306
+ [ENUMERATED_PLUGIN_HOOK_NAMES[4]]: ENUMERATED_PLUGIN_HOOK_NAMES[4],
307
+ [ENUMERATED_PLUGIN_HOOK_NAMES[5]]: ENUMERATED_PLUGIN_HOOK_NAMES[5],
308
+ [ENUMERATED_PLUGIN_HOOK_NAMES[6]]: ENUMERATED_PLUGIN_HOOK_NAMES[6],
309
+ [ENUMERATED_PLUGIN_HOOK_NAMES[7]]: ENUMERATED_PLUGIN_HOOK_NAMES[7],
310
+ [ENUMERATED_PLUGIN_HOOK_NAMES[8]]: ENUMERATED_PLUGIN_HOOK_NAMES[8],
311
+ [ENUMERATED_PLUGIN_HOOK_NAMES[9]]: ENUMERATED_PLUGIN_HOOK_NAMES[9],
312
+ [ENUMERATED_PLUGIN_HOOK_NAMES[10]]: ENUMERATED_PLUGIN_HOOK_NAMES[10],
313
+ [ENUMERATED_PLUGIN_HOOK_NAMES[11]]: ENUMERATED_PLUGIN_HOOK_NAMES[11],
314
+ [ENUMERATED_PLUGIN_HOOK_NAMES[12]]: ENUMERATED_PLUGIN_HOOK_NAMES[12],
315
+ [ENUMERATED_PLUGIN_HOOK_NAMES[13]]: ENUMERATED_PLUGIN_HOOK_NAMES[13],
316
+ [ENUMERATED_PLUGIN_HOOK_NAMES[14]]: ENUMERATED_PLUGIN_HOOK_NAMES[14],
317
+ [ENUMERATED_PLUGIN_HOOK_NAMES[15]]: ENUMERATED_PLUGIN_HOOK_NAMES[15],
318
+ [ENUMERATED_PLUGIN_HOOK_NAMES[16]]: ENUMERATED_PLUGIN_HOOK_NAMES[16],
319
+ [ENUMERATED_PLUGIN_HOOK_NAMES[17]]: ENUMERATED_PLUGIN_HOOK_NAMES[17],
320
+ [ENUMERATED_PLUGIN_HOOK_NAMES[18]]: ENUMERATED_PLUGIN_HOOK_NAMES[18],
321
+ [ENUMERATED_PLUGIN_HOOK_NAMES[19]]: ENUMERATED_PLUGIN_HOOK_NAMES[19],
322
+ [ENUMERATED_PLUGIN_HOOK_NAMES[20]]: ENUMERATED_PLUGIN_HOOK_NAMES[20],
323
+ [ENUMERATED_PLUGIN_HOOK_NAMES[21]]: ENUMERATED_PLUGIN_HOOK_NAMES[21],
324
+ [ENUMERATED_PLUGIN_HOOK_NAMES[22]]: ENUMERATED_PLUGIN_HOOK_NAMES[22]
325
+ };
319
326
 
320
327
  //#endregion
321
328
  //#region src/utils/async-flatten.ts
@@ -325,10 +332,10 @@ async function asyncFlatten(array$1) {
325
332
  while (array$1.some((v) => v?.then));
326
333
  return array$1;
327
334
  }
328
- var init_async_flatten = __esm({ "src/utils/async-flatten.ts"() {} });
329
335
 
330
336
  //#endregion
331
337
  //#region src/utils/normalize-plugin-option.ts
338
+ const normalizePluginOption = async (plugins) => (await asyncFlatten([plugins])).filter(Boolean);
332
339
  function checkOutputPluginOption(plugins, onLog) {
333
340
  for (const plugin of plugins) for (const hook of ENUMERATED_INPUT_PLUGIN_HOOK_NAMES) if (hook in plugin) {
334
341
  delete plugin[hook];
@@ -344,52 +351,66 @@ function normalizePlugins(plugins, anonymousPrefix) {
344
351
  }
345
352
  return plugins;
346
353
  }
347
- var normalizePluginOption, ANONYMOUS_PLUGIN_PREFIX, ANONYMOUS_OUTPUT_PLUGIN_PREFIX, BUILTIN_PLUGINS;
348
- var init_normalize_plugin_option = __esm({ "src/utils/normalize-plugin-option.ts"() {
349
- init_constructors();
350
- init_plugin$1();
351
- init_logging();
352
- init_logs();
353
- init_async_flatten();
354
- normalizePluginOption = async (plugins) => (await asyncFlatten([plugins])).filter(Boolean);
355
- ANONYMOUS_PLUGIN_PREFIX = "at position ";
356
- ANONYMOUS_OUTPUT_PLUGIN_PREFIX = "at output position ";
357
- BUILTIN_PLUGINS = [oxcRuntimePlugin({ resolveBase: fileURLToPath(import.meta.url) })];
358
- } });
354
+ const ANONYMOUS_PLUGIN_PREFIX = "at position ";
355
+ const ANONYMOUS_OUTPUT_PLUGIN_PREFIX = "at output position ";
356
+ const BUILTIN_PLUGINS = [oxcRuntimePlugin({ resolveBase: fileURLToPath(import.meta.url) })];
359
357
 
360
358
  //#endregion
361
359
  //#region src/plugin/minimal-plugin-context.ts
362
- var MinimalPluginContextImpl;
363
- var init_minimal_plugin_context = __esm({ "src/plugin/minimal-plugin-context.ts"() {
364
- init_src();
365
- init_log_handler();
366
- init_logging();
367
- init_logs();
368
- MinimalPluginContextImpl = class {
369
- info;
370
- warn;
371
- debug;
372
- meta;
373
- constructor(onLog, logLevel, pluginName, watchMode, hookName) {
374
- this.pluginName = pluginName;
375
- this.hookName = hookName;
376
- this.debug = getLogHandler(LOG_LEVEL_DEBUG, "PLUGIN_LOG", onLog, pluginName, logLevel);
377
- this.info = getLogHandler(LOG_LEVEL_INFO, "PLUGIN_LOG", onLog, pluginName, logLevel);
378
- this.warn = getLogHandler(LOG_LEVEL_WARN, "PLUGIN_WARNING", onLog, pluginName, logLevel);
379
- this.meta = {
380
- rollupVersion: "4.23.0",
381
- rolldownVersion: VERSION,
382
- watchMode
383
- };
384
- }
385
- error(e$1) {
386
- return error(logPluginError(normalizeLog(e$1), this.pluginName, { hook: this.hookName }));
387
- }
388
- };
389
- } });
360
+ var MinimalPluginContextImpl = class {
361
+ info;
362
+ warn;
363
+ debug;
364
+ meta;
365
+ constructor(onLog, logLevel, pluginName, watchMode, hookName) {
366
+ this.pluginName = pluginName;
367
+ this.hookName = hookName;
368
+ this.debug = getLogHandler(LOG_LEVEL_DEBUG, "PLUGIN_LOG", onLog, pluginName, logLevel);
369
+ this.info = getLogHandler(LOG_LEVEL_INFO, "PLUGIN_LOG", onLog, pluginName, logLevel);
370
+ this.warn = getLogHandler(LOG_LEVEL_WARN, "PLUGIN_WARNING", onLog, pluginName, logLevel);
371
+ this.meta = {
372
+ rollupVersion: "4.23.0",
373
+ rolldownVersion: VERSION,
374
+ watchMode
375
+ };
376
+ }
377
+ error(e$1) {
378
+ return error(logPluginError(normalizeLog(e$1), this.pluginName, { hook: this.hookName }));
379
+ }
380
+ };
390
381
 
391
382
  //#endregion
392
383
  //#region src/plugin/plugin-driver.ts
384
+ var PluginDriver = class {
385
+ static async callOptionsHook(inputOptions, watchMode = false) {
386
+ const logLevel = inputOptions.logLevel || LOG_LEVEL_INFO;
387
+ const plugins = getSortedPlugins("options", getObjectPlugins(await normalizePluginOption(inputOptions.plugins)));
388
+ const logger = getLogger(plugins, getOnLog(inputOptions, logLevel), logLevel, watchMode);
389
+ for (const plugin of plugins) {
390
+ const name = plugin.name || "unknown";
391
+ const options = plugin.options;
392
+ if (options) {
393
+ const { handler } = normalizeHook(options);
394
+ const result = await handler.call(new MinimalPluginContextImpl(logger, logLevel, name, watchMode, "onLog"), inputOptions);
395
+ if (result) inputOptions = result;
396
+ }
397
+ }
398
+ return inputOptions;
399
+ }
400
+ static callOutputOptionsHook(rawPlugins, outputOptions, onLog, logLevel, watchMode) {
401
+ const sortedPlugins = getSortedPlugins("outputOptions", getObjectPlugins(rawPlugins));
402
+ for (const plugin of sortedPlugins) {
403
+ const name = plugin.name || "unknown";
404
+ const options = plugin.outputOptions;
405
+ if (options) {
406
+ const { handler } = normalizeHook(options);
407
+ const result = handler.call(new MinimalPluginContextImpl(onLog, logLevel, name, watchMode), outputOptions);
408
+ if (result) outputOptions = result;
409
+ }
410
+ }
411
+ return outputOptions;
412
+ }
413
+ };
393
414
  function getObjectPlugins(plugins) {
394
415
  return plugins.filter((plugin) => {
395
416
  if (!plugin) return void 0;
@@ -424,48 +445,10 @@ function getSortedPlugins(hookName, plugins) {
424
445
  ...post
425
446
  ];
426
447
  }
427
- var PluginDriver;
428
- var init_plugin_driver = __esm({ "src/plugin/plugin-driver.ts"() {
429
- init_constructors();
430
- init_logger();
431
- init_logging();
432
- init_normalize_hook();
433
- init_normalize_plugin_option();
434
- init_minimal_plugin_context();
435
- PluginDriver = class {
436
- static async callOptionsHook(inputOptions, watchMode = false) {
437
- const logLevel = inputOptions.logLevel || LOG_LEVEL_INFO;
438
- const plugins = getSortedPlugins("options", getObjectPlugins(await normalizePluginOption(inputOptions.plugins)));
439
- const logger = getLogger(plugins, getOnLog(inputOptions, logLevel), logLevel, watchMode);
440
- for (const plugin of plugins) {
441
- const name = plugin.name || "unknown";
442
- const options = plugin.options;
443
- if (options) {
444
- const { handler } = normalizeHook(options);
445
- const result = await handler.call(new MinimalPluginContextImpl(logger, logLevel, name, watchMode, "onLog"), inputOptions);
446
- if (result) inputOptions = result;
447
- }
448
- }
449
- return inputOptions;
450
- }
451
- static callOutputOptionsHook(rawPlugins, outputOptions, onLog, logLevel, watchMode) {
452
- const sortedPlugins = getSortedPlugins("outputOptions", getObjectPlugins(rawPlugins));
453
- for (const plugin of sortedPlugins) {
454
- const name = plugin.name || "unknown";
455
- const options = plugin.outputOptions;
456
- if (options) {
457
- const { handler } = normalizeHook(options);
458
- const result = handler.call(new MinimalPluginContextImpl(onLog, logLevel, name, watchMode), outputOptions);
459
- if (result) outputOptions = result;
460
- }
461
- }
462
- return outputOptions;
463
- }
464
- };
465
- } });
466
448
 
467
449
  //#endregion
468
450
  //#region ../../node_modules/.pnpm/valibot@1.1.0_typescript@5.8.3/node_modules/valibot/dist/index.js
451
+ var store$1;
469
452
  /* @__NO_SIDE_EFFECTS__ */
470
453
  function getGlobalConfig(config2) {
471
454
  return {
@@ -475,14 +458,17 @@ function getGlobalConfig(config2) {
475
458
  abortPipeEarly: config2?.abortPipeEarly ?? store$1?.abortPipeEarly
476
459
  };
477
460
  }
461
+ var store2;
478
462
  /* @__NO_SIDE_EFFECTS__ */
479
463
  function getGlobalMessage(lang) {
480
464
  return store2?.get(lang);
481
465
  }
466
+ var store3;
482
467
  /* @__NO_SIDE_EFFECTS__ */
483
468
  function getSchemaMessage(lang) {
484
469
  return store3?.get(lang);
485
470
  }
471
+ var store4;
486
472
  /* @__NO_SIDE_EFFECTS__ */
487
473
  function getSpecificMessage(reference, lang) {
488
474
  return store4?.get(reference)?.get(lang);
@@ -540,6 +526,18 @@ function _joinExpects(values2, separator) {
540
526
  if (list.length > 1) return `(${list.join(` ${separator} `)})`;
541
527
  return list[0] ?? "never";
542
528
  }
529
+ var ValiError = class extends Error {
530
+ /**
531
+ * Creates a Valibot error with useful information.
532
+ *
533
+ * @param issues The error issues.
534
+ */
535
+ constructor(issues) {
536
+ super(issues[0].message);
537
+ this.name = "ValiError";
538
+ this.issues = issues;
539
+ }
540
+ };
543
541
  /* @__NO_SIDE_EFFECTS__ */
544
542
  function args(schema) {
545
543
  return {
@@ -1436,21 +1434,6 @@ function safeParse(schema, input, config2) {
1436
1434
  issues: dataset.issues
1437
1435
  };
1438
1436
  }
1439
- var store$1, store2, store3, store4, ValiError;
1440
- var init_dist$3 = __esm({ "../../node_modules/.pnpm/valibot@1.1.0_typescript@5.8.3/node_modules/valibot/dist/index.js"() {
1441
- ValiError = class extends Error {
1442
- /**
1443
- * Creates a Valibot error with useful information.
1444
- *
1445
- * @param issues The error issues.
1446
- */
1447
- constructor(issues) {
1448
- super(issues[0].message);
1449
- this.name = "ValiError";
1450
- this.issues = issues;
1451
- }
1452
- };
1453
- } });
1454
1437
 
1455
1438
  //#endregion
1456
1439
  //#region ../../node_modules/.pnpm/@valibot+to-json-schema@1.3.0_valibot@1.1.0_typescript@5.8.3_/node_modules/@valibot/to-json-schema/dist/index.js
@@ -1668,6 +1651,7 @@ function convertAction(jsonSchema, valibotAction, config) {
1668
1651
  function flattenPipe(pipe$1) {
1669
1652
  return pipe$1.flatMap((item) => "pipe" in item ? flattenPipe(item.pipe) : item);
1670
1653
  }
1654
+ let refCount = 0;
1671
1655
  /**
1672
1656
  * Converts any supported Valibot schema to the JSON Schema format.
1673
1657
  *
@@ -1851,6 +1835,7 @@ function convertSchema(jsonSchema, valibotSchema, config, context, skipRef = fal
1851
1835
  if (errors) for (const message of errors) handleError(message, config);
1852
1836
  return jsonSchema;
1853
1837
  }
1838
+ let store;
1854
1839
  /**
1855
1840
  * Returns the current global schema definitions.
1856
1841
  *
@@ -1884,11 +1869,6 @@ function toJsonSchema(schema, config) {
1884
1869
  if (context.referenceMap.size) jsonSchema.$defs = context.definitions;
1885
1870
  return jsonSchema;
1886
1871
  }
1887
- var refCount, store;
1888
- var init_dist$2 = __esm({ "../../node_modules/.pnpm/@valibot+to-json-schema@1.3.0_valibot@1.1.0_typescript@5.8.3_/node_modules/@valibot/to-json-schema/dist/index.js"() {
1889
- init_dist$3();
1890
- refCount = 0;
1891
- } });
1892
1872
 
1893
1873
  //#endregion
1894
1874
  //#region ../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.cjs
@@ -1997,15 +1977,377 @@ var require_ansis = __commonJS({ "../../node_modules/.pnpm/ansis@4.1.0/node_modu
1997
1977
 
1998
1978
  //#endregion
1999
1979
  //#region ../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.mjs
2000
- var import_ansis, ansis_default, Ansis, fg, bg, rgb, bgRgb, hex, bgHex, reset, inverse, hidden, visible, bold, dim, italic, underline, strikethrough, black, red, green, yellow, blue, magenta, cyan, white, gray, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bgGray, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright;
2001
- var init_ansis = __esm({ "../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.mjs"() {
2002
- import_ansis = __toESM(require_ansis(), 1);
2003
- ansis_default = import_ansis.default;
2004
- ({Ansis, fg, bg, rgb, bgRgb, hex, bgHex, reset, inverse, hidden, visible, bold, dim, italic, underline, strikethrough, black, red, green, yellow, blue, magenta, cyan, white, gray, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bgGray, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright} = import_ansis.default);
2005
- } });
1980
+ var import_ansis = __toESM(require_ansis(), 1);
1981
+ var ansis_default = import_ansis.default;
1982
+ const { Ansis, fg, bg, rgb, bgRgb, hex, bgHex, reset, inverse, hidden, visible, bold, dim, italic, underline, strikethrough, black, red, green, yellow, blue, magenta, cyan, white, gray, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bgGray, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright } = import_ansis.default;
2006
1983
 
2007
1984
  //#endregion
2008
1985
  //#region src/utils/validator.ts
1986
+ const StringOrRegExpSchema = union([string(), instance(RegExp)]);
1987
+ const LogLevelSchema = union([
1988
+ literal("debug"),
1989
+ literal("info"),
1990
+ literal("warn")
1991
+ ]);
1992
+ const LogLevelOptionSchema = union([LogLevelSchema, literal("silent")]);
1993
+ const LogLevelWithErrorSchema = union([LogLevelSchema, literal("error")]);
1994
+ const RollupLogSchema = any();
1995
+ const RollupLogWithStringSchema = union([RollupLogSchema, string()]);
1996
+ const InputOptionSchema = union([
1997
+ string(),
1998
+ array(string()),
1999
+ record(string(), string())
2000
+ ]);
2001
+ const ExternalSchema = union([
2002
+ StringOrRegExpSchema,
2003
+ array(StringOrRegExpSchema),
2004
+ pipe(function_(), args(tuple([
2005
+ string(),
2006
+ optional(string()),
2007
+ boolean()
2008
+ ])), returns(nullish(boolean())))
2009
+ ]);
2010
+ const ModuleTypesSchema = record(string(), union([
2011
+ literal("asset"),
2012
+ literal("base64"),
2013
+ literal("binary"),
2014
+ literal("css"),
2015
+ literal("dataurl"),
2016
+ literal("empty"),
2017
+ literal("js"),
2018
+ literal("json"),
2019
+ literal("jsx"),
2020
+ literal("text"),
2021
+ literal("ts"),
2022
+ literal("tsx")
2023
+ ]));
2024
+ const JsxOptionsSchema = strictObject({
2025
+ runtime: pipe(optional(union([literal("classic"), literal("automatic")])), description("Which runtime to use")),
2026
+ development: pipe(optional(boolean()), description("Development specific information")),
2027
+ throwIfNamespace: pipe(optional(string()), description("Toggles whether to throw an error when a tag name uses an XML namespace")),
2028
+ importSource: pipe(optional(string()), description("Import the factory of element and fragment if mode is classic")),
2029
+ pragma: pipe(optional(string()), description("Jsx element transformation")),
2030
+ pragmaFlag: pipe(optional(string()), description("Jsx fragment transformation")),
2031
+ refresh: pipe(optional(boolean()), description("Enable react fast refresh"))
2032
+ });
2033
+ const RollupJsxOptionsSchema = strictObject({
2034
+ mode: optional(union([
2035
+ literal("classic"),
2036
+ literal("automatic"),
2037
+ literal("preserve")
2038
+ ])),
2039
+ factory: optional(string()),
2040
+ fragment: optional(string()),
2041
+ importSource: optional(string()),
2042
+ jsxImportSource: optional(string())
2043
+ });
2044
+ const HelperModeSchema = union([literal("Runtime"), literal("External")]);
2045
+ const DecoratorOptionSchema = object({
2046
+ legacy: optional(boolean()),
2047
+ emitDecoratorMetadata: optional(boolean())
2048
+ });
2049
+ const HelpersSchema = object({ mode: optional(HelperModeSchema) });
2050
+ const RewriteImportExtensionsSchema = union([
2051
+ literal("rewrite"),
2052
+ literal("remove"),
2053
+ boolean()
2054
+ ]);
2055
+ const TypescriptSchema = object({
2056
+ jsxPragma: optional(string()),
2057
+ jsxPragmaFrag: optional(string()),
2058
+ onlyRemoveTypeImports: optional(boolean()),
2059
+ allowNamespaces: optional(boolean()),
2060
+ allowDeclareFields: optional(boolean()),
2061
+ declaration: optional(object({
2062
+ stripInternal: optional(boolean()),
2063
+ sourcemap: optional(boolean())
2064
+ })),
2065
+ rewriteImportExtensions: optional(RewriteImportExtensionsSchema)
2066
+ });
2067
+ const AssumptionsSchema = object({
2068
+ ignoreFunctionLength: optional(boolean()),
2069
+ noDocumentAll: optional(boolean()),
2070
+ objectRestNoSymbols: optional(boolean()),
2071
+ pureGetters: optional(boolean()),
2072
+ setPublicClassFields: optional(boolean())
2073
+ });
2074
+ const TransformOptionsSchema = object({
2075
+ assumptions: optional(AssumptionsSchema),
2076
+ typescript: optional(TypescriptSchema),
2077
+ helpers: optional(HelpersSchema),
2078
+ decorators: optional(DecoratorOptionSchema),
2079
+ jsx: optional(JsxOptionsSchema),
2080
+ target: pipe(optional(union([string(), array(string())])), description("The JavaScript target environment"))
2081
+ });
2082
+ const WatchOptionsSchema = strictObject({
2083
+ chokidar: optional(never(`The "watch.chokidar" option is deprecated, please use "watch.notify" instead of it`)),
2084
+ exclude: optional(union([StringOrRegExpSchema, array(StringOrRegExpSchema)])),
2085
+ include: optional(union([StringOrRegExpSchema, array(StringOrRegExpSchema)])),
2086
+ notify: pipe(optional(strictObject({
2087
+ compareContents: optional(boolean()),
2088
+ pollInterval: optional(number())
2089
+ })), description("Notify options")),
2090
+ skipWrite: pipe(optional(boolean()), description("Skip the bundle.write() step")),
2091
+ buildDelay: pipe(optional(number()), description("Throttle watch rebuilds"))
2092
+ });
2093
+ const ChecksOptionsSchema = strictObject({
2094
+ circularDependency: pipe(optional(boolean()), description("Whether to emit warning when detecting circular dependency")),
2095
+ eval: pipe(optional(boolean()), description("Whether to emit warning when detecting eval")),
2096
+ missingGlobalName: pipe(optional(boolean()), description("Whether to emit warning when detecting missing global name")),
2097
+ missingNameOptionForIifeExport: pipe(optional(boolean()), description("Whether to emit warning when detecting missing name option for iife export")),
2098
+ mixedExport: pipe(optional(boolean()), description("Whether to emit warning when detecting mixed export")),
2099
+ unresolvedEntry: pipe(optional(boolean()), description("Whether to emit warning when detecting unresolved entry")),
2100
+ unresolvedImport: pipe(optional(boolean()), description("Whether to emit warning when detecting unresolved import")),
2101
+ filenameConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting filename conflict")),
2102
+ commonJsVariableInEsm: pipe(optional(boolean()), description("Whether to emit warning when detecting common js variable in esm")),
2103
+ importIsUndefined: pipe(optional(boolean()), description("Whether to emit warning when detecting import is undefined")),
2104
+ configurationFieldConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting configuration field conflict"))
2105
+ });
2106
+ const MinifyOptionsSchema = strictObject({
2107
+ mangle: optional(boolean()),
2108
+ compress: optional(boolean()),
2109
+ removeWhitespace: optional(boolean())
2110
+ });
2111
+ const ResolveOptionsSchema = strictObject({
2112
+ alias: optional(record(string(), union([string(), array(string())]))),
2113
+ aliasFields: optional(array(array(string()))),
2114
+ conditionNames: optional(array(string())),
2115
+ extensionAlias: optional(record(string(), array(string()))),
2116
+ exportsFields: optional(array(array(string()))),
2117
+ extensions: optional(array(string())),
2118
+ mainFields: optional(array(string())),
2119
+ mainFiles: optional(array(string())),
2120
+ modules: optional(array(string())),
2121
+ symlinks: optional(boolean()),
2122
+ tsconfigFilename: optional(string())
2123
+ });
2124
+ const TreeshakingOptionsSchema = union([boolean(), looseObject({
2125
+ annotations: optional(boolean()),
2126
+ manualPureFunctions: optional(array(string())),
2127
+ unknownGlobalSideEffects: optional(boolean())
2128
+ })]);
2129
+ const OnLogSchema = pipe(function_(), args(tuple([
2130
+ LogLevelSchema,
2131
+ RollupLogSchema,
2132
+ pipe(function_(), args(tuple([LogLevelWithErrorSchema, RollupLogWithStringSchema])))
2133
+ ])));
2134
+ const OnwarnSchema = pipe(function_(), args(tuple([RollupLogSchema, pipe(function_(), args(tuple([union([RollupLogWithStringSchema, pipe(function_(), returns(RollupLogWithStringSchema))])])))])));
2135
+ const HmrSchema = union([boolean(), strictObject({
2136
+ port: optional(number()),
2137
+ host: optional(string()),
2138
+ implement: optional(string())
2139
+ })]);
2140
+ const InputOptionsSchema = strictObject({
2141
+ input: optional(InputOptionSchema),
2142
+ plugins: optional(custom(() => true)),
2143
+ external: optional(ExternalSchema),
2144
+ makeAbsoluteExternalsRelative: optional(union([boolean(), literal("ifRelativeSource")])),
2145
+ resolve: optional(ResolveOptionsSchema),
2146
+ cwd: pipe(optional(string()), description("Current working directory")),
2147
+ platform: pipe(optional(union([
2148
+ literal("browser"),
2149
+ literal("neutral"),
2150
+ literal("node")
2151
+ ])), description(`Platform for which the code should be generated (node, ${ansis_default.underline("browser")}, neutral)`)),
2152
+ shimMissingExports: pipe(optional(boolean()), description("Create shim variables for missing exports")),
2153
+ treeshake: optional(TreeshakingOptionsSchema),
2154
+ logLevel: pipe(optional(LogLevelOptionSchema), description(`Log level (${ansis_default.dim("silent")}, ${ansis_default.underline(ansis_default.gray("info"))}, debug, ${ansis_default.yellow("warn")})`)),
2155
+ onLog: optional(OnLogSchema),
2156
+ onwarn: optional(OnwarnSchema),
2157
+ moduleTypes: pipe(optional(ModuleTypesSchema), description("Module types for customized extensions")),
2158
+ experimental: optional(strictObject({
2159
+ disableLiveBindings: optional(boolean()),
2160
+ enableComposingJsPlugins: optional(boolean()),
2161
+ viteMode: optional(boolean()),
2162
+ resolveNewUrlToAsset: optional(boolean()),
2163
+ strictExecutionOrder: optional(boolean()),
2164
+ hmr: optional(HmrSchema),
2165
+ attachDebugInfo: optional(union([
2166
+ literal("none"),
2167
+ literal("simple"),
2168
+ literal("full")
2169
+ ]))
2170
+ })),
2171
+ define: pipe(optional(record(string(), string())), description("Define global variables")),
2172
+ inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
2173
+ profilerNames: optional(boolean()),
2174
+ jsx: optional(union([
2175
+ literal(false),
2176
+ literal("react"),
2177
+ literal("react-jsx"),
2178
+ literal("preserve"),
2179
+ RollupJsxOptionsSchema
2180
+ ])),
2181
+ transform: optional(TransformOptionsSchema),
2182
+ watch: optional(union([WatchOptionsSchema, literal(false)])),
2183
+ dropLabels: pipe(optional(array(string())), description("Remove labeled statements with these label names")),
2184
+ checks: optional(ChecksOptionsSchema),
2185
+ keepNames: pipe(optional(boolean()), description("Keep function/class name")),
2186
+ debug: pipe(optional(object({ sessionId: pipe(optional(string()), description("Used to name the build.")) })), description("Enable debug mode. Emit debug information to disk. This might slow down the build process significantly.")),
2187
+ preserveEntrySignatures: pipe(optional(union([
2188
+ literal("strict"),
2189
+ literal("allow-extension"),
2190
+ literal("exports-only"),
2191
+ literal(false)
2192
+ ])))
2193
+ });
2194
+ const InputCliOverrideSchema = strictObject({
2195
+ input: pipe(optional(array(string())), description("Entry file")),
2196
+ external: pipe(optional(array(string())), description("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`")),
2197
+ inject: pipe(optional(record(string(), string())), description("Inject import statements on demand")),
2198
+ treeshake: pipe(optional(boolean()), description("enable treeshaking")),
2199
+ makeAbsoluteExternalsRelative: pipe(optional(boolean()), description("Prevent normalization of external imports")),
2200
+ jsx: pipe(optional(union([
2201
+ literal(false),
2202
+ literal("react"),
2203
+ literal("react-jsx"),
2204
+ literal("preserve")
2205
+ ])), description("Jsx options preset")),
2206
+ preserveEntrySignatures: pipe(optional(union([literal(false)])), description("Avoid facade chunks for entry points"))
2207
+ });
2208
+ const InputCliOptionsSchema = omit(strictObject({
2209
+ ...InputOptionsSchema.entries,
2210
+ ...InputCliOverrideSchema.entries
2211
+ }), [
2212
+ "plugins",
2213
+ "onwarn",
2214
+ "onLog",
2215
+ "resolve",
2216
+ "experimental",
2217
+ "profilerNames",
2218
+ "watch"
2219
+ ]);
2220
+ const ModuleFormatSchema = union([
2221
+ literal("es"),
2222
+ literal("cjs"),
2223
+ literal("esm"),
2224
+ literal("module"),
2225
+ literal("commonjs"),
2226
+ literal("iife"),
2227
+ literal("umd")
2228
+ ]);
2229
+ const AddonFunctionSchema = pipe(function_(), args(tuple([custom(() => true)])), returnsAsync(unionAsync([string(), pipeAsync(promise(), awaitAsync(), string())])));
2230
+ const ChunkFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
2231
+ const AssetFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
2232
+ const SanitizeFileNameSchema = union([boolean(), pipe(function_(), args(tuple([string()])), returns(string()))]);
2233
+ const GlobalsFunctionSchema = pipe(function_(), args(tuple([string()])), returns(string()));
2234
+ const AdvancedChunksSchema = strictObject({
2235
+ minSize: optional(number()),
2236
+ maxSize: optional(number()),
2237
+ minModuleSize: optional(number()),
2238
+ maxModuleSize: optional(number()),
2239
+ minShareCount: optional(number()),
2240
+ groups: optional(array(strictObject({
2241
+ name: string(),
2242
+ test: optional(union([
2243
+ string(),
2244
+ instance(RegExp),
2245
+ pipe(function_(), args(tuple([string()])), returns(union([nullish(boolean()), void_()])))
2246
+ ])),
2247
+ priority: optional(number()),
2248
+ minSize: optional(number()),
2249
+ minShareCount: optional(number()),
2250
+ maxSize: optional(number()),
2251
+ minModuleSize: optional(number()),
2252
+ maxModuleSize: optional(number())
2253
+ })))
2254
+ });
2255
+ const OutputOptionsSchema = strictObject({
2256
+ dir: pipe(optional(string()), description("Output directory, defaults to `dist` if `file` is not set")),
2257
+ file: pipe(optional(string()), description("Single output file")),
2258
+ exports: pipe(optional(union([
2259
+ literal("auto"),
2260
+ literal("named"),
2261
+ literal("default"),
2262
+ literal("none")
2263
+ ])), description(`Specify a export mode (${ansis_default.underline("auto")}, named, default, none)`)),
2264
+ hashCharacters: pipe(optional(union([
2265
+ literal("base64"),
2266
+ literal("base36"),
2267
+ literal("hex")
2268
+ ])), description("Use the specified character set for file hashes")),
2269
+ format: pipe(optional(ModuleFormatSchema), description(`Output format of the generated bundle (supports ${ansis_default.underline("esm")}, cjs, and iife)`)),
2270
+ sourcemap: pipe(optional(union([
2271
+ boolean(),
2272
+ literal("inline"),
2273
+ literal("hidden")
2274
+ ])), description(`Generate sourcemap (\`-s inline\` for inline, or ${ansis_default.bold("pass the `-s` on the last argument if you want to generate `.map` file")})`)),
2275
+ sourcemapDebugIds: pipe(optional(boolean()), description("Inject sourcemap debug IDs")),
2276
+ sourcemapIgnoreList: optional(union([boolean(), custom(() => true)])),
2277
+ sourcemapPathTransform: optional(custom(() => true)),
2278
+ banner: optional(union([string(), AddonFunctionSchema])),
2279
+ footer: optional(union([string(), AddonFunctionSchema])),
2280
+ intro: optional(union([string(), AddonFunctionSchema])),
2281
+ outro: optional(union([string(), AddonFunctionSchema])),
2282
+ extend: pipe(optional(boolean()), description("Extend global variable defined by name in IIFE / UMD formats")),
2283
+ esModule: optional(union([boolean(), literal("if-default-prop")])),
2284
+ assetFileNames: optional(AssetFileNamesSchema),
2285
+ entryFileNames: optional(ChunkFileNamesSchema),
2286
+ chunkFileNames: optional(ChunkFileNamesSchema),
2287
+ cssEntryFileNames: optional(ChunkFileNamesSchema),
2288
+ cssChunkFileNames: optional(ChunkFileNamesSchema),
2289
+ sanitizeFileName: optional(SanitizeFileNameSchema),
2290
+ minify: pipe(optional(union([
2291
+ boolean(),
2292
+ string("dce-only"),
2293
+ MinifyOptionsSchema
2294
+ ])), description("Minify the bundled file")),
2295
+ name: pipe(optional(string()), description("Name for UMD / IIFE format outputs")),
2296
+ globals: pipe(optional(union([record(string(), string()), GlobalsFunctionSchema])), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
2297
+ externalLiveBindings: pipe(optional(boolean()), description("external live bindings")),
2298
+ inlineDynamicImports: pipe(optional(boolean()), description("Inline dynamic imports")),
2299
+ manualChunks: optional(never("manualChunks is not supported. Please use advancedChunks instead")),
2300
+ advancedChunks: optional(AdvancedChunksSchema),
2301
+ legalComments: pipe(optional(union([literal("none"), literal("inline")])), description("Control comments in the output")),
2302
+ plugins: optional(custom(() => true)),
2303
+ polyfillRequire: pipe(optional(boolean()), description("Disable require polyfill injection")),
2304
+ hoistTransitiveImports: optional(custom((input) => {
2305
+ if (input) return false;
2306
+ return true;
2307
+ }, () => `The 'true' value is not supported`)),
2308
+ preserveModules: pipe(optional(boolean()), description("Preserve module structure")),
2309
+ preserveModulesRoot: pipe(optional(string()), description("Put preserved modules under this path at root level")),
2310
+ virtualDirname: optional(string())
2311
+ });
2312
+ const getAddonDescription = (placement, wrapper) => {
2313
+ return `Code to insert the ${ansis_default.bold(placement)} of the bundled file (${ansis_default.bold(wrapper)} the wrapper function)`;
2314
+ };
2315
+ const OutputCliOverrideSchema = strictObject({
2316
+ assetFileNames: pipe(optional(string()), description("Name pattern for asset files")),
2317
+ entryFileNames: pipe(optional(string()), description("Name pattern for emitted entry chunks")),
2318
+ chunkFileNames: pipe(optional(string()), description("Name pattern for emitted secondary chunks")),
2319
+ cssEntryFileNames: pipe(optional(string()), description("Name pattern for emitted css entry chunks")),
2320
+ cssChunkFileNames: pipe(optional(string()), description("Name pattern for emitted css secondary chunks")),
2321
+ sanitizeFileName: pipe(optional(boolean()), description("Sanitize file name")),
2322
+ banner: pipe(optional(string()), description(getAddonDescription("top", "outside"))),
2323
+ footer: pipe(optional(string()), description(getAddonDescription("bottom", "outside"))),
2324
+ intro: pipe(optional(string()), description(getAddonDescription("top", "inside"))),
2325
+ outro: pipe(optional(string()), description(getAddonDescription("bottom", "inside"))),
2326
+ esModule: pipe(optional(boolean()), description("Always generate `__esModule` marks in non-ESM formats, defaults to `if-default-prop` (use `--no-esModule` to always disable)")),
2327
+ globals: pipe(optional(record(string(), string())), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
2328
+ advancedChunks: pipe(optional(strictObject({
2329
+ minSize: pipe(optional(number()), description("Minimum size of the chunk")),
2330
+ minShareCount: pipe(optional(number()), description("Minimum share count of the chunk"))
2331
+ })), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
2332
+ minify: pipe(optional(boolean()), description("Minify the bundled file"))
2333
+ });
2334
+ const OutputCliOptionsSchema = omit(strictObject({
2335
+ ...OutputOptionsSchema.entries,
2336
+ ...OutputCliOverrideSchema.entries
2337
+ }), [
2338
+ "sourcemapIgnoreList",
2339
+ "sourcemapPathTransform",
2340
+ "plugins",
2341
+ "hoistTransitiveImports"
2342
+ ]);
2343
+ const CliOptionsSchema = strictObject({
2344
+ config: pipe(optional(union([string(), boolean()])), description("Path to the config file (default: `rolldown.config.js`)")),
2345
+ help: pipe(optional(boolean()), description("Show help")),
2346
+ version: pipe(optional(boolean()), description("Show version number")),
2347
+ watch: pipe(optional(boolean()), description("Watch files in bundle and rebuild on changes")),
2348
+ ...InputCliOptionsSchema.entries,
2349
+ ...OutputCliOptionsSchema.entries
2350
+ });
2009
2351
  function validateCliOptions(options) {
2010
2352
  let parsed = safeParse(CliOptionsSchema, options);
2011
2353
  return [parsed.output, parsed.issues?.map((issue) => {
@@ -2013,6 +2355,8 @@ function validateCliOptions(options) {
2013
2355
  return `Invalid value for option ${option}: ${issue.message}`;
2014
2356
  })];
2015
2357
  }
2358
+ const inputHelperMsgRecord = { output: { ignored: true } };
2359
+ const outputHelperMsgRecord = {};
2016
2360
  function validateOption(key, options) {
2017
2361
  if (globalThis.process?.env?.ROLLUP_TEST) return;
2018
2362
  let parsed = safeParse(key === "input" ? InputOptionsSchema : OutputOptionsSchema, options);
@@ -2044,410 +2388,38 @@ function getOutputCliKeys() {
2044
2388
  function getJsonSchema() {
2045
2389
  return toJsonSchema(CliOptionsSchema, { errorMode: "ignore" });
2046
2390
  }
2047
- var StringOrRegExpSchema, LogLevelSchema, LogLevelOptionSchema, LogLevelWithErrorSchema, RollupLogSchema, RollupLogWithStringSchema, InputOptionSchema, ExternalSchema, ModuleTypesSchema, JsxOptionsSchema, RollupJsxOptionsSchema, HelperModeSchema, DecoratorOptionSchema, HelpersSchema, RewriteImportExtensionsSchema, TypescriptSchema, AssumptionsSchema, TransformOptionsSchema, WatchOptionsSchema, ChecksOptionsSchema, MinifyOptionsSchema, ResolveOptionsSchema, TreeshakingOptionsSchema, OnLogSchema, OnwarnSchema, HmrSchema, InputOptionsSchema, InputCliOverrideSchema, InputCliOptionsSchema, ModuleFormatSchema, AddonFunctionSchema, ChunkFileNamesSchema, AssetFileNamesSchema, SanitizeFileNameSchema, GlobalsFunctionSchema, AdvancedChunksSchema, OutputOptionsSchema, getAddonDescription, OutputCliOverrideSchema, OutputCliOptionsSchema, CliOptionsSchema, inputHelperMsgRecord, outputHelperMsgRecord;
2048
- var init_validator = __esm({ "src/utils/validator.ts"() {
2049
- init_dist$2();
2050
- init_ansis();
2051
- init_dist$3();
2052
- StringOrRegExpSchema = union([string(), instance(RegExp)]);
2053
- LogLevelSchema = union([
2054
- literal("debug"),
2055
- literal("info"),
2056
- literal("warn")
2057
- ]);
2058
- LogLevelOptionSchema = union([LogLevelSchema, literal("silent")]);
2059
- LogLevelWithErrorSchema = union([LogLevelSchema, literal("error")]);
2060
- RollupLogSchema = any();
2061
- RollupLogWithStringSchema = union([RollupLogSchema, string()]);
2062
- InputOptionSchema = union([
2063
- string(),
2064
- array(string()),
2065
- record(string(), string())
2066
- ]);
2067
- ExternalSchema = union([
2068
- StringOrRegExpSchema,
2069
- array(StringOrRegExpSchema),
2070
- pipe(function_(), args(tuple([
2071
- string(),
2072
- optional(string()),
2073
- boolean()
2074
- ])), returns(nullish(boolean())))
2075
- ]);
2076
- ModuleTypesSchema = record(string(), union([
2077
- literal("asset"),
2078
- literal("base64"),
2079
- literal("binary"),
2080
- literal("css"),
2081
- literal("dataurl"),
2082
- literal("empty"),
2083
- literal("js"),
2084
- literal("json"),
2085
- literal("jsx"),
2086
- literal("text"),
2087
- literal("ts"),
2088
- literal("tsx")
2089
- ]));
2090
- JsxOptionsSchema = strictObject({
2091
- runtime: pipe(optional(union([literal("classic"), literal("automatic")])), description("Which runtime to use")),
2092
- development: pipe(optional(boolean()), description("Development specific information")),
2093
- throwIfNamespace: pipe(optional(string()), description("Toggles whether to throw an error when a tag name uses an XML namespace")),
2094
- importSource: pipe(optional(string()), description("Import the factory of element and fragment if mode is classic")),
2095
- pragma: pipe(optional(string()), description("Jsx element transformation")),
2096
- pragmaFlag: pipe(optional(string()), description("Jsx fragment transformation")),
2097
- refresh: pipe(optional(boolean()), description("Enable react fast refresh"))
2098
- });
2099
- RollupJsxOptionsSchema = strictObject({
2100
- mode: optional(union([
2101
- literal("classic"),
2102
- literal("automatic"),
2103
- literal("preserve")
2104
- ])),
2105
- factory: optional(string()),
2106
- fragment: optional(string()),
2107
- importSource: optional(string()),
2108
- jsxImportSource: optional(string())
2109
- });
2110
- HelperModeSchema = union([literal("Runtime"), literal("External")]);
2111
- DecoratorOptionSchema = object({
2112
- legacy: optional(boolean()),
2113
- emitDecoratorMetadata: optional(boolean())
2114
- });
2115
- HelpersSchema = object({ mode: optional(HelperModeSchema) });
2116
- RewriteImportExtensionsSchema = union([
2117
- literal("rewrite"),
2118
- literal("remove"),
2119
- boolean()
2120
- ]);
2121
- TypescriptSchema = object({
2122
- jsxPragma: optional(string()),
2123
- jsxPragmaFrag: optional(string()),
2124
- onlyRemoveTypeImports: optional(boolean()),
2125
- allowNamespaces: optional(boolean()),
2126
- allowDeclareFields: optional(boolean()),
2127
- declaration: optional(object({
2128
- stripInternal: optional(boolean()),
2129
- sourcemap: optional(boolean())
2130
- })),
2131
- rewriteImportExtensions: optional(RewriteImportExtensionsSchema)
2132
- });
2133
- AssumptionsSchema = object({
2134
- ignoreFunctionLength: optional(boolean()),
2135
- noDocumentAll: optional(boolean()),
2136
- objectRestNoSymbols: optional(boolean()),
2137
- pureGetters: optional(boolean()),
2138
- setPublicClassFields: optional(boolean())
2139
- });
2140
- TransformOptionsSchema = object({
2141
- assumptions: optional(AssumptionsSchema),
2142
- typescript: optional(TypescriptSchema),
2143
- helpers: optional(HelpersSchema),
2144
- decorators: optional(DecoratorOptionSchema),
2145
- jsx: optional(JsxOptionsSchema),
2146
- target: pipe(optional(union([string(), array(string())])), description("The JavaScript target environment"))
2147
- });
2148
- WatchOptionsSchema = strictObject({
2149
- chokidar: optional(never(`The "watch.chokidar" option is deprecated, please use "watch.notify" instead of it`)),
2150
- exclude: optional(union([StringOrRegExpSchema, array(StringOrRegExpSchema)])),
2151
- include: optional(union([StringOrRegExpSchema, array(StringOrRegExpSchema)])),
2152
- notify: pipe(optional(strictObject({
2153
- compareContents: optional(boolean()),
2154
- pollInterval: optional(number())
2155
- })), description("Notify options")),
2156
- skipWrite: pipe(optional(boolean()), description("Skip the bundle.write() step")),
2157
- buildDelay: pipe(optional(number()), description("Throttle watch rebuilds"))
2158
- });
2159
- ChecksOptionsSchema = strictObject({
2160
- circularDependency: pipe(optional(boolean()), description("Whether to emit warning when detecting circular dependency")),
2161
- eval: pipe(optional(boolean()), description("Whether to emit warning when detecting eval")),
2162
- missingGlobalName: pipe(optional(boolean()), description("Whether to emit warning when detecting missing global name")),
2163
- missingNameOptionForIifeExport: pipe(optional(boolean()), description("Whether to emit warning when detecting missing name option for iife export")),
2164
- mixedExport: pipe(optional(boolean()), description("Whether to emit warning when detecting mixed export")),
2165
- unresolvedEntry: pipe(optional(boolean()), description("Whether to emit warning when detecting unresolved entry")),
2166
- unresolvedImport: pipe(optional(boolean()), description("Whether to emit warning when detecting unresolved import")),
2167
- filenameConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting filename conflict")),
2168
- commonJsVariableInEsm: pipe(optional(boolean()), description("Whether to emit warning when detecting common js variable in esm")),
2169
- importIsUndefined: pipe(optional(boolean()), description("Whether to emit warning when detecting import is undefined")),
2170
- configurationFieldConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting configuration field conflict"))
2171
- });
2172
- MinifyOptionsSchema = strictObject({
2173
- mangle: optional(boolean()),
2174
- compress: optional(boolean()),
2175
- removeWhitespace: optional(boolean())
2176
- });
2177
- ResolveOptionsSchema = strictObject({
2178
- alias: optional(record(string(), union([string(), array(string())]))),
2179
- aliasFields: optional(array(array(string()))),
2180
- conditionNames: optional(array(string())),
2181
- extensionAlias: optional(record(string(), array(string()))),
2182
- exportsFields: optional(array(array(string()))),
2183
- extensions: optional(array(string())),
2184
- mainFields: optional(array(string())),
2185
- mainFiles: optional(array(string())),
2186
- modules: optional(array(string())),
2187
- symlinks: optional(boolean()),
2188
- tsconfigFilename: optional(string())
2189
- });
2190
- TreeshakingOptionsSchema = union([boolean(), looseObject({
2191
- annotations: optional(boolean()),
2192
- manualPureFunctions: optional(array(string())),
2193
- unknownGlobalSideEffects: optional(boolean())
2194
- })]);
2195
- OnLogSchema = pipe(function_(), args(tuple([
2196
- LogLevelSchema,
2197
- RollupLogSchema,
2198
- pipe(function_(), args(tuple([LogLevelWithErrorSchema, RollupLogWithStringSchema])))
2199
- ])));
2200
- OnwarnSchema = pipe(function_(), args(tuple([RollupLogSchema, pipe(function_(), args(tuple([union([RollupLogWithStringSchema, pipe(function_(), returns(RollupLogWithStringSchema))])])))])));
2201
- HmrSchema = union([boolean(), strictObject({
2202
- port: optional(number()),
2203
- host: optional(string()),
2204
- implement: optional(string())
2205
- })]);
2206
- InputOptionsSchema = strictObject({
2207
- input: optional(InputOptionSchema),
2208
- plugins: optional(custom(() => true)),
2209
- external: optional(ExternalSchema),
2210
- makeAbsoluteExternalsRelative: optional(union([boolean(), literal("ifRelativeSource")])),
2211
- resolve: optional(ResolveOptionsSchema),
2212
- cwd: pipe(optional(string()), description("Current working directory")),
2213
- platform: pipe(optional(union([
2214
- literal("browser"),
2215
- literal("neutral"),
2216
- literal("node")
2217
- ])), description(`Platform for which the code should be generated (node, ${ansis_default.underline("browser")}, neutral)`)),
2218
- shimMissingExports: pipe(optional(boolean()), description("Create shim variables for missing exports")),
2219
- treeshake: optional(TreeshakingOptionsSchema),
2220
- logLevel: pipe(optional(LogLevelOptionSchema), description(`Log level (${ansis_default.dim("silent")}, ${ansis_default.underline(ansis_default.gray("info"))}, debug, ${ansis_default.yellow("warn")})`)),
2221
- onLog: optional(OnLogSchema),
2222
- onwarn: optional(OnwarnSchema),
2223
- moduleTypes: pipe(optional(ModuleTypesSchema), description("Module types for customized extensions")),
2224
- experimental: optional(strictObject({
2225
- disableLiveBindings: optional(boolean()),
2226
- enableComposingJsPlugins: optional(boolean()),
2227
- resolveNewUrlToAsset: optional(boolean()),
2228
- strictExecutionOrder: optional(boolean()),
2229
- hmr: optional(HmrSchema),
2230
- attachDebugInfo: optional(union([
2231
- literal("none"),
2232
- literal("simple"),
2233
- literal("full")
2234
- ]))
2235
- })),
2236
- define: pipe(optional(record(string(), string())), description("Define global variables")),
2237
- inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
2238
- profilerNames: optional(boolean()),
2239
- jsx: optional(union([
2240
- literal(false),
2241
- literal("react"),
2242
- literal("react-jsx"),
2243
- literal("preserve"),
2244
- RollupJsxOptionsSchema
2245
- ])),
2246
- transform: optional(TransformOptionsSchema),
2247
- watch: optional(union([WatchOptionsSchema, literal(false)])),
2248
- dropLabels: pipe(optional(array(string())), description("Remove labeled statements with these label names")),
2249
- checks: optional(ChecksOptionsSchema),
2250
- keepNames: pipe(optional(boolean()), description("Keep function/class name")),
2251
- debug: pipe(optional(object({ sessionId: pipe(optional(string()), description("Used to name the build.")) })), description("Enable debug mode. Emit debug information to disk. This might slow down the build process significantly.")),
2252
- preserveEntrySignatures: pipe(optional(union([
2253
- literal("strict"),
2254
- literal("allow-extension"),
2255
- literal("exports-only"),
2256
- literal(false)
2257
- ])))
2258
- });
2259
- InputCliOverrideSchema = strictObject({
2260
- input: pipe(optional(array(string())), description("Entry file")),
2261
- external: pipe(optional(array(string())), description("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`")),
2262
- inject: pipe(optional(record(string(), string())), description("Inject import statements on demand")),
2263
- treeshake: pipe(optional(boolean()), description("enable treeshaking")),
2264
- makeAbsoluteExternalsRelative: pipe(optional(boolean()), description("Prevent normalization of external imports")),
2265
- jsx: pipe(optional(union([
2266
- literal(false),
2267
- literal("react"),
2268
- literal("react-jsx"),
2269
- literal("preserve")
2270
- ])), description("Jsx options preset")),
2271
- preserveEntrySignatures: pipe(optional(union([literal(false)])), description("Avoid facade chunks for entry points"))
2272
- });
2273
- InputCliOptionsSchema = omit(strictObject({
2274
- ...InputOptionsSchema.entries,
2275
- ...InputCliOverrideSchema.entries
2276
- }), [
2277
- "plugins",
2278
- "onwarn",
2279
- "onLog",
2280
- "resolve",
2281
- "experimental",
2282
- "profilerNames",
2283
- "watch"
2284
- ]);
2285
- ModuleFormatSchema = union([
2286
- literal("es"),
2287
- literal("cjs"),
2288
- literal("esm"),
2289
- literal("module"),
2290
- literal("commonjs"),
2291
- literal("iife"),
2292
- literal("umd")
2293
- ]);
2294
- AddonFunctionSchema = pipe(function_(), args(tuple([custom(() => true)])), returnsAsync(unionAsync([string(), pipeAsync(promise(), awaitAsync(), string())])));
2295
- ChunkFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
2296
- AssetFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
2297
- SanitizeFileNameSchema = union([boolean(), pipe(function_(), args(tuple([string()])), returns(string()))]);
2298
- GlobalsFunctionSchema = pipe(function_(), args(tuple([string()])), returns(string()));
2299
- AdvancedChunksSchema = strictObject({
2300
- minSize: optional(number()),
2301
- maxSize: optional(number()),
2302
- minModuleSize: optional(number()),
2303
- maxModuleSize: optional(number()),
2304
- minShareCount: optional(number()),
2305
- groups: optional(array(strictObject({
2306
- name: string(),
2307
- test: optional(union([
2308
- string(),
2309
- instance(RegExp),
2310
- pipe(function_(), args(tuple([string()])), returns(union([nullish(boolean()), void_()])))
2311
- ])),
2312
- priority: optional(number()),
2313
- minSize: optional(number()),
2314
- minShareCount: optional(number()),
2315
- maxSize: optional(number()),
2316
- minModuleSize: optional(number()),
2317
- maxModuleSize: optional(number())
2318
- })))
2319
- });
2320
- OutputOptionsSchema = strictObject({
2321
- dir: pipe(optional(string()), description("Output directory, defaults to `dist` if `file` is not set")),
2322
- file: pipe(optional(string()), description("Single output file")),
2323
- exports: pipe(optional(union([
2324
- literal("auto"),
2325
- literal("named"),
2326
- literal("default"),
2327
- literal("none")
2328
- ])), description(`Specify a export mode (${ansis_default.underline("auto")}, named, default, none)`)),
2329
- hashCharacters: pipe(optional(union([
2330
- literal("base64"),
2331
- literal("base36"),
2332
- literal("hex")
2333
- ])), description("Use the specified character set for file hashes")),
2334
- format: pipe(optional(ModuleFormatSchema), description(`Output format of the generated bundle (supports ${ansis_default.underline("esm")}, cjs, and iife)`)),
2335
- sourcemap: pipe(optional(union([
2336
- boolean(),
2337
- literal("inline"),
2338
- literal("hidden")
2339
- ])), description(`Generate sourcemap (\`-s inline\` for inline, or ${ansis_default.bold("pass the `-s` on the last argument if you want to generate `.map` file")})`)),
2340
- sourcemapDebugIds: pipe(optional(boolean()), description("Inject sourcemap debug IDs")),
2341
- sourcemapIgnoreList: optional(union([boolean(), custom(() => true)])),
2342
- sourcemapPathTransform: optional(custom(() => true)),
2343
- banner: optional(union([string(), AddonFunctionSchema])),
2344
- footer: optional(union([string(), AddonFunctionSchema])),
2345
- intro: optional(union([string(), AddonFunctionSchema])),
2346
- outro: optional(union([string(), AddonFunctionSchema])),
2347
- extend: pipe(optional(boolean()), description("Extend global variable defined by name in IIFE / UMD formats")),
2348
- esModule: optional(union([boolean(), literal("if-default-prop")])),
2349
- assetFileNames: optional(AssetFileNamesSchema),
2350
- entryFileNames: optional(ChunkFileNamesSchema),
2351
- chunkFileNames: optional(ChunkFileNamesSchema),
2352
- cssEntryFileNames: optional(ChunkFileNamesSchema),
2353
- cssChunkFileNames: optional(ChunkFileNamesSchema),
2354
- sanitizeFileName: optional(SanitizeFileNameSchema),
2355
- minify: pipe(optional(union([
2356
- boolean(),
2357
- string("dce-only"),
2358
- MinifyOptionsSchema
2359
- ])), description("Minify the bundled file")),
2360
- name: pipe(optional(string()), description("Name for UMD / IIFE format outputs")),
2361
- globals: pipe(optional(union([record(string(), string()), GlobalsFunctionSchema])), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
2362
- externalLiveBindings: pipe(optional(boolean()), description("external live bindings")),
2363
- inlineDynamicImports: pipe(optional(boolean()), description("Inline dynamic imports")),
2364
- manualChunks: optional(never("manualChunks is not supported. Please use advancedChunks instead")),
2365
- advancedChunks: optional(AdvancedChunksSchema),
2366
- legalComments: pipe(optional(union([literal("none"), literal("inline")])), description("Control comments in the output")),
2367
- plugins: optional(custom(() => true)),
2368
- polyfillRequire: pipe(optional(boolean()), description("Disable require polyfill injection")),
2369
- hoistTransitiveImports: optional(custom((input) => {
2370
- if (input) return false;
2371
- return true;
2372
- }, () => `The 'true' value is not supported`)),
2373
- preserveModules: pipe(optional(boolean()), description("Preserve module structure")),
2374
- preserveModulesRoot: pipe(optional(string()), description("Put preserved modules under this path at root level")),
2375
- virtualDirname: optional(string())
2376
- });
2377
- getAddonDescription = (placement, wrapper) => {
2378
- return `Code to insert the ${ansis_default.bold(placement)} of the bundled file (${ansis_default.bold(wrapper)} the wrapper function)`;
2379
- };
2380
- OutputCliOverrideSchema = strictObject({
2381
- assetFileNames: pipe(optional(string()), description("Name pattern for asset files")),
2382
- entryFileNames: pipe(optional(string()), description("Name pattern for emitted entry chunks")),
2383
- chunkFileNames: pipe(optional(string()), description("Name pattern for emitted secondary chunks")),
2384
- cssEntryFileNames: pipe(optional(string()), description("Name pattern for emitted css entry chunks")),
2385
- cssChunkFileNames: pipe(optional(string()), description("Name pattern for emitted css secondary chunks")),
2386
- sanitizeFileName: pipe(optional(boolean()), description("Sanitize file name")),
2387
- banner: pipe(optional(string()), description(getAddonDescription("top", "outside"))),
2388
- footer: pipe(optional(string()), description(getAddonDescription("bottom", "outside"))),
2389
- intro: pipe(optional(string()), description(getAddonDescription("top", "inside"))),
2390
- outro: pipe(optional(string()), description(getAddonDescription("bottom", "inside"))),
2391
- esModule: pipe(optional(boolean()), description("Always generate `__esModule` marks in non-ESM formats, defaults to `if-default-prop` (use `--no-esModule` to always disable)")),
2392
- globals: pipe(optional(record(string(), string())), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
2393
- advancedChunks: pipe(optional(strictObject({
2394
- minSize: pipe(optional(number()), description("Minimum size of the chunk")),
2395
- minShareCount: pipe(optional(number()), description("Minimum share count of the chunk"))
2396
- })), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
2397
- minify: pipe(optional(boolean()), description("Minify the bundled file"))
2398
- });
2399
- OutputCliOptionsSchema = omit(strictObject({
2400
- ...OutputOptionsSchema.entries,
2401
- ...OutputCliOverrideSchema.entries
2402
- }), [
2403
- "sourcemapIgnoreList",
2404
- "sourcemapPathTransform",
2405
- "plugins",
2406
- "hoistTransitiveImports"
2407
- ]);
2408
- CliOptionsSchema = strictObject({
2409
- config: pipe(optional(union([string(), boolean()])), description("Path to the config file (default: `rolldown.config.js`)")),
2410
- help: pipe(optional(boolean()), description("Show help")),
2411
- version: pipe(optional(boolean()), description("Show version number")),
2412
- watch: pipe(optional(boolean()), description("Watch files in bundle and rebuild on changes")),
2413
- ...InputCliOptionsSchema.entries,
2414
- ...OutputCliOptionsSchema.entries
2415
- });
2416
- inputHelperMsgRecord = { output: { ignored: true } };
2417
- outputHelperMsgRecord = {};
2418
- } });
2419
2391
 
2420
2392
  //#endregion
2421
2393
  //#region src/constants/plugin-context.ts
2422
- var SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF;
2423
- var init_plugin_context$1 = __esm({ "src/constants/plugin-context.ts"() {
2424
- SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF = Symbol("plugin-context-resolve-caller");
2425
- } });
2394
+ /**
2395
+ * If Composed plugins call `this.resolve` with `skipSelf: true`, the composed plugins will be skipped as a whole.
2396
+ * To prevent that, we use this symbol to store the actual caller of `this.resolve` with `skipSelf: true`. And we
2397
+ * will modify the skipSelf option to `false` and use this symbol to skip the caller itself in the composed plugins
2398
+ * internally.
2399
+ */
2400
+ const SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF = Symbol("plugin-context-resolve-caller");
2426
2401
 
2427
2402
  //#endregion
2428
2403
  //#region src/options/normalized-input-options.ts
2429
- var NormalizedInputOptionsImpl;
2430
- var init_normalized_input_options = __esm({ "src/options/normalized-input-options.ts"() {
2431
- NormalizedInputOptionsImpl = class {
2432
- inner;
2433
- constructor(inner, onLog) {
2434
- this.onLog = onLog;
2435
- this.inner = inner;
2436
- }
2437
- get shimMissingExports() {
2438
- return this.inner.shimMissingExports;
2439
- }
2440
- get input() {
2441
- return this.inner.input;
2442
- }
2443
- get cwd() {
2444
- return this.inner.cwd ?? void 0;
2445
- }
2446
- get platform() {
2447
- return this.inner.platform;
2448
- }
2449
- };
2450
- } });
2404
+ var NormalizedInputOptionsImpl = class {
2405
+ inner;
2406
+ constructor(inner, onLog) {
2407
+ this.onLog = onLog;
2408
+ this.inner = inner;
2409
+ }
2410
+ get shimMissingExports() {
2411
+ return this.inner.shimMissingExports;
2412
+ }
2413
+ get input() {
2414
+ return this.inner.input;
2415
+ }
2416
+ get cwd() {
2417
+ return this.inner.cwd ?? void 0;
2418
+ }
2419
+ get platform() {
2420
+ return this.inner.platform;
2421
+ }
2422
+ };
2451
2423
 
2452
2424
  //#endregion
2453
2425
  //#region src/types/sourcemap.ts
@@ -2464,7 +2436,6 @@ function bindingifySourcemap(map) {
2464
2436
  debugId: "debugId" in map ? map.debugId : void 0
2465
2437
  } };
2466
2438
  }
2467
- var init_sourcemap = __esm({ "src/types/sourcemap.ts"() {} });
2468
2439
 
2469
2440
  //#endregion
2470
2441
  //#region src/utils/error.ts
@@ -2515,7 +2486,6 @@ function getErrorMessage(e$1) {
2515
2486
  function joinNewLine(s1, s2) {
2516
2487
  return s1.replace(/\n+$/, "") + "\n" + s2.replace(/^\n+/, "");
2517
2488
  }
2518
- var init_error = __esm({ "src/utils/error.ts"() {} });
2519
2489
 
2520
2490
  //#endregion
2521
2491
  //#region src/utils/transform-module-info.ts
@@ -2537,9 +2507,6 @@ function transformModuleInfo(info, option) {
2537
2507
  ...option
2538
2508
  };
2539
2509
  }
2540
- var init_transform_module_info = __esm({ "src/utils/transform-module-info.ts"() {
2541
- init_misc();
2542
- } });
2543
2510
 
2544
2511
  //#endregion
2545
2512
  //#region src/utils/transform-side-effects.ts
@@ -2553,7 +2520,6 @@ function bindingifySideEffects(sideEffects) {
2553
2520
  default: throw new Error(`Unexpected side effects: ${sideEffects}`);
2554
2521
  }
2555
2522
  }
2556
- var init_transform_side_effects = __esm({ "src/utils/transform-side-effects.ts"() {} });
2557
2523
 
2558
2524
  //#endregion
2559
2525
  //#region src/utils/transform-sourcemap.ts
@@ -2569,7 +2535,6 @@ function normalizeTransformHookSourcemap(id$1, originalCode, rawMap) {
2569
2535
  if (isEmptySourcemapFiled(map.sources) || map.sources && map.sources.length === 1 && map.sources[0] !== id$1) map.sources = [id$1];
2570
2536
  return map;
2571
2537
  }
2572
- var init_transform_sourcemap = __esm({ "src/utils/transform-sourcemap.ts"() {} });
2573
2538
 
2574
2539
  //#endregion
2575
2540
  //#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-D6FCK2GA.js
@@ -2580,7 +2545,6 @@ function u$1(o$1, n$1, a$2) {
2580
2545
  lazyArgs: n$1
2581
2546
  });
2582
2547
  }
2583
- var init_chunk_D6FCK2GA = __esm({ "../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-D6FCK2GA.js"() {} });
2584
2548
 
2585
2549
  //#endregion
2586
2550
  //#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-WIMGWYZL.js
@@ -2590,40 +2554,23 @@ function u(r$1, n$1, o$1) {
2590
2554
  if (a$2 === 1) return u$1(r$1, n$1, o$1);
2591
2555
  throw new Error("Wrong number of arguments");
2592
2556
  }
2593
- var init_chunk_WIMGWYZL = __esm({ "../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-WIMGWYZL.js"() {
2594
- init_chunk_D6FCK2GA();
2595
- } });
2596
2557
 
2597
2558
  //#endregion
2598
2559
  //#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-3IFJP4R5.js
2599
2560
  function d(...r$1) {
2600
2561
  return u(i, r$1);
2601
2562
  }
2602
- var i;
2603
- var init_chunk_3IFJP4R5 = __esm({ "../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-3IFJP4R5.js"() {
2604
- init_chunk_WIMGWYZL();
2605
- i = (r$1, t$2) => {
2606
- let a$2 = [[], []];
2607
- for (let [o$1, e$1] of r$1.entries()) t$2(e$1, o$1, r$1) ? a$2[0].push(e$1) : a$2[1].push(e$1);
2608
- return a$2;
2609
- };
2610
- } });
2563
+ var i = (r$1, t$2) => {
2564
+ let a$2 = [[], []];
2565
+ for (let [o$1, e$1] of r$1.entries()) t$2(e$1, o$1, r$1) ? a$2[0].push(e$1) : a$2[1].push(e$1);
2566
+ return a$2;
2567
+ };
2611
2568
 
2612
2569
  //#endregion
2613
2570
  //#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-5NQBDF4H.js
2614
2571
  function t(...n$1) {
2615
2572
  return u(Object.keys, n$1);
2616
2573
  }
2617
- var init_chunk_5NQBDF4H = __esm({ "../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-5NQBDF4H.js"() {
2618
- init_chunk_WIMGWYZL();
2619
- } });
2620
-
2621
- //#endregion
2622
- //#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/index.js
2623
- var init_dist$1 = __esm({ "../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/index.js"() {
2624
- init_chunk_3IFJP4R5();
2625
- init_chunk_5NQBDF4H();
2626
- } });
2627
2574
 
2628
2575
  //#endregion
2629
2576
  //#region src/plugin/bindingify-hook-filter.ts
@@ -2765,11 +2712,6 @@ function bindingifyRenderChunkFilter(filterOption) {
2765
2712
  if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
2766
2713
  return filterOption.code ? bindingifyGeneralHookFilter("code", filterOption.code) : void 0;
2767
2714
  }
2768
- var init_bindingify_hook_filter = __esm({ "src/plugin/bindingify-hook-filter.ts"() {
2769
- init_dist();
2770
- init_dist$1();
2771
- init_misc();
2772
- } });
2773
2715
 
2774
2716
  //#endregion
2775
2717
  //#region src/plugin/bindingify-plugin-hook-meta.ts
@@ -2785,7 +2727,6 @@ function bindingPluginOrder(order) {
2785
2727
  default: throw new Error(`Unknown plugin order: ${order}`);
2786
2728
  }
2787
2729
  }
2788
- var init_bindingify_plugin_hook_meta = __esm({ "src/plugin/bindingify-plugin-hook-meta.ts"() {} });
2789
2730
 
2790
2731
  //#endregion
2791
2732
  //#region src/utils/asset-source.ts
@@ -2795,150 +2736,132 @@ function transformAssetSource(bindingAssetSource$1) {
2795
2736
  function bindingAssetSource(source) {
2796
2737
  return { inner: source };
2797
2738
  }
2798
- var init_asset_source = __esm({ "src/utils/asset-source.ts"() {} });
2799
2739
 
2800
2740
  //#endregion
2801
2741
  //#region src/plugin/plugin-context.ts
2802
- var PluginContextImpl;
2803
- var init_plugin_context = __esm({ "src/plugin/plugin-context.ts"() {
2804
- init_logging();
2805
- init_logs();
2806
- init_parse_ast_index();
2807
- init_minimal_plugin_context();
2808
- init_asset_source();
2809
- init_bindingify_input_options();
2810
- init_misc();
2811
- init_transform_side_effects();
2812
- PluginContextImpl = class extends MinimalPluginContextImpl {
2813
- getModuleInfo;
2814
- constructor(outputOptions, context, plugin, data, onLog, logLevel, watchMode, currentLoadingModule) {
2815
- super(onLog, logLevel, plugin.name, watchMode);
2816
- this.outputOptions = outputOptions;
2817
- this.context = context;
2818
- this.data = data;
2819
- this.onLog = onLog;
2820
- this.currentLoadingModule = currentLoadingModule;
2821
- this.getModuleInfo = (id$1) => this.data.getModuleInfo(id$1, context);
2822
- }
2823
- async load(options) {
2824
- const id$1 = options.id;
2825
- if (id$1 === this.currentLoadingModule) this.onLog(LOG_LEVEL_WARN, logCycleLoading(this.pluginName, this.currentLoadingModule));
2826
- const moduleInfo = this.data.getModuleInfo(id$1, this.context);
2827
- if (moduleInfo && moduleInfo.code !== null) return moduleInfo;
2828
- const rawOptions = {
2829
- meta: options.meta || {},
2830
- moduleSideEffects: options.moduleSideEffects || null,
2831
- invalidate: false
2832
- };
2833
- this.data.updateModuleOption(id$1, rawOptions);
2834
- async function createLoadModulePromise(context, data) {
2835
- const loadPromise = data.loadModulePromiseMap.get(id$1);
2836
- if (loadPromise) return loadPromise;
2837
- const promise$1 = new Promise((resolve, _) => {
2838
- data.loadModulePromiseResolveFnMap.set(id$1, resolve);
2839
- });
2840
- data.loadModulePromiseMap.set(id$1, promise$1);
2841
- try {
2842
- await context.load(id$1, bindingifySideEffects(options.moduleSideEffects));
2843
- } catch (e$1) {
2844
- data.loadModulePromiseMap.delete(id$1);
2845
- data.loadModulePromiseResolveFnMap.delete(id$1);
2846
- throw e$1;
2847
- }
2848
- return promise$1;
2849
- }
2850
- await createLoadModulePromise(this.context, this.data);
2851
- return this.data.getModuleInfo(id$1, this.context);
2852
- }
2853
- async resolve(source, importer, options) {
2854
- let receipt = void 0;
2855
- if (options != null) receipt = this.data.saveResolveOptions(options);
2856
- const res = await this.context.resolve(source, importer, {
2857
- custom: receipt,
2858
- skipSelf: options?.skipSelf
2859
- });
2860
- if (receipt != null) this.data.removeSavedResolveOptions(receipt);
2861
- if (res == null) return null;
2862
- const info = this.data.getModuleOption(res.id) || {};
2863
- return {
2864
- ...res,
2865
- external: res.external === "relative" ? unreachable(`The PluginContext resolve result external couldn't be 'relative'`) : res.external,
2866
- ...info
2867
- };
2868
- }
2869
- emitFile = (file) => {
2870
- if (file.type === "prebuilt-chunk") return unimplemented("PluginContext.emitFile with type prebuilt-chunk");
2871
- if (file.type === "chunk") return this.context.emitChunk({
2872
- preserveEntrySignatures: bindingifyPreserveEntrySignatures(file.preserveSignature),
2873
- ...file
2874
- });
2875
- const fnSanitizedFileName = file.fileName || typeof this.outputOptions.sanitizeFileName !== "function" ? void 0 : this.outputOptions.sanitizeFileName(file.name || "asset");
2876
- const filename = file.fileName ? void 0 : this.getAssetFileNames(file);
2877
- return this.context.emitFile({
2878
- ...file,
2879
- originalFileName: file.originalFileName || void 0,
2880
- source: bindingAssetSource(file.source)
2881
- }, filename, fnSanitizedFileName);
2742
+ var PluginContextImpl = class extends MinimalPluginContextImpl {
2743
+ getModuleInfo;
2744
+ constructor(outputOptions, context, plugin, data, onLog, logLevel, watchMode, currentLoadingModule) {
2745
+ super(onLog, logLevel, plugin.name, watchMode);
2746
+ this.outputOptions = outputOptions;
2747
+ this.context = context;
2748
+ this.data = data;
2749
+ this.onLog = onLog;
2750
+ this.currentLoadingModule = currentLoadingModule;
2751
+ this.getModuleInfo = (id$1) => this.data.getModuleInfo(id$1, context);
2752
+ }
2753
+ async load(options) {
2754
+ const id$1 = options.id;
2755
+ if (id$1 === this.currentLoadingModule) this.onLog(LOG_LEVEL_WARN, logCycleLoading(this.pluginName, this.currentLoadingModule));
2756
+ const moduleInfo = this.data.getModuleInfo(id$1, this.context);
2757
+ if (moduleInfo && moduleInfo.code !== null) return moduleInfo;
2758
+ const rawOptions = {
2759
+ meta: options.meta || {},
2760
+ moduleSideEffects: options.moduleSideEffects || null,
2761
+ invalidate: false
2882
2762
  };
2883
- getAssetFileNames(file) {
2884
- if (typeof this.outputOptions.assetFileNames === "function") return this.outputOptions.assetFileNames({
2885
- names: file.name ? [file.name] : [],
2886
- originalFileNames: file.originalFileName ? [file.originalFileName] : [],
2887
- source: file.source,
2888
- type: "asset"
2763
+ this.data.updateModuleOption(id$1, rawOptions);
2764
+ async function createLoadModulePromise(context, data) {
2765
+ const loadPromise = data.loadModulePromiseMap.get(id$1);
2766
+ if (loadPromise) return loadPromise;
2767
+ const promise$1 = new Promise((resolve, _) => {
2768
+ data.loadModulePromiseResolveFnMap.set(id$1, resolve);
2889
2769
  });
2770
+ data.loadModulePromiseMap.set(id$1, promise$1);
2771
+ try {
2772
+ await context.load(id$1, bindingifySideEffects(options.moduleSideEffects));
2773
+ } catch (e$1) {
2774
+ data.loadModulePromiseMap.delete(id$1);
2775
+ data.loadModulePromiseResolveFnMap.delete(id$1);
2776
+ throw e$1;
2777
+ }
2778
+ return promise$1;
2890
2779
  }
2891
- getFileName(referenceId) {
2892
- return this.context.getFileName(referenceId);
2893
- }
2894
- getModuleIds() {
2895
- return this.data.getModuleIds(this.context);
2896
- }
2897
- addWatchFile(id$1) {
2898
- this.context.addWatchFile(id$1);
2899
- }
2900
- parse(input, options) {
2901
- return parseAst(input, options);
2902
- }
2780
+ await createLoadModulePromise(this.context, this.data);
2781
+ return this.data.getModuleInfo(id$1, this.context);
2782
+ }
2783
+ async resolve(source, importer, options) {
2784
+ let receipt = void 0;
2785
+ if (options != null) receipt = this.data.saveResolveOptions(options);
2786
+ const res = await this.context.resolve(source, importer, {
2787
+ custom: receipt,
2788
+ skipSelf: options?.skipSelf
2789
+ });
2790
+ if (receipt != null) this.data.removeSavedResolveOptions(receipt);
2791
+ if (res == null) return null;
2792
+ const info = this.data.getModuleOption(res.id) || {};
2793
+ return {
2794
+ ...res,
2795
+ external: res.external === "relative" ? unreachable(`The PluginContext resolve result external couldn't be 'relative'`) : res.external,
2796
+ ...info
2797
+ };
2798
+ }
2799
+ emitFile = (file) => {
2800
+ if (file.type === "prebuilt-chunk") return unimplemented("PluginContext.emitFile with type prebuilt-chunk");
2801
+ if (file.type === "chunk") return this.context.emitChunk({
2802
+ preserveEntrySignatures: bindingifyPreserveEntrySignatures(file.preserveSignature),
2803
+ ...file
2804
+ });
2805
+ const fnSanitizedFileName = file.fileName || typeof this.outputOptions.sanitizeFileName !== "function" ? void 0 : this.outputOptions.sanitizeFileName(file.name || "asset");
2806
+ const filename = file.fileName ? void 0 : this.getAssetFileNames(file);
2807
+ return this.context.emitFile({
2808
+ ...file,
2809
+ originalFileName: file.originalFileName || void 0,
2810
+ source: bindingAssetSource(file.source)
2811
+ }, filename, fnSanitizedFileName);
2903
2812
  };
2904
- } });
2813
+ getAssetFileNames(file) {
2814
+ if (typeof this.outputOptions.assetFileNames === "function") return this.outputOptions.assetFileNames({
2815
+ names: file.name ? [file.name] : [],
2816
+ originalFileNames: file.originalFileName ? [file.originalFileName] : [],
2817
+ source: file.source,
2818
+ type: "asset"
2819
+ });
2820
+ }
2821
+ getFileName(referenceId) {
2822
+ return this.context.getFileName(referenceId);
2823
+ }
2824
+ getModuleIds() {
2825
+ return this.data.getModuleIds(this.context);
2826
+ }
2827
+ addWatchFile(id$1) {
2828
+ this.context.addWatchFile(id$1);
2829
+ }
2830
+ parse(input, options) {
2831
+ return parseAst(input, options);
2832
+ }
2833
+ };
2905
2834
 
2906
2835
  //#endregion
2907
2836
  //#region src/plugin/transform-plugin-context.ts
2908
- var TransformPluginContextImpl;
2909
- var init_transform_plugin_context = __esm({ "src/plugin/transform-plugin-context.ts"() {
2910
- init_log_handler();
2911
- init_logs();
2912
- init_plugin_context();
2913
- TransformPluginContextImpl = class extends PluginContextImpl {
2914
- constructor(outputOptions, context, plugin, data, inner, moduleId, moduleSource, onLog, LogLevelOption, watchMode) {
2915
- super(outputOptions, context, plugin, data, onLog, LogLevelOption, watchMode, moduleId);
2916
- this.inner = inner;
2917
- this.moduleId = moduleId;
2918
- this.moduleSource = moduleSource;
2919
- const getLogHandler$1 = (handler) => (log, pos) => {
2920
- log = normalizeLog(log);
2921
- if (pos) augmentCodeLocation(log, pos, moduleSource, moduleId);
2922
- log.id = moduleId;
2923
- log.hook = "transform";
2924
- handler(log);
2925
- };
2926
- this.debug = getLogHandler$1(this.debug);
2927
- this.warn = getLogHandler$1(this.warn);
2928
- this.info = getLogHandler$1(this.info);
2929
- }
2930
- error(e$1, pos) {
2931
- if (typeof e$1 === "string") e$1 = { message: e$1 };
2932
- if (pos) augmentCodeLocation(e$1, pos, this.moduleSource, this.moduleId);
2933
- e$1.id = this.moduleId;
2934
- e$1.hook = "transform";
2935
- return error(logPluginError(normalizeLog(e$1), this.pluginName));
2936
- }
2937
- getCombinedSourcemap() {
2938
- return JSON.parse(this.inner.getCombinedSourcemap());
2939
- }
2940
- };
2941
- } });
2837
+ var TransformPluginContextImpl = class extends PluginContextImpl {
2838
+ constructor(outputOptions, context, plugin, data, inner, moduleId, moduleSource, onLog, LogLevelOption, watchMode) {
2839
+ super(outputOptions, context, plugin, data, onLog, LogLevelOption, watchMode, moduleId);
2840
+ this.inner = inner;
2841
+ this.moduleId = moduleId;
2842
+ this.moduleSource = moduleSource;
2843
+ const getLogHandler$1 = (handler) => (log, pos) => {
2844
+ log = normalizeLog(log);
2845
+ if (pos) augmentCodeLocation(log, pos, moduleSource, moduleId);
2846
+ log.id = moduleId;
2847
+ log.hook = "transform";
2848
+ handler(log);
2849
+ };
2850
+ this.debug = getLogHandler$1(this.debug);
2851
+ this.warn = getLogHandler$1(this.warn);
2852
+ this.info = getLogHandler$1(this.info);
2853
+ }
2854
+ error(e$1, pos) {
2855
+ if (typeof e$1 === "string") e$1 = { message: e$1 };
2856
+ if (pos) augmentCodeLocation(e$1, pos, this.moduleSource, this.moduleId);
2857
+ e$1.id = this.moduleId;
2858
+ e$1.hook = "transform";
2859
+ return error(logPluginError(normalizeLog(e$1), this.pluginName));
2860
+ }
2861
+ getCombinedSourcemap() {
2862
+ return JSON.parse(this.inner.getCombinedSourcemap());
2863
+ }
2864
+ };
2942
2865
 
2943
2866
  //#endregion
2944
2867
  //#region src/plugin/bindingify-build-hooks.ts
@@ -3103,20 +3026,6 @@ function bindingifyModuleParsed(args$1) {
3103
3026
  meta: bindingifyPluginHookMeta(meta)
3104
3027
  };
3105
3028
  }
3106
- var init_bindingify_build_hooks = __esm({ "src/plugin/bindingify-build-hooks.ts"() {
3107
- init_normalize_hook();
3108
- init_plugin_context$1();
3109
- init_normalized_input_options();
3110
- init_sourcemap();
3111
- init_error();
3112
- init_transform_module_info();
3113
- init_transform_side_effects();
3114
- init_transform_sourcemap();
3115
- init_bindingify_hook_filter();
3116
- init_bindingify_plugin_hook_meta();
3117
- init_plugin_context();
3118
- init_transform_plugin_context();
3119
- } });
3120
3029
 
3121
3030
  //#endregion
3122
3031
  //#region src/utils/transform-rendered-module.ts
@@ -3133,7 +3042,6 @@ function transformToRenderedModule(bindingRenderedModule) {
3133
3042
  }
3134
3043
  };
3135
3044
  }
3136
- var init_transform_rendered_module = __esm({ "src/utils/transform-rendered-module.ts"() {} });
3137
3045
 
3138
3046
  //#endregion
3139
3047
  //#region src/utils/transform-rendered-chunk.ts
@@ -3183,9 +3091,6 @@ function transformChunkModules(modules) {
3183
3091
  }
3184
3092
  return result;
3185
3093
  }
3186
- var init_transform_rendered_chunk = __esm({ "src/utils/transform-rendered-chunk.ts"() {
3187
- init_transform_rendered_module();
3188
- } });
3189
3094
 
3190
3095
  //#endregion
3191
3096
  //#region src/utils/bindingify-output-options.ts
@@ -3270,125 +3175,116 @@ function bindingifyAssetFilenames(assetFileNames) {
3270
3175
  };
3271
3176
  return assetFileNames;
3272
3177
  }
3273
- var init_bindingify_output_options = __esm({ "src/utils/bindingify-output-options.ts"() {
3274
- init_asset_source();
3275
- init_misc();
3276
- init_transform_rendered_chunk();
3277
- } });
3278
3178
 
3279
3179
  //#endregion
3280
3180
  //#region src/options/normalized-output-options.ts
3181
+ var NormalizedOutputOptionsImpl = class {
3182
+ constructor(inner, outputOptions, normalizedOutputPlugins) {
3183
+ this.inner = inner;
3184
+ this.outputOptions = outputOptions;
3185
+ this.normalizedOutputPlugins = normalizedOutputPlugins;
3186
+ }
3187
+ get dir() {
3188
+ return this.inner.dir ?? void 0;
3189
+ }
3190
+ get entryFileNames() {
3191
+ return this.inner.entryFilenames || this.outputOptions.entryFileNames;
3192
+ }
3193
+ get chunkFileNames() {
3194
+ return this.inner.chunkFilenames || this.outputOptions.chunkFileNames;
3195
+ }
3196
+ get assetFileNames() {
3197
+ return this.inner.assetFilenames || this.outputOptions.assetFileNames;
3198
+ }
3199
+ get format() {
3200
+ return this.inner.format;
3201
+ }
3202
+ get exports() {
3203
+ return this.inner.exports;
3204
+ }
3205
+ get sourcemap() {
3206
+ return this.inner.sourcemap;
3207
+ }
3208
+ get cssEntryFileNames() {
3209
+ return this.inner.cssEntryFilenames || this.outputOptions.cssEntryFileNames;
3210
+ }
3211
+ get cssChunkFileNames() {
3212
+ return this.inner.cssChunkFilenames || this.outputOptions.cssChunkFileNames;
3213
+ }
3214
+ get shimMissingExports() {
3215
+ return this.inner.shimMissingExports;
3216
+ }
3217
+ get name() {
3218
+ return this.inner.name ?? void 0;
3219
+ }
3220
+ get file() {
3221
+ return this.inner.file ?? void 0;
3222
+ }
3223
+ get inlineDynamicImports() {
3224
+ return this.inner.inlineDynamicImports;
3225
+ }
3226
+ get externalLiveBindings() {
3227
+ return this.inner.externalLiveBindings;
3228
+ }
3229
+ get banner() {
3230
+ return normalizeAddon(this.outputOptions.banner);
3231
+ }
3232
+ get footer() {
3233
+ return normalizeAddon(this.outputOptions.footer);
3234
+ }
3235
+ get intro() {
3236
+ return normalizeAddon(this.outputOptions.intro);
3237
+ }
3238
+ get outro() {
3239
+ return normalizeAddon(this.outputOptions.outro);
3240
+ }
3241
+ get esModule() {
3242
+ return this.inner.esModule;
3243
+ }
3244
+ get extend() {
3245
+ return this.inner.extend;
3246
+ }
3247
+ get globals() {
3248
+ return this.inner.globals || this.outputOptions.globals;
3249
+ }
3250
+ get hashCharacters() {
3251
+ return this.inner.hashCharacters;
3252
+ }
3253
+ get sourcemapDebugIds() {
3254
+ return this.inner.sourcemapDebugIds;
3255
+ }
3256
+ get sourcemapIgnoreList() {
3257
+ return bindingifySourcemapIgnoreList(this.outputOptions.sourcemapIgnoreList);
3258
+ }
3259
+ get sourcemapPathTransform() {
3260
+ return this.outputOptions.sourcemapPathTransform;
3261
+ }
3262
+ get minify() {
3263
+ return this.inner.minify;
3264
+ }
3265
+ get legalComments() {
3266
+ return this.inner.legalComments;
3267
+ }
3268
+ get polyfillRequire() {
3269
+ return this.inner.polyfillRequire;
3270
+ }
3271
+ get plugins() {
3272
+ return this.normalizedOutputPlugins;
3273
+ }
3274
+ get preserveModules() {
3275
+ return this.inner.preserveModules;
3276
+ }
3277
+ get preserveModulesRoot() {
3278
+ return this.inner.preserveModulesRoot;
3279
+ }
3280
+ get virtualDirname() {
3281
+ return this.inner.virtualDirname;
3282
+ }
3283
+ };
3281
3284
  function normalizeAddon(value) {
3282
3285
  if (typeof value === "function") return value;
3283
3286
  return () => value || "";
3284
3287
  }
3285
- var NormalizedOutputOptionsImpl;
3286
- var init_normalized_output_options = __esm({ "src/options/normalized-output-options.ts"() {
3287
- init_bindingify_output_options();
3288
- NormalizedOutputOptionsImpl = class {
3289
- constructor(inner, outputOptions, normalizedOutputPlugins) {
3290
- this.inner = inner;
3291
- this.outputOptions = outputOptions;
3292
- this.normalizedOutputPlugins = normalizedOutputPlugins;
3293
- }
3294
- get dir() {
3295
- return this.inner.dir ?? void 0;
3296
- }
3297
- get entryFileNames() {
3298
- return this.inner.entryFilenames || this.outputOptions.entryFileNames;
3299
- }
3300
- get chunkFileNames() {
3301
- return this.inner.chunkFilenames || this.outputOptions.chunkFileNames;
3302
- }
3303
- get assetFileNames() {
3304
- return this.inner.assetFilenames || this.outputOptions.assetFileNames;
3305
- }
3306
- get format() {
3307
- return this.inner.format;
3308
- }
3309
- get exports() {
3310
- return this.inner.exports;
3311
- }
3312
- get sourcemap() {
3313
- return this.inner.sourcemap;
3314
- }
3315
- get cssEntryFileNames() {
3316
- return this.inner.cssEntryFilenames || this.outputOptions.cssEntryFileNames;
3317
- }
3318
- get cssChunkFileNames() {
3319
- return this.inner.cssChunkFilenames || this.outputOptions.cssChunkFileNames;
3320
- }
3321
- get shimMissingExports() {
3322
- return this.inner.shimMissingExports;
3323
- }
3324
- get name() {
3325
- return this.inner.name ?? void 0;
3326
- }
3327
- get file() {
3328
- return this.inner.file ?? void 0;
3329
- }
3330
- get inlineDynamicImports() {
3331
- return this.inner.inlineDynamicImports;
3332
- }
3333
- get externalLiveBindings() {
3334
- return this.inner.externalLiveBindings;
3335
- }
3336
- get banner() {
3337
- return normalizeAddon(this.outputOptions.banner);
3338
- }
3339
- get footer() {
3340
- return normalizeAddon(this.outputOptions.footer);
3341
- }
3342
- get intro() {
3343
- return normalizeAddon(this.outputOptions.intro);
3344
- }
3345
- get outro() {
3346
- return normalizeAddon(this.outputOptions.outro);
3347
- }
3348
- get esModule() {
3349
- return this.inner.esModule;
3350
- }
3351
- get extend() {
3352
- return this.inner.extend;
3353
- }
3354
- get globals() {
3355
- return this.inner.globals || this.outputOptions.globals;
3356
- }
3357
- get hashCharacters() {
3358
- return this.inner.hashCharacters;
3359
- }
3360
- get sourcemapDebugIds() {
3361
- return this.inner.sourcemapDebugIds;
3362
- }
3363
- get sourcemapIgnoreList() {
3364
- return bindingifySourcemapIgnoreList(this.outputOptions.sourcemapIgnoreList);
3365
- }
3366
- get sourcemapPathTransform() {
3367
- return this.outputOptions.sourcemapPathTransform;
3368
- }
3369
- get minify() {
3370
- return this.inner.minify;
3371
- }
3372
- get legalComments() {
3373
- return this.inner.legalComments;
3374
- }
3375
- get polyfillRequire() {
3376
- return this.inner.polyfillRequire;
3377
- }
3378
- get plugins() {
3379
- return this.normalizedOutputPlugins;
3380
- }
3381
- get preserveModules() {
3382
- return this.inner.preserveModules;
3383
- }
3384
- get preserveModulesRoot() {
3385
- return this.inner.preserveModulesRoot;
3386
- }
3387
- get virtualDirname() {
3388
- return this.inner.virtualDirname;
3389
- }
3390
- };
3391
- } });
3392
3288
 
3393
3289
  //#endregion
3394
3290
  //#region src/utils/transform-to-rollup-output.ts
@@ -3546,12 +3442,6 @@ function collectChangedBundle(changed, bundle) {
3546
3442
  deleted: Array.from(changed.deleted)
3547
3443
  };
3548
3444
  }
3549
- var init_transform_to_rollup_output = __esm({ "src/utils/transform-to-rollup-output.ts"() {
3550
- init_sourcemap();
3551
- init_asset_source();
3552
- init_error();
3553
- init_transform_rendered_chunk();
3554
- } });
3555
3445
 
3556
3446
  //#endregion
3557
3447
  //#region src/plugin/bindingify-output-hooks.ts
@@ -3703,18 +3593,6 @@ function bindingifyOutro(args$1) {
3703
3593
  meta: bindingifyPluginHookMeta(meta)
3704
3594
  };
3705
3595
  }
3706
- var init_bindingify_output_hooks = __esm({ "src/plugin/bindingify-output-hooks.ts"() {
3707
- init_normalized_input_options();
3708
- init_normalized_output_options();
3709
- init_sourcemap();
3710
- init_error();
3711
- init_normalize_hook();
3712
- init_transform_rendered_chunk();
3713
- init_transform_to_rollup_output();
3714
- init_bindingify_hook_filter();
3715
- init_bindingify_plugin_hook_meta();
3716
- init_plugin_context();
3717
- } });
3718
3596
 
3719
3597
  //#endregion
3720
3598
  //#region src/plugin/bindingify-watch-hooks.ts
@@ -3740,14 +3618,43 @@ function bindingifyCloseWatcher(args$1) {
3740
3618
  meta: bindingifyPluginHookMeta(meta)
3741
3619
  };
3742
3620
  }
3743
- var init_bindingify_watch_hooks = __esm({ "src/plugin/bindingify-watch-hooks.ts"() {
3744
- init_normalize_hook();
3745
- init_bindingify_plugin_hook_meta();
3746
- init_plugin_context();
3747
- } });
3748
3621
 
3749
3622
  //#endregion
3750
3623
  //#region src/plugin/generated/hook-usage.ts
3624
+ let HookUsageKind = /* @__PURE__ */ function(HookUsageKind$1) {
3625
+ HookUsageKind$1[HookUsageKind$1["buildStart"] = 1] = "buildStart";
3626
+ HookUsageKind$1[HookUsageKind$1["resolveId"] = 2] = "resolveId";
3627
+ HookUsageKind$1[HookUsageKind$1["resolveDynamicImport"] = 4] = "resolveDynamicImport";
3628
+ HookUsageKind$1[HookUsageKind$1["load"] = 8] = "load";
3629
+ HookUsageKind$1[HookUsageKind$1["transform"] = 16] = "transform";
3630
+ HookUsageKind$1[HookUsageKind$1["moduleParsed"] = 32] = "moduleParsed";
3631
+ HookUsageKind$1[HookUsageKind$1["buildEnd"] = 64] = "buildEnd";
3632
+ HookUsageKind$1[HookUsageKind$1["renderStart"] = 128] = "renderStart";
3633
+ HookUsageKind$1[HookUsageKind$1["renderError"] = 256] = "renderError";
3634
+ HookUsageKind$1[HookUsageKind$1["renderChunk"] = 512] = "renderChunk";
3635
+ HookUsageKind$1[HookUsageKind$1["augmentChunkHash"] = 1024] = "augmentChunkHash";
3636
+ HookUsageKind$1[HookUsageKind$1["generateBundle"] = 2048] = "generateBundle";
3637
+ HookUsageKind$1[HookUsageKind$1["writeBundle"] = 4096] = "writeBundle";
3638
+ HookUsageKind$1[HookUsageKind$1["closeBundle"] = 8192] = "closeBundle";
3639
+ HookUsageKind$1[HookUsageKind$1["watchChange"] = 16384] = "watchChange";
3640
+ HookUsageKind$1[HookUsageKind$1["closeWatcher"] = 32768] = "closeWatcher";
3641
+ HookUsageKind$1[HookUsageKind$1["transformAst"] = 65536] = "transformAst";
3642
+ HookUsageKind$1[HookUsageKind$1["banner"] = 131072] = "banner";
3643
+ HookUsageKind$1[HookUsageKind$1["footer"] = 262144] = "footer";
3644
+ HookUsageKind$1[HookUsageKind$1["intro"] = 524288] = "intro";
3645
+ HookUsageKind$1[HookUsageKind$1["outro"] = 1048576] = "outro";
3646
+ return HookUsageKind$1;
3647
+ }({});
3648
+ var HookUsage = class {
3649
+ bitflag = BigInt(0);
3650
+ constructor() {}
3651
+ union(kind) {
3652
+ this.bitflag |= BigInt(kind);
3653
+ }
3654
+ inner() {
3655
+ return Number(this.bitflag);
3656
+ }
3657
+ };
3751
3658
  function extractHookUsage(plugin) {
3752
3659
  let hookUsage = new HookUsage();
3753
3660
  if (plugin.buildStart) hookUsage.union(HookUsageKind.buildStart);
@@ -3772,43 +3679,6 @@ function extractHookUsage(plugin) {
3772
3679
  if (plugin.outro) hookUsage.union(HookUsageKind.outro);
3773
3680
  return hookUsage;
3774
3681
  }
3775
- var HookUsageKind, HookUsage;
3776
- var init_hook_usage = __esm({ "src/plugin/generated/hook-usage.ts"() {
3777
- HookUsageKind = /* @__PURE__ */ function(HookUsageKind$1) {
3778
- HookUsageKind$1[HookUsageKind$1["buildStart"] = 1] = "buildStart";
3779
- HookUsageKind$1[HookUsageKind$1["resolveId"] = 2] = "resolveId";
3780
- HookUsageKind$1[HookUsageKind$1["resolveDynamicImport"] = 4] = "resolveDynamicImport";
3781
- HookUsageKind$1[HookUsageKind$1["load"] = 8] = "load";
3782
- HookUsageKind$1[HookUsageKind$1["transform"] = 16] = "transform";
3783
- HookUsageKind$1[HookUsageKind$1["moduleParsed"] = 32] = "moduleParsed";
3784
- HookUsageKind$1[HookUsageKind$1["buildEnd"] = 64] = "buildEnd";
3785
- HookUsageKind$1[HookUsageKind$1["renderStart"] = 128] = "renderStart";
3786
- HookUsageKind$1[HookUsageKind$1["renderError"] = 256] = "renderError";
3787
- HookUsageKind$1[HookUsageKind$1["renderChunk"] = 512] = "renderChunk";
3788
- HookUsageKind$1[HookUsageKind$1["augmentChunkHash"] = 1024] = "augmentChunkHash";
3789
- HookUsageKind$1[HookUsageKind$1["generateBundle"] = 2048] = "generateBundle";
3790
- HookUsageKind$1[HookUsageKind$1["writeBundle"] = 4096] = "writeBundle";
3791
- HookUsageKind$1[HookUsageKind$1["closeBundle"] = 8192] = "closeBundle";
3792
- HookUsageKind$1[HookUsageKind$1["watchChange"] = 16384] = "watchChange";
3793
- HookUsageKind$1[HookUsageKind$1["closeWatcher"] = 32768] = "closeWatcher";
3794
- HookUsageKind$1[HookUsageKind$1["transformAst"] = 65536] = "transformAst";
3795
- HookUsageKind$1[HookUsageKind$1["banner"] = 131072] = "banner";
3796
- HookUsageKind$1[HookUsageKind$1["footer"] = 262144] = "footer";
3797
- HookUsageKind$1[HookUsageKind$1["intro"] = 524288] = "intro";
3798
- HookUsageKind$1[HookUsageKind$1["outro"] = 1048576] = "outro";
3799
- return HookUsageKind$1;
3800
- }({});
3801
- HookUsage = class {
3802
- bitflag = BigInt(0);
3803
- constructor() {}
3804
- union(kind) {
3805
- this.bitflag |= BigInt(kind);
3806
- }
3807
- inner() {
3808
- return Number(this.bitflag);
3809
- }
3810
- };
3811
- } });
3812
3682
 
3813
3683
  //#endregion
3814
3684
  //#region src/plugin/bindingify-plugin.ts
@@ -3931,106 +3801,95 @@ function wrapHandlers(plugin) {
3931
3801
  }
3932
3802
  return plugin;
3933
3803
  }
3934
- var init_bindingify_plugin = __esm({ "src/plugin/bindingify-plugin.ts"() {
3935
- init_bindingify_build_hooks();
3936
- init_bindingify_output_hooks();
3937
- init_logs();
3938
- init_bindingify_watch_hooks();
3939
- init_hook_usage();
3940
- } });
3941
3804
 
3942
3805
  //#endregion
3943
3806
  //#region src/plugin/plugin-context-data.ts
3944
- var PluginContextData;
3945
- var init_plugin_context_data = __esm({ "src/plugin/plugin-context-data.ts"() {
3946
- init_transform_module_info();
3947
- PluginContextData = class {
3948
- moduleOptionMap = /* @__PURE__ */ new Map();
3949
- resolveOptionsMap = /* @__PURE__ */ new Map();
3950
- loadModulePromiseMap = /* @__PURE__ */ new Map();
3951
- loadModulePromiseResolveFnMap = /* @__PURE__ */ new Map();
3952
- renderedChunkMeta = null;
3953
- updateModuleOption(id$1, option) {
3954
- const existing = this.moduleOptionMap.get(id$1);
3955
- if (existing) {
3956
- if (option.moduleSideEffects != null) existing.moduleSideEffects = option.moduleSideEffects;
3957
- if (option.meta != null) Object.assign(existing.meta, option.meta);
3958
- if (option.invalidate != null) existing.invalidate = option.invalidate;
3959
- } else {
3960
- this.moduleOptionMap.set(id$1, option);
3961
- return option;
3962
- }
3963
- return existing;
3964
- }
3965
- getModuleOption(id$1) {
3966
- const option = this.moduleOptionMap.get(id$1);
3967
- if (!option) {
3968
- const raw = {
3969
- moduleSideEffects: null,
3970
- meta: {}
3971
- };
3972
- this.moduleOptionMap.set(id$1, raw);
3973
- return raw;
3974
- }
3807
+ var PluginContextData = class {
3808
+ moduleOptionMap = /* @__PURE__ */ new Map();
3809
+ resolveOptionsMap = /* @__PURE__ */ new Map();
3810
+ loadModulePromiseMap = /* @__PURE__ */ new Map();
3811
+ loadModulePromiseResolveFnMap = /* @__PURE__ */ new Map();
3812
+ renderedChunkMeta = null;
3813
+ updateModuleOption(id$1, option) {
3814
+ const existing = this.moduleOptionMap.get(id$1);
3815
+ if (existing) {
3816
+ if (option.moduleSideEffects != null) existing.moduleSideEffects = option.moduleSideEffects;
3817
+ if (option.meta != null) Object.assign(existing.meta, option.meta);
3818
+ if (option.invalidate != null) existing.invalidate = option.invalidate;
3819
+ } else {
3820
+ this.moduleOptionMap.set(id$1, option);
3975
3821
  return option;
3976
3822
  }
3977
- getModuleInfo(id$1, context) {
3978
- const bindingInfo = context.getModuleInfo(id$1);
3979
- if (bindingInfo) {
3980
- const info = transformModuleInfo(bindingInfo, this.getModuleOption(id$1));
3981
- return this.proxyModuleInfo(id$1, info);
3982
- }
3983
- return null;
3984
- }
3985
- proxyModuleInfo(id$1, info) {
3986
- let moduleSideEffects = info.moduleSideEffects;
3987
- Object.defineProperty(info, "moduleSideEffects", {
3988
- get() {
3989
- return moduleSideEffects;
3990
- },
3991
- set: (v) => {
3992
- this.updateModuleOption(id$1, {
3993
- moduleSideEffects: v,
3994
- meta: info.meta,
3995
- invalidate: true
3996
- });
3997
- moduleSideEffects = v;
3998
- }
3999
- });
4000
- return info;
4001
- }
4002
- getModuleIds(context) {
4003
- const moduleIds = context.getModuleIds();
4004
- return moduleIds.values();
4005
- }
4006
- saveResolveOptions(options) {
4007
- const index = this.resolveOptionsMap.size;
4008
- this.resolveOptionsMap.set(index, options);
4009
- return index;
4010
- }
4011
- getSavedResolveOptions(receipt) {
4012
- return this.resolveOptionsMap.get(receipt);
4013
- }
4014
- removeSavedResolveOptions(receipt) {
4015
- this.resolveOptionsMap.delete(receipt);
4016
- }
4017
- setRenderChunkMeta(meta) {
4018
- this.renderedChunkMeta = meta;
4019
- }
4020
- getRenderChunkMeta() {
4021
- return this.renderedChunkMeta;
4022
- }
4023
- markModuleLoaded(id$1, _success) {
4024
- const resolve = this.loadModulePromiseResolveFnMap.get(id$1);
4025
- if (resolve) resolve();
3823
+ return existing;
3824
+ }
3825
+ getModuleOption(id$1) {
3826
+ const option = this.moduleOptionMap.get(id$1);
3827
+ if (!option) {
3828
+ const raw = {
3829
+ moduleSideEffects: null,
3830
+ meta: {}
3831
+ };
3832
+ this.moduleOptionMap.set(id$1, raw);
3833
+ return raw;
4026
3834
  }
4027
- clear() {
4028
- this.renderedChunkMeta = null;
4029
- this.loadModulePromiseMap.clear();
4030
- this.loadModulePromiseResolveFnMap.clear();
3835
+ return option;
3836
+ }
3837
+ getModuleInfo(id$1, context) {
3838
+ const bindingInfo = context.getModuleInfo(id$1);
3839
+ if (bindingInfo) {
3840
+ const info = transformModuleInfo(bindingInfo, this.getModuleOption(id$1));
3841
+ return this.proxyModuleInfo(id$1, info);
4031
3842
  }
4032
- };
4033
- } });
3843
+ return null;
3844
+ }
3845
+ proxyModuleInfo(id$1, info) {
3846
+ let moduleSideEffects = info.moduleSideEffects;
3847
+ Object.defineProperty(info, "moduleSideEffects", {
3848
+ get() {
3849
+ return moduleSideEffects;
3850
+ },
3851
+ set: (v) => {
3852
+ this.updateModuleOption(id$1, {
3853
+ moduleSideEffects: v,
3854
+ meta: info.meta,
3855
+ invalidate: true
3856
+ });
3857
+ moduleSideEffects = v;
3858
+ }
3859
+ });
3860
+ return info;
3861
+ }
3862
+ getModuleIds(context) {
3863
+ const moduleIds = context.getModuleIds();
3864
+ return moduleIds.values();
3865
+ }
3866
+ saveResolveOptions(options) {
3867
+ const index = this.resolveOptionsMap.size;
3868
+ this.resolveOptionsMap.set(index, options);
3869
+ return index;
3870
+ }
3871
+ getSavedResolveOptions(receipt) {
3872
+ return this.resolveOptionsMap.get(receipt);
3873
+ }
3874
+ removeSavedResolveOptions(receipt) {
3875
+ this.resolveOptionsMap.delete(receipt);
3876
+ }
3877
+ setRenderChunkMeta(meta) {
3878
+ this.renderedChunkMeta = meta;
3879
+ }
3880
+ getRenderChunkMeta() {
3881
+ return this.renderedChunkMeta;
3882
+ }
3883
+ markModuleLoaded(id$1, _success) {
3884
+ const resolve = this.loadModulePromiseResolveFnMap.get(id$1);
3885
+ if (resolve) resolve();
3886
+ }
3887
+ clear() {
3888
+ this.renderedChunkMeta = null;
3889
+ this.loadModulePromiseMap.clear();
3890
+ this.loadModulePromiseResolveFnMap.clear();
3891
+ }
3892
+ };
4034
3893
 
4035
3894
  //#endregion
4036
3895
  //#region src/utils/normalize-string-or-regex.ts
@@ -4042,7 +3901,6 @@ function normalizedStringOrRegex(pattern) {
4042
3901
  function isReadonlyArray(input) {
4043
3902
  return Array.isArray(input);
4044
3903
  }
4045
- var init_normalize_string_or_regex = __esm({ "src/utils/normalize-string-or-regex.ts"() {} });
4046
3904
 
4047
3905
  //#endregion
4048
3906
  //#region src/utils/bindingify-input-options.ts
@@ -4253,31 +4111,31 @@ function bindingifyPreserveEntrySignatures(preserveEntrySignatures) {
4253
4111
  field0: preserveEntrySignatures
4254
4112
  };
4255
4113
  }
4256
- var init_bindingify_input_options = __esm({ "src/utils/bindingify-input-options.ts"() {
4257
- init_constructors();
4258
- init_utils();
4259
- init_bindingify_plugin();
4260
- init_plugin_context_data();
4261
- init_misc();
4262
- init_normalize_string_or_regex();
4263
- init_transform_side_effects();
4264
- } });
4265
4114
 
4266
4115
  //#endregion
4267
4116
  //#region src/utils/plugin/index.ts
4268
- var isPluginHookName;
4269
- var init_plugin = __esm({ "src/utils/plugin/index.ts"() {
4270
- init_plugin$1();
4271
- isPluginHookName = function() {
4272
- const PLUGIN_HOOK_NAMES_SET = new Set(ENUMERATED_PLUGIN_HOOK_NAMES);
4273
- return function isPluginHookName$1(hookName) {
4274
- return PLUGIN_HOOK_NAMES_SET.has(hookName);
4275
- };
4276
- }();
4277
- } });
4117
+ const isPluginHookName = function() {
4118
+ const PLUGIN_HOOK_NAMES_SET = new Set(ENUMERATED_PLUGIN_HOOK_NAMES);
4119
+ return function isPluginHookName$1(hookName) {
4120
+ return PLUGIN_HOOK_NAMES_SET.has(hookName);
4121
+ };
4122
+ }();
4278
4123
 
4279
4124
  //#endregion
4280
4125
  //#region src/utils/compose-js-plugins.ts
4126
+ const unsupportedHookName = [
4127
+ "augmentChunkHash",
4128
+ "generateBundle",
4129
+ "moduleParsed",
4130
+ "onLog",
4131
+ "options",
4132
+ "outputOptions",
4133
+ "renderError",
4134
+ "renderStart",
4135
+ "resolveDynamicImport",
4136
+ "writeBundle"
4137
+ ];
4138
+ const unsupportedHooks = new Set(unsupportedHookName);
4281
4139
  function isUnsupportedHooks(hookName) {
4282
4140
  return unsupportedHooks.has(hookName);
4283
4141
  }
@@ -4570,28 +4428,6 @@ function composeJsPlugins(plugins) {
4570
4428
  }
4571
4429
  return newPlugins;
4572
4430
  }
4573
- var unsupportedHookName, unsupportedHooks;
4574
- var init_compose_js_plugins = __esm({ "src/utils/compose-js-plugins.ts"() {
4575
- init_dist$1();
4576
- init_constructors();
4577
- init_plugin_context$1();
4578
- init_misc();
4579
- init_normalize_hook();
4580
- init_plugin();
4581
- unsupportedHookName = [
4582
- "augmentChunkHash",
4583
- "generateBundle",
4584
- "moduleParsed",
4585
- "onLog",
4586
- "options",
4587
- "outputOptions",
4588
- "renderError",
4589
- "renderStart",
4590
- "resolveDynamicImport",
4591
- "writeBundle"
4592
- ];
4593
- unsupportedHooks = new Set(unsupportedHookName);
4594
- } });
4595
4431
 
4596
4432
  //#endregion
4597
4433
  //#region src/utils/initialize-parallel-plugins.ts
@@ -4644,19 +4480,16 @@ async function initializeWorker(registryId, pluginInfos, threadNumber) {
4644
4480
  throw e$1;
4645
4481
  }
4646
4482
  }
4647
- var availableParallelism;
4648
- var init_initialize_parallel_plugins = __esm({ "src/utils/initialize-parallel-plugins.ts"() {
4649
- availableParallelism = () => {
4650
- let availableParallelism$1 = 1;
4651
- try {
4652
- availableParallelism$1 = os.availableParallelism();
4653
- } catch {
4654
- const cpus = os.cpus();
4655
- if (Array.isArray(cpus) && cpus.length > 0) availableParallelism$1 = cpus.length;
4656
- }
4657
- return Math.min(availableParallelism$1, 8);
4658
- };
4659
- } });
4483
+ const availableParallelism = () => {
4484
+ let availableParallelism$1 = 1;
4485
+ try {
4486
+ availableParallelism$1 = os.availableParallelism();
4487
+ } catch {
4488
+ const cpus = os.cpus();
4489
+ if (Array.isArray(cpus) && cpus.length > 0) availableParallelism$1 = cpus.length;
4490
+ }
4491
+ return Math.min(availableParallelism$1, 8);
4492
+ };
4660
4493
 
4661
4494
  //#endregion
4662
4495
  //#region src/utils/create-bundler-option.ts
@@ -4692,25 +4525,16 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode, isCl
4692
4525
  throw e$1;
4693
4526
  }
4694
4527
  }
4695
- var init_create_bundler_option = __esm({ "src/utils/create-bundler-option.ts"() {
4696
- init_logger();
4697
- init_logging();
4698
- init_plugin_driver();
4699
- init_bindingify_input_options();
4700
- init_bindingify_output_options();
4701
- init_compose_js_plugins();
4702
- init_initialize_parallel_plugins();
4703
- init_normalize_plugin_option();
4704
- } });
4705
4528
 
4706
4529
  //#endregion
4707
4530
  //#region src/utils/create-bundler.ts
4708
- async function createBundler(inputOptions, outputOptions, isClose) {
4531
+ let asyncRuntimeShutdown = false;
4532
+ async function createBundlerImpl(bundler, inputOptions, outputOptions, isClose) {
4709
4533
  const option = await createBundlerOptions(inputOptions, outputOptions, false, isClose);
4710
4534
  if (asyncRuntimeShutdown) startAsyncRuntime();
4711
4535
  try {
4712
4536
  return {
4713
- bundler: new Bundler(option.bundlerOptions),
4537
+ impl: bundler.createImpl(option.bundlerOptions),
4714
4538
  stopWorkers: option.stopWorkers,
4715
4539
  shutdown: () => {
4716
4540
  shutdownAsyncRuntime();
@@ -4722,11 +4546,6 @@ async function createBundler(inputOptions, outputOptions, isClose) {
4722
4546
  throw e$1;
4723
4547
  }
4724
4548
  }
4725
- var asyncRuntimeShutdown;
4726
- var init_create_bundler = __esm({ "src/utils/create-bundler.ts"() {
4727
- init_create_bundler_option();
4728
- asyncRuntimeShutdown = false;
4729
- } });
4730
4549
 
4731
4550
  //#endregion
4732
4551
  //#region src/utils/transform-hmr-patch-output.ts
@@ -4739,80 +4558,66 @@ function handleHmrPatchOutputErrors(output) {
4739
4558
  const rawErrors = output.errors;
4740
4559
  if (rawErrors.length > 0) throw normalizeErrors(rawErrors);
4741
4560
  }
4742
- var init_transform_hmr_patch_output = __esm({ "src/utils/transform-hmr-patch-output.ts"() {
4743
- init_error();
4744
- } });
4745
4561
 
4746
4562
  //#endregion
4747
4563
  //#region src/api/rolldown/rolldown-build.ts
4748
- var RolldownBuild;
4749
- var init_rolldown_build = __esm({ "src/api/rolldown/rolldown-build.ts"() {
4750
- init_create_bundler();
4751
- init_transform_to_rollup_output();
4752
- init_transform_hmr_patch_output();
4753
- init_validator();
4754
- Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
4755
- RolldownBuild = class {
4756
- #inputOptions;
4757
- #bundler;
4758
- constructor(inputOptions) {
4759
- this.#inputOptions = inputOptions;
4760
- }
4761
- get closed() {
4762
- return this.#bundler?.bundler.closed ?? false;
4763
- }
4764
- async #getBundlerWithStopWorker(outputOptions, isClose) {
4765
- if (this.#bundler) await this.#bundler.stopWorkers?.();
4766
- return this.#bundler = await createBundler(this.#inputOptions, outputOptions, isClose);
4767
- }
4768
- async generate(outputOptions = {}) {
4769
- validateOption("output", outputOptions);
4770
- const { bundler } = await this.#getBundlerWithStopWorker(outputOptions);
4771
- const output = await bundler.generate();
4772
- return transformToRollupOutput(output);
4773
- }
4774
- async write(outputOptions = {}) {
4775
- validateOption("output", outputOptions);
4776
- const { bundler } = await this.#getBundlerWithStopWorker(outputOptions);
4777
- const output = await bundler.write();
4778
- return transformToRollupOutput(output);
4779
- }
4780
- async close() {
4781
- const { bundler, stopWorkers, shutdown } = await this.#getBundlerWithStopWorker({}, true);
4782
- await stopWorkers?.();
4783
- await bundler.close();
4784
- shutdown();
4785
- }
4786
- async [Symbol.asyncDispose]() {
4787
- await this.close();
4788
- }
4789
- async generateHmrPatch(changedFiles) {
4790
- const output = await this.#bundler.bundler.generateHmrPatch(changedFiles);
4791
- return transformHmrPatchOutput(output);
4792
- }
4793
- async hmrInvalidate(file, firstInvalidatedBy) {
4794
- const output = await this.#bundler.bundler.hmrInvalidate(file, firstInvalidatedBy);
4795
- return transformHmrPatchOutput(output);
4796
- }
4797
- get watchFiles() {
4798
- return this.#bundler?.bundler.getWatchFiles() ?? Promise.resolve([]);
4799
- }
4800
- };
4801
- } });
4564
+ Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
4565
+ var RolldownBuild = class {
4566
+ #inputOptions;
4567
+ #bundler;
4568
+ #bundlerImpl;
4569
+ constructor(inputOptions) {
4570
+ this.#inputOptions = inputOptions;
4571
+ this.#bundler = new BindingBundler();
4572
+ }
4573
+ get closed() {
4574
+ return this.#bundlerImpl?.impl.closed ?? false;
4575
+ }
4576
+ async #getBundlerWithStopWorker(outputOptions, isClose) {
4577
+ if (this.#bundlerImpl) await this.#bundlerImpl.stopWorkers?.();
4578
+ return this.#bundlerImpl = await createBundlerImpl(this.#bundler, this.#inputOptions, outputOptions, isClose);
4579
+ }
4580
+ async generate(outputOptions = {}) {
4581
+ validateOption("output", outputOptions);
4582
+ const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
4583
+ const output = await impl.generate();
4584
+ return transformToRollupOutput(output);
4585
+ }
4586
+ async write(outputOptions = {}) {
4587
+ validateOption("output", outputOptions);
4588
+ const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
4589
+ const output = await impl.write();
4590
+ return transformToRollupOutput(output);
4591
+ }
4592
+ async close() {
4593
+ const { impl, stopWorkers, shutdown } = await this.#getBundlerWithStopWorker({}, true);
4594
+ await stopWorkers?.();
4595
+ await impl.close();
4596
+ shutdown();
4597
+ }
4598
+ async [Symbol.asyncDispose]() {
4599
+ await this.close();
4600
+ }
4601
+ async generateHmrPatch(changedFiles) {
4602
+ const output = await this.#bundlerImpl.impl.generateHmrPatch(changedFiles);
4603
+ return transformHmrPatchOutput(output);
4604
+ }
4605
+ async hmrInvalidate(file, firstInvalidatedBy) {
4606
+ const output = await this.#bundlerImpl.impl.hmrInvalidate(file, firstInvalidatedBy);
4607
+ return transformHmrPatchOutput(output);
4608
+ }
4609
+ get watchFiles() {
4610
+ return this.#bundlerImpl?.impl.getWatchFiles() ?? Promise.resolve([]);
4611
+ }
4612
+ };
4802
4613
 
4803
4614
  //#endregion
4804
4615
  //#region src/api/rolldown/index.ts
4805
- var rolldown;
4806
- var init_rolldown = __esm({ "src/api/rolldown/index.ts"() {
4807
- init_plugin_driver();
4808
- init_validator();
4809
- init_rolldown_build();
4810
- rolldown = async (input) => {
4811
- validateOption("input", input);
4812
- const inputOptions = await PluginDriver.callOptionsHook(input);
4813
- return new RolldownBuild(inputOptions);
4814
- };
4815
- } });
4616
+ const rolldown = async (input) => {
4617
+ validateOption("input", input);
4618
+ const inputOptions = await PluginDriver.callOptionsHook(input);
4619
+ return new RolldownBuild(inputOptions);
4620
+ };
4816
4621
 
4817
4622
  //#endregion
4818
4623
  //#region src/api/build.ts
@@ -4829,86 +4634,106 @@ async function build(options) {
4829
4634
  }
4830
4635
  }
4831
4636
  }
4832
- var init_build = __esm({ "src/api/build.ts"() {
4833
- init_rolldown();
4834
- } });
4835
4637
 
4836
4638
  //#endregion
4837
4639
  //#region src/api/watch/watch-emitter.ts
4838
- var WatcherEmitter;
4839
- var init_watch_emitter = __esm({ "src/api/watch/watch-emitter.ts"() {
4840
- init_error();
4841
- WatcherEmitter = class {
4842
- listeners = /* @__PURE__ */ new Map();
4843
- timer;
4844
- constructor() {
4845
- this.timer = setInterval(() => {}, 1e9);
4846
- }
4847
- on(event, listener) {
4848
- const listeners = this.listeners.get(event);
4849
- if (listeners) listeners.push(listener);
4850
- else this.listeners.set(event, [listener]);
4851
- return this;
4852
- }
4853
- off(event, listener) {
4854
- const listeners = this.listeners.get(event);
4855
- if (listeners) {
4856
- const index = listeners.indexOf(listener);
4857
- if (index !== -1) listeners.splice(index, 1);
4858
- }
4859
- return this;
4640
+ var WatcherEmitter = class {
4641
+ listeners = /* @__PURE__ */ new Map();
4642
+ timer;
4643
+ constructor() {
4644
+ this.timer = setInterval(() => {}, 1e9);
4645
+ }
4646
+ on(event, listener) {
4647
+ const listeners = this.listeners.get(event);
4648
+ if (listeners) listeners.push(listener);
4649
+ else this.listeners.set(event, [listener]);
4650
+ return this;
4651
+ }
4652
+ off(event, listener) {
4653
+ const listeners = this.listeners.get(event);
4654
+ if (listeners) {
4655
+ const index = listeners.indexOf(listener);
4656
+ if (index !== -1) listeners.splice(index, 1);
4860
4657
  }
4861
- async onEvent(event) {
4862
- const listeners = this.listeners.get(event.eventKind());
4863
- if (listeners) switch (event.eventKind()) {
4864
- case "close":
4865
- case "restart":
4866
- for (const listener of listeners) await listener();
4867
- break;
4868
- case "event":
4869
- for (const listener of listeners) {
4870
- const code$1 = event.bundleEventKind();
4871
- switch (code$1) {
4872
- case "BUNDLE_END":
4873
- const { duration, output, result } = event.bundleEndData();
4874
- await listener({
4875
- code: "BUNDLE_END",
4876
- duration,
4877
- output: [output],
4878
- result
4879
- });
4880
- break;
4881
- case "ERROR":
4882
- const data = event.bundleErrorData();
4883
- await listener({
4884
- code: "ERROR",
4885
- error: normalizeErrors(data.error),
4886
- result: data.result
4887
- });
4888
- break;
4889
- default:
4890
- await listener({ code: code$1 });
4891
- break;
4892
- }
4893
- }
4894
- break;
4895
- case "change":
4896
- for (const listener of listeners) {
4897
- const { path: path$1, kind } = event.watchChangeData();
4898
- await listener(path$1, { event: kind });
4658
+ return this;
4659
+ }
4660
+ async onEvent(event) {
4661
+ const listeners = this.listeners.get(event.eventKind());
4662
+ if (listeners) switch (event.eventKind()) {
4663
+ case "close":
4664
+ case "restart":
4665
+ for (const listener of listeners) await listener();
4666
+ break;
4667
+ case "event":
4668
+ for (const listener of listeners) {
4669
+ const code$1 = event.bundleEventKind();
4670
+ switch (code$1) {
4671
+ case "BUNDLE_END":
4672
+ const { duration, output, result } = event.bundleEndData();
4673
+ await listener({
4674
+ code: "BUNDLE_END",
4675
+ duration,
4676
+ output: [output],
4677
+ result
4678
+ });
4679
+ break;
4680
+ case "ERROR":
4681
+ const data = event.bundleErrorData();
4682
+ await listener({
4683
+ code: "ERROR",
4684
+ error: normalizeErrors(data.error),
4685
+ result: data.result
4686
+ });
4687
+ break;
4688
+ default:
4689
+ await listener({ code: code$1 });
4690
+ break;
4899
4691
  }
4900
- break;
4901
- default: throw new Error(`Unknown event: ${event}`);
4902
- }
4903
- }
4904
- async close() {
4905
- clearInterval(this.timer);
4692
+ }
4693
+ break;
4694
+ case "change":
4695
+ for (const listener of listeners) {
4696
+ const { path: path$1, kind } = event.watchChangeData();
4697
+ await listener(path$1, { event: kind });
4698
+ }
4699
+ break;
4700
+ default: throw new Error(`Unknown event: ${event}`);
4906
4701
  }
4907
- };
4908
- } });
4702
+ }
4703
+ async close() {
4704
+ clearInterval(this.timer);
4705
+ }
4706
+ };
4909
4707
 
4910
4708
  //#endregion
4911
4709
  //#region src/api/watch/watcher.ts
4710
+ var Watcher = class {
4711
+ closed;
4712
+ inner;
4713
+ emitter;
4714
+ stopWorkers;
4715
+ constructor(emitter, inner, stopWorkers) {
4716
+ this.closed = false;
4717
+ this.inner = inner;
4718
+ this.emitter = emitter;
4719
+ const originClose = emitter.close.bind(emitter);
4720
+ emitter.close = async () => {
4721
+ await this.close();
4722
+ originClose();
4723
+ };
4724
+ this.stopWorkers = stopWorkers;
4725
+ }
4726
+ async close() {
4727
+ if (this.closed) return;
4728
+ this.closed = true;
4729
+ for (const stop of this.stopWorkers) await stop?.();
4730
+ await this.inner.close();
4731
+ shutdownAsyncRuntime();
4732
+ }
4733
+ start() {
4734
+ process.nextTick(() => this.inner.start(this.emitter.onEvent.bind(this.emitter)));
4735
+ }
4736
+ };
4912
4737
  async function createWatcher(emitter, input) {
4913
4738
  const options = arraify(input);
4914
4739
  const bundlerOptions = await Promise.all(options.map((option) => arraify(option.output || {}).map(async (output) => {
@@ -4930,72 +4755,24 @@ function getValidNotifyOption(bundlerOptions) {
4930
4755
  } else result = notifyOption;
4931
4756
  }
4932
4757
  }
4933
- var Watcher;
4934
- var init_watcher = __esm({ "src/api/watch/watcher.ts"() {
4935
- init_logging();
4936
- init_logs();
4937
- init_plugin_driver();
4938
- init_create_bundler_option();
4939
- init_misc();
4940
- Watcher = class {
4941
- closed;
4942
- inner;
4943
- emitter;
4944
- stopWorkers;
4945
- constructor(emitter, inner, stopWorkers) {
4946
- this.closed = false;
4947
- this.inner = inner;
4948
- this.emitter = emitter;
4949
- const originClose = emitter.close.bind(emitter);
4950
- emitter.close = async () => {
4951
- await this.close();
4952
- originClose();
4953
- };
4954
- this.stopWorkers = stopWorkers;
4955
- }
4956
- async close() {
4957
- if (this.closed) return;
4958
- this.closed = true;
4959
- for (const stop of this.stopWorkers) await stop?.();
4960
- await this.inner.close();
4961
- shutdownAsyncRuntime();
4962
- }
4963
- start() {
4964
- process.nextTick(() => this.inner.start(this.emitter.onEvent.bind(this.emitter)));
4965
- }
4966
- };
4967
- } });
4968
4758
 
4969
4759
  //#endregion
4970
4760
  //#region src/api/watch/index.ts
4971
- var watch;
4972
- var init_watch = __esm({ "src/api/watch/index.ts"() {
4973
- init_watch_emitter();
4974
- init_watcher();
4975
- watch = (input) => {
4976
- const emitter = new WatcherEmitter();
4977
- createWatcher(emitter, input);
4978
- return emitter;
4979
- };
4980
- } });
4761
+ const watch = (input) => {
4762
+ const emitter = new WatcherEmitter();
4763
+ createWatcher(emitter, input);
4764
+ return emitter;
4765
+ };
4981
4766
 
4982
4767
  //#endregion
4983
4768
  //#region src/utils/define-config.ts
4984
4769
  function defineConfig(config) {
4985
4770
  return config;
4986
4771
  }
4987
- var init_define_config = __esm({ "src/utils/define-config.ts"() {} });
4988
4772
 
4989
4773
  //#endregion
4990
4774
  //#region src/index.ts
4991
- var VERSION;
4992
- var init_src = __esm({ "src/index.ts"() {
4993
- init_build();
4994
- init_rolldown();
4995
- init_watch();
4996
- init_define_config();
4997
- VERSION = version;
4998
- } });
4775
+ const VERSION = version;
4999
4776
 
5000
4777
  //#endregion
5001
- export { BuiltinPlugin, PluginContextData, PluginDriver, VERSION, ansis_default, assetPlugin, bindingifyPlugin, build, buildImportAnalysisPlugin, composeJsPlugins, createBundler, defineConfig, description$1 as description, dynamicImportVarsPlugin, getInputCliKeys, getJsonSchema, getOutputCliKeys, handleOutputErrors, importGlobPlugin, init_ansis, init_bindingify_plugin, init_compose_js_plugins, init_constructors, init_create_bundler, init_define_config, init_normalize_string_or_regex, init_plugin_context_data, init_plugin_driver, init_rolldown, init_src, init_transform_to_rollup_output, init_validator, init_watch, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, reporterPlugin, rolldown, validateCliOptions, version, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch, webWorkerPostPlugin };
4778
+ export { BuiltinPlugin, PluginContextData, PluginDriver, VERSION, __commonJS, __toESM, ansis_default, assetPlugin, bindingifyPlugin, build, buildImportAnalysisPlugin, composeJsPlugins, createBundlerImpl, defineConfig, description$1 as description, dynamicImportVarsPlugin, getInputCliKeys, getJsonSchema, getOutputCliKeys, handleOutputErrors, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, reporterPlugin, rolldown, validateCliOptions, version, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch, webWorkerPostPlugin };