rolldown 1.0.0-beta.34 → 1.0.0-beta.36

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 (44) hide show
  1. package/dist/cli.mjs +218 -229
  2. package/dist/config.d.mts +2 -2
  3. package/dist/config.mjs +3 -3
  4. package/dist/experimental-index.d.mts +16 -4
  5. package/dist/experimental-index.mjs +23 -7
  6. package/dist/filter-index.d.mts +2 -2
  7. package/dist/index.d.mts +2 -2
  8. package/dist/index.mjs +2 -2
  9. package/dist/parallel-plugin-worker.mjs +3 -4
  10. package/dist/parallel-plugin.d.mts +2 -2
  11. package/dist/parse-ast-index.d.mts +1 -1
  12. package/dist/parse-ast-index.mjs +1 -1
  13. package/dist/shared/{binding-9k0egz6L.d.mts → binding-wK0CRIMb.d.mts} +1 -0
  14. package/dist/shared/{define-config-DVSr6Unb.d.mts → define-config-wxvILtDx.d.mts} +30 -3
  15. package/dist/shared/{load-config-CXpGBNqp.mjs → load-config-Jqw6FAJp.mjs} +4 -6
  16. package/dist/shared/parse-ast-index-CkDFQ-07.mjs +10847 -0
  17. package/dist/shared/{prompt-C5jz26Zn.mjs → prompt-DuG2i9ud.mjs} +4 -7
  18. package/dist/shared/{src-Chn1S4O2.mjs → src-WjgJWoNk.mjs} +141 -70
  19. package/package.json +33 -48
  20. package/dist/cli.cjs +0 -1767
  21. package/dist/cli.d.cts +0 -1
  22. package/dist/config.cjs +0 -12
  23. package/dist/config.d.cts +0 -10
  24. package/dist/experimental-index.cjs +0 -139
  25. package/dist/experimental-index.d.cts +0 -90
  26. package/dist/filter-index.cjs +0 -105
  27. package/dist/filter-index.d.cts +0 -4
  28. package/dist/index.cjs +0 -9
  29. package/dist/index.d.cts +0 -3
  30. package/dist/parallel-plugin-worker.cjs +0 -32
  31. package/dist/parallel-plugin-worker.d.cts +0 -1
  32. package/dist/parallel-plugin.cjs +0 -8
  33. package/dist/parallel-plugin.d.cts +0 -14
  34. package/dist/parse-ast-index.cjs +0 -4
  35. package/dist/parse-ast-index.d.cts +0 -8
  36. package/dist/shared/binding-D13M6Llu.d.cts +0 -1425
  37. package/dist/shared/chunk-DDkG_k5U.cjs +0 -39
  38. package/dist/shared/define-config-D5AluabE.d.cts +0 -1394
  39. package/dist/shared/load-config-CefxSUnT.cjs +0 -125
  40. package/dist/shared/misc-DksvspN4.cjs +0 -58
  41. package/dist/shared/parse-ast-index-BCv3Y1TT.cjs +0 -859
  42. package/dist/shared/parse-ast-index-DjojK-Vf.mjs +0 -725
  43. package/dist/shared/prompt-QNI93ne7.cjs +0 -854
  44. package/dist/shared/src-djpzntWm.cjs +0 -4622
package/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { __commonJS, __toESM } from "./shared/parse-ast-index-DjojK-Vf.mjs";
2
- import { description, getInputCliKeys, getJsonSchema, getOutputCliKeys, rolldown, validateCliOptions, version, watch } from "./shared/src-Chn1S4O2.mjs";
1
+ import { __commonJS, __toESM } from "./shared/parse-ast-index-CkDFQ-07.mjs";
2
+ import { description, getInputCliKeys, getJsonSchema, getOutputCliKeys, rolldown, validateCliOptions, version, watch } from "./shared/src-WjgJWoNk.mjs";
3
3
  import { arraify } from "./shared/misc-CQeo-AFx.mjs";
4
- import { loadConfig } from "./shared/load-config-CXpGBNqp.mjs";
4
+ import { loadConfig } from "./shared/load-config-Jqw6FAJp.mjs";
5
5
  import path, { sep } from "node:path";
6
6
  import colors from "ansis";
7
7
  import process$1 from "node:process";
@@ -9,6 +9,207 @@ import { formatWithOptions, parseArgs } from "node:util";
9
9
  import * as tty from "node:tty";
10
10
  import { performance } from "node:perf_hooks";
11
11
 
12
+ //#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
13
+ /**
14
+ * This is not the set of all possible signals.
15
+ *
16
+ * It IS, however, the set of all signals that trigger
17
+ * an exit on either Linux or BSD systems. Linux is a
18
+ * superset of the signal names supported on BSD, and
19
+ * the unknown signals just fail to register, so we can
20
+ * catch that easily enough.
21
+ *
22
+ * Windows signals are a different set, since there are
23
+ * signals that terminate Windows processes, but don't
24
+ * terminate (or don't even exist) on Posix systems.
25
+ *
26
+ * Don't bother with SIGKILL. It's uncatchable, which
27
+ * means that we can't fire any callbacks anyway.
28
+ *
29
+ * If a user does happen to register a handler on a non-
30
+ * fatal signal like SIGWINCH or something, and then
31
+ * exit, it'll end up firing `process.emit('exit')`, so
32
+ * the handler will be fired anyway.
33
+ *
34
+ * SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
35
+ * artificially, inherently leave the process in a
36
+ * state from which it is not safe to try and enter JS
37
+ * listeners.
38
+ */
39
+ const signals = [];
40
+ signals.push("SIGHUP", "SIGINT", "SIGTERM");
41
+ if (process.platform !== "win32") signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
42
+ if (process.platform === "linux") signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
43
+
44
+ //#endregion
45
+ //#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
46
+ const processOk = (process$3) => !!process$3 && typeof process$3 === "object" && typeof process$3.removeListener === "function" && typeof process$3.emit === "function" && typeof process$3.reallyExit === "function" && typeof process$3.listeners === "function" && typeof process$3.kill === "function" && typeof process$3.pid === "number" && typeof process$3.on === "function";
47
+ const kExitEmitter = Symbol.for("signal-exit emitter");
48
+ const global = globalThis;
49
+ const ObjectDefineProperty = Object.defineProperty.bind(Object);
50
+ var Emitter = class {
51
+ emitted = {
52
+ afterExit: false,
53
+ exit: false
54
+ };
55
+ listeners = {
56
+ afterExit: [],
57
+ exit: []
58
+ };
59
+ count = 0;
60
+ id = Math.random();
61
+ constructor() {
62
+ if (global[kExitEmitter]) return global[kExitEmitter];
63
+ ObjectDefineProperty(global, kExitEmitter, {
64
+ value: this,
65
+ writable: false,
66
+ enumerable: false,
67
+ configurable: false
68
+ });
69
+ }
70
+ on(ev, fn) {
71
+ this.listeners[ev].push(fn);
72
+ }
73
+ removeListener(ev, fn) {
74
+ const list = this.listeners[ev];
75
+ const i$1 = list.indexOf(fn);
76
+ /* c8 ignore start */
77
+ if (i$1 === -1) return;
78
+ /* c8 ignore stop */
79
+ if (i$1 === 0 && list.length === 1) list.length = 0;
80
+ else list.splice(i$1, 1);
81
+ }
82
+ emit(ev, code, signal) {
83
+ if (this.emitted[ev]) return false;
84
+ this.emitted[ev] = true;
85
+ let ret = false;
86
+ for (const fn of this.listeners[ev]) ret = fn(code, signal) === true || ret;
87
+ if (ev === "exit") ret = this.emit("afterExit", code, signal) || ret;
88
+ return ret;
89
+ }
90
+ };
91
+ var SignalExitBase = class {};
92
+ const signalExitWrap = (handler) => {
93
+ return {
94
+ onExit(cb, opts) {
95
+ return handler.onExit(cb, opts);
96
+ },
97
+ load() {
98
+ return handler.load();
99
+ },
100
+ unload() {
101
+ return handler.unload();
102
+ }
103
+ };
104
+ };
105
+ var SignalExitFallback = class extends SignalExitBase {
106
+ onExit() {
107
+ return () => {};
108
+ }
109
+ load() {}
110
+ unload() {}
111
+ };
112
+ var SignalExit = class extends SignalExitBase {
113
+ /* c8 ignore start */
114
+ #hupSig = process$2.platform === "win32" ? "SIGINT" : "SIGHUP";
115
+ /* c8 ignore stop */
116
+ #emitter = new Emitter();
117
+ #process;
118
+ #originalProcessEmit;
119
+ #originalProcessReallyExit;
120
+ #sigListeners = {};
121
+ #loaded = false;
122
+ constructor(process$3) {
123
+ super();
124
+ this.#process = process$3;
125
+ this.#sigListeners = {};
126
+ for (const sig of signals) this.#sigListeners[sig] = () => {
127
+ const listeners = this.#process.listeners(sig);
128
+ let { count } = this.#emitter;
129
+ /* c8 ignore start */
130
+ const p = process$3;
131
+ if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") count += p.__signal_exit_emitter__.count;
132
+ /* c8 ignore stop */
133
+ if (listeners.length === count) {
134
+ this.unload();
135
+ const ret = this.#emitter.emit("exit", null, sig);
136
+ /* c8 ignore start */
137
+ const s$1 = sig === "SIGHUP" ? this.#hupSig : sig;
138
+ if (!ret) process$3.kill(process$3.pid, s$1);
139
+ }
140
+ };
141
+ this.#originalProcessReallyExit = process$3.reallyExit;
142
+ this.#originalProcessEmit = process$3.emit;
143
+ }
144
+ onExit(cb, opts) {
145
+ /* c8 ignore start */
146
+ if (!processOk(this.#process)) return () => {};
147
+ /* c8 ignore stop */
148
+ if (this.#loaded === false) this.load();
149
+ const ev = opts?.alwaysLast ? "afterExit" : "exit";
150
+ this.#emitter.on(ev, cb);
151
+ return () => {
152
+ this.#emitter.removeListener(ev, cb);
153
+ if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) this.unload();
154
+ };
155
+ }
156
+ load() {
157
+ if (this.#loaded) return;
158
+ this.#loaded = true;
159
+ this.#emitter.count += 1;
160
+ for (const sig of signals) try {
161
+ const fn = this.#sigListeners[sig];
162
+ if (fn) this.#process.on(sig, fn);
163
+ } catch (_$1) {}
164
+ this.#process.emit = (ev, ...a$1) => {
165
+ return this.#processEmit(ev, ...a$1);
166
+ };
167
+ this.#process.reallyExit = (code) => {
168
+ return this.#processReallyExit(code);
169
+ };
170
+ }
171
+ unload() {
172
+ if (!this.#loaded) return;
173
+ this.#loaded = false;
174
+ signals.forEach((sig) => {
175
+ const listener = this.#sigListeners[sig];
176
+ /* c8 ignore start */
177
+ if (!listener) throw new Error("Listener not defined for signal: " + sig);
178
+ /* c8 ignore stop */
179
+ try {
180
+ this.#process.removeListener(sig, listener);
181
+ } catch (_$1) {}
182
+ /* c8 ignore stop */
183
+ });
184
+ this.#process.emit = this.#originalProcessEmit;
185
+ this.#process.reallyExit = this.#originalProcessReallyExit;
186
+ this.#emitter.count -= 1;
187
+ }
188
+ #processReallyExit(code) {
189
+ /* c8 ignore start */
190
+ if (!processOk(this.#process)) return 0;
191
+ this.#process.exitCode = code || 0;
192
+ /* c8 ignore stop */
193
+ this.#emitter.emit("exit", this.#process.exitCode, null);
194
+ return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
195
+ }
196
+ #processEmit(ev, ...args) {
197
+ const og = this.#originalProcessEmit;
198
+ if (ev === "exit" && processOk(this.#process)) {
199
+ if (typeof args[0] === "number") this.#process.exitCode = args[0];
200
+ /* c8 ignore start */
201
+ const ret = og.call(this.#process, ev, ...args);
202
+ /* c8 ignore start */
203
+ this.#emitter.emit("exit", this.#process.exitCode, null);
204
+ /* c8 ignore stop */
205
+ return ret;
206
+ } else return og.call(this.#process, ev, ...args);
207
+ }
208
+ };
209
+ const process$2 = globalThis.process;
210
+ const { onExit, load, unload } = signalExitWrap(processOk(process$2) ? new SignalExit(process$2) : new SignalExitFallback());
211
+
212
+ //#endregion
12
213
  //#region ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/core.mjs
13
214
  const LogLevels = {
14
215
  silent: Number.NEGATIVE_INFINITY,
@@ -398,12 +599,10 @@ function createConsola$1(options$1 = {}) {
398
599
  //#region ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/shared/consola.DRwqZj3T.mjs
399
600
  function parseStack(stack, message) {
400
601
  const cwd$1 = process.cwd() + sep;
401
- const lines = stack.split("\n").splice(message.split("\n").length).map((l$1) => l$1.trim().replace("file://", "").replace(cwd$1, ""));
402
- return lines;
602
+ return stack.split("\n").splice(message.split("\n").length).map((l$1) => l$1.trim().replace("file://", "").replace(cwd$1, ""));
403
603
  }
404
604
  function writeStream(data, stream) {
405
- const write = stream.__write || stream.write;
406
- return write.call(stream, data);
605
+ return (stream.__write || stream.write).call(stream, data);
407
606
  }
408
607
  const bracket = (x) => x ? `[${x}]` : "";
409
608
  var BasicReporter = class {
@@ -807,11 +1006,9 @@ function G() {
807
1006
  const e = F.find((s$1) => s$1[0]);
808
1007
  if (e) return { name: e[1] };
809
1008
  }
810
- const P = G();
811
- P?.name;
1009
+ G()?.name;
812
1010
  function ansiRegex({ onlyFirst = false } = {}) {
813
- const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
814
- const pattern = [`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`, "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
1011
+ const pattern = [`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))`, "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
815
1012
  return new RegExp(pattern, onlyFirst ? void 0 : "g");
816
1013
  }
817
1014
  const regex = ansiRegex();
@@ -897,8 +1094,7 @@ const TYPE_ICONS = {
897
1094
  log: ""
898
1095
  };
899
1096
  function stringWidth(str) {
900
- const hasICU = typeof Intl === "object";
901
- if (!hasICU || !Intl.Segmenter) return stripAnsi(str).length;
1097
+ if (!(typeof Intl === "object") || !Intl.Segmenter) return stripAnsi(str).length;
902
1098
  return stringWidth$1(str);
903
1099
  }
904
1100
  var FancyReporter = class extends BasicReporter {
@@ -950,16 +1146,15 @@ function getBgColor(color = "bgWhite") {
950
1146
  function createConsola(options$1 = {}) {
951
1147
  let level = _getDefaultLogLevel();
952
1148
  if (process.env.CONSOLA_LEVEL) level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
953
- const consola2 = createConsola$1({
1149
+ return createConsola$1({
954
1150
  level,
955
1151
  defaults: { level },
956
1152
  stdout: process.stdout,
957
1153
  stderr: process.stderr,
958
- prompt: (...args) => import("./shared/prompt-C5jz26Zn.mjs").then((m) => m.prompt(...args)),
1154
+ prompt: (...args) => import("./shared/prompt-DuG2i9ud.mjs").then((m) => m.prompt(...args)),
959
1155
  reporters: options$1.reporters || [options$1.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()],
960
1156
  ...options$1
961
1157
  });
962
- return consola2;
963
1158
  }
964
1159
  function _getDefaultLogLevel() {
965
1160
  if (g) return LogLevels.debug;
@@ -1115,8 +1310,7 @@ function normalizeCliOptions(cliOptions, positionals) {
1115
1310
  "watch"
1116
1311
  ];
1117
1312
  for (let [key, value] of Object.entries(options$1)) {
1118
- const keys = key.split(".");
1119
- const [primary] = keys;
1313
+ const [primary] = key.split(".");
1120
1314
  if (keysOfInput.includes(primary)) setNestedProperty(result.input, key, value);
1121
1315
  else if (keysOfOutput.includes(primary)) setNestedProperty(result.output, key, value);
1122
1316
  else if (!reservedKeys.includes(key)) {
@@ -1135,9 +1329,8 @@ const objectSchema = getJsonSchema();
1135
1329
  const flattenedSchema = flattenSchema(objectSchema.properties);
1136
1330
  const options = Object.fromEntries(Object.entries(flattenedSchema).filter(([_key, schema]) => getSchemaType(schema) !== "never").map(([key, schema]) => {
1137
1331
  const config = Object.getOwnPropertyDescriptor(alias, key)?.value;
1138
- const type = getSchemaType(schema);
1139
1332
  const result = {
1140
- type: type === "boolean" ? "boolean" : "string",
1333
+ type: getSchemaType(schema) === "boolean" ? "boolean" : "string",
1141
1334
  description: schema?.description ?? config?.description ?? "",
1142
1335
  hint: config?.hint
1143
1336
  };
@@ -1221,207 +1414,6 @@ function parseCliArguments() {
1221
1414
  return normalizeCliOptions(values, positionals);
1222
1415
  }
1223
1416
 
1224
- //#endregion
1225
- //#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
1226
- /**
1227
- * This is not the set of all possible signals.
1228
- *
1229
- * It IS, however, the set of all signals that trigger
1230
- * an exit on either Linux or BSD systems. Linux is a
1231
- * superset of the signal names supported on BSD, and
1232
- * the unknown signals just fail to register, so we can
1233
- * catch that easily enough.
1234
- *
1235
- * Windows signals are a different set, since there are
1236
- * signals that terminate Windows processes, but don't
1237
- * terminate (or don't even exist) on Posix systems.
1238
- *
1239
- * Don't bother with SIGKILL. It's uncatchable, which
1240
- * means that we can't fire any callbacks anyway.
1241
- *
1242
- * If a user does happen to register a handler on a non-
1243
- * fatal signal like SIGWINCH or something, and then
1244
- * exit, it'll end up firing `process.emit('exit')`, so
1245
- * the handler will be fired anyway.
1246
- *
1247
- * SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
1248
- * artificially, inherently leave the process in a
1249
- * state from which it is not safe to try and enter JS
1250
- * listeners.
1251
- */
1252
- const signals = [];
1253
- signals.push("SIGHUP", "SIGINT", "SIGTERM");
1254
- if (process.platform !== "win32") signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
1255
- if (process.platform === "linux") signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
1256
-
1257
- //#endregion
1258
- //#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
1259
- const processOk = (process$3) => !!process$3 && typeof process$3 === "object" && typeof process$3.removeListener === "function" && typeof process$3.emit === "function" && typeof process$3.reallyExit === "function" && typeof process$3.listeners === "function" && typeof process$3.kill === "function" && typeof process$3.pid === "number" && typeof process$3.on === "function";
1260
- const kExitEmitter = Symbol.for("signal-exit emitter");
1261
- const global = globalThis;
1262
- const ObjectDefineProperty = Object.defineProperty.bind(Object);
1263
- var Emitter = class {
1264
- emitted = {
1265
- afterExit: false,
1266
- exit: false
1267
- };
1268
- listeners = {
1269
- afterExit: [],
1270
- exit: []
1271
- };
1272
- count = 0;
1273
- id = Math.random();
1274
- constructor() {
1275
- if (global[kExitEmitter]) return global[kExitEmitter];
1276
- ObjectDefineProperty(global, kExitEmitter, {
1277
- value: this,
1278
- writable: false,
1279
- enumerable: false,
1280
- configurable: false
1281
- });
1282
- }
1283
- on(ev, fn) {
1284
- this.listeners[ev].push(fn);
1285
- }
1286
- removeListener(ev, fn) {
1287
- const list = this.listeners[ev];
1288
- const i$1 = list.indexOf(fn);
1289
- /* c8 ignore start */
1290
- if (i$1 === -1) return;
1291
- /* c8 ignore stop */
1292
- if (i$1 === 0 && list.length === 1) list.length = 0;
1293
- else list.splice(i$1, 1);
1294
- }
1295
- emit(ev, code, signal) {
1296
- if (this.emitted[ev]) return false;
1297
- this.emitted[ev] = true;
1298
- let ret = false;
1299
- for (const fn of this.listeners[ev]) ret = fn(code, signal) === true || ret;
1300
- if (ev === "exit") ret = this.emit("afterExit", code, signal) || ret;
1301
- return ret;
1302
- }
1303
- };
1304
- var SignalExitBase = class {};
1305
- const signalExitWrap = (handler) => {
1306
- return {
1307
- onExit(cb, opts) {
1308
- return handler.onExit(cb, opts);
1309
- },
1310
- load() {
1311
- return handler.load();
1312
- },
1313
- unload() {
1314
- return handler.unload();
1315
- }
1316
- };
1317
- };
1318
- var SignalExitFallback = class extends SignalExitBase {
1319
- onExit() {
1320
- return () => {};
1321
- }
1322
- load() {}
1323
- unload() {}
1324
- };
1325
- var SignalExit = class extends SignalExitBase {
1326
- /* c8 ignore start */
1327
- #hupSig = process$2.platform === "win32" ? "SIGINT" : "SIGHUP";
1328
- /* c8 ignore stop */
1329
- #emitter = new Emitter();
1330
- #process;
1331
- #originalProcessEmit;
1332
- #originalProcessReallyExit;
1333
- #sigListeners = {};
1334
- #loaded = false;
1335
- constructor(process$3) {
1336
- super();
1337
- this.#process = process$3;
1338
- this.#sigListeners = {};
1339
- for (const sig of signals) this.#sigListeners[sig] = () => {
1340
- const listeners = this.#process.listeners(sig);
1341
- let { count } = this.#emitter;
1342
- /* c8 ignore start */
1343
- const p = process$3;
1344
- if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") count += p.__signal_exit_emitter__.count;
1345
- /* c8 ignore stop */
1346
- if (listeners.length === count) {
1347
- this.unload();
1348
- const ret = this.#emitter.emit("exit", null, sig);
1349
- /* c8 ignore start */
1350
- const s$1 = sig === "SIGHUP" ? this.#hupSig : sig;
1351
- if (!ret) process$3.kill(process$3.pid, s$1);
1352
- }
1353
- };
1354
- this.#originalProcessReallyExit = process$3.reallyExit;
1355
- this.#originalProcessEmit = process$3.emit;
1356
- }
1357
- onExit(cb, opts) {
1358
- /* c8 ignore start */
1359
- if (!processOk(this.#process)) return () => {};
1360
- /* c8 ignore stop */
1361
- if (this.#loaded === false) this.load();
1362
- const ev = opts?.alwaysLast ? "afterExit" : "exit";
1363
- this.#emitter.on(ev, cb);
1364
- return () => {
1365
- this.#emitter.removeListener(ev, cb);
1366
- if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) this.unload();
1367
- };
1368
- }
1369
- load() {
1370
- if (this.#loaded) return;
1371
- this.#loaded = true;
1372
- this.#emitter.count += 1;
1373
- for (const sig of signals) try {
1374
- const fn = this.#sigListeners[sig];
1375
- if (fn) this.#process.on(sig, fn);
1376
- } catch (_$1) {}
1377
- this.#process.emit = (ev, ...a$1) => {
1378
- return this.#processEmit(ev, ...a$1);
1379
- };
1380
- this.#process.reallyExit = (code) => {
1381
- return this.#processReallyExit(code);
1382
- };
1383
- }
1384
- unload() {
1385
- if (!this.#loaded) return;
1386
- this.#loaded = false;
1387
- signals.forEach((sig) => {
1388
- const listener = this.#sigListeners[sig];
1389
- /* c8 ignore start */
1390
- if (!listener) throw new Error("Listener not defined for signal: " + sig);
1391
- /* c8 ignore stop */
1392
- try {
1393
- this.#process.removeListener(sig, listener);
1394
- } catch (_$1) {}
1395
- /* c8 ignore stop */
1396
- });
1397
- this.#process.emit = this.#originalProcessEmit;
1398
- this.#process.reallyExit = this.#originalProcessReallyExit;
1399
- this.#emitter.count -= 1;
1400
- }
1401
- #processReallyExit(code) {
1402
- /* c8 ignore start */
1403
- if (!processOk(this.#process)) return 0;
1404
- this.#process.exitCode = code || 0;
1405
- /* c8 ignore stop */
1406
- this.#emitter.emit("exit", this.#process.exitCode, null);
1407
- return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
1408
- }
1409
- #processEmit(ev, ...args) {
1410
- const og = this.#originalProcessEmit;
1411
- if (ev === "exit" && processOk(this.#process)) {
1412
- if (typeof args[0] === "number") this.#process.exitCode = args[0];
1413
- /* c8 ignore start */
1414
- const ret = og.call(this.#process, ev, ...args);
1415
- /* c8 ignore start */
1416
- this.#emitter.emit("exit", this.#process.exitCode, null);
1417
- /* c8 ignore stop */
1418
- return ret;
1419
- } else return og.call(this.#process, ev, ...args);
1420
- }
1421
- };
1422
- const process$2 = globalThis.process;
1423
- const { onExit, load, unload } = signalExitWrap(processOk(process$2) ? new SignalExit(process$2) : new SignalExitFallback());
1424
-
1425
1417
  //#endregion
1426
1418
  //#region src/utils/clear-screen.ts
1427
1419
  const CLEAR_SCREEN = "\x1Bc";
@@ -1434,8 +1426,8 @@ function getClearScreenFunction(options$1) {
1434
1426
  }
1435
1427
 
1436
1428
  //#endregion
1437
- //#region ../../node_modules/.pnpm/@oxc-project+runtime@0.82.3/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js
1438
- var require_usingCtx = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.82.3/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js": ((exports, module) => {
1429
+ //#region ../../node_modules/.pnpm/@oxc-project+runtime@0.87.0/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js
1430
+ var require_usingCtx = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.87.0/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js": ((exports, module) => {
1439
1431
  function _usingCtx() {
1440
1432
  var r$1 = "function" == typeof SuppressedError ? SuppressedError : function(r$2, e$1) {
1441
1433
  var n$2 = Error();
@@ -1513,16 +1505,14 @@ async function bundleWithCliOptions(cliOptions) {
1513
1505
  try {
1514
1506
  var _usingCtx$1 = (0, import_usingCtx.default)();
1515
1507
  if (cliOptions.output.dir || cliOptions.output.file) {
1516
- const operation = cliOptions.watch ? watchInner : bundleInner;
1517
- await operation({}, cliOptions);
1508
+ await (cliOptions.watch ? watchInner : bundleInner)({}, cliOptions);
1518
1509
  return;
1519
1510
  }
1520
1511
  if (cliOptions.watch) {
1521
1512
  logger.error("You must specify `output.dir` to use watch mode");
1522
1513
  process.exit(1);
1523
1514
  }
1524
- const build = _usingCtx$1.a(await rolldown(cliOptions.input));
1525
- const { output: outputs } = await build.generate(cliOptions.output);
1515
+ const { output: outputs } = await _usingCtx$1.a(await rolldown(cliOptions.input)).generate(cliOptions.output);
1526
1516
  if (outputs.length === 0) {
1527
1517
  logger.error("No output generated");
1528
1518
  process.exit(1);
@@ -1605,8 +1595,7 @@ async function bundleInner(config, cliOptions) {
1605
1595
  }
1606
1596
  result.forEach(printBundleOutputPretty);
1607
1597
  logger.log(``);
1608
- const endTime = performance.now();
1609
- const duration = endTime - startTime;
1598
+ const duration = performance.now() - startTime;
1610
1599
  logger.success(`rolldown v${version} Finished in ${colors.green(ms(duration))}`);
1611
1600
  }
1612
1601
  function printBundleOutputPretty(output) {
package/dist/config.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import "./shared/binding-9k0egz6L.mjs";
2
- import { ConfigExport, defineConfig } from "./shared/define-config-DVSr6Unb.mjs";
1
+ import "./shared/binding-wK0CRIMb.mjs";
2
+ import { ConfigExport, defineConfig } from "./shared/define-config-wxvILtDx.mjs";
3
3
 
4
4
  //#region src/utils/load-config.d.ts
5
5
  declare function loadConfig(configPath: string): Promise<ConfigExport>;
package/dist/config.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import "./shared/parse-ast-index-DjojK-Vf.mjs";
2
- import { defineConfig, version } from "./shared/src-Chn1S4O2.mjs";
1
+ import "./shared/parse-ast-index-CkDFQ-07.mjs";
2
+ import { defineConfig, version } from "./shared/src-WjgJWoNk.mjs";
3
3
  import "./shared/misc-CQeo-AFx.mjs";
4
- import { loadConfig } from "./shared/load-config-CXpGBNqp.mjs";
4
+ import { loadConfig } from "./shared/load-config-Jqw6FAJp.mjs";
5
5
 
6
6
  //#region src/config.ts
7
7
  const VERSION = version;
@@ -1,13 +1,25 @@
1
- import { BindingAssetPluginConfig, BindingBuildImportAnalysisPluginConfig, BindingDynamicImportVarsPluginConfig, BindingEsmExternalRequirePluginConfig, BindingImportGlobPluginConfig, BindingIsolatedDeclarationPluginConfig, BindingJsonPluginConfig, BindingManifestPluginConfig, BindingModulePreloadPolyfillPluginConfig, BindingReplacePluginConfig, BindingReporterPluginConfig, BindingTransformPluginConfig, BindingViteResolvePluginConfig, BindingWasmHelperPluginConfig, IsolatedDeclarationsOptions, IsolatedDeclarationsResult, NapiResolveOptions, ResolveResult, ResolverFactory, TransformOptions, TransformResult, isolatedDeclaration, moduleRunnerTransform, transform } from "./shared/binding-9k0egz6L.mjs";
2
- import { BuiltinPlugin, InputOptions, OutputOptions, StringOrRegExp, defineParallelPlugin } from "./shared/define-config-DVSr6Unb.mjs";
1
+ import { BindingAssetPluginConfig, BindingBuildImportAnalysisPluginConfig, BindingDynamicImportVarsPluginConfig, BindingEsmExternalRequirePluginConfig, BindingHmrUpdate, BindingImportGlobPluginConfig, BindingIsolatedDeclarationPluginConfig, BindingJsonPluginConfig, BindingManifestPluginConfig, BindingModulePreloadPolyfillPluginConfig, BindingReplacePluginConfig, BindingReporterPluginConfig, BindingTransformPluginConfig, BindingViteResolvePluginConfig, BindingWasmHelperPluginConfig, IsolatedDeclarationsOptions, IsolatedDeclarationsResult, NapiResolveOptions, ResolveResult, ResolverFactory, TransformOptions, TransformResult, isolatedDeclaration, moduleRunnerTransform, transform } from "./shared/binding-wK0CRIMb.mjs";
2
+ import { BuiltinPlugin, InputOptions, OutputOptions, StringOrRegExp, defineParallelPlugin } from "./shared/define-config-wxvILtDx.mjs";
3
3
 
4
+ //#region src/api/dev/dev-options.d.ts
5
+ interface DevWatchOptions {
6
+ usePolling?: boolean;
7
+ pollInterval?: number;
8
+ }
9
+ interface DevOptions {
10
+ onHmrUpdates?: (updates: BindingHmrUpdate[]) => void | Promise<void>;
11
+ watch?: DevWatchOptions;
12
+ }
13
+ //#endregion
4
14
  //#region src/api/dev/dev-engine.d.ts
5
15
  declare class DevEngine {
6
16
  #private;
7
- static create(inputOptions: InputOptions, outputOptions: OutputOptions): Promise<DevEngine>;
17
+ static create(inputOptions: InputOptions, outputOptions?: OutputOptions, devOptions?: DevOptions): Promise<DevEngine>;
8
18
  private constructor();
9
19
  run(): Promise<void>;
10
20
  ensureCurrentBuildFinish(): Promise<void>;
21
+ ensureLatestBuild(): Promise<void>;
22
+ invalidate(file: string, firstInvalidatedBy?: string): Promise<BindingHmrUpdate>;
11
23
  }
12
24
  //#endregion
13
25
  //#region src/api/dev/index.d.ts
@@ -87,4 +99,4 @@ type TransformPluginConfig = Omit<BindingTransformPluginConfig, "include" | "exc
87
99
  };
88
100
  declare function transformPlugin(config?: TransformPluginConfig): BuiltinPlugin;
89
101
  //#endregion
90
- export { DevEngine, type IsolatedDeclarationsOptions, type IsolatedDeclarationsResult, type NapiResolveOptions as ResolveOptions, type ResolveResult, ResolverFactory, type TransformOptions, type TransformResult, aliasPlugin, assetPlugin, buildImportAnalysisPlugin, defineParallelPlugin, dev, dynamicImportVarsPlugin, esmExternalRequirePlugin, importGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, replacePlugin, reporterPlugin, experimental_scan as scan, transform, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin };
102
+ export { DevEngine, type DevOptions, type DevWatchOptions, type IsolatedDeclarationsOptions, type IsolatedDeclarationsResult, type NapiResolveOptions as ResolveOptions, type ResolveResult, ResolverFactory, type TransformOptions, type TransformResult, aliasPlugin, assetPlugin, buildImportAnalysisPlugin, defineParallelPlugin, dev, dynamicImportVarsPlugin, esmExternalRequirePlugin, importGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, replacePlugin, reporterPlugin, experimental_scan as scan, transform, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin };
@@ -1,5 +1,5 @@
1
- import { BindingBundler, BindingDevEngine, ResolverFactory, isolatedDeclaration, moduleRunnerTransform, transform } from "./shared/parse-ast-index-DjojK-Vf.mjs";
2
- import { BuiltinPlugin, PluginDriver, assetPlugin, buildImportAnalysisPlugin, createBundlerImpl, createBundlerOptions, dynamicImportVarsPlugin, esmExternalRequirePlugin, handleOutputErrors, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, reporterPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin } from "./shared/src-Chn1S4O2.mjs";
1
+ import { BindingBundler, BindingDevEngine, ResolverFactory, isolatedDeclaration, moduleRunnerTransform, transform } from "./shared/parse-ast-index-CkDFQ-07.mjs";
2
+ import { PluginDriver, assetPlugin, buildImportAnalysisPlugin, createBuiltinPlugin, createBundlerImpl, createBundlerOptions, dynamicImportVarsPlugin, esmExternalRequirePlugin, handleOutputErrors, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, reporterPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin } from "./shared/src-WjgJWoNk.mjs";
3
3
  import "./shared/misc-CQeo-AFx.mjs";
4
4
  import { pathToFileURL } from "node:url";
5
5
 
@@ -7,10 +7,17 @@ import { pathToFileURL } from "node:url";
7
7
  var DevEngine = class DevEngine {
8
8
  #inner;
9
9
  #cachedBuildFinishPromise = null;
10
- static async create(inputOptions, outputOptions) {
10
+ static async create(inputOptions, outputOptions = {}, devOptions = {}) {
11
11
  inputOptions = await PluginDriver.callOptionsHook(inputOptions);
12
12
  const options = await createBundlerOptions(inputOptions, outputOptions, false);
13
- const inner = new BindingDevEngine(options.bundlerOptions);
13
+ const bindingDevOptions = {
14
+ onHmrUpdates: devOptions.onHmrUpdates,
15
+ watch: devOptions.watch && {
16
+ usePolling: devOptions.watch.usePolling,
17
+ pollInterval: devOptions.watch.pollInterval
18
+ }
19
+ };
20
+ const inner = new BindingDevEngine(options.bundlerOptions, bindingDevOptions);
14
21
  return new DevEngine(inner);
15
22
  }
16
23
  constructor(inner) {
@@ -27,6 +34,12 @@ var DevEngine = class DevEngine {
27
34
  this.#cachedBuildFinishPromise = promise;
28
35
  return promise;
29
36
  }
37
+ async ensureLatestBuild() {
38
+ await this.#inner.ensureLatestBuild();
39
+ }
40
+ async invalidate(file, firstInvalidatedBy) {
41
+ return this.#inner.invalidate(file, firstInvalidatedBy);
42
+ }
30
43
  };
31
44
 
32
45
  //#endregion
@@ -62,7 +75,7 @@ function defineParallelPlugin(pluginPath) {
62
75
  //#endregion
63
76
  //#region src/builtin-plugin/alias-plugin.ts
64
77
  function aliasPlugin(config) {
65
- return new BuiltinPlugin("builtin:alias", config);
78
+ return createBuiltinPlugin("builtin:alias", config);
66
79
  }
67
80
 
68
81
  //#endregion
@@ -90,7 +103,10 @@ function aliasPlugin(config) {
90
103
  * ```
91
104
  */
92
105
  function replacePlugin(values = {}, options = {}) {
93
- return new BuiltinPlugin("builtin:replace", {
106
+ Object.keys(values).forEach((key) => {
107
+ values[key] = values[key].toString();
108
+ });
109
+ return createBuiltinPlugin("builtin:replace", {
94
110
  ...options,
95
111
  values
96
112
  });
@@ -106,7 +122,7 @@ function transformPlugin(config) {
106
122
  jsxRefreshInclude: normalizedStringOrRegex(config.jsxRefreshInclude),
107
123
  jsxRefreshExclude: normalizedStringOrRegex(config.jsxRefreshExclude)
108
124
  };
109
- return new BuiltinPlugin("builtin:transform", config);
125
+ return createBuiltinPlugin("builtin:transform", config);
110
126
  }
111
127
 
112
128
  //#endregion
@@ -1,4 +1,4 @@
1
- import "./shared/binding-9k0egz6L.mjs";
2
- import { withFilter } from "./shared/define-config-DVSr6Unb.mjs";
1
+ import "./shared/binding-wK0CRIMb.mjs";
2
+ import { withFilter } from "./shared/define-config-wxvILtDx.mjs";
3
3
  import { and, code, exclude, id, include, moduleType, not, or, queries, query } from "@rolldown/pluginutils";
4
4
  export { and, code, exclude, id, include, moduleType, not, or, queries, query, withFilter };