rolldown 1.1.4 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/cli.mjs +11 -8
  2. package/dist/config.d.mts +22 -10
  3. package/dist/config.mjs +2 -2
  4. package/dist/experimental-index.d.mts +164 -155
  5. package/dist/experimental-index.mjs +23 -14
  6. package/dist/experimental-runtime-types.d.ts +111 -41
  7. package/dist/filter-index.d.mts +6 -5
  8. package/dist/get-log-filter.d.mts +2 -2
  9. package/dist/index.d.mts +4 -4
  10. package/dist/index.mjs +10 -4
  11. package/dist/parallel-plugin-worker.mjs +2 -2
  12. package/dist/parallel-plugin.d.mts +3 -4
  13. package/dist/parse-ast-index.d.mts +19 -20
  14. package/dist/parse-ast-index.mjs +2 -2
  15. package/dist/plugins-index.d.mts +27 -28
  16. package/dist/plugins-index.mjs +2 -2
  17. package/dist/shared/{binding-B1q9aYT-.d.mts → binding-Dbbi0RbO.d.mts} +49 -25
  18. package/dist/shared/{binding-BmkJW3Wy.mjs → binding-Dby9rwGk.mjs} +26 -26
  19. package/dist/shared/{bindingify-input-options-BsDhfYrS.mjs → bindingify-input-options-_ppP73I9.mjs} +11 -13
  20. package/dist/shared/{constructors-2i1T9YcF.d.mts → constructors-CSWbNgBZ.d.mts} +9 -10
  21. package/dist/shared/{constructors-CE6zZSUt.mjs → constructors-CuGa75s-.mjs} +1 -1
  22. package/dist/shared/define-config-B-IDOhDz.d.mts +4003 -0
  23. package/dist/shared/dist-DKbukT1H.mjs +154 -0
  24. package/dist/shared/{error-BlQ0-ek7.mjs → error-DFGNOCle.mjs} +1 -1
  25. package/dist/shared/get-log-filter-AjBknEEO.d.mts +34 -0
  26. package/dist/shared/{load-config-FRmAU9xl.mjs → load-config-C6UyiS41.mjs} +19 -2
  27. package/dist/shared/{logging-BSNejiLS.d.mts → logging-xuHO4mAy.d.mts} +6 -6
  28. package/dist/shared/{logs-aMKUxRpj.mjs → logs-ZGEh6uhb.mjs} +6 -1
  29. package/dist/shared/{normalize-string-or-regex-BYkbbGqQ.mjs → normalize-string-or-regex-SiXbePVH.mjs} +2 -2
  30. package/dist/shared/{parse-DVMnkavl.mjs → parse-BFj5G_7i.mjs} +2 -2
  31. package/dist/shared/{prompt-B1Yc1NPt.mjs → prompt--dNycKSZ.mjs} +59 -17
  32. package/dist/shared/{resolve-tsconfig-CdIAR1Eb.mjs → resolve-tsconfig-2TXRF_zr.mjs} +2 -2
  33. package/dist/shared/{rolldown-tbHvKzVl.mjs → rolldown-951h_1lf.mjs} +1 -1
  34. package/dist/shared/{rolldown-build-aV0QeeTW.mjs → rolldown-build-CdF8HAHX.mjs} +33 -13
  35. package/dist/shared/transform-Cs2bUDRH.d.mts +148 -0
  36. package/dist/shared/{watch-DIhJ-T1s.mjs → watch-WnrlHRS0.mjs} +5 -5
  37. package/dist/utils-index.d.mts +29 -30
  38. package/dist/utils-index.mjs +8 -6
  39. package/package.json +23 -22
  40. package/dist/shared/define-config-BBz954-q.d.mts +0 -3901
  41. package/dist/shared/get-log-filter-BpNVNJ5-.d.mts +0 -35
  42. package/dist/shared/transform-CEmFsvJW.d.mts +0 -149
@@ -0,0 +1,154 @@
1
+ import { Module } from "node:module";
2
+ import { MessageChannel } from "node:worker_threads";
3
+ import { fileURLToPath } from "node:url";
4
+ //#region ../../node_modules/.pnpm/fresh-import@0.2.1/node_modules/fresh-import/dist/index.js
5
+ const instanceId = Math.random().toString(36).slice(2);
6
+ const relativeImportRE = /^\.{1,2}(?:\/|\\)/;
7
+ function escapeRegExp(value) {
8
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
9
+ }
10
+ /**
11
+ * The tracking query name `fresh-import-<instance>`, where `<instance>` is a
12
+ * random value unique to this loaded module instance. Any two instances (even
13
+ * two copies of the same build loaded into the same process) get distinct
14
+ * names, so each hook only recognizes the imports it tagged itself.
15
+ */
16
+ function buildQueryName() {
17
+ return `fresh-import-${instanceId}`;
18
+ }
19
+ /**
20
+ * Build the regex that matches the tracking query `?<name>=<id>,<context>`
21
+ * (or the `&<name>=...` form).
22
+ */
23
+ function buildQueryRE(queryName) {
24
+ return new RegExp(`(?:\\?|&)${escapeRegExp(queryName)}=(\\d+),([^&]+)(?:&|$)`);
25
+ }
26
+ /**
27
+ * Build the tracking query `?<name>=<id>,<context>` that `collect` appends to
28
+ * the entry specifier. `id` cache-busts the import (a distinct URL forces a
29
+ * fresh evaluation) and `context` tags the import graph so the resolve hook can
30
+ * attribute resolved dependencies back to the originating collect.
31
+ */
32
+ function formatTrackingQuery(queryName, id, context) {
33
+ return `?${queryName}=${id},${context}`;
34
+ }
35
+ /**
36
+ * Shared body of the resolve hook for both the on-thread and off-thread
37
+ * importers. Given an already-resolved `result`, decides whether it is a tracked
38
+ * relative file dependency; if so, reports it via `onDependency` and tags the
39
+ * URL so the query propagates to its own dependencies.
40
+ *
41
+ * The sync/async difference between the two hooks lives entirely in the caller
42
+ * (which awaits `nextResolve` or not); this function performs no I/O. `result`
43
+ * is mutated in place and returned.
44
+ */
45
+ function trackResolved(specifier, context, result, queryName, queryRE, onDependency) {
46
+ const isRelativeImport = relativeImportRE.test(specifier);
47
+ if (result.format === "builtin" || !isRelativeImport) return result;
48
+ if (!context.parentURL || queryRE.test(result.url) || !result.url.startsWith("file:")) return result;
49
+ const m = queryRE.exec(context.parentURL);
50
+ if (m) {
51
+ const [, id, contextFile] = m;
52
+ onDependency(contextFile, result.url);
53
+ result.url = result.url.replace(/(\?)|$/, (_n, n1) => `?${queryName}=${id},${contextFile}${n1 === "?" ? "&" : ""}`);
54
+ }
55
+ return result;
56
+ }
57
+ var loader_default = "data:text/javascript,Math.random().toString(36).slice(2);%0Aconst relativeImportRE = /^\\.{1,2}(%3F:\\/|\\\\)/;%0Afunction escapeRegExp(value) {%0A%09return value.replace(/[.*+%3F^${}()|[\\]\\\\]/g, \"\\\\$&\");%0A}%0A/**%0A* Build the regex that matches the tracking query `%3F<name>=<id>,<context>`%0A* (or the `&<name>=...` form).%0A*/%0Afunction buildQueryRE(queryName) {%0A%09return new RegExp(`(%3F:\\\\%3F|&)${escapeRegExp(queryName)}=(\\\\d+),([^&]+)(%3F:&|$)`);%0A}%0A/**%0A* Shared body of the resolve hook for both the on-thread and off-thread%0A* importers. Given an already-resolved `result`, decides whether it is a tracked%0A* relative file dependency; if so, reports it via `onDependency` and tags the%0A* URL so the query propagates to its own dependencies.%0A*%0A* The sync/async difference between the two hooks lives entirely in the caller%0A* (which awaits `nextResolve` or not); this function performs no I/O. `result`%0A* is mutated in place and returned.%0A*/%0Afunction trackResolved(specifier, context, result, queryName, queryRE, onDependency) {%0A%09const isRelativeImport = relativeImportRE.test(specifier);%0A%09if (result.format === \"builtin\" || !isRelativeImport) return result;%0A%09if (!context.parentURL || queryRE.test(result.url) || !result.url.startsWith(\"file:\")) return result;%0A%09const m = queryRE.exec(context.parentURL);%0A%09if (m) {%0A%09%09const [, id, contextFile] = m;%0A%09%09onDependency(contextFile, result.url);%0A%09%09result.url = result.url.replace(/(\\%3F)|$/, (_n, n1) => `%3F${queryName}=${id},${contextFile}${n1 === \"%3F\" %3F \"&\" : \"\"}`);%0A%09}%0A%09return result;%0A}%0A//%23endregion%0A//%23region src/off-thread/loader.ts%0Alet port;%0Alet queryName;%0Alet queryRE;%0Aconst initialize = async (data) => {%0A%09port = data.port;%0A%09queryName = data.queryName;%0A%09queryRE = buildQueryRE(queryName);%0A};%0Aconst resolve = async (specifier, context, nextResolve) => {%0A%09return trackResolved(specifier, context, await nextResolve(specifier, context), queryName, queryRE, (ctx, url) => {%0A%09%09port.postMessage({%0A%09%09%09context: ctx,%0A%09%09%09url%0A%09%09});%0A%09});%0A};%0A//%23endregion%0Aexport { initialize, resolve };%0A";
58
+ let nextId$1 = 0;
59
+ /**
60
+ * Off-thread importer: registers an ESM loader in a worker thread via
61
+ * `Module.register` and receives tracked dependencies over a `MessagePort`.
62
+ * Used on Node versions without `Module.registerHooks`.
63
+ */
64
+ function createOffThreadImporter() {
65
+ const queryName = buildQueryName();
66
+ const { port1, port2 } = new MessageChannel();
67
+ Module.register(loader_default, {
68
+ data: {
69
+ port: port2,
70
+ queryName
71
+ },
72
+ transferList: [port2]
73
+ });
74
+ port1.unref();
75
+ return { async collect(specifier) {
76
+ const id = nextId$1++;
77
+ const depsList = /* @__PURE__ */ new Set();
78
+ const onMessage = (e) => {
79
+ if (e.context === specifier) depsList.add(e.url);
80
+ };
81
+ port1.on("message", onMessage);
82
+ port1.unref();
83
+ try {
84
+ const result = await import(specifier + formatTrackingQuery(queryName, id, specifier));
85
+ await new Promise((resolve) => setImmediate(resolve));
86
+ return {
87
+ result,
88
+ dependencies: [...depsList].filter((url) => url.startsWith("file:")).map((url) => fileURLToPath(url))
89
+ };
90
+ } finally {
91
+ port1.off("message", onMessage);
92
+ }
93
+ } };
94
+ }
95
+ let nextId = 0;
96
+ /**
97
+ * On-thread importer: registers synchronous resolution hooks via
98
+ * `Module.registerHooks` (Node 22.15+/23.5+).
99
+ */
100
+ function createOnThreadImporter() {
101
+ const registry = /* @__PURE__ */ new Map();
102
+ const queryName = buildQueryName();
103
+ const queryRE = buildQueryRE(queryName);
104
+ const resolve = (specifier, context, nextResolve) => {
105
+ return trackResolved(specifier, context, nextResolve(specifier, context), queryName, queryRE, (ctx, url) => {
106
+ registry.get(ctx)?.add(url);
107
+ });
108
+ };
109
+ Module.registerHooks({ resolve });
110
+ return { async collect(specifier) {
111
+ const id = nextId++;
112
+ const depsList = /* @__PURE__ */ new Set();
113
+ registry.set(specifier, depsList);
114
+ try {
115
+ return {
116
+ result: await import(specifier + formatTrackingQuery(queryName, id, specifier)),
117
+ dependencies: [...depsList].filter((url) => url.startsWith("file:")).map((url) => fileURLToPath(url))
118
+ };
119
+ } finally {
120
+ registry.delete(specifier);
121
+ }
122
+ } };
123
+ }
124
+ /**
125
+ * Create the importer best suited to the current runtime, or `undefined` if it
126
+ * provides neither module-hook API.
127
+ */
128
+ function createImporter() {
129
+ if (Module.registerHooks) return createOnThreadImporter();
130
+ if (Module.register) return createOffThreadImporter();
131
+ }
132
+ let importer;
133
+ let initialized = false;
134
+ /**
135
+ * Import an ESM entry in its own fresh module graph (separate from Node's module
136
+ * cache and from other concurrent imports) and report the dependency files it
137
+ * pulled in.
138
+ *
139
+ * Each call re-evaluates the entry in a fresh graph; concurrent calls stay
140
+ * isolated from one another. Only statically-imported relative dependencies are
141
+ * tracked, not dynamic imports.
142
+ *
143
+ * Returns `undefined` on runtimes that provide neither `Module.registerHooks`
144
+ * nor `Module.register`.
145
+ */
146
+ function freshImport(specifier) {
147
+ if (!initialized) {
148
+ importer = createImporter();
149
+ initialized = true;
150
+ }
151
+ return importer?.collect(specifier);
152
+ }
153
+ //#endregion
154
+ export { freshImport };
@@ -1,4 +1,4 @@
1
- import { t as require_binding } from "./binding-BmkJW3Wy.mjs";
1
+ import { t as require_binding } from "./binding-Dby9rwGk.mjs";
2
2
  //#region src/types/sourcemap.ts
3
3
  function bindingifySourcemap(map) {
4
4
  if (map == null) return;
@@ -0,0 +1,34 @@
1
+ import { a as RolldownLog } from "./logging-xuHO4mAy.mjs";
2
+ //#region src/get-log-filter.d.ts
3
+ /**
4
+ * @param filters A list of log filters to apply
5
+ * @returns A function that tests whether a log should be output
6
+ *
7
+ * @category Config
8
+ */
9
+ type GetLogFilter = (filters: string[]) => (log: RolldownLog) => boolean;
10
+ /**
11
+ * A helper function to generate log filters using the same syntax as the CLI.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * import { defineConfig } from 'rolldown';
16
+ * import { getLogFilter } from 'rolldown/getLogFilter';
17
+ *
18
+ * const logFilter = getLogFilter(['code:FOO', 'code:BAR']);
19
+ *
20
+ * export default defineConfig({
21
+ * input: 'main.js',
22
+ * onLog(level, log, handler) {
23
+ * if (logFilter(log)) {
24
+ * handler(level, log);
25
+ * }
26
+ * }
27
+ * });
28
+ * ```
29
+ *
30
+ * @category Config
31
+ */
32
+ declare const getLogFilter: GetLogFilter;
33
+ //#endregion
34
+ export { getLogFilter as n, GetLogFilter as t };
@@ -1,4 +1,4 @@
1
- import { t as rolldown } from "./rolldown-tbHvKzVl.mjs";
1
+ import { t as rolldown } from "./rolldown-951h_1lf.mjs";
2
2
  import fs from "node:fs";
3
3
  import path from "node:path";
4
4
  import { readdir } from "node:fs/promises";
@@ -98,21 +98,38 @@ function tryStatSync(file) {
98
98
  return fs.statSync(file, { throwIfNoEntry: false });
99
99
  } catch {}
100
100
  }
101
+ async function loadNativeConfig(resolvedPath) {
102
+ const url = pathToFileURL(resolvedPath).href;
103
+ const { freshImport } = await import("./dist-DKbukT1H.mjs");
104
+ const freshImported = freshImport(url);
105
+ if (freshImported) {
106
+ const { result } = await freshImported;
107
+ return result.default;
108
+ }
109
+ return (await import(url + "?t=" + Date.now())).default;
110
+ }
101
111
  /**
102
112
  * Load config from a file in a way that Rolldown does.
103
113
  *
104
114
  * @param configPath The path to the config file. If empty, it will look for `rolldown.config` with supported extensions in the current working directory.
115
+ * @param options Loading options. `configLoader` selects `'bundle'` (default) or `'native'`.
105
116
  * @returns The loaded config export
106
117
  *
107
118
  * @category Config
108
119
  */
109
- async function loadConfig(configPath) {
120
+ async function loadConfig(configPath, options = {}) {
121
+ const configLoader = options.configLoader ?? "bundle";
110
122
  const ext = path.extname(configPath = configPath || await findConfigFileNameInCwd());
111
123
  try {
124
+ if (configLoader === "native") return await loadNativeConfig(path.resolve(configPath));
112
125
  if (SUPPORTED_JS_CONFIG_FORMATS.includes(ext) || process.env.NODE_OPTIONS?.includes("--import=tsx") && SUPPORTED_TS_CONFIG_FORMATS.includes(ext)) return (await import(pathToFileURL(configPath).href)).default;
113
126
  else if (SUPPORTED_TS_CONFIG_FORMATS.includes(ext)) return await loadTsConfig(path.resolve(configPath));
114
127
  else throw new Error(`Unsupported config format. Expected: \`${SUPPORTED_CONFIG_FORMATS.join(",")}\` but got \`${ext}\``);
115
128
  } catch (err) {
129
+ if (configLoader === "native") {
130
+ const tsHint = SUPPORTED_TS_CONFIG_FORMATS.includes(ext) && !process.features.typescript ? " This runtime does not natively support TypeScript config files." : "";
131
+ throw new Error(`Failed to load the config file "${configPath}" using the "native" config loader.${tsHint} Try "--configLoader bundle", or register a loader such as "--import tsx".`, { cause: err });
132
+ }
116
133
  throw new Error("Error happened while loading config.", { cause: err });
117
134
  }
118
135
  }
@@ -9,9 +9,9 @@ interface RolldownLog {
9
9
  binding?: string;
10
10
  cause?: unknown;
11
11
  /**
12
- * The log code for this log object.
13
- * @example 'PLUGIN_ERROR'
14
- */
12
+ * The log code for this log object.
13
+ * @example 'PLUGIN_ERROR'
14
+ */
15
15
  code?: string;
16
16
  exporter?: string;
17
17
  frame?: string;
@@ -24,9 +24,9 @@ interface RolldownLog {
24
24
  line: number;
25
25
  };
26
26
  /**
27
- * The message for this log object.
28
- * @example 'The "transform" hook used by the output plugin "rolldown-plugin-foo" is a build time hook and will not be run for that plugin. Either this plugin cannot be used as an output plugin, or it should have an option to configure it as an output plugin.'
29
- */
27
+ * The message for this log object.
28
+ * @example 'The "transform" hook used by the output plugin "rolldown-plugin-foo" is a build time hook and will not be run for that plugin. Either this plugin cannot be used as an output plugin, or it should have an option to configure it as an output plugin.'
29
+ */
30
30
  message: string;
31
31
  meta?: any;
32
32
  names?: string[];
@@ -97,7 +97,12 @@ function locate(source, search, options) {
97
97
  }
98
98
  //#endregion
99
99
  //#region src/log/logs.ts
100
- const INVALID_LOG_POSITION = "INVALID_LOG_POSITION", PLUGIN_ERROR = "PLUGIN_ERROR", INPUT_HOOK_IN_OUTPUT_PLUGIN = "INPUT_HOOK_IN_OUTPUT_PLUGIN", CYCLE_LOADING = "CYCLE_LOADING", MULTIPLE_WATCHER_OPTION = "MULTIPLE_WATCHER_OPTION", PARSE_ERROR = "PARSE_ERROR";
100
+ const INVALID_LOG_POSITION = "INVALID_LOG_POSITION";
101
+ const PLUGIN_ERROR = "PLUGIN_ERROR";
102
+ const INPUT_HOOK_IN_OUTPUT_PLUGIN = "INPUT_HOOK_IN_OUTPUT_PLUGIN";
103
+ const CYCLE_LOADING = "CYCLE_LOADING";
104
+ const MULTIPLE_WATCHER_OPTION = "MULTIPLE_WATCHER_OPTION";
105
+ const PARSE_ERROR = "PARSE_ERROR";
101
106
  function logParseError(message, id, pos) {
102
107
  return {
103
108
  code: PARSE_ERROR,
@@ -1,5 +1,5 @@
1
- import { n as __toESM, t as require_binding } from "./binding-BmkJW3Wy.mjs";
2
- import { c as logPluginError, n as error } from "./logs-aMKUxRpj.mjs";
1
+ import { n as __toESM, t as require_binding } from "./binding-Dby9rwGk.mjs";
2
+ import { c as logPluginError, n as error } from "./logs-ZGEh6uhb.mjs";
3
3
  //#region src/builtin-plugin/utils.ts
4
4
  var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
5
5
  var BuiltinPlugin = class {
@@ -1,5 +1,5 @@
1
- import { n as __toESM, t as require_binding } from "./binding-BmkJW3Wy.mjs";
2
- //#region ../../node_modules/.pnpm/oxc-parser@0.138.0/node_modules/oxc-parser/src-js/wrap.js
1
+ import { n as __toESM, t as require_binding } from "./binding-Dby9rwGk.mjs";
2
+ //#region ../../node_modules/.pnpm/oxc-parser@0.140.0/node_modules/oxc-parser/src-js/wrap.js
3
3
  var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
4
4
  function wrap(result) {
5
5
  let program, module, comments, errors;
@@ -204,7 +204,11 @@ function A$1(t, u = {}) {
204
204
  }
205
205
  return e;
206
206
  }
207
- const m = 10, L$1 = (t = 0) => (u) => `\x1B[${u + t}m`, N = (t = 0) => (u) => `\x1B[${38 + t};5;${u}m`, I = (t = 0) => (u, F, e) => `\x1B[${38 + t};2;${u};${F};${e}m`, r = {
207
+ const m = 10;
208
+ const L$1 = (t = 0) => (u) => `\x1B[${u + t}m`;
209
+ const N = (t = 0) => (u) => `\x1B[${38 + t};5;${u}m`;
210
+ const I = (t = 0) => (u, F, e) => `\x1B[${38 + t};2;${u};${F};${e}m`;
211
+ const r = {
208
212
  modifier: {
209
213
  reset: [0, 0],
210
214
  bold: [1, 22],
@@ -258,7 +262,8 @@ const m = 10, L$1 = (t = 0) => (u) => `\x1B[${u + t}m`, N = (t = 0) => (u) => `\
258
262
  }
259
263
  };
260
264
  Object.keys(r.modifier);
261
- const tD = Object.keys(r.color), eD = Object.keys(r.bgColor);
265
+ const tD = Object.keys(r.color);
266
+ const eD = Object.keys(r.bgColor);
262
267
  [...tD, ...eD];
263
268
  function sD() {
264
269
  const t = /* @__PURE__ */ new Map();
@@ -331,7 +336,18 @@ function sD() {
331
336
  }
332
337
  }), r;
333
338
  }
334
- const iD = sD(), v = /* @__PURE__ */ new Set(["\x1B", "›"]), CD = 39, w$1 = "\x07", W$1 = "[", rD = "]", R = "m", y = `${rD}8;;`, V$1 = (t) => `${v.values().next().value}${W$1}${t}${R}`, z = (t) => `${v.values().next().value}${y}${t}${w$1}`, ED = (t) => t.split(" ").map((u) => A$1(u)), _ = (t, u, F) => {
339
+ const iD = sD();
340
+ const v = /* @__PURE__ */ new Set(["\x1B", "›"]);
341
+ const CD = 39;
342
+ const w$1 = "\x07";
343
+ const W$1 = "[";
344
+ const rD = "]";
345
+ const R = "m";
346
+ const y = `${rD}8;;`;
347
+ const V$1 = (t) => `${v.values().next().value}${W$1}${t}${R}`;
348
+ const z = (t) => `${v.values().next().value}${y}${t}${w$1}`;
349
+ const ED = (t) => t.split(" ").map((u) => A$1(u));
350
+ const _ = (t, u, F) => {
335
351
  const e = [...u];
336
352
  let s = false, i = false, D = A$1(T$1(t[t.length - 1]));
337
353
  for (const [C, o] of e.entries()) {
@@ -343,12 +359,14 @@ const iD = sD(), v = /* @__PURE__ */ new Set(["\x1B", "›"]), CD = 39, w$1 = "\x
343
359
  D += E, D === F && C < e.length - 1 && (t.push(""), D = 0);
344
360
  }
345
361
  !D && t[t.length - 1].length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
346
- }, nD = (t) => {
362
+ };
363
+ const nD = (t) => {
347
364
  const u = t.split(" ");
348
365
  let F = u.length;
349
366
  for (; F > 0 && !(A$1(u[F - 1]) > 0);) F--;
350
367
  return F === u.length ? t : u.slice(0, F).join(" ") + u.slice(F).join("");
351
- }, oD = (t, u, F = {}) => {
368
+ };
369
+ const oD = (t, u, F = {}) => {
352
370
  if (F.trim !== false && t.trim() === "") return "";
353
371
  let e = "", s, i;
354
372
  const D = ED(t);
@@ -436,12 +454,14 @@ function d$1(t, u) {
436
454
  const F = t;
437
455
  F.isTTY && F.setRawMode(u);
438
456
  }
439
- var AD = Object.defineProperty, pD = (t, u, F) => u in t ? AD(t, u, {
457
+ var AD = Object.defineProperty;
458
+ var pD = (t, u, F) => u in t ? AD(t, u, {
440
459
  enumerable: true,
441
460
  configurable: true,
442
461
  writable: true,
443
462
  value: F
444
- }) : t[u] = F, h = (t, u, F) => (pD(t, typeof u != "symbol" ? u + "" : u, F), F);
463
+ }) : t[u] = F;
464
+ var h = (t, u, F) => (pD(t, typeof u != "symbol" ? u + "" : u, F), F);
445
465
  var x = class {
446
466
  constructor(u, F = true) {
447
467
  h(this, "input"), h(this, "output"), h(this, "_abortSignal"), h(this, "rl"), h(this, "opts"), h(this, "_render"), h(this, "_track", false), h(this, "_prevFrame", ""), h(this, "_subscribers", /* @__PURE__ */ new Map()), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value");
@@ -562,12 +582,14 @@ var fD = class extends x {
562
582
  });
563
583
  }
564
584
  };
565
- var bD = Object.defineProperty, mD = (t, u, F) => u in t ? bD(t, u, {
585
+ var bD = Object.defineProperty;
586
+ var mD = (t, u, F) => u in t ? bD(t, u, {
566
587
  enumerable: true,
567
588
  configurable: true,
568
589
  writable: true,
569
590
  value: F
570
- }) : t[u] = F, Y = (t, u, F) => (mD(t, typeof u != "symbol" ? u + "" : u, F), F);
591
+ }) : t[u] = F;
592
+ var Y = (t, u, F) => (mD(t, typeof u != "symbol" ? u + "" : u, F), F);
571
593
  let wD = class extends x {
572
594
  constructor(u) {
573
595
  super(u, false), Y(this, "options"), Y(this, "cursor", 0), this.options = u.options, this.value = [...u.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: F }) => F === u.cursorAt), 0), this.on("key", (F) => {
@@ -600,12 +622,14 @@ let wD = class extends x {
600
622
  this.value = u ? this.value.filter((F) => F !== this._value) : [...this.value, this._value];
601
623
  }
602
624
  };
603
- var SD = Object.defineProperty, $D = (t, u, F) => u in t ? SD(t, u, {
625
+ var SD = Object.defineProperty;
626
+ var $D = (t, u, F) => u in t ? SD(t, u, {
604
627
  enumerable: true,
605
628
  configurable: true,
606
629
  writable: true,
607
630
  value: F
608
- }) : t[u] = F, q = (t, u, F) => ($D(t, typeof u != "symbol" ? u + "" : u, F), F);
631
+ }) : t[u] = F;
632
+ var q = (t, u, F) => ($D(t, typeof u != "symbol" ? u + "" : u, F), F);
609
633
  var jD = class extends x {
610
634
  constructor(u) {
611
635
  super(u, false), q(this, "options"), q(this, "cursor", 0), this.options = u.options, this.cursor = this.options.findIndex(({ value: F }) => F === u.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (F) => {
@@ -648,7 +672,20 @@ var PD = class extends x {
648
672
  function ce() {
649
673
  return g$1.platform !== "win32" ? g$1.env.TERM !== "linux" : !!g$1.env.CI || !!g$1.env.WT_SESSION || !!g$1.env.TERMINUS_SUBLIME || g$1.env.ConEmuTask === "{cmd::Cmder}" || g$1.env.TERM_PROGRAM === "Terminus-Sublime" || g$1.env.TERM_PROGRAM === "vscode" || g$1.env.TERM === "xterm-256color" || g$1.env.TERM === "alacritty" || g$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
650
674
  }
651
- const V = ce(), u = (t, n) => V ? t : n, le = u("❯", ">"), L = u("■", "x"), W = u("▲", "x"), C = u("✔", "√"), o = u(""), d = u(""), k = u("●", ">"), P = u("○", " "), A = u("◻", "[•]"), T = u("◼", "[+]"), F = u("◻", "[ ]"), w = (t) => {
675
+ const V = ce();
676
+ const u = (t, n) => V ? t : n;
677
+ const le = u("❯", ">");
678
+ const L = u("■", "x");
679
+ const W = u("▲", "x");
680
+ const C = u("✔", "√");
681
+ const o = u("");
682
+ const d = u("");
683
+ const k = u("●", ">");
684
+ const P = u("○", " ");
685
+ const A = u("◻", "[•]");
686
+ const T = u("◼", "[+]");
687
+ const F = u("◻", "[ ]");
688
+ const w = (t) => {
652
689
  switch (t) {
653
690
  case "initial":
654
691
  case "active": return e.cyan(le);
@@ -656,7 +693,8 @@ const V = ce(), u = (t, n) => V ? t : n, le = u("❯", ">"), L = u("■", "x"),
656
693
  case "error": return e.yellow(W);
657
694
  case "submit": return e.green(C);
658
695
  }
659
- }, B = (t) => {
696
+ };
697
+ const B = (t) => {
660
698
  const { cursor: n, options: s, style: r } = t, i = t.maxItems ?? Number.POSITIVE_INFINITY, a = Math.max(process.stdout.rows - 4, 0), c = Math.min(a, Math.max(i, 5));
661
699
  let l = 0;
662
700
  n >= l + c - 3 ? l = Math.max(Math.min(n - c + 3, s.length - c), 0) : n < l + 2 && (l = Math.max(n - 2, 0));
@@ -665,7 +703,8 @@ const V = ce(), u = (t, n) => V ? t : n, le = u("❯", ">"), L = u("■", "x"),
665
703
  const j = v === 0 && $, E = v === x.length - 1 && p;
666
704
  return j || E ? e.dim("...") : r(M, v + l === n);
667
705
  });
668
- }, he = (t) => new PD({
706
+ };
707
+ const he = (t) => new PD({
669
708
  validate: t.validate,
670
709
  placeholder: t.placeholder,
671
710
  defaultValue: t.defaultValue,
@@ -687,7 +726,8 @@ ${e.cyan(d)}
687
726
  `;
688
727
  }
689
728
  }
690
- }).prompt(), ye = (t) => {
729
+ }).prompt();
730
+ const ye = (t) => {
691
731
  const n = t.active ?? "Yes", s = t.inactive ?? "No";
692
732
  return new fD({
693
733
  active: n,
@@ -707,7 +747,8 @@ ${e.cyan(d)}
707
747
  }
708
748
  }
709
749
  }).prompt();
710
- }, ve = (t) => {
750
+ };
751
+ const ve = (t) => {
711
752
  const n = (s, r) => {
712
753
  const i = s.label ?? String(s.value);
713
754
  switch (r) {
@@ -740,7 +781,8 @@ ${e.cyan(d)}
740
781
  }
741
782
  }
742
783
  }).prompt();
743
- }, fe = (t) => {
784
+ };
785
+ const fe = (t) => {
744
786
  const n = (s, r) => {
745
787
  const i = s.label ?? String(s.value);
746
788
  return r === "active" ? `${e.cyan(A)} ${i} ${s.hint ? e.dim(`(${s.hint})`) : ""}` : r === "selected" ? `${e.green(T)} ${e.dim(i)}` : r === "cancelled" ? `${e.strikethrough(e.dim(i))}` : r === "active-selected" ? `${e.green(T)} ${i} ${s.hint ? e.dim(`(${s.hint})`) : ""}` : r === "submitted" ? `${e.dim(i)}` : `${e.dim(F)} ${e.dim(i)}`;
@@ -1,5 +1,5 @@
1
- import { n as __toESM, t as require_binding } from "./binding-BmkJW3Wy.mjs";
2
- import { a as bindingifySourcemap, n as normalizeBindingError } from "./error-BlQ0-ek7.mjs";
1
+ import { n as __toESM, t as require_binding } from "./binding-Dby9rwGk.mjs";
2
+ import { a as bindingifySourcemap, n as normalizeBindingError } from "./error-DFGNOCle.mjs";
3
3
  //#region src/utils/minify.ts
4
4
  var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { c as validateOption, t as RolldownBuild, u as PluginDriver } from "./rolldown-build-aV0QeeTW.mjs";
1
+ import { c as validateOption, t as RolldownBuild, u as PluginDriver } from "./rolldown-build-CdF8HAHX.mjs";
2
2
  //#region src/api/rolldown/index.ts
3
3
  /**
4
4
  * The API compatible with Rollup's `rollup` function.
@@ -1,9 +1,9 @@
1
- import { n as __toESM, t as require_binding } from "./binding-BmkJW3Wy.mjs";
2
- import { i as logInputHookInOutputPlugin, n as error } from "./logs-aMKUxRpj.mjs";
3
- import { n as BuiltinPlugin } from "./normalize-string-or-regex-BYkbbGqQ.mjs";
4
- import { a as transformModuleInfo, c as __decorate, d as PlainObjectLike, f as MinimalPluginContextImpl, h as LOG_LEVEL_DEBUG, i as PluginContextData, l as transformAssetSource, m as normalizeLog, o as transformToRollupOutput, p as normalizeHook, s as transformRenderedChunk, t as bindingifyInputOptions, u as lazyProp, v as LOG_LEVEL_WARN, x as VERSION, y as logLevelPriority } from "./bindingify-input-options-BsDhfYrS.mjs";
1
+ import { n as __toESM, t as require_binding } from "./binding-Dby9rwGk.mjs";
2
+ import { i as logInputHookInOutputPlugin, n as error } from "./logs-ZGEh6uhb.mjs";
3
+ import { n as BuiltinPlugin } from "./normalize-string-or-regex-SiXbePVH.mjs";
4
+ import { a as transformModuleInfo, b as VERSION, c as __decorate, d as PlainObjectLike, f as MinimalPluginContextImpl, h as LOG_LEVEL_DEBUG, i as PluginContextData, l as transformAssetSource, m as normalizeLog, o as transformToRollupOutput, p as normalizeHook, s as transformRenderedChunk, t as bindingifyInputOptions, u as lazyProp, v as LOG_LEVEL_WARN, y as logLevelPriority } from "./bindingify-input-options-_ppP73I9.mjs";
5
5
  import { i as unimplemented } from "./misc-CoQm4NHO.mjs";
6
- import { i as unwrapBindingResult } from "./error-BlQ0-ek7.mjs";
6
+ import { i as unwrapBindingResult } from "./error-DFGNOCle.mjs";
7
7
  import { Worker } from "node:worker_threads";
8
8
  import path, { sep } from "node:path";
9
9
  import { formatWithOptions, styleText } from "node:util";
@@ -1545,6 +1545,7 @@ const MinifyOptionsSchema = /* @__PURE__ */ strictObject({
1545
1545
  function: /* @__PURE__ */ boolean(),
1546
1546
  class: /* @__PURE__ */ boolean()
1547
1547
  })])),
1548
+ reserved: /* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ string())),
1548
1549
  debug: /* @__PURE__ */ optional(/* @__PURE__ */ boolean())
1549
1550
  })])),
1550
1551
  codegen: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ strictObject({
@@ -1752,6 +1753,7 @@ const OutputOptionsSchema = /* @__PURE__ */ strictObject({
1752
1753
  /* @__PURE__ */ literal("hidden")
1753
1754
  ])), /* @__PURE__ */ description(`Generate sourcemap (\`-s inline\` for inline, or \`-s\` for \`.map\` file)`)),
1754
1755
  sourcemapBaseUrl: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Base URL used to prefix sourcemap paths")),
1756
+ sourcemapFileNames: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(ChunkFileNamesSchema), /* @__PURE__ */ description("Name pattern for emitted sourcemaps")),
1755
1757
  sourcemapDebugIds: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Inject sourcemap debug IDs")),
1756
1758
  sourcemapExcludeSources: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Exclude source content from sourcemaps")),
1757
1759
  sourcemapIgnoreList: /* @__PURE__ */ optional(/* @__PURE__ */ union([
@@ -1825,7 +1827,7 @@ const OutputCliOverrideSchema = /* @__PURE__ */ strictObject({
1825
1827
  codeSplitting: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ strictObject({
1826
1828
  minSize: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ number()), /* @__PURE__ */ description("Minimum size of the chunk")),
1827
1829
  minShareCount: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ number()), /* @__PURE__ */ description("Minimum share count of the chunk"))
1828
- })])), /* @__PURE__ */ description("Code splitting options (true, false, or object)")),
1830
+ })])), /* @__PURE__ */ description("Code splitting options. Enabled by default; use `--no-codeSplitting` to disable, or `--codeSplitting.minSize` / `--codeSplitting.minShareCount` to configure")),
1829
1831
  advancedChunks: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ strictObject({
1830
1832
  minSize: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ number()), /* @__PURE__ */ description("Minimum size of the chunk")),
1831
1833
  minShareCount: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ number()), /* @__PURE__ */ description("Minimum share count of the chunk"))
@@ -1847,6 +1849,7 @@ const CliOptionsSchema = /* @__PURE__ */ strictObject({
1847
1849
  environment: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ string(), /* @__PURE__ */ array(/* @__PURE__ */ string())])), /* @__PURE__ */ description("Pass additional settings to the config file via process.ENV.")),
1848
1850
  version: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Show version number")),
1849
1851
  watch: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Watch files in bundle and rebuild on changes")),
1852
+ configLoader: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ literal("bundle"), /* @__PURE__ */ literal("native")])), /* @__PURE__ */ description("How to load the config file (bundle, native)")),
1850
1853
  ...InputCliOptionsSchema.entries,
1851
1854
  ...OutputCliOptionsSchema.entries
1852
1855
  });
@@ -2566,7 +2569,9 @@ function box(text, _opts = {}) {
2566
2569
  }
2567
2570
  //#endregion
2568
2571
  //#region ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/index.mjs
2569
- const r = Object.create(null), i = (e) => globalThis.process?.env || import.meta.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (e ? r : globalThis), o = new Proxy(r, {
2572
+ const r = Object.create(null);
2573
+ const i = (e) => globalThis.process?.env || import.meta.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (e ? r : globalThis);
2574
+ const o = new Proxy(r, {
2570
2575
  get(e, s) {
2571
2576
  return i()[s] ?? r[s];
2572
2577
  },
@@ -2586,7 +2591,9 @@ const r = Object.create(null), i = (e) => globalThis.process?.env || import.meta
2586
2591
  const e = i(true);
2587
2592
  return Object.keys(e);
2588
2593
  }
2589
- }), t = typeof process < "u" && process.env && process.env.NODE_ENV || "", f = [
2594
+ });
2595
+ const t = typeof process < "u" && process.env && process.env.NODE_ENV || "";
2596
+ const f = [
2590
2597
  ["APPVEYOR"],
2591
2598
  [
2592
2599
  "AWS_AMPLIFY",
@@ -2698,19 +2705,31 @@ l.name;
2698
2705
  function n(e) {
2699
2706
  return e ? e !== "false" : false;
2700
2707
  }
2701
- const I = globalThis.process?.platform || "", T = n(o.CI) || l.ci !== false, a = n(globalThis.process?.stdout && globalThis.process?.stdout.isTTY), g = n(o.DEBUG), R = t === "test" || n(o.TEST);
2708
+ const I = globalThis.process?.platform || "";
2709
+ const T = n(o.CI) || l.ci !== false;
2710
+ const a = n(globalThis.process?.stdout && globalThis.process?.stdout.isTTY);
2711
+ const g = n(o.DEBUG);
2712
+ const R = t === "test" || n(o.TEST);
2702
2713
  o.MINIMAL;
2703
2714
  const A = /^win/i.test(I);
2704
2715
  !n(o.NO_COLOR) && (n(o.FORCE_COLOR) || (a || A) && o.TERM);
2705
2716
  const C = (globalThis.process?.versions?.node || "").replace(/^v/, "") || null;
2706
2717
  Number(C?.split(".")[0]);
2707
- const y = globalThis.process || Object.create(null), _ = { versions: {} };
2718
+ const y = globalThis.process || Object.create(null);
2719
+ const _ = { versions: {} };
2708
2720
  new Proxy(y, { get(e, s) {
2709
2721
  if (s === "env") return o;
2710
2722
  if (s in e) return e[s];
2711
2723
  if (s in _) return _[s];
2712
2724
  } });
2713
- const c = globalThis.process?.release?.name === "node", O = !!globalThis.Bun || !!globalThis.process?.versions?.bun, D = !!globalThis.Deno, L = !!globalThis.fastly, S = !!globalThis.Netlify, u = !!globalThis.EdgeRuntime, N = globalThis.navigator?.userAgent === "Cloudflare-Workers", F = [
2725
+ const c = globalThis.process?.release?.name === "node";
2726
+ const O = !!globalThis.Bun || !!globalThis.process?.versions?.bun;
2727
+ const D = !!globalThis.Deno;
2728
+ const L = !!globalThis.fastly;
2729
+ const S = !!globalThis.Netlify;
2730
+ const u = !!globalThis.EdgeRuntime;
2731
+ const N = globalThis.navigator?.userAgent === "Cloudflare-Workers";
2732
+ const F = [
2714
2733
  [S, "netlify"],
2715
2734
  [u, "edge-light"],
2716
2735
  [N, "workerd"],
@@ -2868,7 +2887,7 @@ function createConsola(options = {}) {
2868
2887
  defaults: { level },
2869
2888
  stdout: process.stdout,
2870
2889
  stderr: process.stderr,
2871
- prompt: (...args) => import("./prompt-B1Yc1NPt.mjs").then((m) => m.prompt(...args)),
2890
+ prompt: (...args) => import("./prompt--dNycKSZ.mjs").then((m) => m.prompt(...args)),
2872
2891
  reporters: options.reporters || [options.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()],
2873
2892
  ...options
2874
2893
  });
@@ -2909,7 +2928,7 @@ function createTestingLogger() {
2909
2928
  //#endregion
2910
2929
  //#region src/utils/bindingify-output-options.ts
2911
2930
  function bindingifyOutputOptions(outputOptions, pluginContextData) {
2912
- const { dir, format, exports, hashCharacters, sourcemap, sourcemapBaseUrl, sourcemapDebugIds, sourcemapExcludeSources, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, banner, footer, postBanner, postFooter, intro, outro, esModule, globals, paths, generatedCode, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, comments, preserveModulesRoot, manualChunks, topLevelVar, cleanDir, strictExecutionOrder } = outputOptions;
2931
+ const { dir, format, exports, hashCharacters, sourcemap, sourcemapBaseUrl, sourcemapDebugIds, sourcemapFileNames, sourcemapExcludeSources, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, banner, footer, postBanner, postFooter, intro, outro, esModule, globals, paths, generatedCode, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, comments, preserveModulesRoot, manualChunks, topLevelVar, cleanDir, strictExecutionOrder } = outputOptions;
2913
2932
  if (legalComments != null) logger.warn("`legalComments` option is deprecated, please use `comments.legal` instead.");
2914
2933
  const { inlineDynamicImports, advancedChunks } = bindingifyCodeSplitting(outputOptions.codeSplitting, outputOptions.inlineDynamicImports, outputOptions.advancedChunks, manualChunks, pluginContextData);
2915
2934
  return {
@@ -2921,6 +2940,7 @@ function bindingifyOutputOptions(outputOptions, pluginContextData) {
2921
2940
  sourcemap: bindingifySourcemap(sourcemap),
2922
2941
  sourcemapBaseUrl,
2923
2942
  sourcemapDebugIds,
2943
+ sourcemapFileNames,
2924
2944
  sourcemapExcludeSources,
2925
2945
  sourcemapIgnoreList: sourcemapIgnoreList ?? /node_modules/,
2926
2946
  sourcemapPathTransform,