@rolldown/browser 1.0.0-beta.10-commit.2c4c2a8 → 1.0.0-beta.10-commit.bf212da

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 (37) hide show
  1. package/dist/cli.cjs +5 -5
  2. package/dist/cli.mjs +1077 -1036
  3. package/dist/config.cjs +3 -3
  4. package/dist/config.d.mts +2 -2
  5. package/dist/config.mjs +5 -4
  6. package/dist/experimental-index.browser.mjs +1 -1
  7. package/dist/experimental-index.cjs +2 -2
  8. package/dist/experimental-index.d.mts +2 -2
  9. package/dist/experimental-index.mjs +14 -3
  10. package/dist/filter-index.d.mts +2 -2
  11. package/dist/filter-index.mjs +2 -1
  12. package/dist/index.browser.mjs +1 -1
  13. package/dist/index.cjs +2 -2
  14. package/dist/index.d.mts +2 -2
  15. package/dist/index.mjs +4 -3
  16. package/dist/parallel-plugin-worker.cjs +2 -2
  17. package/dist/parallel-plugin-worker.mjs +33 -27
  18. package/dist/parallel-plugin.d.mts +2 -2
  19. package/dist/parse-ast-index.cjs +1 -1
  20. package/dist/parse-ast-index.d.mts +1 -1
  21. package/dist/parse-ast-index.mjs +2 -1
  22. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  23. package/dist/shared/chunk-DSsiIF1Z.mjs +30 -0
  24. package/dist/shared/{define-config-cqCLLLZ-.d.mts → define-config-BIXBk1MV.d.mts} +1 -1
  25. package/dist/shared/dist-DeDsdiza.mjs +153 -0
  26. package/dist/shared/{load-config-CYWG5VGh.mjs → load-config--2oCCJCi.mjs} +19 -14
  27. package/dist/shared/{load-config-CZJl5O5j.cjs → load-config-CrWUKkBw.cjs} +1 -1
  28. package/dist/shared/{parse-ast-index-C31FpvkE.mjs → parse-ast-index-B3Tue26H.mjs} +28 -10
  29. package/dist/shared/{parse-ast-index-BuelS_NF.cjs → parse-ast-index-DL8_b_QU.cjs} +1 -1
  30. package/dist/shared/prompt-jPdbaKAj.mjs +854 -0
  31. package/dist/shared/{src-DjLBYDtp.mjs → src-_MeBFVb3.mjs} +1422 -1132
  32. package/dist/shared/{src-BuLkcy4X.cjs → src-heZFfrWc.cjs} +86 -16
  33. package/dist/{src-C1J_jnOM.js → src-DOq2164b.js} +6 -6
  34. package/package.json +1 -1
  35. package/dist/shared/dist-BoWaIc-K.mjs +0 -147
  36. package/dist/shared/prompt-C3zHEaSG.mjs +0 -852
  37. /package/dist/shared/{binding-Dod8fhx9.d.mts → binding-CHPrEDXp.d.mts} +0 -0
@@ -1,39 +1,14 @@
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-C31FpvkE.mjs";
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-B3Tue26H.mjs";
3
4
  import { BindingCallableBuiltinPlugin, BindingHookSideEffects, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingWatcher, Bundler, ParallelJsPluginRegistry, shutdownAsyncRuntime, startAsyncRuntime } from "../rolldown-binding.wasi.cjs";
4
5
  import path from "node:path";
5
6
  import { fileURLToPath } from "node:url";
6
7
  import os from "node:os";
7
8
  import { Worker } from "node:worker_threads";
8
9
 
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
35
10
  //#region package.json
36
- var version = "1.0.0-beta.10-commit.2c4c2a8";
11
+ var version = "1.0.0-beta.10-commit.bf212da";
37
12
  var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
38
13
 
39
14
  //#endregion
@@ -52,15 +27,10 @@ function bindingifyBuiltInPlugin(plugin) {
52
27
  options: plugin._options
53
28
  };
54
29
  }
30
+ var init_utils = __esm({ "src/builtin-plugin/utils.ts"() {} });
55
31
 
56
32
  //#endregion
57
33
  //#region src/builtin-plugin/constructors.ts
58
- var BuiltinPlugin = class {
59
- constructor(name, _options) {
60
- this.name = name;
61
- this._options = _options;
62
- }
63
- };
64
34
  function modulePreloadPolyfillPlugin() {
65
35
  return new BuiltinPlugin("builtin:module-preload-polyfill");
66
36
  }
@@ -128,24 +98,36 @@ function webWorkerPostPlugin() {
128
98
  function oxcRuntimePlugin(config) {
129
99
  return new BuiltinPlugin("builtin:oxc-runtime", config);
130
100
  }
101
+ var BuiltinPlugin;
102
+ var init_constructors = __esm({ "src/builtin-plugin/constructors.ts"() {
103
+ init_utils();
104
+ BuiltinPlugin = class {
105
+ constructor(name, _options) {
106
+ this.name = name;
107
+ this._options = _options;
108
+ }
109
+ };
110
+ } });
131
111
 
132
112
  //#endregion
133
113
  //#region src/log/logging.ts
134
- const LOG_LEVEL_SILENT = "silent";
135
- const LOG_LEVEL_ERROR = "error";
136
- const LOG_LEVEL_WARN = "warn";
137
- const LOG_LEVEL_INFO = "info";
138
- const LOG_LEVEL_DEBUG = "debug";
139
- const logLevelPriority = {
140
- [LOG_LEVEL_DEBUG]: 0,
141
- [LOG_LEVEL_INFO]: 1,
142
- [LOG_LEVEL_WARN]: 2,
143
- [LOG_LEVEL_SILENT]: 3
144
- };
114
+ var LOG_LEVEL_SILENT, LOG_LEVEL_ERROR, LOG_LEVEL_WARN, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, logLevelPriority;
115
+ var init_logging = __esm({ "src/log/logging.ts"() {
116
+ LOG_LEVEL_SILENT = "silent";
117
+ LOG_LEVEL_ERROR = "error";
118
+ LOG_LEVEL_WARN = "warn";
119
+ LOG_LEVEL_INFO = "info";
120
+ LOG_LEVEL_DEBUG = "debug";
121
+ logLevelPriority = {
122
+ [LOG_LEVEL_DEBUG]: 0,
123
+ [LOG_LEVEL_INFO]: 1,
124
+ [LOG_LEVEL_WARN]: 2,
125
+ [LOG_LEVEL_SILENT]: 3
126
+ };
127
+ } });
145
128
 
146
129
  //#endregion
147
130
  //#region src/log/log-handler.ts
148
- const normalizeLog = (log) => typeof log === "string" ? { message: log } : typeof log === "function" ? normalizeLog(log()) : log;
149
131
  function getLogHandler(level, code$1, logger, pluginName, logLevel) {
150
132
  if (logLevelPriority[level] < logLevelPriority[logLevel]) return noop;
151
133
  return (log, pos) => {
@@ -157,6 +139,13 @@ function getLogHandler(level, code$1, logger, pluginName, logLevel) {
157
139
  logger(level, log);
158
140
  };
159
141
  }
142
+ var normalizeLog;
143
+ var init_log_handler = __esm({ "src/log/log-handler.ts"() {
144
+ init_misc();
145
+ init_logging();
146
+ init_logs();
147
+ normalizeLog = (log) => typeof log === "string" ? { message: log } : typeof log === "function" ? normalizeLog(log()) : log;
148
+ } });
160
149
 
161
150
  //#endregion
162
151
  //#region src/log/logger.ts
@@ -192,47 +181,55 @@ function getLogger(plugins, onLog, logLevel, watchMode) {
192
181
  };
193
182
  return logger;
194
183
  }
195
- const getOnLog = (config, logLevel, printLog = defaultPrintLog) => {
196
- const { onwarn, onLog } = config;
197
- const defaultOnLog = getDefaultOnLog(printLog, onwarn);
198
- if (onLog) {
199
- const minimalPriority = logLevelPriority[logLevel];
200
- return (level, log) => onLog(level, addLogToString(log), (level$1, handledLog) => {
201
- if (level$1 === LOG_LEVEL_ERROR) return error(normalizeLog(handledLog));
202
- if (logLevelPriority[level$1] >= minimalPriority) defaultOnLog(level$1, normalizeLog(handledLog));
203
- });
204
- }
205
- return defaultOnLog;
206
- };
207
- const getDefaultOnLog = (printLog, onwarn) => onwarn ? (level, log) => {
208
- if (level === LOG_LEVEL_WARN) onwarn(addLogToString(log), (warning) => printLog(LOG_LEVEL_WARN, normalizeLog(warning)));
209
- else printLog(level, log);
210
- } : printLog;
211
- const addLogToString = (log) => {
212
- Object.defineProperty(log, "toString", {
213
- value: () => getExtendedLogMessage(log),
214
- writable: true
215
- });
216
- return log;
217
- };
218
- const defaultPrintLog = (level, log) => {
219
- const message = getExtendedLogMessage(log);
220
- switch (level) {
221
- case LOG_LEVEL_WARN: return console.warn(message);
222
- case LOG_LEVEL_DEBUG: return console.debug(message);
223
- default: return console.info(message);
224
- }
225
- };
226
- const getExtendedLogMessage = (log) => {
227
- let prefix = "";
228
- if (log.plugin) prefix += `(${log.plugin} plugin) `;
229
- if (log.loc) prefix += `${relativeId(log.loc.file)} (${log.loc.line}:${log.loc.column}) `;
230
- return prefix + log.message;
231
- };
232
184
  function relativeId(id$1) {
233
185
  if (!path.isAbsolute(id$1)) return id$1;
234
186
  return path.relative(path.resolve(), id$1);
235
187
  }
188
+ var getOnLog, getDefaultOnLog, addLogToString, defaultPrintLog, getExtendedLogMessage;
189
+ var init_logger = __esm({ "src/log/logger.ts"() {
190
+ init_src();
191
+ init_plugin_driver();
192
+ init_log_handler();
193
+ init_logging();
194
+ init_logs();
195
+ getOnLog = (config, logLevel, printLog = defaultPrintLog) => {
196
+ const { onwarn, onLog } = config;
197
+ const defaultOnLog = getDefaultOnLog(printLog, onwarn);
198
+ if (onLog) {
199
+ const minimalPriority = logLevelPriority[logLevel];
200
+ return (level, log) => onLog(level, addLogToString(log), (level$1, handledLog) => {
201
+ if (level$1 === LOG_LEVEL_ERROR) return error(normalizeLog(handledLog));
202
+ if (logLevelPriority[level$1] >= minimalPriority) defaultOnLog(level$1, normalizeLog(handledLog));
203
+ });
204
+ }
205
+ return defaultOnLog;
206
+ };
207
+ getDefaultOnLog = (printLog, onwarn) => onwarn ? (level, log) => {
208
+ if (level === LOG_LEVEL_WARN) onwarn(addLogToString(log), (warning) => printLog(LOG_LEVEL_WARN, normalizeLog(warning)));
209
+ else printLog(level, log);
210
+ } : printLog;
211
+ addLogToString = (log) => {
212
+ Object.defineProperty(log, "toString", {
213
+ value: () => getExtendedLogMessage(log),
214
+ writable: true
215
+ });
216
+ return log;
217
+ };
218
+ defaultPrintLog = (level, log) => {
219
+ const message = getExtendedLogMessage(log);
220
+ switch (level) {
221
+ case LOG_LEVEL_WARN: return console.warn(message);
222
+ case LOG_LEVEL_DEBUG: return console.debug(message);
223
+ default: return console.info(message);
224
+ }
225
+ };
226
+ getExtendedLogMessage = (log) => {
227
+ let prefix = "";
228
+ if (log.plugin) prefix += `(${log.plugin} plugin) `;
229
+ if (log.loc) prefix += `${relativeId(log.loc.file)} (${log.loc.line}:${log.loc.column}) `;
230
+ return prefix + log.message;
231
+ };
232
+ } });
236
233
 
237
234
  //#endregion
238
235
  //#region src/utils/normalize-hook.ts
@@ -252,75 +249,71 @@ function normalizeHook(hook) {
252
249
  }
253
250
  unreachable("Invalid hook type");
254
251
  }
252
+ var init_normalize_hook = __esm({ "src/utils/normalize-hook.ts"() {
253
+ init_misc();
254
+ } });
255
255
 
256
256
  //#endregion
257
257
  //#region src/constants/plugin.ts
258
- const ENUMERATED_INPUT_PLUGIN_HOOK_NAMES = [
259
- "options",
260
- "buildStart",
261
- "resolveId",
262
- "load",
263
- "transform",
264
- "moduleParsed",
265
- "buildEnd",
266
- "onLog",
267
- "resolveDynamicImport",
268
- "closeBundle",
269
- "closeWatcher",
270
- "watchChange"
271
- ];
272
- const ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES = [
273
- "augmentChunkHash",
274
- "outputOptions",
275
- "renderChunk",
276
- "renderStart",
277
- "renderError",
278
- "writeBundle",
279
- "generateBundle"
280
- ];
281
- const ENUMERATED_PLUGIN_HOOK_NAMES = [
282
- ...ENUMERATED_INPUT_PLUGIN_HOOK_NAMES,
283
- ...ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES,
284
- "footer",
285
- "banner",
286
- "intro",
287
- "outro"
288
- ];
289
- /**
290
- * Names of all defined hooks. It's like
291
- * ```js
292
- * const DEFINED_HOOK_NAMES ={
293
- * options: 'options',
294
- * buildStart: 'buildStart',
295
- * ...
296
- * }
297
- * ```
298
- */
299
- const DEFINED_HOOK_NAMES = {
300
- [ENUMERATED_PLUGIN_HOOK_NAMES[0]]: ENUMERATED_PLUGIN_HOOK_NAMES[0],
301
- [ENUMERATED_PLUGIN_HOOK_NAMES[1]]: ENUMERATED_PLUGIN_HOOK_NAMES[1],
302
- [ENUMERATED_PLUGIN_HOOK_NAMES[2]]: ENUMERATED_PLUGIN_HOOK_NAMES[2],
303
- [ENUMERATED_PLUGIN_HOOK_NAMES[3]]: ENUMERATED_PLUGIN_HOOK_NAMES[3],
304
- [ENUMERATED_PLUGIN_HOOK_NAMES[4]]: ENUMERATED_PLUGIN_HOOK_NAMES[4],
305
- [ENUMERATED_PLUGIN_HOOK_NAMES[5]]: ENUMERATED_PLUGIN_HOOK_NAMES[5],
306
- [ENUMERATED_PLUGIN_HOOK_NAMES[6]]: ENUMERATED_PLUGIN_HOOK_NAMES[6],
307
- [ENUMERATED_PLUGIN_HOOK_NAMES[7]]: ENUMERATED_PLUGIN_HOOK_NAMES[7],
308
- [ENUMERATED_PLUGIN_HOOK_NAMES[8]]: ENUMERATED_PLUGIN_HOOK_NAMES[8],
309
- [ENUMERATED_PLUGIN_HOOK_NAMES[9]]: ENUMERATED_PLUGIN_HOOK_NAMES[9],
310
- [ENUMERATED_PLUGIN_HOOK_NAMES[10]]: ENUMERATED_PLUGIN_HOOK_NAMES[10],
311
- [ENUMERATED_PLUGIN_HOOK_NAMES[11]]: ENUMERATED_PLUGIN_HOOK_NAMES[11],
312
- [ENUMERATED_PLUGIN_HOOK_NAMES[12]]: ENUMERATED_PLUGIN_HOOK_NAMES[12],
313
- [ENUMERATED_PLUGIN_HOOK_NAMES[13]]: ENUMERATED_PLUGIN_HOOK_NAMES[13],
314
- [ENUMERATED_PLUGIN_HOOK_NAMES[14]]: ENUMERATED_PLUGIN_HOOK_NAMES[14],
315
- [ENUMERATED_PLUGIN_HOOK_NAMES[15]]: ENUMERATED_PLUGIN_HOOK_NAMES[15],
316
- [ENUMERATED_PLUGIN_HOOK_NAMES[16]]: ENUMERATED_PLUGIN_HOOK_NAMES[16],
317
- [ENUMERATED_PLUGIN_HOOK_NAMES[17]]: ENUMERATED_PLUGIN_HOOK_NAMES[17],
318
- [ENUMERATED_PLUGIN_HOOK_NAMES[18]]: ENUMERATED_PLUGIN_HOOK_NAMES[18],
319
- [ENUMERATED_PLUGIN_HOOK_NAMES[19]]: ENUMERATED_PLUGIN_HOOK_NAMES[19],
320
- [ENUMERATED_PLUGIN_HOOK_NAMES[20]]: ENUMERATED_PLUGIN_HOOK_NAMES[20],
321
- [ENUMERATED_PLUGIN_HOOK_NAMES[21]]: ENUMERATED_PLUGIN_HOOK_NAMES[21],
322
- [ENUMERATED_PLUGIN_HOOK_NAMES[22]]: ENUMERATED_PLUGIN_HOOK_NAMES[22]
323
- };
258
+ var ENUMERATED_INPUT_PLUGIN_HOOK_NAMES, ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES, ENUMERATED_PLUGIN_HOOK_NAMES, DEFINED_HOOK_NAMES;
259
+ var init_plugin$1 = __esm({ "src/constants/plugin.ts"() {
260
+ 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
+ ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES = [
275
+ "augmentChunkHash",
276
+ "outputOptions",
277
+ "renderChunk",
278
+ "renderStart",
279
+ "renderError",
280
+ "writeBundle",
281
+ "generateBundle"
282
+ ];
283
+ 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
+ DEFINED_HOOK_NAMES = {
292
+ [ENUMERATED_PLUGIN_HOOK_NAMES[0]]: ENUMERATED_PLUGIN_HOOK_NAMES[0],
293
+ [ENUMERATED_PLUGIN_HOOK_NAMES[1]]: ENUMERATED_PLUGIN_HOOK_NAMES[1],
294
+ [ENUMERATED_PLUGIN_HOOK_NAMES[2]]: ENUMERATED_PLUGIN_HOOK_NAMES[2],
295
+ [ENUMERATED_PLUGIN_HOOK_NAMES[3]]: ENUMERATED_PLUGIN_HOOK_NAMES[3],
296
+ [ENUMERATED_PLUGIN_HOOK_NAMES[4]]: ENUMERATED_PLUGIN_HOOK_NAMES[4],
297
+ [ENUMERATED_PLUGIN_HOOK_NAMES[5]]: ENUMERATED_PLUGIN_HOOK_NAMES[5],
298
+ [ENUMERATED_PLUGIN_HOOK_NAMES[6]]: ENUMERATED_PLUGIN_HOOK_NAMES[6],
299
+ [ENUMERATED_PLUGIN_HOOK_NAMES[7]]: ENUMERATED_PLUGIN_HOOK_NAMES[7],
300
+ [ENUMERATED_PLUGIN_HOOK_NAMES[8]]: ENUMERATED_PLUGIN_HOOK_NAMES[8],
301
+ [ENUMERATED_PLUGIN_HOOK_NAMES[9]]: ENUMERATED_PLUGIN_HOOK_NAMES[9],
302
+ [ENUMERATED_PLUGIN_HOOK_NAMES[10]]: ENUMERATED_PLUGIN_HOOK_NAMES[10],
303
+ [ENUMERATED_PLUGIN_HOOK_NAMES[11]]: ENUMERATED_PLUGIN_HOOK_NAMES[11],
304
+ [ENUMERATED_PLUGIN_HOOK_NAMES[12]]: ENUMERATED_PLUGIN_HOOK_NAMES[12],
305
+ [ENUMERATED_PLUGIN_HOOK_NAMES[13]]: ENUMERATED_PLUGIN_HOOK_NAMES[13],
306
+ [ENUMERATED_PLUGIN_HOOK_NAMES[14]]: ENUMERATED_PLUGIN_HOOK_NAMES[14],
307
+ [ENUMERATED_PLUGIN_HOOK_NAMES[15]]: ENUMERATED_PLUGIN_HOOK_NAMES[15],
308
+ [ENUMERATED_PLUGIN_HOOK_NAMES[16]]: ENUMERATED_PLUGIN_HOOK_NAMES[16],
309
+ [ENUMERATED_PLUGIN_HOOK_NAMES[17]]: ENUMERATED_PLUGIN_HOOK_NAMES[17],
310
+ [ENUMERATED_PLUGIN_HOOK_NAMES[18]]: ENUMERATED_PLUGIN_HOOK_NAMES[18],
311
+ [ENUMERATED_PLUGIN_HOOK_NAMES[19]]: ENUMERATED_PLUGIN_HOOK_NAMES[19],
312
+ [ENUMERATED_PLUGIN_HOOK_NAMES[20]]: ENUMERATED_PLUGIN_HOOK_NAMES[20],
313
+ [ENUMERATED_PLUGIN_HOOK_NAMES[21]]: ENUMERATED_PLUGIN_HOOK_NAMES[21],
314
+ [ENUMERATED_PLUGIN_HOOK_NAMES[22]]: ENUMERATED_PLUGIN_HOOK_NAMES[22]
315
+ };
316
+ } });
324
317
 
325
318
  //#endregion
326
319
  //#region src/utils/async-flatten.ts
@@ -330,10 +323,10 @@ async function asyncFlatten(array$1) {
330
323
  while (array$1.some((v) => v?.then));
331
324
  return array$1;
332
325
  }
326
+ var init_async_flatten = __esm({ "src/utils/async-flatten.ts"() {} });
333
327
 
334
328
  //#endregion
335
329
  //#region src/utils/normalize-plugin-option.ts
336
- const normalizePluginOption = async (plugins) => (await asyncFlatten([plugins])).filter(Boolean);
337
330
  function checkOutputPluginOption(plugins, onLog) {
338
331
  for (const plugin of plugins) for (const hook of ENUMERATED_INPUT_PLUGIN_HOOK_NAMES) if (hook in plugin) {
339
332
  delete plugin[hook];
@@ -349,66 +342,52 @@ function normalizePlugins(plugins, anonymousPrefix) {
349
342
  }
350
343
  return plugins;
351
344
  }
352
- const ANONYMOUS_PLUGIN_PREFIX = "at position ";
353
- const ANONYMOUS_OUTPUT_PLUGIN_PREFIX = "at output position ";
354
- const BUILTIN_PLUGINS = [oxcRuntimePlugin({ resolveBase: fileURLToPath(import.meta.url) })];
345
+ var normalizePluginOption, ANONYMOUS_PLUGIN_PREFIX, ANONYMOUS_OUTPUT_PLUGIN_PREFIX, BUILTIN_PLUGINS;
346
+ var init_normalize_plugin_option = __esm({ "src/utils/normalize-plugin-option.ts"() {
347
+ init_constructors();
348
+ init_plugin$1();
349
+ init_logging();
350
+ init_logs();
351
+ init_async_flatten();
352
+ normalizePluginOption = async (plugins) => (await asyncFlatten([plugins])).filter(Boolean);
353
+ ANONYMOUS_PLUGIN_PREFIX = "at position ";
354
+ ANONYMOUS_OUTPUT_PLUGIN_PREFIX = "at output position ";
355
+ BUILTIN_PLUGINS = [oxcRuntimePlugin({ resolveBase: fileURLToPath(import.meta.url) })];
356
+ } });
355
357
 
356
358
  //#endregion
357
359
  //#region src/plugin/minimal-plugin-context.ts
358
- var MinimalPluginContextImpl = class {
359
- info;
360
- warn;
361
- debug;
362
- meta;
363
- constructor(onLog, logLevel, pluginName, watchMode, hookName) {
364
- this.pluginName = pluginName;
365
- this.hookName = hookName;
366
- this.debug = getLogHandler(LOG_LEVEL_DEBUG, "PLUGIN_LOG", onLog, pluginName, logLevel);
367
- this.info = getLogHandler(LOG_LEVEL_INFO, "PLUGIN_LOG", onLog, pluginName, logLevel);
368
- this.warn = getLogHandler(LOG_LEVEL_WARN, "PLUGIN_WARNING", onLog, pluginName, logLevel);
369
- this.meta = {
370
- rollupVersion: "4.23.0",
371
- rolldownVersion: VERSION,
372
- watchMode
373
- };
374
- }
375
- error(e$1) {
376
- return error(logPluginError(normalizeLog(e$1), this.pluginName, { hook: this.hookName }));
377
- }
378
- };
360
+ var MinimalPluginContextImpl;
361
+ var init_minimal_plugin_context = __esm({ "src/plugin/minimal-plugin-context.ts"() {
362
+ init_src();
363
+ init_log_handler();
364
+ init_logging();
365
+ init_logs();
366
+ MinimalPluginContextImpl = class {
367
+ info;
368
+ warn;
369
+ debug;
370
+ meta;
371
+ constructor(onLog, logLevel, pluginName, watchMode, hookName) {
372
+ this.pluginName = pluginName;
373
+ this.hookName = hookName;
374
+ this.debug = getLogHandler(LOG_LEVEL_DEBUG, "PLUGIN_LOG", onLog, pluginName, logLevel);
375
+ this.info = getLogHandler(LOG_LEVEL_INFO, "PLUGIN_LOG", onLog, pluginName, logLevel);
376
+ this.warn = getLogHandler(LOG_LEVEL_WARN, "PLUGIN_WARNING", onLog, pluginName, logLevel);
377
+ this.meta = {
378
+ rollupVersion: "4.23.0",
379
+ rolldownVersion: VERSION,
380
+ watchMode
381
+ };
382
+ }
383
+ error(e$1) {
384
+ return error(logPluginError(normalizeLog(e$1), this.pluginName, { hook: this.hookName }));
385
+ }
386
+ };
387
+ } });
379
388
 
380
389
  //#endregion
381
390
  //#region src/plugin/plugin-driver.ts
382
- var PluginDriver = class {
383
- static async callOptionsHook(inputOptions, watchMode = false) {
384
- const logLevel = inputOptions.logLevel || LOG_LEVEL_INFO;
385
- const plugins = getSortedPlugins("options", getObjectPlugins(await normalizePluginOption(inputOptions.plugins)));
386
- const logger = getLogger(plugins, getOnLog(inputOptions, logLevel), logLevel, watchMode);
387
- for (const plugin of plugins) {
388
- const name = plugin.name || "unknown";
389
- const options = plugin.options;
390
- if (options) {
391
- const { handler } = normalizeHook(options);
392
- const result = await handler.call(new MinimalPluginContextImpl(logger, logLevel, name, watchMode, "onLog"), inputOptions);
393
- if (result) inputOptions = result;
394
- }
395
- }
396
- return inputOptions;
397
- }
398
- static callOutputOptionsHook(rawPlugins, outputOptions, onLog, logLevel, watchMode) {
399
- const sortedPlugins = getSortedPlugins("outputOptions", getObjectPlugins(rawPlugins));
400
- for (const plugin of sortedPlugins) {
401
- const name = plugin.name || "unknown";
402
- const options = plugin.outputOptions;
403
- if (options) {
404
- const { handler } = normalizeHook(options);
405
- const result = handler.call(new MinimalPluginContextImpl(onLog, logLevel, name, watchMode), outputOptions);
406
- if (result) outputOptions = result;
407
- }
408
- }
409
- return outputOptions;
410
- }
411
- };
412
391
  function getObjectPlugins(plugins) {
413
392
  return plugins.filter((plugin) => {
414
393
  if (!plugin) return void 0;
@@ -443,10 +422,48 @@ function getSortedPlugins(hookName, plugins) {
443
422
  ...post
444
423
  ];
445
424
  }
425
+ var PluginDriver;
426
+ var init_plugin_driver = __esm({ "src/plugin/plugin-driver.ts"() {
427
+ init_constructors();
428
+ init_logger();
429
+ init_logging();
430
+ init_normalize_hook();
431
+ init_normalize_plugin_option();
432
+ init_minimal_plugin_context();
433
+ PluginDriver = class {
434
+ static async callOptionsHook(inputOptions, watchMode = false) {
435
+ const logLevel = inputOptions.logLevel || LOG_LEVEL_INFO;
436
+ const plugins = getSortedPlugins("options", getObjectPlugins(await normalizePluginOption(inputOptions.plugins)));
437
+ const logger = getLogger(plugins, getOnLog(inputOptions, logLevel), logLevel, watchMode);
438
+ for (const plugin of plugins) {
439
+ const name = plugin.name || "unknown";
440
+ const options = plugin.options;
441
+ if (options) {
442
+ const { handler } = normalizeHook(options);
443
+ const result = await handler.call(new MinimalPluginContextImpl(logger, logLevel, name, watchMode, "onLog"), inputOptions);
444
+ if (result) inputOptions = result;
445
+ }
446
+ }
447
+ return inputOptions;
448
+ }
449
+ static callOutputOptionsHook(rawPlugins, outputOptions, onLog, logLevel, watchMode) {
450
+ const sortedPlugins = getSortedPlugins("outputOptions", getObjectPlugins(rawPlugins));
451
+ for (const plugin of sortedPlugins) {
452
+ const name = plugin.name || "unknown";
453
+ const options = plugin.outputOptions;
454
+ if (options) {
455
+ const { handler } = normalizeHook(options);
456
+ const result = handler.call(new MinimalPluginContextImpl(onLog, logLevel, name, watchMode), outputOptions);
457
+ if (result) outputOptions = result;
458
+ }
459
+ }
460
+ return outputOptions;
461
+ }
462
+ };
463
+ } });
446
464
 
447
465
  //#endregion
448
466
  //#region ../../node_modules/.pnpm/valibot@1.1.0_typescript@5.8.3/node_modules/valibot/dist/index.js
449
- var store$1;
450
467
  /* @__NO_SIDE_EFFECTS__ */
451
468
  function getGlobalConfig(config2) {
452
469
  return {
@@ -456,17 +473,14 @@ function getGlobalConfig(config2) {
456
473
  abortPipeEarly: config2?.abortPipeEarly ?? store$1?.abortPipeEarly
457
474
  };
458
475
  }
459
- var store2;
460
476
  /* @__NO_SIDE_EFFECTS__ */
461
477
  function getGlobalMessage(lang) {
462
478
  return store2?.get(lang);
463
479
  }
464
- var store3;
465
480
  /* @__NO_SIDE_EFFECTS__ */
466
481
  function getSchemaMessage(lang) {
467
482
  return store3?.get(lang);
468
483
  }
469
- var store4;
470
484
  /* @__NO_SIDE_EFFECTS__ */
471
485
  function getSpecificMessage(reference, lang) {
472
486
  return store4?.get(reference)?.get(lang);
@@ -524,18 +538,6 @@ function _joinExpects(values2, separator) {
524
538
  if (list.length > 1) return `(${list.join(` ${separator} `)})`;
525
539
  return list[0] ?? "never";
526
540
  }
527
- var ValiError = class extends Error {
528
- /**
529
- * Creates a Valibot error with useful information.
530
- *
531
- * @param issues The error issues.
532
- */
533
- constructor(issues) {
534
- super(issues[0].message);
535
- this.name = "ValiError";
536
- this.issues = issues;
537
- }
538
- };
539
541
  /* @__NO_SIDE_EFFECTS__ */
540
542
  function args(schema) {
541
543
  return {
@@ -1432,13 +1434,32 @@ function safeParse(schema, input, config2) {
1432
1434
  issues: dataset.issues
1433
1435
  };
1434
1436
  }
1437
+ var store$1, store2, store3, store4, ValiError;
1438
+ var init_dist$3 = __esm({ "../../node_modules/.pnpm/valibot@1.1.0_typescript@5.8.3/node_modules/valibot/dist/index.js"() {
1439
+ ValiError = class extends Error {
1440
+ /**
1441
+ * Creates a Valibot error with useful information.
1442
+ *
1443
+ * @param issues The error issues.
1444
+ */
1445
+ constructor(issues) {
1446
+ super(issues[0].message);
1447
+ this.name = "ValiError";
1448
+ this.issues = issues;
1449
+ }
1450
+ };
1451
+ } });
1435
1452
 
1436
1453
  //#endregion
1437
- //#region ../../node_modules/.pnpm/@valibot+to-json-schema@1.2.0_valibot@1.1.0_typescript@5.8.3_/node_modules/@valibot/to-json-schema/dist/index.js
1438
- var store;
1439
- function getGlobalDefs() {
1440
- return store;
1441
- }
1454
+ //#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
1455
+ /**
1456
+ * Adds an error message to the errors array.
1457
+ *
1458
+ * @param errors The array of error messages.
1459
+ * @param message The error message to add.
1460
+ *
1461
+ * @returns The new errors.
1462
+ */
1442
1463
  function addError(errors, message) {
1443
1464
  if (errors) {
1444
1465
  errors.push(message);
@@ -1446,6 +1467,12 @@ function addError(errors, message) {
1446
1467
  }
1447
1468
  return [message];
1448
1469
  }
1470
+ /**
1471
+ * Throws an error or logs a warning based on the configuration.
1472
+ *
1473
+ * @param message The message to throw or log.
1474
+ * @param config The conversion configuration.
1475
+ */
1449
1476
  function handleError(message, config) {
1450
1477
  switch (config?.errorMode) {
1451
1478
  case "ignore": break;
@@ -1456,7 +1483,17 @@ function handleError(message, config) {
1456
1483
  default: throw new Error(message);
1457
1484
  }
1458
1485
  }
1486
+ /**
1487
+ * Converts any supported Valibot action to the JSON Schema format.
1488
+ *
1489
+ * @param jsonSchema The JSON Schema object.
1490
+ * @param valibotAction The Valibot action object.
1491
+ * @param config The conversion configuration.
1492
+ *
1493
+ * @returns The converted JSON Schema.
1494
+ */
1459
1495
  function convertAction(jsonSchema, valibotAction, config) {
1496
+ if (config?.ignoreActions?.includes(valibotAction.type)) return jsonSchema;
1460
1497
  let errors;
1461
1498
  switch (valibotAction.type) {
1462
1499
  case "base64": {
@@ -1619,7 +1656,27 @@ function convertAction(jsonSchema, valibotAction, config) {
1619
1656
  if (errors) for (const message of errors) handleError(message, config);
1620
1657
  return jsonSchema;
1621
1658
  }
1622
- var refCount = 0;
1659
+ /**
1660
+ * Flattens a Valibot pipe by recursively expanding nested pipes.
1661
+ *
1662
+ * @param pipe The pipeline to flatten.
1663
+ *
1664
+ * @returns A flat pipeline.
1665
+ */
1666
+ function flattenPipe(pipe$1) {
1667
+ return pipe$1.flatMap((item) => "pipe" in item ? flattenPipe(item.pipe) : item);
1668
+ }
1669
+ /**
1670
+ * Converts any supported Valibot schema to the JSON Schema format.
1671
+ *
1672
+ * @param jsonSchema The JSON Schema object.
1673
+ * @param valibotSchema The Valibot schema object.
1674
+ * @param config The conversion configuration.
1675
+ * @param context The conversion context.
1676
+ * @param skipRef Whether to skip using a reference.
1677
+ *
1678
+ * @returns The converted JSON Schema.
1679
+ */
1623
1680
  function convertSchema(jsonSchema, valibotSchema, config, context, skipRef = false) {
1624
1681
  if (!skipRef) {
1625
1682
  const referenceId = context.referenceMap.get(valibotSchema);
@@ -1638,10 +1695,20 @@ function convertSchema(jsonSchema, valibotSchema, config, context, skipRef = fal
1638
1695
  }
1639
1696
  }
1640
1697
  if ("pipe" in valibotSchema) {
1641
- for (let index = 0; index < valibotSchema.pipe.length; index++) {
1642
- const valibotPipeItem = valibotSchema.pipe[index];
1698
+ const flatPipe = flattenPipe(valibotSchema.pipe);
1699
+ let startIndex = 0;
1700
+ let stopIndex = flatPipe.length - 1;
1701
+ if (config?.typeMode === "input") {
1702
+ const inputStopIndex = flatPipe.slice(1).findIndex((item) => item.kind === "schema" || item.kind === "transformation" && (item.type === "find_item" || item.type === "parse_json" || item.type === "raw_transform" || item.type === "reduce_items" || item.type === "stringify_json" || item.type === "transform"));
1703
+ if (inputStopIndex !== -1) stopIndex = inputStopIndex;
1704
+ } else if (config?.typeMode === "output") {
1705
+ const outputStartIndex = flatPipe.findLastIndex((item) => item.kind === "schema");
1706
+ if (outputStartIndex !== -1) startIndex = outputStartIndex;
1707
+ }
1708
+ for (let index = startIndex; index <= stopIndex; index++) {
1709
+ const valibotPipeItem = flatPipe[index];
1643
1710
  if (valibotPipeItem.kind === "schema") {
1644
- if (index > 0) handleError("A \"pipe\" with multiple schemas cannot be converted to JSON Schema.", config);
1711
+ if (index > startIndex) handleError("Set the \"typeMode\" config to \"input\" or \"output\" to convert pipelines with multiple schemas.", config);
1645
1712
  jsonSchema = convertSchema(jsonSchema, valibotPipeItem, config, context, true);
1646
1713
  } else jsonSchema = convertAction(jsonSchema, valibotPipeItem, config);
1647
1714
  }
@@ -1760,7 +1827,7 @@ function convertSchema(jsonSchema, valibotSchema, config, context, skipRef = fal
1760
1827
  const refOverride = config.overrideRef({
1761
1828
  ...context,
1762
1829
  referenceId,
1763
- valibotSchema,
1830
+ valibotSchema: wrappedValibotSchema,
1764
1831
  jsonSchema
1765
1832
  });
1766
1833
  if (refOverride) jsonSchema.$ref = refOverride;
@@ -1782,6 +1849,24 @@ function convertSchema(jsonSchema, valibotSchema, config, context, skipRef = fal
1782
1849
  if (errors) for (const message of errors) handleError(message, config);
1783
1850
  return jsonSchema;
1784
1851
  }
1852
+ /**
1853
+ * Returns the current global schema definitions.
1854
+ *
1855
+ * @returns The schema definitions.
1856
+ *
1857
+ * @beta
1858
+ */
1859
+ function getGlobalDefs() {
1860
+ return store;
1861
+ }
1862
+ /**
1863
+ * Converts a Valibot schema to the JSON Schema format.
1864
+ *
1865
+ * @param schema The Valibot schema object.
1866
+ * @param config The JSON Schema configuration.
1867
+ *
1868
+ * @returns The converted JSON Schema.
1869
+ */
1785
1870
  function toJsonSchema(schema, config) {
1786
1871
  const context = {
1787
1872
  definitions: {},
@@ -1797,6 +1882,11 @@ function toJsonSchema(schema, config) {
1797
1882
  if (context.referenceMap.size) jsonSchema.$defs = context.definitions;
1798
1883
  return jsonSchema;
1799
1884
  }
1885
+ var refCount, store;
1886
+ 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"() {
1887
+ init_dist$3();
1888
+ refCount = 0;
1889
+ } });
1800
1890
 
1801
1891
  //#endregion
1802
1892
  //#region ../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.cjs
@@ -1905,363 +1995,15 @@ var require_ansis = __commonJS({ "../../node_modules/.pnpm/ansis@4.1.0/node_modu
1905
1995
 
1906
1996
  //#endregion
1907
1997
  //#region ../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.mjs
1908
- var import_ansis = __toESM(require_ansis(), 1);
1909
- var ansis_default = import_ansis.default;
1910
- 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;
1998
+ 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;
1999
+ var init_ansis = __esm({ "../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.mjs"() {
2000
+ import_ansis = __toESM(require_ansis(), 1);
2001
+ ansis_default = import_ansis.default;
2002
+ ({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);
2003
+ } });
1911
2004
 
1912
2005
  //#endregion
1913
2006
  //#region src/utils/validator.ts
1914
- const StringOrRegExpSchema = union([string(), instance(RegExp)]);
1915
- const LogLevelSchema = union([
1916
- literal("debug"),
1917
- literal("info"),
1918
- literal("warn")
1919
- ]);
1920
- const LogLevelOptionSchema = union([LogLevelSchema, literal("silent")]);
1921
- const LogLevelWithErrorSchema = union([LogLevelSchema, literal("error")]);
1922
- const RollupLogSchema = any();
1923
- const RollupLogWithStringSchema = union([RollupLogSchema, string()]);
1924
- const InputOptionSchema = union([
1925
- string(),
1926
- array(string()),
1927
- record(string(), string())
1928
- ]);
1929
- const ExternalSchema = union([
1930
- StringOrRegExpSchema,
1931
- array(StringOrRegExpSchema),
1932
- pipe(function_(), args(tuple([
1933
- string(),
1934
- optional(string()),
1935
- boolean()
1936
- ])), returns(nullish(boolean())))
1937
- ]);
1938
- const ModuleTypesSchema = record(string(), union([
1939
- literal("asset"),
1940
- literal("base64"),
1941
- literal("binary"),
1942
- literal("css"),
1943
- literal("dataurl"),
1944
- literal("empty"),
1945
- literal("js"),
1946
- literal("json"),
1947
- literal("jsx"),
1948
- literal("text"),
1949
- literal("ts"),
1950
- literal("tsx")
1951
- ]));
1952
- const JsxOptionsSchema = strictObject({
1953
- runtime: pipe(optional(union([literal("classic"), literal("automatic")])), description("Which runtime to use")),
1954
- development: pipe(optional(boolean()), description("Development specific information")),
1955
- throwIfNamespace: pipe(optional(string()), description("Toggles whether to throw an error when a tag name uses an XML namespace")),
1956
- importSource: pipe(optional(string()), description("Import the factory of element and fragment if mode is classic")),
1957
- pragma: pipe(optional(string()), description("Jsx element transformation")),
1958
- pragmaFlag: pipe(optional(string()), description("Jsx fragment transformation")),
1959
- refresh: pipe(optional(boolean()), description("Enable react fast refresh"))
1960
- });
1961
- const RollupJsxOptionsSchema = strictObject({
1962
- mode: optional(union([
1963
- literal("classic"),
1964
- literal("automatic"),
1965
- literal("preserve")
1966
- ])),
1967
- factory: optional(string()),
1968
- fragment: optional(string()),
1969
- importSource: optional(string()),
1970
- jsxImportSource: optional(string())
1971
- });
1972
- const HelperModeSchema = union([literal("Runtime"), literal("External")]);
1973
- const DecoratorOptionSchema = object({
1974
- legacy: optional(boolean()),
1975
- emitDecoratorMetadata: optional(boolean())
1976
- });
1977
- const HelpersSchema = object({ mode: optional(HelperModeSchema) });
1978
- const RewriteImportExtensionsSchema = union([
1979
- literal("rewrite"),
1980
- literal("remove"),
1981
- boolean()
1982
- ]);
1983
- const TypescriptSchema = object({
1984
- jsxPragma: optional(string()),
1985
- jsxPragmaFrag: optional(string()),
1986
- onlyRemoveTypeImports: optional(boolean()),
1987
- allowNamespaces: optional(boolean()),
1988
- allowDeclareFields: optional(boolean()),
1989
- declaration: optional(object({
1990
- stripInternal: optional(boolean()),
1991
- sourcemap: optional(boolean())
1992
- })),
1993
- rewriteImportExtensions: optional(RewriteImportExtensionsSchema)
1994
- });
1995
- const AssumptionsSchema = object({
1996
- ignoreFunctionLength: optional(boolean()),
1997
- noDocumentAll: optional(boolean()),
1998
- objectRestNoSymbols: optional(boolean()),
1999
- pureGetters: optional(boolean()),
2000
- setPublicClassFields: optional(boolean())
2001
- });
2002
- const TransformOptionsSchema = object({
2003
- assumptions: optional(AssumptionsSchema),
2004
- typescript: optional(TypescriptSchema),
2005
- helpers: optional(HelpersSchema),
2006
- decorators: optional(DecoratorOptionSchema),
2007
- jsx: optional(JsxOptionsSchema),
2008
- target: pipe(optional(union([string(), array(string())])), description("The JavaScript target environment"))
2009
- });
2010
- const WatchOptionsSchema = strictObject({
2011
- chokidar: optional(never(`The "watch.chokidar" option is deprecated, please use "watch.notify" instead of it`)),
2012
- exclude: optional(union([StringOrRegExpSchema, array(StringOrRegExpSchema)])),
2013
- include: optional(union([StringOrRegExpSchema, array(StringOrRegExpSchema)])),
2014
- notify: pipe(optional(strictObject({
2015
- compareContents: optional(boolean()),
2016
- pollInterval: optional(number())
2017
- })), description("Notify options")),
2018
- skipWrite: pipe(optional(boolean()), description("Skip the bundle.write() step")),
2019
- buildDelay: pipe(optional(number()), description("Throttle watch rebuilds"))
2020
- });
2021
- const ChecksOptionsSchema = strictObject({
2022
- circularDependency: pipe(optional(boolean()), description("Whether to emit warning when detecting circular dependency")),
2023
- eval: pipe(optional(boolean()), description("Whether to emit warning when detecting eval")),
2024
- missingGlobalName: pipe(optional(boolean()), description("Whether to emit warning when detecting missing global name")),
2025
- missingNameOptionForIifeExport: pipe(optional(boolean()), description("Whether to emit warning when detecting missing name option for iife export")),
2026
- mixedExport: pipe(optional(boolean()), description("Whether to emit warning when detecting mixed export")),
2027
- unresolvedEntry: pipe(optional(boolean()), description("Whether to emit warning when detecting unresolved entry")),
2028
- unresolvedImport: pipe(optional(boolean()), description("Whether to emit warning when detecting unresolved import")),
2029
- filenameConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting filename conflict")),
2030
- commonJsVariableInEsm: pipe(optional(boolean()), description("Whether to emit warning when detecting common js variable in esm")),
2031
- importIsUndefined: pipe(optional(boolean()), description("Whether to emit warning when detecting import is undefined")),
2032
- configurationFieldConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting configuration field conflict"))
2033
- });
2034
- const MinifyOptionsSchema = strictObject({
2035
- mangle: optional(boolean()),
2036
- compress: optional(boolean()),
2037
- removeWhitespace: optional(boolean())
2038
- });
2039
- const ResolveOptionsSchema = strictObject({
2040
- alias: optional(record(string(), union([string(), array(string())]))),
2041
- aliasFields: optional(array(array(string()))),
2042
- conditionNames: optional(array(string())),
2043
- extensionAlias: optional(record(string(), array(string()))),
2044
- exportsFields: optional(array(array(string()))),
2045
- extensions: optional(array(string())),
2046
- mainFields: optional(array(string())),
2047
- mainFiles: optional(array(string())),
2048
- modules: optional(array(string())),
2049
- symlinks: optional(boolean()),
2050
- tsconfigFilename: optional(string())
2051
- });
2052
- const TreeshakingOptionsSchema = union([boolean(), looseObject({
2053
- annotations: optional(boolean()),
2054
- manualPureFunctions: optional(array(string())),
2055
- unknownGlobalSideEffects: optional(boolean())
2056
- })]);
2057
- const OnLogSchema = pipe(function_(), args(tuple([
2058
- LogLevelSchema,
2059
- RollupLogSchema,
2060
- pipe(function_(), args(tuple([LogLevelWithErrorSchema, RollupLogWithStringSchema])))
2061
- ])));
2062
- const OnwarnSchema = pipe(function_(), args(tuple([RollupLogSchema, pipe(function_(), args(tuple([union([RollupLogWithStringSchema, pipe(function_(), returns(RollupLogWithStringSchema))])])))])));
2063
- const HmrSchema = union([boolean(), strictObject({
2064
- port: optional(number()),
2065
- host: optional(string()),
2066
- implement: optional(string())
2067
- })]);
2068
- const InputOptionsSchema = strictObject({
2069
- input: optional(InputOptionSchema),
2070
- plugins: optional(custom(() => true)),
2071
- external: optional(ExternalSchema),
2072
- resolve: optional(ResolveOptionsSchema),
2073
- cwd: pipe(optional(string()), description("Current working directory")),
2074
- platform: pipe(optional(union([
2075
- literal("browser"),
2076
- literal("neutral"),
2077
- literal("node")
2078
- ])), description(`Platform for which the code should be generated (node, ${ansis_default.underline("browser")}, neutral)`)),
2079
- shimMissingExports: pipe(optional(boolean()), description("Create shim variables for missing exports")),
2080
- treeshake: optional(TreeshakingOptionsSchema),
2081
- logLevel: pipe(optional(LogLevelOptionSchema), description(`Log level (${ansis_default.dim("silent")}, ${ansis_default.underline(ansis_default.gray("info"))}, debug, ${ansis_default.yellow("warn")})`)),
2082
- onLog: optional(OnLogSchema),
2083
- onwarn: optional(OnwarnSchema),
2084
- moduleTypes: pipe(optional(ModuleTypesSchema), description("Module types for customized extensions")),
2085
- experimental: optional(strictObject({
2086
- disableLiveBindings: optional(boolean()),
2087
- enableComposingJsPlugins: optional(boolean()),
2088
- resolveNewUrlToAsset: optional(boolean()),
2089
- strictExecutionOrder: optional(boolean()),
2090
- hmr: optional(HmrSchema),
2091
- attachDebugInfo: optional(boolean())
2092
- })),
2093
- define: pipe(optional(record(string(), string())), description("Define global variables")),
2094
- inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
2095
- profilerNames: optional(boolean()),
2096
- jsx: optional(union([
2097
- literal(false),
2098
- literal("react"),
2099
- literal("react-jsx"),
2100
- literal("preserve"),
2101
- RollupJsxOptionsSchema
2102
- ])),
2103
- transform: optional(TransformOptionsSchema),
2104
- watch: optional(union([WatchOptionsSchema, literal(false)])),
2105
- dropLabels: pipe(optional(array(string())), description("Remove labeled statements with these label names")),
2106
- checks: optional(ChecksOptionsSchema),
2107
- keepNames: pipe(optional(boolean()), description("Keep function/class name")),
2108
- 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."))
2109
- });
2110
- const InputCliOverrideSchema = strictObject({
2111
- input: pipe(optional(array(string())), description("Entry file")),
2112
- external: pipe(optional(array(string())), description("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`")),
2113
- inject: pipe(optional(record(string(), string())), description("Inject import statements on demand")),
2114
- treeshake: pipe(optional(boolean()), description("enable treeshaking")),
2115
- jsx: pipe(optional(union([
2116
- literal(false),
2117
- literal("react"),
2118
- literal("react-jsx"),
2119
- literal("preserve")
2120
- ])), description("Jsx options preset"))
2121
- });
2122
- const InputCliOptionsSchema = omit(strictObject({
2123
- ...InputOptionsSchema.entries,
2124
- ...InputCliOverrideSchema.entries
2125
- }), [
2126
- "plugins",
2127
- "onwarn",
2128
- "onLog",
2129
- "resolve",
2130
- "experimental",
2131
- "profilerNames",
2132
- "watch"
2133
- ]);
2134
- const ModuleFormatSchema = union([
2135
- literal("es"),
2136
- literal("cjs"),
2137
- literal("esm"),
2138
- literal("module"),
2139
- literal("commonjs"),
2140
- literal("iife"),
2141
- literal("umd")
2142
- ]);
2143
- const AddonFunctionSchema = pipe(function_(), args(tuple([custom(() => true)])), returnsAsync(unionAsync([string(), pipeAsync(promise(), awaitAsync(), string())])));
2144
- const ChunkFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
2145
- const AssetFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
2146
- const SanitizeFileNameSchema = union([boolean(), pipe(function_(), args(tuple([string()])), returns(string()))]);
2147
- const GlobalsFunctionSchema = pipe(function_(), args(tuple([string()])), returns(string()));
2148
- const AdvancedChunksSchema = strictObject({
2149
- minSize: optional(number()),
2150
- maxSize: optional(number()),
2151
- minModuleSize: optional(number()),
2152
- maxModuleSize: optional(number()),
2153
- minShareCount: optional(number()),
2154
- groups: optional(array(strictObject({
2155
- name: string(),
2156
- test: optional(union([
2157
- string(),
2158
- instance(RegExp),
2159
- pipe(function_(), args(tuple([string()])), returns(union([nullish(boolean()), void_()])))
2160
- ])),
2161
- priority: optional(number()),
2162
- minSize: optional(number()),
2163
- minShareCount: optional(number()),
2164
- maxSize: optional(number()),
2165
- minModuleSize: optional(number()),
2166
- maxModuleSize: optional(number())
2167
- })))
2168
- });
2169
- const OutputOptionsSchema = strictObject({
2170
- dir: pipe(optional(string()), description("Output directory, defaults to `dist` if `file` is not set")),
2171
- file: pipe(optional(string()), description("Single output file")),
2172
- exports: pipe(optional(union([
2173
- literal("auto"),
2174
- literal("named"),
2175
- literal("default"),
2176
- literal("none")
2177
- ])), description(`Specify a export mode (${ansis_default.underline("auto")}, named, default, none)`)),
2178
- hashCharacters: pipe(optional(union([
2179
- literal("base64"),
2180
- literal("base36"),
2181
- literal("hex")
2182
- ])), description("Use the specified character set for file hashes")),
2183
- format: pipe(optional(ModuleFormatSchema), description(`Output format of the generated bundle (supports ${ansis_default.underline("esm")}, cjs, and iife)`)),
2184
- sourcemap: pipe(optional(union([
2185
- boolean(),
2186
- literal("inline"),
2187
- literal("hidden")
2188
- ])), 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")})`)),
2189
- sourcemapDebugIds: pipe(optional(boolean()), description("Inject sourcemap debug IDs")),
2190
- sourcemapIgnoreList: optional(union([boolean(), custom(() => true)])),
2191
- sourcemapPathTransform: optional(custom(() => true)),
2192
- banner: optional(union([string(), AddonFunctionSchema])),
2193
- footer: optional(union([string(), AddonFunctionSchema])),
2194
- intro: optional(union([string(), AddonFunctionSchema])),
2195
- outro: optional(union([string(), AddonFunctionSchema])),
2196
- extend: pipe(optional(boolean()), description("Extend global variable defined by name in IIFE / UMD formats")),
2197
- esModule: optional(union([boolean(), literal("if-default-prop")])),
2198
- assetFileNames: optional(AssetFileNamesSchema),
2199
- entryFileNames: optional(ChunkFileNamesSchema),
2200
- chunkFileNames: optional(ChunkFileNamesSchema),
2201
- cssEntryFileNames: optional(ChunkFileNamesSchema),
2202
- cssChunkFileNames: optional(ChunkFileNamesSchema),
2203
- sanitizeFileName: optional(SanitizeFileNameSchema),
2204
- minify: pipe(optional(union([
2205
- boolean(),
2206
- string("dce-only"),
2207
- MinifyOptionsSchema
2208
- ])), description("Minify the bundled file")),
2209
- name: pipe(optional(string()), description("Name for UMD / IIFE format outputs")),
2210
- globals: pipe(optional(union([record(string(), string()), GlobalsFunctionSchema])), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
2211
- externalLiveBindings: pipe(optional(boolean()), description("external live bindings")),
2212
- inlineDynamicImports: pipe(optional(boolean()), description("Inline dynamic imports")),
2213
- manualChunks: optional(never("manualChunks is not supported. Please use advancedChunks instead")),
2214
- advancedChunks: optional(AdvancedChunksSchema),
2215
- legalComments: pipe(optional(union([literal("none"), literal("inline")])), description("Control comments in the output")),
2216
- plugins: optional(custom(() => true)),
2217
- polyfillRequire: pipe(optional(boolean()), description("Disable require polyfill injection")),
2218
- hoistTransitiveImports: optional(custom((input) => {
2219
- if (input) return false;
2220
- return true;
2221
- }, () => `The 'true' value is not supported`)),
2222
- preserveModules: pipe(optional(boolean()), description("Preserve module structure")),
2223
- preserveModulesRoot: pipe(optional(string()), description("Put preserved modules under this path at root level")),
2224
- virtualDirname: optional(string())
2225
- });
2226
- const getAddonDescription = (placement, wrapper) => {
2227
- return `Code to insert the ${ansis_default.bold(placement)} of the bundled file (${ansis_default.bold(wrapper)} the wrapper function)`;
2228
- };
2229
- const OutputCliOverrideSchema = strictObject({
2230
- assetFileNames: pipe(optional(string()), description("Name pattern for asset files")),
2231
- entryFileNames: pipe(optional(string()), description("Name pattern for emitted entry chunks")),
2232
- chunkFileNames: pipe(optional(string()), description("Name pattern for emitted secondary chunks")),
2233
- cssEntryFileNames: pipe(optional(string()), description("Name pattern for emitted css entry chunks")),
2234
- cssChunkFileNames: pipe(optional(string()), description("Name pattern for emitted css secondary chunks")),
2235
- sanitizeFileName: pipe(optional(boolean()), description("Sanitize file name")),
2236
- banner: pipe(optional(string()), description(getAddonDescription("top", "outside"))),
2237
- footer: pipe(optional(string()), description(getAddonDescription("bottom", "outside"))),
2238
- intro: pipe(optional(string()), description(getAddonDescription("top", "inside"))),
2239
- outro: pipe(optional(string()), description(getAddonDescription("bottom", "inside"))),
2240
- esModule: pipe(optional(boolean()), description("Always generate `__esModule` marks in non-ESM formats, defaults to `if-default-prop` (use `--no-esModule` to always disable)")),
2241
- globals: pipe(optional(record(string(), string())), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
2242
- advancedChunks: pipe(optional(strictObject({
2243
- minSize: pipe(optional(number()), description("Minimum size of the chunk")),
2244
- minShareCount: pipe(optional(number()), description("Minimum share count of the chunk"))
2245
- })), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
2246
- minify: pipe(optional(boolean()), description("Minify the bundled file"))
2247
- });
2248
- const OutputCliOptionsSchema = omit(strictObject({
2249
- ...OutputOptionsSchema.entries,
2250
- ...OutputCliOverrideSchema.entries
2251
- }), [
2252
- "sourcemapIgnoreList",
2253
- "sourcemapPathTransform",
2254
- "plugins",
2255
- "hoistTransitiveImports"
2256
- ]);
2257
- const CliOptionsSchema = strictObject({
2258
- config: pipe(optional(union([string(), boolean()])), description("Path to the config file (default: `rolldown.config.js`)")),
2259
- help: pipe(optional(boolean()), description("Show help")),
2260
- version: pipe(optional(boolean()), description("Show version number")),
2261
- watch: pipe(optional(boolean()), description("Watch files in bundle and rebuild on changes")),
2262
- ...InputCliOptionsSchema.entries,
2263
- ...OutputCliOptionsSchema.entries
2264
- });
2265
2007
  function validateCliOptions(options) {
2266
2008
  let parsed = safeParse(CliOptionsSchema, options);
2267
2009
  return [parsed.output, parsed.issues?.map((issue) => {
@@ -2269,8 +2011,6 @@ function validateCliOptions(options) {
2269
2011
  return `Invalid value for option ${option}: ${issue.message}`;
2270
2012
  })];
2271
2013
  }
2272
- const inputHelperMsgRecord = { output: { ignored: true } };
2273
- const outputHelperMsgRecord = {};
2274
2014
  function validateOption(key, options) {
2275
2015
  if (globalThis.process?.env?.ROLLUP_TEST) return;
2276
2016
  let parsed = safeParse(key === "input" ? InputOptionsSchema : OutputOptionsSchema, options);
@@ -2302,38 +2042,397 @@ function getOutputCliKeys() {
2302
2042
  function getJsonSchema() {
2303
2043
  return toJsonSchema(CliOptionsSchema, { errorMode: "ignore" });
2304
2044
  }
2045
+ 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;
2046
+ var init_validator = __esm({ "src/utils/validator.ts"() {
2047
+ init_dist$2();
2048
+ init_ansis();
2049
+ init_dist$3();
2050
+ StringOrRegExpSchema = union([string(), instance(RegExp)]);
2051
+ LogLevelSchema = union([
2052
+ literal("debug"),
2053
+ literal("info"),
2054
+ literal("warn")
2055
+ ]);
2056
+ LogLevelOptionSchema = union([LogLevelSchema, literal("silent")]);
2057
+ LogLevelWithErrorSchema = union([LogLevelSchema, literal("error")]);
2058
+ RollupLogSchema = any();
2059
+ RollupLogWithStringSchema = union([RollupLogSchema, string()]);
2060
+ InputOptionSchema = union([
2061
+ string(),
2062
+ array(string()),
2063
+ record(string(), string())
2064
+ ]);
2065
+ ExternalSchema = union([
2066
+ StringOrRegExpSchema,
2067
+ array(StringOrRegExpSchema),
2068
+ pipe(function_(), args(tuple([
2069
+ string(),
2070
+ optional(string()),
2071
+ boolean()
2072
+ ])), returns(nullish(boolean())))
2073
+ ]);
2074
+ ModuleTypesSchema = record(string(), union([
2075
+ literal("asset"),
2076
+ literal("base64"),
2077
+ literal("binary"),
2078
+ literal("css"),
2079
+ literal("dataurl"),
2080
+ literal("empty"),
2081
+ literal("js"),
2082
+ literal("json"),
2083
+ literal("jsx"),
2084
+ literal("text"),
2085
+ literal("ts"),
2086
+ literal("tsx")
2087
+ ]));
2088
+ JsxOptionsSchema = strictObject({
2089
+ runtime: pipe(optional(union([literal("classic"), literal("automatic")])), description("Which runtime to use")),
2090
+ development: pipe(optional(boolean()), description("Development specific information")),
2091
+ throwIfNamespace: pipe(optional(string()), description("Toggles whether to throw an error when a tag name uses an XML namespace")),
2092
+ importSource: pipe(optional(string()), description("Import the factory of element and fragment if mode is classic")),
2093
+ pragma: pipe(optional(string()), description("Jsx element transformation")),
2094
+ pragmaFlag: pipe(optional(string()), description("Jsx fragment transformation")),
2095
+ refresh: pipe(optional(boolean()), description("Enable react fast refresh"))
2096
+ });
2097
+ RollupJsxOptionsSchema = strictObject({
2098
+ mode: optional(union([
2099
+ literal("classic"),
2100
+ literal("automatic"),
2101
+ literal("preserve")
2102
+ ])),
2103
+ factory: optional(string()),
2104
+ fragment: optional(string()),
2105
+ importSource: optional(string()),
2106
+ jsxImportSource: optional(string())
2107
+ });
2108
+ HelperModeSchema = union([literal("Runtime"), literal("External")]);
2109
+ DecoratorOptionSchema = object({
2110
+ legacy: optional(boolean()),
2111
+ emitDecoratorMetadata: optional(boolean())
2112
+ });
2113
+ HelpersSchema = object({ mode: optional(HelperModeSchema) });
2114
+ RewriteImportExtensionsSchema = union([
2115
+ literal("rewrite"),
2116
+ literal("remove"),
2117
+ boolean()
2118
+ ]);
2119
+ TypescriptSchema = object({
2120
+ jsxPragma: optional(string()),
2121
+ jsxPragmaFrag: optional(string()),
2122
+ onlyRemoveTypeImports: optional(boolean()),
2123
+ allowNamespaces: optional(boolean()),
2124
+ allowDeclareFields: optional(boolean()),
2125
+ declaration: optional(object({
2126
+ stripInternal: optional(boolean()),
2127
+ sourcemap: optional(boolean())
2128
+ })),
2129
+ rewriteImportExtensions: optional(RewriteImportExtensionsSchema)
2130
+ });
2131
+ AssumptionsSchema = object({
2132
+ ignoreFunctionLength: optional(boolean()),
2133
+ noDocumentAll: optional(boolean()),
2134
+ objectRestNoSymbols: optional(boolean()),
2135
+ pureGetters: optional(boolean()),
2136
+ setPublicClassFields: optional(boolean())
2137
+ });
2138
+ TransformOptionsSchema = object({
2139
+ assumptions: optional(AssumptionsSchema),
2140
+ typescript: optional(TypescriptSchema),
2141
+ helpers: optional(HelpersSchema),
2142
+ decorators: optional(DecoratorOptionSchema),
2143
+ jsx: optional(JsxOptionsSchema),
2144
+ target: pipe(optional(union([string(), array(string())])), description("The JavaScript target environment"))
2145
+ });
2146
+ WatchOptionsSchema = strictObject({
2147
+ chokidar: optional(never(`The "watch.chokidar" option is deprecated, please use "watch.notify" instead of it`)),
2148
+ exclude: optional(union([StringOrRegExpSchema, array(StringOrRegExpSchema)])),
2149
+ include: optional(union([StringOrRegExpSchema, array(StringOrRegExpSchema)])),
2150
+ notify: pipe(optional(strictObject({
2151
+ compareContents: optional(boolean()),
2152
+ pollInterval: optional(number())
2153
+ })), description("Notify options")),
2154
+ skipWrite: pipe(optional(boolean()), description("Skip the bundle.write() step")),
2155
+ buildDelay: pipe(optional(number()), description("Throttle watch rebuilds"))
2156
+ });
2157
+ ChecksOptionsSchema = strictObject({
2158
+ circularDependency: pipe(optional(boolean()), description("Whether to emit warning when detecting circular dependency")),
2159
+ eval: pipe(optional(boolean()), description("Whether to emit warning when detecting eval")),
2160
+ missingGlobalName: pipe(optional(boolean()), description("Whether to emit warning when detecting missing global name")),
2161
+ missingNameOptionForIifeExport: pipe(optional(boolean()), description("Whether to emit warning when detecting missing name option for iife export")),
2162
+ mixedExport: pipe(optional(boolean()), description("Whether to emit warning when detecting mixed export")),
2163
+ unresolvedEntry: pipe(optional(boolean()), description("Whether to emit warning when detecting unresolved entry")),
2164
+ unresolvedImport: pipe(optional(boolean()), description("Whether to emit warning when detecting unresolved import")),
2165
+ filenameConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting filename conflict")),
2166
+ commonJsVariableInEsm: pipe(optional(boolean()), description("Whether to emit warning when detecting common js variable in esm")),
2167
+ importIsUndefined: pipe(optional(boolean()), description("Whether to emit warning when detecting import is undefined")),
2168
+ configurationFieldConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting configuration field conflict"))
2169
+ });
2170
+ MinifyOptionsSchema = strictObject({
2171
+ mangle: optional(boolean()),
2172
+ compress: optional(boolean()),
2173
+ removeWhitespace: optional(boolean())
2174
+ });
2175
+ ResolveOptionsSchema = strictObject({
2176
+ alias: optional(record(string(), union([string(), array(string())]))),
2177
+ aliasFields: optional(array(array(string()))),
2178
+ conditionNames: optional(array(string())),
2179
+ extensionAlias: optional(record(string(), array(string()))),
2180
+ exportsFields: optional(array(array(string()))),
2181
+ extensions: optional(array(string())),
2182
+ mainFields: optional(array(string())),
2183
+ mainFiles: optional(array(string())),
2184
+ modules: optional(array(string())),
2185
+ symlinks: optional(boolean()),
2186
+ tsconfigFilename: optional(string())
2187
+ });
2188
+ TreeshakingOptionsSchema = union([boolean(), looseObject({
2189
+ annotations: optional(boolean()),
2190
+ manualPureFunctions: optional(array(string())),
2191
+ unknownGlobalSideEffects: optional(boolean())
2192
+ })]);
2193
+ OnLogSchema = pipe(function_(), args(tuple([
2194
+ LogLevelSchema,
2195
+ RollupLogSchema,
2196
+ pipe(function_(), args(tuple([LogLevelWithErrorSchema, RollupLogWithStringSchema])))
2197
+ ])));
2198
+ OnwarnSchema = pipe(function_(), args(tuple([RollupLogSchema, pipe(function_(), args(tuple([union([RollupLogWithStringSchema, pipe(function_(), returns(RollupLogWithStringSchema))])])))])));
2199
+ HmrSchema = union([boolean(), strictObject({
2200
+ port: optional(number()),
2201
+ host: optional(string()),
2202
+ implement: optional(string())
2203
+ })]);
2204
+ InputOptionsSchema = strictObject({
2205
+ input: optional(InputOptionSchema),
2206
+ plugins: optional(custom(() => true)),
2207
+ external: optional(ExternalSchema),
2208
+ resolve: optional(ResolveOptionsSchema),
2209
+ cwd: pipe(optional(string()), description("Current working directory")),
2210
+ platform: pipe(optional(union([
2211
+ literal("browser"),
2212
+ literal("neutral"),
2213
+ literal("node")
2214
+ ])), description(`Platform for which the code should be generated (node, ${ansis_default.underline("browser")}, neutral)`)),
2215
+ shimMissingExports: pipe(optional(boolean()), description("Create shim variables for missing exports")),
2216
+ treeshake: optional(TreeshakingOptionsSchema),
2217
+ logLevel: pipe(optional(LogLevelOptionSchema), description(`Log level (${ansis_default.dim("silent")}, ${ansis_default.underline(ansis_default.gray("info"))}, debug, ${ansis_default.yellow("warn")})`)),
2218
+ onLog: optional(OnLogSchema),
2219
+ onwarn: optional(OnwarnSchema),
2220
+ moduleTypes: pipe(optional(ModuleTypesSchema), description("Module types for customized extensions")),
2221
+ experimental: optional(strictObject({
2222
+ disableLiveBindings: optional(boolean()),
2223
+ enableComposingJsPlugins: optional(boolean()),
2224
+ resolveNewUrlToAsset: optional(boolean()),
2225
+ strictExecutionOrder: optional(boolean()),
2226
+ hmr: optional(HmrSchema),
2227
+ attachDebugInfo: optional(boolean())
2228
+ })),
2229
+ define: pipe(optional(record(string(), string())), description("Define global variables")),
2230
+ inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
2231
+ profilerNames: optional(boolean()),
2232
+ jsx: optional(union([
2233
+ literal(false),
2234
+ literal("react"),
2235
+ literal("react-jsx"),
2236
+ literal("preserve"),
2237
+ RollupJsxOptionsSchema
2238
+ ])),
2239
+ transform: optional(TransformOptionsSchema),
2240
+ watch: optional(union([WatchOptionsSchema, literal(false)])),
2241
+ dropLabels: pipe(optional(array(string())), description("Remove labeled statements with these label names")),
2242
+ checks: optional(ChecksOptionsSchema),
2243
+ keepNames: pipe(optional(boolean()), description("Keep function/class name")),
2244
+ 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."))
2245
+ });
2246
+ InputCliOverrideSchema = strictObject({
2247
+ input: pipe(optional(array(string())), description("Entry file")),
2248
+ external: pipe(optional(array(string())), description("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`")),
2249
+ inject: pipe(optional(record(string(), string())), description("Inject import statements on demand")),
2250
+ treeshake: pipe(optional(boolean()), description("enable treeshaking")),
2251
+ jsx: pipe(optional(union([
2252
+ literal(false),
2253
+ literal("react"),
2254
+ literal("react-jsx"),
2255
+ literal("preserve")
2256
+ ])), description("Jsx options preset"))
2257
+ });
2258
+ InputCliOptionsSchema = omit(strictObject({
2259
+ ...InputOptionsSchema.entries,
2260
+ ...InputCliOverrideSchema.entries
2261
+ }), [
2262
+ "plugins",
2263
+ "onwarn",
2264
+ "onLog",
2265
+ "resolve",
2266
+ "experimental",
2267
+ "profilerNames",
2268
+ "watch"
2269
+ ]);
2270
+ ModuleFormatSchema = union([
2271
+ literal("es"),
2272
+ literal("cjs"),
2273
+ literal("esm"),
2274
+ literal("module"),
2275
+ literal("commonjs"),
2276
+ literal("iife"),
2277
+ literal("umd")
2278
+ ]);
2279
+ AddonFunctionSchema = pipe(function_(), args(tuple([custom(() => true)])), returnsAsync(unionAsync([string(), pipeAsync(promise(), awaitAsync(), string())])));
2280
+ ChunkFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
2281
+ AssetFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
2282
+ SanitizeFileNameSchema = union([boolean(), pipe(function_(), args(tuple([string()])), returns(string()))]);
2283
+ GlobalsFunctionSchema = pipe(function_(), args(tuple([string()])), returns(string()));
2284
+ AdvancedChunksSchema = strictObject({
2285
+ minSize: optional(number()),
2286
+ maxSize: optional(number()),
2287
+ minModuleSize: optional(number()),
2288
+ maxModuleSize: optional(number()),
2289
+ minShareCount: optional(number()),
2290
+ groups: optional(array(strictObject({
2291
+ name: string(),
2292
+ test: optional(union([
2293
+ string(),
2294
+ instance(RegExp),
2295
+ pipe(function_(), args(tuple([string()])), returns(union([nullish(boolean()), void_()])))
2296
+ ])),
2297
+ priority: optional(number()),
2298
+ minSize: optional(number()),
2299
+ minShareCount: optional(number()),
2300
+ maxSize: optional(number()),
2301
+ minModuleSize: optional(number()),
2302
+ maxModuleSize: optional(number())
2303
+ })))
2304
+ });
2305
+ OutputOptionsSchema = strictObject({
2306
+ dir: pipe(optional(string()), description("Output directory, defaults to `dist` if `file` is not set")),
2307
+ file: pipe(optional(string()), description("Single output file")),
2308
+ exports: pipe(optional(union([
2309
+ literal("auto"),
2310
+ literal("named"),
2311
+ literal("default"),
2312
+ literal("none")
2313
+ ])), description(`Specify a export mode (${ansis_default.underline("auto")}, named, default, none)`)),
2314
+ hashCharacters: pipe(optional(union([
2315
+ literal("base64"),
2316
+ literal("base36"),
2317
+ literal("hex")
2318
+ ])), description("Use the specified character set for file hashes")),
2319
+ format: pipe(optional(ModuleFormatSchema), description(`Output format of the generated bundle (supports ${ansis_default.underline("esm")}, cjs, and iife)`)),
2320
+ sourcemap: pipe(optional(union([
2321
+ boolean(),
2322
+ literal("inline"),
2323
+ literal("hidden")
2324
+ ])), 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")})`)),
2325
+ sourcemapDebugIds: pipe(optional(boolean()), description("Inject sourcemap debug IDs")),
2326
+ sourcemapIgnoreList: optional(union([boolean(), custom(() => true)])),
2327
+ sourcemapPathTransform: optional(custom(() => true)),
2328
+ banner: optional(union([string(), AddonFunctionSchema])),
2329
+ footer: optional(union([string(), AddonFunctionSchema])),
2330
+ intro: optional(union([string(), AddonFunctionSchema])),
2331
+ outro: optional(union([string(), AddonFunctionSchema])),
2332
+ extend: pipe(optional(boolean()), description("Extend global variable defined by name in IIFE / UMD formats")),
2333
+ esModule: optional(union([boolean(), literal("if-default-prop")])),
2334
+ assetFileNames: optional(AssetFileNamesSchema),
2335
+ entryFileNames: optional(ChunkFileNamesSchema),
2336
+ chunkFileNames: optional(ChunkFileNamesSchema),
2337
+ cssEntryFileNames: optional(ChunkFileNamesSchema),
2338
+ cssChunkFileNames: optional(ChunkFileNamesSchema),
2339
+ sanitizeFileName: optional(SanitizeFileNameSchema),
2340
+ minify: pipe(optional(union([
2341
+ boolean(),
2342
+ string("dce-only"),
2343
+ MinifyOptionsSchema
2344
+ ])), description("Minify the bundled file")),
2345
+ name: pipe(optional(string()), description("Name for UMD / IIFE format outputs")),
2346
+ globals: pipe(optional(union([record(string(), string()), GlobalsFunctionSchema])), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
2347
+ externalLiveBindings: pipe(optional(boolean()), description("external live bindings")),
2348
+ inlineDynamicImports: pipe(optional(boolean()), description("Inline dynamic imports")),
2349
+ manualChunks: optional(never("manualChunks is not supported. Please use advancedChunks instead")),
2350
+ advancedChunks: optional(AdvancedChunksSchema),
2351
+ legalComments: pipe(optional(union([literal("none"), literal("inline")])), description("Control comments in the output")),
2352
+ plugins: optional(custom(() => true)),
2353
+ polyfillRequire: pipe(optional(boolean()), description("Disable require polyfill injection")),
2354
+ hoistTransitiveImports: optional(custom((input) => {
2355
+ if (input) return false;
2356
+ return true;
2357
+ }, () => `The 'true' value is not supported`)),
2358
+ preserveModules: pipe(optional(boolean()), description("Preserve module structure")),
2359
+ preserveModulesRoot: pipe(optional(string()), description("Put preserved modules under this path at root level")),
2360
+ virtualDirname: optional(string())
2361
+ });
2362
+ getAddonDescription = (placement, wrapper) => {
2363
+ return `Code to insert the ${ansis_default.bold(placement)} of the bundled file (${ansis_default.bold(wrapper)} the wrapper function)`;
2364
+ };
2365
+ OutputCliOverrideSchema = strictObject({
2366
+ assetFileNames: pipe(optional(string()), description("Name pattern for asset files")),
2367
+ entryFileNames: pipe(optional(string()), description("Name pattern for emitted entry chunks")),
2368
+ chunkFileNames: pipe(optional(string()), description("Name pattern for emitted secondary chunks")),
2369
+ cssEntryFileNames: pipe(optional(string()), description("Name pattern for emitted css entry chunks")),
2370
+ cssChunkFileNames: pipe(optional(string()), description("Name pattern for emitted css secondary chunks")),
2371
+ sanitizeFileName: pipe(optional(boolean()), description("Sanitize file name")),
2372
+ banner: pipe(optional(string()), description(getAddonDescription("top", "outside"))),
2373
+ footer: pipe(optional(string()), description(getAddonDescription("bottom", "outside"))),
2374
+ intro: pipe(optional(string()), description(getAddonDescription("top", "inside"))),
2375
+ outro: pipe(optional(string()), description(getAddonDescription("bottom", "inside"))),
2376
+ esModule: pipe(optional(boolean()), description("Always generate `__esModule` marks in non-ESM formats, defaults to `if-default-prop` (use `--no-esModule` to always disable)")),
2377
+ globals: pipe(optional(record(string(), string())), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
2378
+ advancedChunks: pipe(optional(strictObject({
2379
+ minSize: pipe(optional(number()), description("Minimum size of the chunk")),
2380
+ minShareCount: pipe(optional(number()), description("Minimum share count of the chunk"))
2381
+ })), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
2382
+ minify: pipe(optional(boolean()), description("Minify the bundled file"))
2383
+ });
2384
+ OutputCliOptionsSchema = omit(strictObject({
2385
+ ...OutputOptionsSchema.entries,
2386
+ ...OutputCliOverrideSchema.entries
2387
+ }), [
2388
+ "sourcemapIgnoreList",
2389
+ "sourcemapPathTransform",
2390
+ "plugins",
2391
+ "hoistTransitiveImports"
2392
+ ]);
2393
+ CliOptionsSchema = strictObject({
2394
+ config: pipe(optional(union([string(), boolean()])), description("Path to the config file (default: `rolldown.config.js`)")),
2395
+ help: pipe(optional(boolean()), description("Show help")),
2396
+ version: pipe(optional(boolean()), description("Show version number")),
2397
+ watch: pipe(optional(boolean()), description("Watch files in bundle and rebuild on changes")),
2398
+ ...InputCliOptionsSchema.entries,
2399
+ ...OutputCliOptionsSchema.entries
2400
+ });
2401
+ inputHelperMsgRecord = { output: { ignored: true } };
2402
+ outputHelperMsgRecord = {};
2403
+ } });
2305
2404
 
2306
2405
  //#endregion
2307
2406
  //#region src/constants/plugin-context.ts
2308
- /**
2309
- * If Composed plugins call `this.resolve` with `skipSelf: true`, the composed plugins will be skipped as a whole.
2310
- * To prevent that, we use this symbol to store the actual caller of `this.resolve` with `skipSelf: true`. And we
2311
- * will modify the skipSelf option to `false` and use this symbol to skip the caller itself in the composed plugins
2312
- * internally.
2313
- */
2314
- const SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF = Symbol("plugin-context-resolve-caller");
2407
+ var SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF;
2408
+ var init_plugin_context$1 = __esm({ "src/constants/plugin-context.ts"() {
2409
+ SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF = Symbol("plugin-context-resolve-caller");
2410
+ } });
2315
2411
 
2316
2412
  //#endregion
2317
2413
  //#region src/options/normalized-input-options.ts
2318
- var NormalizedInputOptionsImpl = class {
2319
- inner;
2320
- constructor(inner, onLog) {
2321
- this.onLog = onLog;
2322
- this.inner = inner;
2323
- }
2324
- get shimMissingExports() {
2325
- return this.inner.shimMissingExports;
2326
- }
2327
- get input() {
2328
- return this.inner.input;
2329
- }
2330
- get cwd() {
2331
- return this.inner.cwd ?? void 0;
2332
- }
2333
- get platform() {
2334
- return this.inner.platform;
2335
- }
2336
- };
2414
+ var NormalizedInputOptionsImpl;
2415
+ var init_normalized_input_options = __esm({ "src/options/normalized-input-options.ts"() {
2416
+ NormalizedInputOptionsImpl = class {
2417
+ inner;
2418
+ constructor(inner, onLog) {
2419
+ this.onLog = onLog;
2420
+ this.inner = inner;
2421
+ }
2422
+ get shimMissingExports() {
2423
+ return this.inner.shimMissingExports;
2424
+ }
2425
+ get input() {
2426
+ return this.inner.input;
2427
+ }
2428
+ get cwd() {
2429
+ return this.inner.cwd ?? void 0;
2430
+ }
2431
+ get platform() {
2432
+ return this.inner.platform;
2433
+ }
2434
+ };
2435
+ } });
2337
2436
 
2338
2437
  //#endregion
2339
2438
  //#region src/types/sourcemap.ts
@@ -2350,6 +2449,7 @@ function bindingifySourcemap(map) {
2350
2449
  debugId: "debugId" in map ? map.debugId : void 0
2351
2450
  } };
2352
2451
  }
2452
+ var init_sourcemap = __esm({ "src/types/sourcemap.ts"() {} });
2353
2453
 
2354
2454
  //#endregion
2355
2455
  //#region src/utils/error.ts
@@ -2400,6 +2500,7 @@ function getErrorMessage(e$1) {
2400
2500
  function joinNewLine(s1, s2) {
2401
2501
  return s1.replace(/\n+$/, "") + "\n" + s2.replace(/^\n+/, "");
2402
2502
  }
2503
+ var init_error = __esm({ "src/utils/error.ts"() {} });
2403
2504
 
2404
2505
  //#endregion
2405
2506
  //#region src/utils/transform-module-info.ts
@@ -2421,6 +2522,9 @@ function transformModuleInfo(info, option) {
2421
2522
  ...option
2422
2523
  };
2423
2524
  }
2525
+ var init_transform_module_info = __esm({ "src/utils/transform-module-info.ts"() {
2526
+ init_misc();
2527
+ } });
2424
2528
 
2425
2529
  //#endregion
2426
2530
  //#region src/utils/transform-side-effects.ts
@@ -2434,6 +2538,7 @@ function bindingifySideEffects(sideEffects) {
2434
2538
  default: throw new Error(`Unexpected side effects: ${sideEffects}`);
2435
2539
  }
2436
2540
  }
2541
+ var init_transform_side_effects = __esm({ "src/utils/transform-side-effects.ts"() {} });
2437
2542
 
2438
2543
  //#endregion
2439
2544
  //#region src/utils/transform-sourcemap.ts
@@ -2449,9 +2554,10 @@ function normalizeTransformHookSourcemap(id$1, originalCode, rawMap) {
2449
2554
  if (isEmptySourcemapFiled(map.sources) || map.sources && map.sources.length === 1 && map.sources[0] !== id$1) map.sources = [id$1];
2450
2555
  return map;
2451
2556
  }
2557
+ var init_transform_sourcemap = __esm({ "src/utils/transform-sourcemap.ts"() {} });
2452
2558
 
2453
2559
  //#endregion
2454
- //#region ../../node_modules/.pnpm/remeda@2.21.6/node_modules/remeda/dist/chunk-D6FCK2GA.js
2560
+ //#region ../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-D6FCK2GA.js
2455
2561
  function u$1(o$1, n$1, a$2) {
2456
2562
  let t$2 = (r$1) => o$1(r$1, ...n$1);
2457
2563
  return a$2 === void 0 ? t$2 : Object.assign(t$2, {
@@ -2459,32 +2565,50 @@ function u$1(o$1, n$1, a$2) {
2459
2565
  lazyArgs: n$1
2460
2566
  });
2461
2567
  }
2568
+ var init_chunk_D6FCK2GA = __esm({ "../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-D6FCK2GA.js"() {} });
2462
2569
 
2463
2570
  //#endregion
2464
- //#region ../../node_modules/.pnpm/remeda@2.21.6/node_modules/remeda/dist/chunk-WIMGWYZL.js
2571
+ //#region ../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-WIMGWYZL.js
2465
2572
  function u(r$1, n$1, o$1) {
2466
2573
  let a$2 = r$1.length - n$1.length;
2467
2574
  if (a$2 === 0) return r$1(...n$1);
2468
2575
  if (a$2 === 1) return u$1(r$1, n$1, o$1);
2469
2576
  throw new Error("Wrong number of arguments");
2470
2577
  }
2578
+ var init_chunk_WIMGWYZL = __esm({ "../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-WIMGWYZL.js"() {
2579
+ init_chunk_D6FCK2GA();
2580
+ } });
2471
2581
 
2472
2582
  //#endregion
2473
- //#region ../../node_modules/.pnpm/remeda@2.21.6/node_modules/remeda/dist/chunk-3IFJP4R5.js
2583
+ //#region ../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-3IFJP4R5.js
2474
2584
  function d(...r$1) {
2475
2585
  return u(i, r$1);
2476
2586
  }
2477
- var i = (r$1, t$2) => {
2478
- let a$2 = [[], []];
2479
- 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);
2480
- return a$2;
2481
- };
2587
+ var i;
2588
+ var init_chunk_3IFJP4R5 = __esm({ "../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-3IFJP4R5.js"() {
2589
+ init_chunk_WIMGWYZL();
2590
+ i = (r$1, t$2) => {
2591
+ let a$2 = [[], []];
2592
+ 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);
2593
+ return a$2;
2594
+ };
2595
+ } });
2482
2596
 
2483
2597
  //#endregion
2484
- //#region ../../node_modules/.pnpm/remeda@2.21.6/node_modules/remeda/dist/chunk-5NQBDF4H.js
2598
+ //#region ../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-5NQBDF4H.js
2485
2599
  function t(...n$1) {
2486
2600
  return u(Object.keys, n$1);
2487
2601
  }
2602
+ var init_chunk_5NQBDF4H = __esm({ "../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-5NQBDF4H.js"() {
2603
+ init_chunk_WIMGWYZL();
2604
+ } });
2605
+
2606
+ //#endregion
2607
+ //#region ../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/index.js
2608
+ var init_dist$1 = __esm({ "../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/index.js"() {
2609
+ init_chunk_3IFJP4R5();
2610
+ init_chunk_5NQBDF4H();
2611
+ } });
2488
2612
 
2489
2613
  //#endregion
2490
2614
  //#region src/plugin/bindingify-hook-filter.ts
@@ -2626,6 +2750,11 @@ function bindingifyRenderChunkFilter(filterOption) {
2626
2750
  if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
2627
2751
  return filterOption.code ? bindingifyGeneralHookFilter("code", filterOption.code) : void 0;
2628
2752
  }
2753
+ var init_bindingify_hook_filter = __esm({ "src/plugin/bindingify-hook-filter.ts"() {
2754
+ init_dist();
2755
+ init_dist$1();
2756
+ init_misc();
2757
+ } });
2629
2758
 
2630
2759
  //#endregion
2631
2760
  //#region src/plugin/bindingify-plugin-hook-meta.ts
@@ -2641,6 +2770,7 @@ function bindingPluginOrder(order) {
2641
2770
  default: throw new Error(`Unknown plugin order: ${order}`);
2642
2771
  }
2643
2772
  }
2773
+ var init_bindingify_plugin_hook_meta = __esm({ "src/plugin/bindingify-plugin-hook-meta.ts"() {} });
2644
2774
 
2645
2775
  //#endregion
2646
2776
  //#region src/utils/asset-source.ts
@@ -2650,129 +2780,146 @@ function transformAssetSource(bindingAssetSource$1) {
2650
2780
  function bindingAssetSource(source) {
2651
2781
  return { inner: source };
2652
2782
  }
2783
+ var init_asset_source = __esm({ "src/utils/asset-source.ts"() {} });
2653
2784
 
2654
2785
  //#endregion
2655
2786
  //#region src/plugin/plugin-context.ts
2656
- var PluginContextImpl = class extends MinimalPluginContextImpl {
2657
- getModuleInfo;
2658
- constructor(outputOptions, context, plugin, data, onLog, logLevel, watchMode, currentLoadingModule) {
2659
- super(onLog, logLevel, plugin.name, watchMode);
2660
- this.outputOptions = outputOptions;
2661
- this.context = context;
2662
- this.data = data;
2663
- this.onLog = onLog;
2664
- this.currentLoadingModule = currentLoadingModule;
2665
- this.getModuleInfo = (id$1) => this.data.getModuleInfo(id$1, context);
2666
- }
2667
- async load(options) {
2668
- const id$1 = options.id;
2669
- if (id$1 === this.currentLoadingModule) this.onLog(LOG_LEVEL_WARN, logCycleLoading(this.pluginName, this.currentLoadingModule));
2670
- const moduleInfo = this.data.getModuleInfo(id$1, this.context);
2671
- if (moduleInfo && moduleInfo.code !== null) return moduleInfo;
2672
- const rawOptions = {
2673
- meta: options.meta || {},
2674
- moduleSideEffects: options.moduleSideEffects || null,
2675
- invalidate: false
2676
- };
2677
- this.data.updateModuleOption(id$1, rawOptions);
2678
- async function createLoadModulePromise(context, data) {
2679
- const loadPromise = data.loadModulePromiseMap.get(id$1);
2680
- if (loadPromise) return loadPromise;
2681
- const promise$1 = new Promise((resolve, _) => {
2682
- data.loadModulePromiseResolveFnMap.set(id$1, resolve);
2683
- });
2684
- data.loadModulePromiseMap.set(id$1, promise$1);
2685
- try {
2686
- await context.load(id$1, bindingifySideEffects(options.moduleSideEffects));
2687
- } catch (e$1) {
2688
- data.loadModulePromiseMap.delete(id$1);
2689
- data.loadModulePromiseResolveFnMap.delete(id$1);
2690
- throw e$1;
2787
+ var PluginContextImpl;
2788
+ var init_plugin_context = __esm({ "src/plugin/plugin-context.ts"() {
2789
+ init_logging();
2790
+ init_logs();
2791
+ init_parse_ast_index();
2792
+ init_minimal_plugin_context();
2793
+ init_asset_source();
2794
+ init_misc();
2795
+ init_transform_side_effects();
2796
+ PluginContextImpl = class extends MinimalPluginContextImpl {
2797
+ getModuleInfo;
2798
+ constructor(outputOptions, context, plugin, data, onLog, logLevel, watchMode, currentLoadingModule) {
2799
+ super(onLog, logLevel, plugin.name, watchMode);
2800
+ this.outputOptions = outputOptions;
2801
+ this.context = context;
2802
+ this.data = data;
2803
+ this.onLog = onLog;
2804
+ this.currentLoadingModule = currentLoadingModule;
2805
+ this.getModuleInfo = (id$1) => this.data.getModuleInfo(id$1, context);
2806
+ }
2807
+ async load(options) {
2808
+ const id$1 = options.id;
2809
+ if (id$1 === this.currentLoadingModule) this.onLog(LOG_LEVEL_WARN, logCycleLoading(this.pluginName, this.currentLoadingModule));
2810
+ const moduleInfo = this.data.getModuleInfo(id$1, this.context);
2811
+ if (moduleInfo && moduleInfo.code !== null) return moduleInfo;
2812
+ const rawOptions = {
2813
+ meta: options.meta || {},
2814
+ moduleSideEffects: options.moduleSideEffects || null,
2815
+ invalidate: false
2816
+ };
2817
+ this.data.updateModuleOption(id$1, rawOptions);
2818
+ async function createLoadModulePromise(context, data) {
2819
+ const loadPromise = data.loadModulePromiseMap.get(id$1);
2820
+ if (loadPromise) return loadPromise;
2821
+ const promise$1 = new Promise((resolve, _) => {
2822
+ data.loadModulePromiseResolveFnMap.set(id$1, resolve);
2823
+ });
2824
+ data.loadModulePromiseMap.set(id$1, promise$1);
2825
+ try {
2826
+ await context.load(id$1, bindingifySideEffects(options.moduleSideEffects));
2827
+ } catch (e$1) {
2828
+ data.loadModulePromiseMap.delete(id$1);
2829
+ data.loadModulePromiseResolveFnMap.delete(id$1);
2830
+ throw e$1;
2831
+ }
2832
+ return promise$1;
2691
2833
  }
2692
- return promise$1;
2834
+ await createLoadModulePromise(this.context, this.data);
2835
+ return this.data.getModuleInfo(id$1, this.context);
2693
2836
  }
2694
- await createLoadModulePromise(this.context, this.data);
2695
- return this.data.getModuleInfo(id$1, this.context);
2696
- }
2697
- async resolve(source, importer, options) {
2698
- let receipt = void 0;
2699
- if (options != null) receipt = this.data.saveResolveOptions(options);
2700
- const res = await this.context.resolve(source, importer, {
2701
- custom: receipt,
2702
- skipSelf: options?.skipSelf
2703
- });
2704
- if (receipt != null) this.data.removeSavedResolveOptions(receipt);
2705
- if (res == null) return null;
2706
- const info = this.data.getModuleOption(res.id) || {};
2707
- return {
2708
- ...res,
2709
- external: res.external === "relative" ? unreachable(`The PluginContext resolve result external couldn't be 'relative'`) : res.external,
2710
- ...info
2837
+ async resolve(source, importer, options) {
2838
+ let receipt = void 0;
2839
+ if (options != null) receipt = this.data.saveResolveOptions(options);
2840
+ const res = await this.context.resolve(source, importer, {
2841
+ custom: receipt,
2842
+ skipSelf: options?.skipSelf
2843
+ });
2844
+ if (receipt != null) this.data.removeSavedResolveOptions(receipt);
2845
+ if (res == null) return null;
2846
+ const info = this.data.getModuleOption(res.id) || {};
2847
+ return {
2848
+ ...res,
2849
+ external: res.external === "relative" ? unreachable(`The PluginContext resolve result external couldn't be 'relative'`) : res.external,
2850
+ ...info
2851
+ };
2852
+ }
2853
+ emitFile = (file) => {
2854
+ if (file.type === "prebuilt-chunk") return unimplemented("PluginContext.emitFile with type prebuilt-chunk");
2855
+ if (file.type === "chunk") return this.context.emitChunk(file);
2856
+ const fnSanitizedFileName = file.fileName || typeof this.outputOptions.sanitizeFileName !== "function" ? void 0 : this.outputOptions.sanitizeFileName(file.name || "asset");
2857
+ const filename = file.fileName ? void 0 : this.getAssetFileNames(file);
2858
+ return this.context.emitFile({
2859
+ ...file,
2860
+ originalFileName: file.originalFileName || void 0,
2861
+ source: bindingAssetSource(file.source)
2862
+ }, filename, fnSanitizedFileName);
2711
2863
  };
2712
- }
2713
- emitFile = (file) => {
2714
- if (file.type === "prebuilt-chunk") return unimplemented("PluginContext.emitFile with type prebuilt-chunk");
2715
- if (file.type === "chunk") return this.context.emitChunk(file);
2716
- const fnSanitizedFileName = file.fileName || typeof this.outputOptions.sanitizeFileName !== "function" ? void 0 : this.outputOptions.sanitizeFileName(file.name || "asset");
2717
- const filename = file.fileName ? void 0 : this.getAssetFileNames(file);
2718
- return this.context.emitFile({
2719
- ...file,
2720
- originalFileName: file.originalFileName || void 0,
2721
- source: bindingAssetSource(file.source)
2722
- }, filename, fnSanitizedFileName);
2864
+ getAssetFileNames(file) {
2865
+ if (typeof this.outputOptions.assetFileNames === "function") return this.outputOptions.assetFileNames({
2866
+ names: file.name ? [file.name] : [],
2867
+ originalFileNames: file.originalFileName ? [file.originalFileName] : [],
2868
+ source: file.source,
2869
+ type: "asset"
2870
+ });
2871
+ }
2872
+ getFileName(referenceId) {
2873
+ return this.context.getFileName(referenceId);
2874
+ }
2875
+ getModuleIds() {
2876
+ return this.data.getModuleIds(this.context);
2877
+ }
2878
+ addWatchFile(id$1) {
2879
+ this.context.addWatchFile(id$1);
2880
+ }
2881
+ parse(input, options) {
2882
+ return parseAst(input, options);
2883
+ }
2723
2884
  };
2724
- getAssetFileNames(file) {
2725
- if (typeof this.outputOptions.assetFileNames === "function") return this.outputOptions.assetFileNames({
2726
- names: file.name ? [file.name] : [],
2727
- originalFileNames: file.originalFileName ? [file.originalFileName] : [],
2728
- source: file.source,
2729
- type: "asset"
2730
- });
2731
- }
2732
- getFileName(referenceId) {
2733
- return this.context.getFileName(referenceId);
2734
- }
2735
- getModuleIds() {
2736
- return this.data.getModuleIds(this.context);
2737
- }
2738
- addWatchFile(id$1) {
2739
- this.context.addWatchFile(id$1);
2740
- }
2741
- parse(input, options) {
2742
- return parseAst(input, options);
2743
- }
2744
- };
2885
+ } });
2745
2886
 
2746
2887
  //#endregion
2747
2888
  //#region src/plugin/transform-plugin-context.ts
2748
- var TransformPluginContextImpl = class extends PluginContextImpl {
2749
- constructor(outputOptions, context, plugin, data, inner, moduleId, moduleSource, onLog, LogLevelOption, watchMode) {
2750
- super(outputOptions, context, plugin, data, onLog, LogLevelOption, watchMode, moduleId);
2751
- this.inner = inner;
2752
- this.moduleId = moduleId;
2753
- this.moduleSource = moduleSource;
2754
- const getLogHandler$1 = (handler) => (log, pos) => {
2755
- log = normalizeLog(log);
2756
- if (pos) augmentCodeLocation(log, pos, moduleSource, moduleId);
2757
- log.id = moduleId;
2758
- log.hook = "transform";
2759
- handler(log);
2760
- };
2761
- this.debug = getLogHandler$1(this.debug);
2762
- this.warn = getLogHandler$1(this.warn);
2763
- this.info = getLogHandler$1(this.info);
2764
- }
2765
- error(e$1, pos) {
2766
- if (typeof e$1 === "string") e$1 = { message: e$1 };
2767
- if (pos) augmentCodeLocation(e$1, pos, this.moduleSource, this.moduleId);
2768
- e$1.id = this.moduleId;
2769
- e$1.hook = "transform";
2770
- return error(logPluginError(normalizeLog(e$1), this.pluginName));
2771
- }
2772
- getCombinedSourcemap() {
2773
- return JSON.parse(this.inner.getCombinedSourcemap());
2774
- }
2775
- };
2889
+ var TransformPluginContextImpl;
2890
+ var init_transform_plugin_context = __esm({ "src/plugin/transform-plugin-context.ts"() {
2891
+ init_log_handler();
2892
+ init_logs();
2893
+ init_plugin_context();
2894
+ TransformPluginContextImpl = class extends PluginContextImpl {
2895
+ constructor(outputOptions, context, plugin, data, inner, moduleId, moduleSource, onLog, LogLevelOption, watchMode) {
2896
+ super(outputOptions, context, plugin, data, onLog, LogLevelOption, watchMode, moduleId);
2897
+ this.inner = inner;
2898
+ this.moduleId = moduleId;
2899
+ this.moduleSource = moduleSource;
2900
+ const getLogHandler$1 = (handler) => (log, pos) => {
2901
+ log = normalizeLog(log);
2902
+ if (pos) augmentCodeLocation(log, pos, moduleSource, moduleId);
2903
+ log.id = moduleId;
2904
+ log.hook = "transform";
2905
+ handler(log);
2906
+ };
2907
+ this.debug = getLogHandler$1(this.debug);
2908
+ this.warn = getLogHandler$1(this.warn);
2909
+ this.info = getLogHandler$1(this.info);
2910
+ }
2911
+ error(e$1, pos) {
2912
+ if (typeof e$1 === "string") e$1 = { message: e$1 };
2913
+ if (pos) augmentCodeLocation(e$1, pos, this.moduleSource, this.moduleId);
2914
+ e$1.id = this.moduleId;
2915
+ e$1.hook = "transform";
2916
+ return error(logPluginError(normalizeLog(e$1), this.pluginName));
2917
+ }
2918
+ getCombinedSourcemap() {
2919
+ return JSON.parse(this.inner.getCombinedSourcemap());
2920
+ }
2921
+ };
2922
+ } });
2776
2923
 
2777
2924
  //#endregion
2778
2925
  //#region src/plugin/bindingify-build-hooks.ts
@@ -2937,6 +3084,20 @@ function bindingifyModuleParsed(args$1) {
2937
3084
  meta: bindingifyPluginHookMeta(meta)
2938
3085
  };
2939
3086
  }
3087
+ var init_bindingify_build_hooks = __esm({ "src/plugin/bindingify-build-hooks.ts"() {
3088
+ init_normalize_hook();
3089
+ init_plugin_context$1();
3090
+ init_normalized_input_options();
3091
+ init_sourcemap();
3092
+ init_error();
3093
+ init_transform_module_info();
3094
+ init_transform_side_effects();
3095
+ init_transform_sourcemap();
3096
+ init_bindingify_hook_filter();
3097
+ init_bindingify_plugin_hook_meta();
3098
+ init_plugin_context();
3099
+ init_transform_plugin_context();
3100
+ } });
2940
3101
 
2941
3102
  //#endregion
2942
3103
  //#region src/utils/transform-rendered-module.ts
@@ -2953,6 +3114,7 @@ function transformToRenderedModule(bindingRenderedModule) {
2953
3114
  }
2954
3115
  };
2955
3116
  }
3117
+ var init_transform_rendered_module = __esm({ "src/utils/transform-rendered-module.ts"() {} });
2956
3118
 
2957
3119
  //#endregion
2958
3120
  //#region src/utils/transform-rendered-chunk.ts
@@ -3002,6 +3164,9 @@ function transformChunkModules(modules) {
3002
3164
  }
3003
3165
  return result;
3004
3166
  }
3167
+ var init_transform_rendered_chunk = __esm({ "src/utils/transform-rendered-chunk.ts"() {
3168
+ init_transform_rendered_module();
3169
+ } });
3005
3170
 
3006
3171
  //#endregion
3007
3172
  //#region src/utils/bindingify-output-options.ts
@@ -3087,116 +3252,125 @@ function bindingifyAssetFilenames(assetFileNames) {
3087
3252
  };
3088
3253
  return assetFileNames;
3089
3254
  }
3255
+ var init_bindingify_output_options = __esm({ "src/utils/bindingify-output-options.ts"() {
3256
+ init_asset_source();
3257
+ init_misc();
3258
+ init_transform_rendered_chunk();
3259
+ } });
3090
3260
 
3091
3261
  //#endregion
3092
3262
  //#region src/options/normalized-output-options.ts
3093
- var NormalizedOutputOptionsImpl = class {
3094
- constructor(inner, outputOptions, normalizedOutputPlugins) {
3095
- this.inner = inner;
3096
- this.outputOptions = outputOptions;
3097
- this.normalizedOutputPlugins = normalizedOutputPlugins;
3098
- }
3099
- get dir() {
3100
- return this.inner.dir ?? void 0;
3101
- }
3102
- get entryFileNames() {
3103
- return this.inner.entryFilenames || this.outputOptions.entryFileNames;
3104
- }
3105
- get chunkFileNames() {
3106
- return this.inner.chunkFilenames || this.outputOptions.chunkFileNames;
3107
- }
3108
- get assetFileNames() {
3109
- return this.inner.assetFilenames || this.outputOptions.assetFileNames;
3110
- }
3111
- get format() {
3112
- return this.inner.format;
3113
- }
3114
- get exports() {
3115
- return this.inner.exports;
3116
- }
3117
- get sourcemap() {
3118
- return this.inner.sourcemap;
3119
- }
3120
- get cssEntryFileNames() {
3121
- return this.inner.cssEntryFilenames || this.outputOptions.cssEntryFileNames;
3122
- }
3123
- get cssChunkFileNames() {
3124
- return this.inner.cssChunkFilenames || this.outputOptions.cssChunkFileNames;
3125
- }
3126
- get shimMissingExports() {
3127
- return this.inner.shimMissingExports;
3128
- }
3129
- get name() {
3130
- return this.inner.name ?? void 0;
3131
- }
3132
- get file() {
3133
- return this.inner.file ?? void 0;
3134
- }
3135
- get inlineDynamicImports() {
3136
- return this.inner.inlineDynamicImports;
3137
- }
3138
- get externalLiveBindings() {
3139
- return this.inner.externalLiveBindings;
3140
- }
3141
- get banner() {
3142
- return normalizeAddon(this.outputOptions.banner);
3143
- }
3144
- get footer() {
3145
- return normalizeAddon(this.outputOptions.footer);
3146
- }
3147
- get intro() {
3148
- return normalizeAddon(this.outputOptions.intro);
3149
- }
3150
- get outro() {
3151
- return normalizeAddon(this.outputOptions.outro);
3152
- }
3153
- get esModule() {
3154
- return this.inner.esModule;
3155
- }
3156
- get extend() {
3157
- return this.inner.extend;
3158
- }
3159
- get globals() {
3160
- return this.inner.globals || this.outputOptions.globals;
3161
- }
3162
- get hashCharacters() {
3163
- return this.inner.hashCharacters;
3164
- }
3165
- get sourcemapDebugIds() {
3166
- return this.inner.sourcemapDebugIds;
3167
- }
3168
- get sourcemapIgnoreList() {
3169
- return bindingifySourcemapIgnoreList(this.outputOptions.sourcemapIgnoreList);
3170
- }
3171
- get sourcemapPathTransform() {
3172
- return this.outputOptions.sourcemapPathTransform;
3173
- }
3174
- get minify() {
3175
- return this.inner.minify;
3176
- }
3177
- get legalComments() {
3178
- return this.inner.legalComments;
3179
- }
3180
- get polyfillRequire() {
3181
- return this.inner.polyfillRequire;
3182
- }
3183
- get plugins() {
3184
- return this.normalizedOutputPlugins;
3185
- }
3186
- get preserveModules() {
3187
- return this.preserveModules;
3188
- }
3189
- get preserveModulesRoot() {
3190
- return this.preserveModulesRoot;
3191
- }
3192
- get virtualDirname() {
3193
- return this.virtualDirname;
3194
- }
3195
- };
3196
3263
  function normalizeAddon(value) {
3197
3264
  if (typeof value === "function") return value;
3198
3265
  return () => value || "";
3199
3266
  }
3267
+ var NormalizedOutputOptionsImpl;
3268
+ var init_normalized_output_options = __esm({ "src/options/normalized-output-options.ts"() {
3269
+ init_bindingify_output_options();
3270
+ NormalizedOutputOptionsImpl = class {
3271
+ constructor(inner, outputOptions, normalizedOutputPlugins) {
3272
+ this.inner = inner;
3273
+ this.outputOptions = outputOptions;
3274
+ this.normalizedOutputPlugins = normalizedOutputPlugins;
3275
+ }
3276
+ get dir() {
3277
+ return this.inner.dir ?? void 0;
3278
+ }
3279
+ get entryFileNames() {
3280
+ return this.inner.entryFilenames || this.outputOptions.entryFileNames;
3281
+ }
3282
+ get chunkFileNames() {
3283
+ return this.inner.chunkFilenames || this.outputOptions.chunkFileNames;
3284
+ }
3285
+ get assetFileNames() {
3286
+ return this.inner.assetFilenames || this.outputOptions.assetFileNames;
3287
+ }
3288
+ get format() {
3289
+ return this.inner.format;
3290
+ }
3291
+ get exports() {
3292
+ return this.inner.exports;
3293
+ }
3294
+ get sourcemap() {
3295
+ return this.inner.sourcemap;
3296
+ }
3297
+ get cssEntryFileNames() {
3298
+ return this.inner.cssEntryFilenames || this.outputOptions.cssEntryFileNames;
3299
+ }
3300
+ get cssChunkFileNames() {
3301
+ return this.inner.cssChunkFilenames || this.outputOptions.cssChunkFileNames;
3302
+ }
3303
+ get shimMissingExports() {
3304
+ return this.inner.shimMissingExports;
3305
+ }
3306
+ get name() {
3307
+ return this.inner.name ?? void 0;
3308
+ }
3309
+ get file() {
3310
+ return this.inner.file ?? void 0;
3311
+ }
3312
+ get inlineDynamicImports() {
3313
+ return this.inner.inlineDynamicImports;
3314
+ }
3315
+ get externalLiveBindings() {
3316
+ return this.inner.externalLiveBindings;
3317
+ }
3318
+ get banner() {
3319
+ return normalizeAddon(this.outputOptions.banner);
3320
+ }
3321
+ get footer() {
3322
+ return normalizeAddon(this.outputOptions.footer);
3323
+ }
3324
+ get intro() {
3325
+ return normalizeAddon(this.outputOptions.intro);
3326
+ }
3327
+ get outro() {
3328
+ return normalizeAddon(this.outputOptions.outro);
3329
+ }
3330
+ get esModule() {
3331
+ return this.inner.esModule;
3332
+ }
3333
+ get extend() {
3334
+ return this.inner.extend;
3335
+ }
3336
+ get globals() {
3337
+ return this.inner.globals || this.outputOptions.globals;
3338
+ }
3339
+ get hashCharacters() {
3340
+ return this.inner.hashCharacters;
3341
+ }
3342
+ get sourcemapDebugIds() {
3343
+ return this.inner.sourcemapDebugIds;
3344
+ }
3345
+ get sourcemapIgnoreList() {
3346
+ return bindingifySourcemapIgnoreList(this.outputOptions.sourcemapIgnoreList);
3347
+ }
3348
+ get sourcemapPathTransform() {
3349
+ return this.outputOptions.sourcemapPathTransform;
3350
+ }
3351
+ get minify() {
3352
+ return this.inner.minify;
3353
+ }
3354
+ get legalComments() {
3355
+ return this.inner.legalComments;
3356
+ }
3357
+ get polyfillRequire() {
3358
+ return this.inner.polyfillRequire;
3359
+ }
3360
+ get plugins() {
3361
+ return this.normalizedOutputPlugins;
3362
+ }
3363
+ get preserveModules() {
3364
+ return this.preserveModules;
3365
+ }
3366
+ get preserveModulesRoot() {
3367
+ return this.preserveModulesRoot;
3368
+ }
3369
+ get virtualDirname() {
3370
+ return this.virtualDirname;
3371
+ }
3372
+ };
3373
+ } });
3200
3374
 
3201
3375
  //#endregion
3202
3376
  //#region src/utils/transform-to-rollup-output.ts
@@ -3340,6 +3514,12 @@ function collectChangedBundle(changed, bundle) {
3340
3514
  deleted: Array.from(changed.deleted)
3341
3515
  };
3342
3516
  }
3517
+ var init_transform_to_rollup_output = __esm({ "src/utils/transform-to-rollup-output.ts"() {
3518
+ init_sourcemap();
3519
+ init_asset_source();
3520
+ init_error();
3521
+ init_transform_rendered_chunk();
3522
+ } });
3343
3523
 
3344
3524
  //#endregion
3345
3525
  //#region src/plugin/bindingify-output-hooks.ts
@@ -3489,6 +3669,18 @@ function bindingifyOutro(args$1) {
3489
3669
  meta: bindingifyPluginHookMeta(meta)
3490
3670
  };
3491
3671
  }
3672
+ var init_bindingify_output_hooks = __esm({ "src/plugin/bindingify-output-hooks.ts"() {
3673
+ init_normalized_input_options();
3674
+ init_normalized_output_options();
3675
+ init_sourcemap();
3676
+ init_error();
3677
+ init_normalize_hook();
3678
+ init_transform_rendered_chunk();
3679
+ init_transform_to_rollup_output();
3680
+ init_bindingify_hook_filter();
3681
+ init_bindingify_plugin_hook_meta();
3682
+ init_plugin_context();
3683
+ } });
3492
3684
 
3493
3685
  //#endregion
3494
3686
  //#region src/plugin/bindingify-watch-hooks.ts
@@ -3514,43 +3706,14 @@ function bindingifyCloseWatcher(args$1) {
3514
3706
  meta: bindingifyPluginHookMeta(meta)
3515
3707
  };
3516
3708
  }
3709
+ var init_bindingify_watch_hooks = __esm({ "src/plugin/bindingify-watch-hooks.ts"() {
3710
+ init_normalize_hook();
3711
+ init_bindingify_plugin_hook_meta();
3712
+ init_plugin_context();
3713
+ } });
3517
3714
 
3518
3715
  //#endregion
3519
3716
  //#region src/plugin/generated/hook-usage.ts
3520
- let HookUsageKind = /* @__PURE__ */ function(HookUsageKind$1) {
3521
- HookUsageKind$1[HookUsageKind$1["buildStart"] = 1] = "buildStart";
3522
- HookUsageKind$1[HookUsageKind$1["resolveId"] = 2] = "resolveId";
3523
- HookUsageKind$1[HookUsageKind$1["resolveDynamicImport"] = 4] = "resolveDynamicImport";
3524
- HookUsageKind$1[HookUsageKind$1["load"] = 8] = "load";
3525
- HookUsageKind$1[HookUsageKind$1["transform"] = 16] = "transform";
3526
- HookUsageKind$1[HookUsageKind$1["moduleParsed"] = 32] = "moduleParsed";
3527
- HookUsageKind$1[HookUsageKind$1["buildEnd"] = 64] = "buildEnd";
3528
- HookUsageKind$1[HookUsageKind$1["renderStart"] = 128] = "renderStart";
3529
- HookUsageKind$1[HookUsageKind$1["renderError"] = 256] = "renderError";
3530
- HookUsageKind$1[HookUsageKind$1["renderChunk"] = 512] = "renderChunk";
3531
- HookUsageKind$1[HookUsageKind$1["augmentChunkHash"] = 1024] = "augmentChunkHash";
3532
- HookUsageKind$1[HookUsageKind$1["generateBundle"] = 2048] = "generateBundle";
3533
- HookUsageKind$1[HookUsageKind$1["writeBundle"] = 4096] = "writeBundle";
3534
- HookUsageKind$1[HookUsageKind$1["closeBundle"] = 8192] = "closeBundle";
3535
- HookUsageKind$1[HookUsageKind$1["watchChange"] = 16384] = "watchChange";
3536
- HookUsageKind$1[HookUsageKind$1["closeWatcher"] = 32768] = "closeWatcher";
3537
- HookUsageKind$1[HookUsageKind$1["transformAst"] = 65536] = "transformAst";
3538
- HookUsageKind$1[HookUsageKind$1["banner"] = 131072] = "banner";
3539
- HookUsageKind$1[HookUsageKind$1["footer"] = 262144] = "footer";
3540
- HookUsageKind$1[HookUsageKind$1["intro"] = 524288] = "intro";
3541
- HookUsageKind$1[HookUsageKind$1["outro"] = 1048576] = "outro";
3542
- return HookUsageKind$1;
3543
- }({});
3544
- var HookUsage = class {
3545
- bitflag = BigInt(0);
3546
- constructor() {}
3547
- union(kind) {
3548
- this.bitflag |= BigInt(kind);
3549
- }
3550
- inner() {
3551
- return Number(this.bitflag);
3552
- }
3553
- };
3554
3717
  function extractHookUsage(plugin) {
3555
3718
  let hookUsage = new HookUsage();
3556
3719
  if (plugin.buildStart) hookUsage.union(HookUsageKind.buildStart);
@@ -3575,6 +3738,43 @@ function extractHookUsage(plugin) {
3575
3738
  if (plugin.outro) hookUsage.union(HookUsageKind.outro);
3576
3739
  return hookUsage;
3577
3740
  }
3741
+ var HookUsageKind, HookUsage;
3742
+ var init_hook_usage = __esm({ "src/plugin/generated/hook-usage.ts"() {
3743
+ HookUsageKind = /* @__PURE__ */ function(HookUsageKind$1) {
3744
+ HookUsageKind$1[HookUsageKind$1["buildStart"] = 1] = "buildStart";
3745
+ HookUsageKind$1[HookUsageKind$1["resolveId"] = 2] = "resolveId";
3746
+ HookUsageKind$1[HookUsageKind$1["resolveDynamicImport"] = 4] = "resolveDynamicImport";
3747
+ HookUsageKind$1[HookUsageKind$1["load"] = 8] = "load";
3748
+ HookUsageKind$1[HookUsageKind$1["transform"] = 16] = "transform";
3749
+ HookUsageKind$1[HookUsageKind$1["moduleParsed"] = 32] = "moduleParsed";
3750
+ HookUsageKind$1[HookUsageKind$1["buildEnd"] = 64] = "buildEnd";
3751
+ HookUsageKind$1[HookUsageKind$1["renderStart"] = 128] = "renderStart";
3752
+ HookUsageKind$1[HookUsageKind$1["renderError"] = 256] = "renderError";
3753
+ HookUsageKind$1[HookUsageKind$1["renderChunk"] = 512] = "renderChunk";
3754
+ HookUsageKind$1[HookUsageKind$1["augmentChunkHash"] = 1024] = "augmentChunkHash";
3755
+ HookUsageKind$1[HookUsageKind$1["generateBundle"] = 2048] = "generateBundle";
3756
+ HookUsageKind$1[HookUsageKind$1["writeBundle"] = 4096] = "writeBundle";
3757
+ HookUsageKind$1[HookUsageKind$1["closeBundle"] = 8192] = "closeBundle";
3758
+ HookUsageKind$1[HookUsageKind$1["watchChange"] = 16384] = "watchChange";
3759
+ HookUsageKind$1[HookUsageKind$1["closeWatcher"] = 32768] = "closeWatcher";
3760
+ HookUsageKind$1[HookUsageKind$1["transformAst"] = 65536] = "transformAst";
3761
+ HookUsageKind$1[HookUsageKind$1["banner"] = 131072] = "banner";
3762
+ HookUsageKind$1[HookUsageKind$1["footer"] = 262144] = "footer";
3763
+ HookUsageKind$1[HookUsageKind$1["intro"] = 524288] = "intro";
3764
+ HookUsageKind$1[HookUsageKind$1["outro"] = 1048576] = "outro";
3765
+ return HookUsageKind$1;
3766
+ }({});
3767
+ HookUsage = class {
3768
+ bitflag = BigInt(0);
3769
+ constructor() {}
3770
+ union(kind) {
3771
+ this.bitflag |= BigInt(kind);
3772
+ }
3773
+ inner() {
3774
+ return Number(this.bitflag);
3775
+ }
3776
+ };
3777
+ } });
3578
3778
 
3579
3779
  //#endregion
3580
3780
  //#region src/plugin/bindingify-plugin.ts
@@ -3697,95 +3897,106 @@ function wrapHandlers(plugin) {
3697
3897
  }
3698
3898
  return plugin;
3699
3899
  }
3900
+ var init_bindingify_plugin = __esm({ "src/plugin/bindingify-plugin.ts"() {
3901
+ init_bindingify_build_hooks();
3902
+ init_bindingify_output_hooks();
3903
+ init_logs();
3904
+ init_bindingify_watch_hooks();
3905
+ init_hook_usage();
3906
+ } });
3700
3907
 
3701
3908
  //#endregion
3702
3909
  //#region src/plugin/plugin-context-data.ts
3703
- var PluginContextData = class {
3704
- moduleOptionMap = /* @__PURE__ */ new Map();
3705
- resolveOptionsMap = /* @__PURE__ */ new Map();
3706
- loadModulePromiseMap = /* @__PURE__ */ new Map();
3707
- loadModulePromiseResolveFnMap = /* @__PURE__ */ new Map();
3708
- renderedChunkMeta = null;
3709
- updateModuleOption(id$1, option) {
3710
- const existing = this.moduleOptionMap.get(id$1);
3711
- if (existing) {
3712
- if (option.moduleSideEffects != null) existing.moduleSideEffects = option.moduleSideEffects;
3713
- if (option.meta != null) Object.assign(existing.meta, option.meta);
3714
- if (option.invalidate != null) existing.invalidate = option.invalidate;
3715
- } else {
3716
- this.moduleOptionMap.set(id$1, option);
3910
+ var PluginContextData;
3911
+ var init_plugin_context_data = __esm({ "src/plugin/plugin-context-data.ts"() {
3912
+ init_transform_module_info();
3913
+ PluginContextData = class {
3914
+ moduleOptionMap = /* @__PURE__ */ new Map();
3915
+ resolveOptionsMap = /* @__PURE__ */ new Map();
3916
+ loadModulePromiseMap = /* @__PURE__ */ new Map();
3917
+ loadModulePromiseResolveFnMap = /* @__PURE__ */ new Map();
3918
+ renderedChunkMeta = null;
3919
+ updateModuleOption(id$1, option) {
3920
+ const existing = this.moduleOptionMap.get(id$1);
3921
+ if (existing) {
3922
+ if (option.moduleSideEffects != null) existing.moduleSideEffects = option.moduleSideEffects;
3923
+ if (option.meta != null) Object.assign(existing.meta, option.meta);
3924
+ if (option.invalidate != null) existing.invalidate = option.invalidate;
3925
+ } else {
3926
+ this.moduleOptionMap.set(id$1, option);
3927
+ return option;
3928
+ }
3929
+ return existing;
3930
+ }
3931
+ getModuleOption(id$1) {
3932
+ const option = this.moduleOptionMap.get(id$1);
3933
+ if (!option) {
3934
+ const raw = {
3935
+ moduleSideEffects: null,
3936
+ meta: {}
3937
+ };
3938
+ this.moduleOptionMap.set(id$1, raw);
3939
+ return raw;
3940
+ }
3717
3941
  return option;
3718
3942
  }
3719
- return existing;
3720
- }
3721
- getModuleOption(id$1) {
3722
- const option = this.moduleOptionMap.get(id$1);
3723
- if (!option) {
3724
- const raw = {
3725
- moduleSideEffects: null,
3726
- meta: {}
3727
- };
3728
- this.moduleOptionMap.set(id$1, raw);
3729
- return raw;
3943
+ getModuleInfo(id$1, context) {
3944
+ const bindingInfo = context.getModuleInfo(id$1);
3945
+ if (bindingInfo) {
3946
+ const info = transformModuleInfo(bindingInfo, this.getModuleOption(id$1));
3947
+ return this.proxyModuleInfo(id$1, info);
3948
+ }
3949
+ return null;
3730
3950
  }
3731
- return option;
3732
- }
3733
- getModuleInfo(id$1, context) {
3734
- const bindingInfo = context.getModuleInfo(id$1);
3735
- if (bindingInfo) {
3736
- const info = transformModuleInfo(bindingInfo, this.getModuleOption(id$1));
3737
- return this.proxyModuleInfo(id$1, info);
3951
+ proxyModuleInfo(id$1, info) {
3952
+ let moduleSideEffects = info.moduleSideEffects;
3953
+ Object.defineProperty(info, "moduleSideEffects", {
3954
+ get() {
3955
+ return moduleSideEffects;
3956
+ },
3957
+ set: (v) => {
3958
+ this.updateModuleOption(id$1, {
3959
+ moduleSideEffects: v,
3960
+ meta: info.meta,
3961
+ invalidate: true
3962
+ });
3963
+ moduleSideEffects = v;
3964
+ }
3965
+ });
3966
+ return info;
3738
3967
  }
3739
- return null;
3740
- }
3741
- proxyModuleInfo(id$1, info) {
3742
- let moduleSideEffects = info.moduleSideEffects;
3743
- Object.defineProperty(info, "moduleSideEffects", {
3744
- get() {
3745
- return moduleSideEffects;
3746
- },
3747
- set: (v) => {
3748
- this.updateModuleOption(id$1, {
3749
- moduleSideEffects: v,
3750
- meta: info.meta,
3751
- invalidate: true
3752
- });
3753
- moduleSideEffects = v;
3754
- }
3755
- });
3756
- return info;
3757
- }
3758
- getModuleIds(context) {
3759
- const moduleIds = context.getModuleIds();
3760
- return moduleIds.values();
3761
- }
3762
- saveResolveOptions(options) {
3763
- const index = this.resolveOptionsMap.size;
3764
- this.resolveOptionsMap.set(index, options);
3765
- return index;
3766
- }
3767
- getSavedResolveOptions(receipt) {
3768
- return this.resolveOptionsMap.get(receipt);
3769
- }
3770
- removeSavedResolveOptions(receipt) {
3771
- this.resolveOptionsMap.delete(receipt);
3772
- }
3773
- setRenderChunkMeta(meta) {
3774
- this.renderedChunkMeta = meta;
3775
- }
3776
- getRenderChunkMeta() {
3777
- return this.renderedChunkMeta;
3778
- }
3779
- markModuleLoaded(id$1, _success) {
3780
- const resolve = this.loadModulePromiseResolveFnMap.get(id$1);
3781
- if (resolve) resolve();
3782
- }
3783
- clear() {
3784
- this.renderedChunkMeta = null;
3785
- this.loadModulePromiseMap.clear();
3786
- this.loadModulePromiseResolveFnMap.clear();
3787
- }
3788
- };
3968
+ getModuleIds(context) {
3969
+ const moduleIds = context.getModuleIds();
3970
+ return moduleIds.values();
3971
+ }
3972
+ saveResolveOptions(options) {
3973
+ const index = this.resolveOptionsMap.size;
3974
+ this.resolveOptionsMap.set(index, options);
3975
+ return index;
3976
+ }
3977
+ getSavedResolveOptions(receipt) {
3978
+ return this.resolveOptionsMap.get(receipt);
3979
+ }
3980
+ removeSavedResolveOptions(receipt) {
3981
+ this.resolveOptionsMap.delete(receipt);
3982
+ }
3983
+ setRenderChunkMeta(meta) {
3984
+ this.renderedChunkMeta = meta;
3985
+ }
3986
+ getRenderChunkMeta() {
3987
+ return this.renderedChunkMeta;
3988
+ }
3989
+ markModuleLoaded(id$1, _success) {
3990
+ const resolve = this.loadModulePromiseResolveFnMap.get(id$1);
3991
+ if (resolve) resolve();
3992
+ }
3993
+ clear() {
3994
+ this.renderedChunkMeta = null;
3995
+ this.loadModulePromiseMap.clear();
3996
+ this.loadModulePromiseResolveFnMap.clear();
3997
+ }
3998
+ };
3999
+ } });
3789
4000
 
3790
4001
  //#endregion
3791
4002
  //#region src/utils/normalize-string-or-regex.ts
@@ -3797,6 +4008,7 @@ function normalizedStringOrRegex(pattern) {
3797
4008
  function isReadonlyArray(input) {
3798
4009
  return Array.isArray(input);
3799
4010
  }
4011
+ var init_normalize_string_or_regex = __esm({ "src/utils/normalize-string-or-regex.ts"() {} });
3800
4012
 
3801
4013
  //#endregion
3802
4014
  //#region src/utils/bindingify-input-options.ts
@@ -3987,31 +4199,31 @@ function bindingifyMakeAbsoluteExternalsRelative(makeAbsoluteExternalsRelative)
3987
4199
  field0: makeAbsoluteExternalsRelative
3988
4200
  };
3989
4201
  }
4202
+ var init_bindingify_input_options = __esm({ "src/utils/bindingify-input-options.ts"() {
4203
+ init_constructors();
4204
+ init_utils();
4205
+ init_bindingify_plugin();
4206
+ init_plugin_context_data();
4207
+ init_misc();
4208
+ init_normalize_string_or_regex();
4209
+ init_transform_side_effects();
4210
+ } });
3990
4211
 
3991
4212
  //#endregion
3992
4213
  //#region src/utils/plugin/index.ts
3993
- const isPluginHookName = function() {
3994
- const PLUGIN_HOOK_NAMES_SET = new Set(ENUMERATED_PLUGIN_HOOK_NAMES);
3995
- return function isPluginHookName$1(hookName) {
3996
- return PLUGIN_HOOK_NAMES_SET.has(hookName);
3997
- };
3998
- }();
4214
+ var isPluginHookName;
4215
+ var init_plugin = __esm({ "src/utils/plugin/index.ts"() {
4216
+ init_plugin$1();
4217
+ isPluginHookName = function() {
4218
+ const PLUGIN_HOOK_NAMES_SET = new Set(ENUMERATED_PLUGIN_HOOK_NAMES);
4219
+ return function isPluginHookName$1(hookName) {
4220
+ return PLUGIN_HOOK_NAMES_SET.has(hookName);
4221
+ };
4222
+ }();
4223
+ } });
3999
4224
 
4000
4225
  //#endregion
4001
4226
  //#region src/utils/compose-js-plugins.ts
4002
- const unsupportedHookName = [
4003
- "augmentChunkHash",
4004
- "generateBundle",
4005
- "moduleParsed",
4006
- "onLog",
4007
- "options",
4008
- "outputOptions",
4009
- "renderError",
4010
- "renderStart",
4011
- "resolveDynamicImport",
4012
- "writeBundle"
4013
- ];
4014
- const unsupportedHooks = new Set(unsupportedHookName);
4015
4227
  function isUnsupportedHooks(hookName) {
4016
4228
  return unsupportedHooks.has(hookName);
4017
4229
  }
@@ -4304,6 +4516,28 @@ function composeJsPlugins(plugins) {
4304
4516
  }
4305
4517
  return newPlugins;
4306
4518
  }
4519
+ var unsupportedHookName, unsupportedHooks;
4520
+ var init_compose_js_plugins = __esm({ "src/utils/compose-js-plugins.ts"() {
4521
+ init_dist$1();
4522
+ init_constructors();
4523
+ init_plugin_context$1();
4524
+ init_misc();
4525
+ init_normalize_hook();
4526
+ init_plugin();
4527
+ unsupportedHookName = [
4528
+ "augmentChunkHash",
4529
+ "generateBundle",
4530
+ "moduleParsed",
4531
+ "onLog",
4532
+ "options",
4533
+ "outputOptions",
4534
+ "renderError",
4535
+ "renderStart",
4536
+ "resolveDynamicImport",
4537
+ "writeBundle"
4538
+ ];
4539
+ unsupportedHooks = new Set(unsupportedHookName);
4540
+ } });
4307
4541
 
4308
4542
  //#endregion
4309
4543
  //#region src/utils/initialize-parallel-plugins.ts
@@ -4356,16 +4590,19 @@ async function initializeWorker(registryId, pluginInfos, threadNumber) {
4356
4590
  throw e$1;
4357
4591
  }
4358
4592
  }
4359
- const availableParallelism = () => {
4360
- let availableParallelism$1 = 1;
4361
- try {
4362
- availableParallelism$1 = os.availableParallelism();
4363
- } catch {
4364
- const cpus = os.cpus();
4365
- if (Array.isArray(cpus) && cpus.length > 0) availableParallelism$1 = cpus.length;
4366
- }
4367
- return Math.min(availableParallelism$1, 8);
4368
- };
4593
+ var availableParallelism;
4594
+ var init_initialize_parallel_plugins = __esm({ "src/utils/initialize-parallel-plugins.ts"() {
4595
+ availableParallelism = () => {
4596
+ let availableParallelism$1 = 1;
4597
+ try {
4598
+ availableParallelism$1 = os.availableParallelism();
4599
+ } catch {
4600
+ const cpus = os.cpus();
4601
+ if (Array.isArray(cpus) && cpus.length > 0) availableParallelism$1 = cpus.length;
4602
+ }
4603
+ return Math.min(availableParallelism$1, 8);
4604
+ };
4605
+ } });
4369
4606
 
4370
4607
  //#endregion
4371
4608
  //#region src/utils/create-bundler-option.ts
@@ -4401,10 +4638,19 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode, isCl
4401
4638
  throw e$1;
4402
4639
  }
4403
4640
  }
4641
+ var init_create_bundler_option = __esm({ "src/utils/create-bundler-option.ts"() {
4642
+ init_logger();
4643
+ init_logging();
4644
+ init_plugin_driver();
4645
+ init_bindingify_input_options();
4646
+ init_bindingify_output_options();
4647
+ init_compose_js_plugins();
4648
+ init_initialize_parallel_plugins();
4649
+ init_normalize_plugin_option();
4650
+ } });
4404
4651
 
4405
4652
  //#endregion
4406
4653
  //#region src/utils/create-bundler.ts
4407
- let asyncRuntimeShutdown = false;
4408
4654
  async function createBundler(inputOptions, outputOptions, isClose) {
4409
4655
  const option = await createBundlerOptions(inputOptions, outputOptions, false, isClose);
4410
4656
  if (asyncRuntimeShutdown) startAsyncRuntime();
@@ -4422,62 +4668,79 @@ async function createBundler(inputOptions, outputOptions, isClose) {
4422
4668
  throw e$1;
4423
4669
  }
4424
4670
  }
4671
+ var asyncRuntimeShutdown;
4672
+ var init_create_bundler = __esm({ "src/utils/create-bundler.ts"() {
4673
+ init_create_bundler_option();
4674
+ asyncRuntimeShutdown = false;
4675
+ } });
4425
4676
 
4426
4677
  //#endregion
4427
4678
  //#region src/api/rolldown/rolldown-build.ts
4428
- Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
4429
- var RolldownBuild = class {
4430
- #inputOptions;
4431
- #bundler;
4432
- constructor(inputOptions) {
4433
- this.#inputOptions = inputOptions;
4434
- }
4435
- get closed() {
4436
- return this.#bundler?.bundler.closed ?? false;
4437
- }
4438
- async #getBundlerWithStopWorker(outputOptions, isClose) {
4439
- if (this.#bundler) await this.#bundler.stopWorkers?.();
4440
- return this.#bundler = await createBundler(this.#inputOptions, outputOptions, isClose);
4441
- }
4442
- async generate(outputOptions = {}) {
4443
- validateOption("output", outputOptions);
4444
- const { bundler } = await this.#getBundlerWithStopWorker(outputOptions);
4445
- const output = await bundler.generate();
4446
- return transformToRollupOutput(output);
4447
- }
4448
- async write(outputOptions = {}) {
4449
- validateOption("output", outputOptions);
4450
- const { bundler } = await this.#getBundlerWithStopWorker(outputOptions);
4451
- const output = await bundler.write();
4452
- return transformToRollupOutput(output);
4453
- }
4454
- async close() {
4455
- const { bundler, stopWorkers, shutdown } = await this.#getBundlerWithStopWorker({}, true);
4456
- await stopWorkers?.();
4457
- await bundler.close();
4458
- shutdown();
4459
- }
4460
- async [Symbol.asyncDispose]() {
4461
- await this.close();
4462
- }
4463
- async generateHmrPatch(changedFiles) {
4464
- return this.#bundler?.bundler.generateHmrPatch(changedFiles);
4465
- }
4466
- async hmrInvalidate(file, firstInvalidatedBy) {
4467
- return this.#bundler?.bundler.hmrInvalidate(file, firstInvalidatedBy);
4468
- }
4469
- get watchFiles() {
4470
- return this.#bundler?.bundler.getWatchFiles() ?? Promise.resolve([]);
4471
- }
4472
- };
4679
+ var RolldownBuild;
4680
+ var init_rolldown_build = __esm({ "src/api/rolldown/rolldown-build.ts"() {
4681
+ init_create_bundler();
4682
+ init_transform_to_rollup_output();
4683
+ init_validator();
4684
+ Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
4685
+ RolldownBuild = class {
4686
+ #inputOptions;
4687
+ #bundler;
4688
+ constructor(inputOptions) {
4689
+ this.#inputOptions = inputOptions;
4690
+ }
4691
+ get closed() {
4692
+ return this.#bundler?.bundler.closed ?? false;
4693
+ }
4694
+ async #getBundlerWithStopWorker(outputOptions, isClose) {
4695
+ if (this.#bundler) await this.#bundler.stopWorkers?.();
4696
+ return this.#bundler = await createBundler(this.#inputOptions, outputOptions, isClose);
4697
+ }
4698
+ async generate(outputOptions = {}) {
4699
+ validateOption("output", outputOptions);
4700
+ const { bundler } = await this.#getBundlerWithStopWorker(outputOptions);
4701
+ const output = await bundler.generate();
4702
+ return transformToRollupOutput(output);
4703
+ }
4704
+ async write(outputOptions = {}) {
4705
+ validateOption("output", outputOptions);
4706
+ const { bundler } = await this.#getBundlerWithStopWorker(outputOptions);
4707
+ const output = await bundler.write();
4708
+ return transformToRollupOutput(output);
4709
+ }
4710
+ async close() {
4711
+ const { bundler, stopWorkers, shutdown } = await this.#getBundlerWithStopWorker({}, true);
4712
+ await stopWorkers?.();
4713
+ await bundler.close();
4714
+ shutdown();
4715
+ }
4716
+ async [Symbol.asyncDispose]() {
4717
+ await this.close();
4718
+ }
4719
+ async generateHmrPatch(changedFiles) {
4720
+ return this.#bundler?.bundler.generateHmrPatch(changedFiles);
4721
+ }
4722
+ async hmrInvalidate(file, firstInvalidatedBy) {
4723
+ return this.#bundler?.bundler.hmrInvalidate(file, firstInvalidatedBy);
4724
+ }
4725
+ get watchFiles() {
4726
+ return this.#bundler?.bundler.getWatchFiles() ?? Promise.resolve([]);
4727
+ }
4728
+ };
4729
+ } });
4473
4730
 
4474
4731
  //#endregion
4475
4732
  //#region src/api/rolldown/index.ts
4476
- const rolldown = async (input) => {
4477
- validateOption("input", input);
4478
- const inputOptions = await PluginDriver.callOptionsHook(input);
4479
- return new RolldownBuild(inputOptions);
4480
- };
4733
+ var rolldown;
4734
+ var init_rolldown = __esm({ "src/api/rolldown/index.ts"() {
4735
+ init_plugin_driver();
4736
+ init_validator();
4737
+ init_rolldown_build();
4738
+ rolldown = async (input) => {
4739
+ validateOption("input", input);
4740
+ const inputOptions = await PluginDriver.callOptionsHook(input);
4741
+ return new RolldownBuild(inputOptions);
4742
+ };
4743
+ } });
4481
4744
 
4482
4745
  //#endregion
4483
4746
  //#region src/api/build.ts
@@ -4494,106 +4757,86 @@ async function build(options) {
4494
4757
  }
4495
4758
  }
4496
4759
  }
4760
+ var init_build = __esm({ "src/api/build.ts"() {
4761
+ init_rolldown();
4762
+ } });
4497
4763
 
4498
4764
  //#endregion
4499
4765
  //#region src/api/watch/watch-emitter.ts
4500
- var WatcherEmitter = class {
4501
- listeners = /* @__PURE__ */ new Map();
4502
- timer;
4503
- constructor() {
4504
- this.timer = setInterval(() => {}, 1e9);
4505
- }
4506
- on(event, listener) {
4507
- const listeners = this.listeners.get(event);
4508
- if (listeners) listeners.push(listener);
4509
- else this.listeners.set(event, [listener]);
4510
- return this;
4511
- }
4512
- off(event, listener) {
4513
- const listeners = this.listeners.get(event);
4514
- if (listeners) {
4515
- const index = listeners.indexOf(listener);
4516
- if (index !== -1) listeners.splice(index, 1);
4766
+ var WatcherEmitter;
4767
+ var init_watch_emitter = __esm({ "src/api/watch/watch-emitter.ts"() {
4768
+ init_error();
4769
+ WatcherEmitter = class {
4770
+ listeners = /* @__PURE__ */ new Map();
4771
+ timer;
4772
+ constructor() {
4773
+ this.timer = setInterval(() => {}, 1e9);
4517
4774
  }
4518
- return this;
4519
- }
4520
- async onEvent(event) {
4521
- const listeners = this.listeners.get(event.eventKind());
4522
- if (listeners) switch (event.eventKind()) {
4523
- case "close":
4524
- case "restart":
4525
- for (const listener of listeners) await listener();
4526
- break;
4527
- case "event":
4528
- for (const listener of listeners) {
4529
- const code$1 = event.bundleEventKind();
4530
- switch (code$1) {
4531
- case "BUNDLE_END":
4532
- const { duration, output, result } = event.bundleEndData();
4533
- await listener({
4534
- code: "BUNDLE_END",
4535
- duration,
4536
- output: [output],
4537
- result
4538
- });
4539
- break;
4540
- case "ERROR":
4541
- const data = event.bundleErrorData();
4542
- await listener({
4543
- code: "ERROR",
4544
- error: normalizeErrors(data.error),
4545
- result: data.result
4546
- });
4547
- break;
4548
- default:
4549
- await listener({ code: code$1 });
4550
- break;
4775
+ on(event, listener) {
4776
+ const listeners = this.listeners.get(event);
4777
+ if (listeners) listeners.push(listener);
4778
+ else this.listeners.set(event, [listener]);
4779
+ return this;
4780
+ }
4781
+ off(event, listener) {
4782
+ const listeners = this.listeners.get(event);
4783
+ if (listeners) {
4784
+ const index = listeners.indexOf(listener);
4785
+ if (index !== -1) listeners.splice(index, 1);
4786
+ }
4787
+ return this;
4788
+ }
4789
+ async onEvent(event) {
4790
+ const listeners = this.listeners.get(event.eventKind());
4791
+ if (listeners) switch (event.eventKind()) {
4792
+ case "close":
4793
+ case "restart":
4794
+ for (const listener of listeners) await listener();
4795
+ break;
4796
+ case "event":
4797
+ for (const listener of listeners) {
4798
+ const code$1 = event.bundleEventKind();
4799
+ switch (code$1) {
4800
+ case "BUNDLE_END":
4801
+ const { duration, output, result } = event.bundleEndData();
4802
+ await listener({
4803
+ code: "BUNDLE_END",
4804
+ duration,
4805
+ output: [output],
4806
+ result
4807
+ });
4808
+ break;
4809
+ case "ERROR":
4810
+ const data = event.bundleErrorData();
4811
+ await listener({
4812
+ code: "ERROR",
4813
+ error: normalizeErrors(data.error),
4814
+ result: data.result
4815
+ });
4816
+ break;
4817
+ default:
4818
+ await listener({ code: code$1 });
4819
+ break;
4820
+ }
4551
4821
  }
4552
- }
4553
- break;
4554
- case "change":
4555
- for (const listener of listeners) {
4556
- const { path: path$1, kind } = event.watchChangeData();
4557
- await listener(path$1, { event: kind });
4558
- }
4559
- break;
4560
- default: throw new Error(`Unknown event: ${event}`);
4822
+ break;
4823
+ case "change":
4824
+ for (const listener of listeners) {
4825
+ const { path: path$1, kind } = event.watchChangeData();
4826
+ await listener(path$1, { event: kind });
4827
+ }
4828
+ break;
4829
+ default: throw new Error(`Unknown event: ${event}`);
4830
+ }
4561
4831
  }
4562
- }
4563
- async close() {
4564
- clearInterval(this.timer);
4565
- }
4566
- };
4832
+ async close() {
4833
+ clearInterval(this.timer);
4834
+ }
4835
+ };
4836
+ } });
4567
4837
 
4568
4838
  //#endregion
4569
4839
  //#region src/api/watch/watcher.ts
4570
- var Watcher = class {
4571
- closed;
4572
- inner;
4573
- emitter;
4574
- stopWorkers;
4575
- constructor(emitter, inner, stopWorkers) {
4576
- this.closed = false;
4577
- this.inner = inner;
4578
- this.emitter = emitter;
4579
- const originClose = emitter.close.bind(emitter);
4580
- emitter.close = async () => {
4581
- await this.close();
4582
- originClose();
4583
- };
4584
- this.stopWorkers = stopWorkers;
4585
- }
4586
- async close() {
4587
- if (this.closed) return;
4588
- this.closed = true;
4589
- for (const stop of this.stopWorkers) await stop?.();
4590
- await this.inner.close();
4591
- shutdownAsyncRuntime();
4592
- }
4593
- start() {
4594
- process.nextTick(() => this.inner.start(this.emitter.onEvent.bind(this.emitter)));
4595
- }
4596
- };
4597
4840
  async function createWatcher(emitter, input) {
4598
4841
  const options = arraify(input);
4599
4842
  const bundlerOptions = await Promise.all(options.map((option) => arraify(option.output || {}).map(async (output) => {
@@ -4615,24 +4858,71 @@ function getValidNotifyOption(bundlerOptions) {
4615
4858
  } else result = notifyOption;
4616
4859
  }
4617
4860
  }
4861
+ var Watcher;
4862
+ var init_watcher = __esm({ "src/api/watch/watcher.ts"() {
4863
+ init_logging();
4864
+ init_logs();
4865
+ init_plugin_driver();
4866
+ init_create_bundler_option();
4867
+ init_misc();
4868
+ Watcher = class {
4869
+ closed;
4870
+ inner;
4871
+ emitter;
4872
+ stopWorkers;
4873
+ constructor(emitter, inner, stopWorkers) {
4874
+ this.closed = false;
4875
+ this.inner = inner;
4876
+ this.emitter = emitter;
4877
+ const originClose = emitter.close.bind(emitter);
4878
+ emitter.close = async () => {
4879
+ await this.close();
4880
+ originClose();
4881
+ };
4882
+ this.stopWorkers = stopWorkers;
4883
+ }
4884
+ async close() {
4885
+ if (this.closed) return;
4886
+ this.closed = true;
4887
+ for (const stop of this.stopWorkers) await stop?.();
4888
+ await this.inner.close();
4889
+ shutdownAsyncRuntime();
4890
+ }
4891
+ start() {
4892
+ process.nextTick(() => this.inner.start(this.emitter.onEvent.bind(this.emitter)));
4893
+ }
4894
+ };
4895
+ } });
4618
4896
 
4619
4897
  //#endregion
4620
4898
  //#region src/api/watch/index.ts
4621
- const watch = (input) => {
4622
- const emitter = new WatcherEmitter();
4623
- createWatcher(emitter, input);
4624
- return emitter;
4625
- };
4899
+ var watch;
4900
+ var init_watch = __esm({ "src/api/watch/index.ts"() {
4901
+ init_watch_emitter();
4902
+ init_watcher();
4903
+ watch = (input) => {
4904
+ const emitter = new WatcherEmitter();
4905
+ createWatcher(emitter, input);
4906
+ return emitter;
4907
+ };
4908
+ } });
4626
4909
 
4627
4910
  //#endregion
4628
4911
  //#region src/utils/define-config.ts
4629
4912
  function defineConfig(config) {
4630
4913
  return config;
4631
4914
  }
4915
+ var init_define_config = __esm({ "src/utils/define-config.ts"() {} });
4632
4916
 
4633
4917
  //#endregion
4634
4918
  //#region src/index.ts
4635
- const VERSION = version;
4919
+ var VERSION;
4920
+ var init_src = __esm({ "src/index.ts"() {
4921
+ init_build();
4922
+ init_rolldown();
4923
+ init_watch();
4924
+ VERSION = version;
4925
+ } });
4636
4926
 
4637
4927
  //#endregion
4638
- export { BuiltinPlugin, PluginContextData, VERSION, __commonJS, __toESM, ansis_default, assetPlugin, bindingifyPlugin, build, buildImportAnalysisPlugin, composeJsPlugins, createBundler, 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 };
4928
+ export { BuiltinPlugin, PluginContextData, 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_normalize_string_or_regex, init_plugin_context_data, 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 };