rolldown 1.0.0-beta.34 → 1.0.0-beta.35

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 (33) hide show
  1. package/dist/cli.cjs +217 -211
  2. package/dist/cli.mjs +204 -204
  3. package/dist/config.cjs +3 -3
  4. package/dist/config.d.cts +1 -1
  5. package/dist/config.d.mts +1 -1
  6. package/dist/config.mjs +3 -3
  7. package/dist/experimental-index.cjs +23 -8
  8. package/dist/experimental-index.d.cts +13 -4
  9. package/dist/experimental-index.d.mts +13 -4
  10. package/dist/experimental-index.mjs +21 -7
  11. package/dist/filter-index.cjs +2 -1
  12. package/dist/filter-index.d.cts +1 -1
  13. package/dist/filter-index.d.mts +1 -1
  14. package/dist/index.cjs +2 -2
  15. package/dist/index.d.cts +1 -1
  16. package/dist/index.d.mts +1 -1
  17. package/dist/index.mjs +2 -2
  18. package/dist/parallel-plugin-worker.cjs +4 -3
  19. package/dist/parallel-plugin-worker.mjs +2 -2
  20. package/dist/parallel-plugin.d.cts +1 -1
  21. package/dist/parallel-plugin.d.mts +1 -1
  22. package/dist/parse-ast-index.cjs +1 -1
  23. package/dist/parse-ast-index.mjs +1 -1
  24. package/dist/shared/{define-config-DVSr6Unb.d.mts → define-config-3arq8OPE.d.mts} +29 -2
  25. package/dist/shared/{define-config-D5AluabE.d.cts → define-config-DhrkZ_o7.d.cts} +29 -2
  26. package/dist/shared/{load-config-CXpGBNqp.mjs → load-config-C93_L4MP.mjs} +1 -1
  27. package/dist/shared/{load-config-CefxSUnT.cjs → load-config-S_ofSLrj.cjs} +11 -6
  28. package/dist/shared/{parse-ast-index-DjojK-Vf.mjs → parse-ast-index-BadydpMA.mjs} +25 -25
  29. package/dist/shared/{parse-ast-index-BCv3Y1TT.cjs → parse-ast-index-cePJvlvW.cjs} +36 -24
  30. package/dist/shared/{prompt-QNI93ne7.cjs → prompt-Q05EYrFb.cjs} +8 -4
  31. package/dist/shared/{src-djpzntWm.cjs → src-BBMxhaqf.cjs} +93 -42
  32. package/dist/shared/{src-Chn1S4O2.mjs → src-D954P1TH.mjs} +75 -31
  33. package/package.json +18 -19
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-BadydpMA.mjs";
2
+ import { description, getInputCliKeys, getJsonSchema, getOutputCliKeys, rolldown, validateCliOptions, version, watch } from "./shared/src-D954P1TH.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-C93_L4MP.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,
@@ -1221,207 +1422,6 @@ function parseCliArguments() {
1221
1422
  return normalizeCliOptions(values, positionals);
1222
1423
  }
1223
1424
 
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
1425
  //#endregion
1426
1426
  //#region src/utils/clear-screen.ts
1427
1427
  const CLEAR_SCREEN = "\x1Bc";
package/dist/config.cjs CHANGED
@@ -1,7 +1,7 @@
1
- const require_src = require('./shared/src-djpzntWm.cjs');
2
- require('./shared/parse-ast-index-BCv3Y1TT.cjs');
1
+ require('./shared/parse-ast-index-cePJvlvW.cjs');
2
+ const require_src = require('./shared/src-BBMxhaqf.cjs');
3
3
  require('./shared/misc-DksvspN4.cjs');
4
- const require_load_config = require('./shared/load-config-CefxSUnT.cjs');
4
+ const require_load_config = require('./shared/load-config-S_ofSLrj.cjs');
5
5
 
6
6
  //#region src/config.ts
7
7
  const VERSION = require_src.version;
package/dist/config.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./shared/binding-D13M6Llu.cjs";
2
- import { ConfigExport, defineConfig } from "./shared/define-config-D5AluabE.cjs";
2
+ import { ConfigExport, defineConfig } from "./shared/define-config-DhrkZ_o7.cjs";
3
3
 
4
4
  //#region src/utils/load-config.d.ts
5
5
  declare function loadConfig(configPath: string): Promise<ConfigExport>;
package/dist/config.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./shared/binding-9k0egz6L.mjs";
2
- import { ConfigExport, defineConfig } from "./shared/define-config-DVSr6Unb.mjs";
2
+ import { ConfigExport, defineConfig } from "./shared/define-config-3arq8OPE.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-BadydpMA.mjs";
2
+ import { defineConfig, version } from "./shared/src-D954P1TH.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-C93_L4MP.mjs";
5
5
 
6
6
  //#region src/config.ts
7
7
  const VERSION = version;
@@ -1,17 +1,23 @@
1
1
  const require_chunk = require('./shared/chunk-DDkG_k5U.cjs');
2
- const require_src = require('./shared/src-djpzntWm.cjs');
3
- const require_parse_ast_index = require('./shared/parse-ast-index-BCv3Y1TT.cjs');
2
+ const require_parse_ast_index = require('./shared/parse-ast-index-cePJvlvW.cjs');
3
+ const require_src = require('./shared/src-BBMxhaqf.cjs');
4
4
  require('./shared/misc-DksvspN4.cjs');
5
- const node_url = require_chunk.__toESM(require("node:url"));
5
+ let node_url = require("node:url");
6
+ node_url = require_chunk.__toESM(node_url);
6
7
 
7
8
  //#region src/api/dev/dev-engine.ts
8
9
  var DevEngine = class DevEngine {
9
10
  #inner;
10
11
  #cachedBuildFinishPromise = null;
11
- static async create(inputOptions, outputOptions) {
12
+ static async create(inputOptions, outputOptions = {}, devOptions = {}) {
12
13
  inputOptions = await require_src.PluginDriver.callOptionsHook(inputOptions);
13
14
  const options = await require_src.createBundlerOptions(inputOptions, outputOptions, false);
14
- const inner = new require_parse_ast_index.BindingDevEngine(options.bundlerOptions);
15
+ const bindingDevOptions = {
16
+ onHmrUpdates: devOptions.onHmrUpdates,
17
+ usePolling: devOptions.usePolling,
18
+ pollInterval: devOptions.pollInterval
19
+ };
20
+ const inner = new require_parse_ast_index.BindingDevEngine(options.bundlerOptions, bindingDevOptions);
15
21
  return new DevEngine(inner);
16
22
  }
17
23
  constructor(inner) {
@@ -28,6 +34,12 @@ var DevEngine = class DevEngine {
28
34
  this.#cachedBuildFinishPromise = promise;
29
35
  return promise;
30
36
  }
37
+ async ensureLatestBuild() {
38
+ await this.#inner.ensureLatestBuild();
39
+ }
40
+ async invalidate(file, firstInvalidatedBy) {
41
+ return this.#inner.invalidate(file, firstInvalidatedBy);
42
+ }
31
43
  };
32
44
 
33
45
  //#endregion
@@ -63,7 +75,7 @@ function defineParallelPlugin(pluginPath) {
63
75
  //#endregion
64
76
  //#region src/builtin-plugin/alias-plugin.ts
65
77
  function aliasPlugin(config) {
66
- return new require_src.BuiltinPlugin("builtin:alias", config);
78
+ return require_src.createBuiltinPlugin("builtin:alias", config);
67
79
  }
68
80
 
69
81
  //#endregion
@@ -91,7 +103,10 @@ function aliasPlugin(config) {
91
103
  * ```
92
104
  */
93
105
  function replacePlugin(values = {}, options = {}) {
94
- return new require_src.BuiltinPlugin("builtin:replace", {
106
+ Object.keys(values).forEach((key) => {
107
+ values[key] = values[key].toString();
108
+ });
109
+ return require_src.createBuiltinPlugin("builtin:replace", {
95
110
  ...options,
96
111
  values
97
112
  });
@@ -107,7 +122,7 @@ function transformPlugin(config) {
107
122
  jsxRefreshInclude: require_src.normalizedStringOrRegex(config.jsxRefreshInclude),
108
123
  jsxRefreshExclude: require_src.normalizedStringOrRegex(config.jsxRefreshExclude)
109
124
  };
110
- return new require_src.BuiltinPlugin("builtin:transform", config);
125
+ return require_src.createBuiltinPlugin("builtin:transform", config);
111
126
  }
112
127
 
113
128
  //#endregion
@@ -1,13 +1,22 @@
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-D13M6Llu.cjs";
2
- import { BuiltinPlugin, InputOptions, OutputOptions, StringOrRegExp, defineParallelPlugin } from "./shared/define-config-D5AluabE.cjs";
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-D13M6Llu.cjs";
2
+ import { BuiltinPlugin, InputOptions, OutputOptions, StringOrRegExp, defineParallelPlugin } from "./shared/define-config-DhrkZ_o7.cjs";
3
3
 
4
+ //#region src/api/dev/dev-options.d.ts
5
+ interface DevOptions {
6
+ onHmrUpdates?: (updates: BindingHmrUpdate[]) => void | Promise<void>;
7
+ usePolling?: boolean;
8
+ pollInterval?: number;
9
+ }
10
+ //#endregion
4
11
  //#region src/api/dev/dev-engine.d.ts
5
12
  declare class DevEngine {
6
13
  #private;
7
- static create(inputOptions: InputOptions, outputOptions: OutputOptions): Promise<DevEngine>;
14
+ static create(inputOptions: InputOptions, outputOptions?: OutputOptions, devOptions?: DevOptions): Promise<DevEngine>;
8
15
  private constructor();
9
16
  run(): Promise<void>;
10
17
  ensureCurrentBuildFinish(): Promise<void>;
18
+ ensureLatestBuild(): Promise<void>;
19
+ invalidate(file: string, firstInvalidatedBy?: string): Promise<BindingHmrUpdate>;
11
20
  }
12
21
  //#endregion
13
22
  //#region src/api/dev/index.d.ts
@@ -87,4 +96,4 @@ type TransformPluginConfig = Omit<BindingTransformPluginConfig, "include" | "exc
87
96
  };
88
97
  declare function transformPlugin(config?: TransformPluginConfig): BuiltinPlugin;
89
98
  //#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 };
99
+ export { DevEngine, type DevOptions, 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,13 +1,22 @@
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-9k0egz6L.mjs";
2
+ import { BuiltinPlugin, InputOptions, OutputOptions, StringOrRegExp, defineParallelPlugin } from "./shared/define-config-3arq8OPE.mjs";
3
3
 
4
+ //#region src/api/dev/dev-options.d.ts
5
+ interface DevOptions {
6
+ onHmrUpdates?: (updates: BindingHmrUpdate[]) => void | Promise<void>;
7
+ usePolling?: boolean;
8
+ pollInterval?: number;
9
+ }
10
+ //#endregion
4
11
  //#region src/api/dev/dev-engine.d.ts
5
12
  declare class DevEngine {
6
13
  #private;
7
- static create(inputOptions: InputOptions, outputOptions: OutputOptions): Promise<DevEngine>;
14
+ static create(inputOptions: InputOptions, outputOptions?: OutputOptions, devOptions?: DevOptions): Promise<DevEngine>;
8
15
  private constructor();
9
16
  run(): Promise<void>;
10
17
  ensureCurrentBuildFinish(): Promise<void>;
18
+ ensureLatestBuild(): Promise<void>;
19
+ invalidate(file: string, firstInvalidatedBy?: string): Promise<BindingHmrUpdate>;
11
20
  }
12
21
  //#endregion
13
22
  //#region src/api/dev/index.d.ts
@@ -87,4 +96,4 @@ type TransformPluginConfig = Omit<BindingTransformPluginConfig, "include" | "exc
87
96
  };
88
97
  declare function transformPlugin(config?: TransformPluginConfig): BuiltinPlugin;
89
98
  //#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 };
99
+ export { DevEngine, type DevOptions, 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-BadydpMA.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-D954P1TH.mjs";
3
3
  import "./shared/misc-CQeo-AFx.mjs";
4
4
  import { pathToFileURL } from "node:url";
5
5
 
@@ -7,10 +7,15 @@ 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
+ usePolling: devOptions.usePolling,
16
+ pollInterval: devOptions.pollInterval
17
+ };
18
+ const inner = new BindingDevEngine(options.bundlerOptions, bindingDevOptions);
14
19
  return new DevEngine(inner);
15
20
  }
16
21
  constructor(inner) {
@@ -27,6 +32,12 @@ var DevEngine = class DevEngine {
27
32
  this.#cachedBuildFinishPromise = promise;
28
33
  return promise;
29
34
  }
35
+ async ensureLatestBuild() {
36
+ await this.#inner.ensureLatestBuild();
37
+ }
38
+ async invalidate(file, firstInvalidatedBy) {
39
+ return this.#inner.invalidate(file, firstInvalidatedBy);
40
+ }
30
41
  };
31
42
 
32
43
  //#endregion
@@ -62,7 +73,7 @@ function defineParallelPlugin(pluginPath) {
62
73
  //#endregion
63
74
  //#region src/builtin-plugin/alias-plugin.ts
64
75
  function aliasPlugin(config) {
65
- return new BuiltinPlugin("builtin:alias", config);
76
+ return createBuiltinPlugin("builtin:alias", config);
66
77
  }
67
78
 
68
79
  //#endregion
@@ -90,7 +101,10 @@ function aliasPlugin(config) {
90
101
  * ```
91
102
  */
92
103
  function replacePlugin(values = {}, options = {}) {
93
- return new BuiltinPlugin("builtin:replace", {
104
+ Object.keys(values).forEach((key) => {
105
+ values[key] = values[key].toString();
106
+ });
107
+ return createBuiltinPlugin("builtin:replace", {
94
108
  ...options,
95
109
  values
96
110
  });
@@ -106,7 +120,7 @@ function transformPlugin(config) {
106
120
  jsxRefreshInclude: normalizedStringOrRegex(config.jsxRefreshInclude),
107
121
  jsxRefreshExclude: normalizedStringOrRegex(config.jsxRefreshExclude)
108
122
  };
109
- return new BuiltinPlugin("builtin:transform", config);
123
+ return createBuiltinPlugin("builtin:transform", config);
110
124
  }
111
125
 
112
126
  //#endregion