rolldown 1.0.0-beta.37 → 1.0.0-beta.39
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.
- package/dist/cli.d.mts +1 -1
- package/dist/cli.mjs +82 -297
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +3 -3
- package/dist/experimental-index.d.mts +15 -5
- package/dist/experimental-index.mjs +76 -10
- package/dist/filter-index.d.mts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/parallel-plugin-worker.d.mts +1 -1
- package/dist/parallel-plugin-worker.mjs +2 -2
- package/dist/parallel-plugin.d.mts +2 -2
- package/dist/parse-ast-index.d.mts +1 -1
- package/dist/parse-ast-index.mjs +1 -1
- package/dist/shared/{binding-Cjs27cfu.d.mts → binding-aYdpw2Yk.d.mts} +9 -25
- package/dist/shared/{define-config-CV3aiNwN.d.mts → define-config-DMtLQsA0.d.mts} +5 -3
- package/dist/shared/{load-config-BOVuTpJm.mjs → load-config-BhonyBZl.mjs} +2 -2
- package/dist/shared/{parse-ast-index-B5HcAOhq.mjs → parse-ast-index-BzRh1cX7.mjs} +335 -209
- package/dist/shared/{src-BtNlw_84.mjs → src-CC6sgydx.mjs} +332 -532
- package/package.json +24 -24
package/dist/cli.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export { };
|
package/dist/cli.mjs
CHANGED
|
@@ -1,215 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { description,
|
|
1
|
+
import "./shared/parse-ast-index-BzRh1cX7.mjs";
|
|
2
|
+
import { description, getCliSchemaInfo, getInputCliKeys, getOutputCliKeys, onExit, rolldown, validateCliOptions, version, watch } from "./shared/src-CC6sgydx.mjs";
|
|
3
3
|
import { arraify } from "./shared/misc-CQeo-AFx.mjs";
|
|
4
4
|
import { logger } from "./shared/logger-CiCY7ucm.mjs";
|
|
5
|
-
import { loadConfig } from "./shared/load-config-
|
|
5
|
+
import { loadConfig } from "./shared/load-config-BhonyBZl.mjs";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import colors from "ansis";
|
|
8
8
|
import { parseArgs } from "node:util";
|
|
9
9
|
import process$1 from "node:process";
|
|
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 = list.indexOf(fn);
|
|
76
|
-
/* c8 ignore start */
|
|
77
|
-
if (i === -1) return;
|
|
78
|
-
/* c8 ignore stop */
|
|
79
|
-
if (i === 0 && list.length === 1) list.length = 0;
|
|
80
|
-
else list.splice(i, 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 = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
138
|
-
if (!ret) process$3.kill(process$3.pid, s);
|
|
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 (_) {}
|
|
164
|
-
this.#process.emit = (ev, ...a) => {
|
|
165
|
-
return this.#processEmit(ev, ...a);
|
|
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 (_) {}
|
|
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
|
|
213
12
|
//#region src/cli/arguments/alias.ts
|
|
214
13
|
const alias = {
|
|
215
14
|
config: {
|
|
@@ -251,33 +50,6 @@ const alias = {
|
|
|
251
50
|
|
|
252
51
|
//#endregion
|
|
253
52
|
//#region src/cli/arguments/utils.ts
|
|
254
|
-
const priority = [
|
|
255
|
-
"object",
|
|
256
|
-
"array",
|
|
257
|
-
"string",
|
|
258
|
-
"number",
|
|
259
|
-
"boolean"
|
|
260
|
-
];
|
|
261
|
-
function getSchemaType(schema) {
|
|
262
|
-
if ("anyOf" in schema) {
|
|
263
|
-
const types = schema.anyOf.map(getSchemaType);
|
|
264
|
-
let result = priority.find((type) => types.includes(type));
|
|
265
|
-
if (result) return result;
|
|
266
|
-
}
|
|
267
|
-
if ("type" in schema) return schema.type;
|
|
268
|
-
if ("const" in schema) return typeof schema.const;
|
|
269
|
-
return "never";
|
|
270
|
-
}
|
|
271
|
-
function flattenSchema(schema, base = {}, parent = "") {
|
|
272
|
-
if (schema === void 0) return base;
|
|
273
|
-
for (const [k, value] of Object.entries(schema)) {
|
|
274
|
-
const key = parent ? `${parent}.${k}` : k;
|
|
275
|
-
if (getSchemaType(value) === "object") if ("properties" in value) flattenSchema(value.properties, base, key);
|
|
276
|
-
else base[key] = value;
|
|
277
|
-
else base[key] = value;
|
|
278
|
-
}
|
|
279
|
-
return base;
|
|
280
|
-
}
|
|
281
53
|
function setNestedProperty(obj, path$1, value) {
|
|
282
54
|
const keys = path$1.split(".");
|
|
283
55
|
let current = obj;
|
|
@@ -343,13 +115,12 @@ function normalizeCliOptions(cliOptions, positionals) {
|
|
|
343
115
|
|
|
344
116
|
//#endregion
|
|
345
117
|
//#region src/cli/arguments/index.ts
|
|
346
|
-
const
|
|
347
|
-
const
|
|
348
|
-
const options = Object.fromEntries(Object.entries(flattenedSchema).filter(([_key, schema]) => getSchemaType(schema) !== "never").map(([key, schema]) => {
|
|
118
|
+
const schemaInfo = getCliSchemaInfo();
|
|
119
|
+
const options = Object.fromEntries(Object.entries(schemaInfo).filter(([_key, info]) => info.type !== "never").map(([key, info]) => {
|
|
349
120
|
const config = Object.getOwnPropertyDescriptor(alias, key)?.value;
|
|
350
121
|
const result = {
|
|
351
|
-
type:
|
|
352
|
-
description:
|
|
122
|
+
type: info.type === "boolean" ? "boolean" : "string",
|
|
123
|
+
description: info?.description ?? config?.description ?? "",
|
|
353
124
|
hint: config?.hint
|
|
354
125
|
};
|
|
355
126
|
if (config && config?.abbreviation) result.short = config?.abbreviation;
|
|
@@ -371,7 +142,7 @@ function parseCliArguments() {
|
|
|
371
142
|
let negative = false;
|
|
372
143
|
if (option.name.startsWith("no-")) {
|
|
373
144
|
const name = kebabCaseToCamelCase(option.name.substring(3));
|
|
374
|
-
if (name in
|
|
145
|
+
if (name in schemaInfo) {
|
|
375
146
|
delete values[option.name];
|
|
376
147
|
option.name = name;
|
|
377
148
|
negative = true;
|
|
@@ -379,12 +150,12 @@ function parseCliArguments() {
|
|
|
379
150
|
}
|
|
380
151
|
delete values[option.name];
|
|
381
152
|
option.name = kebabCaseToCamelCase(option.name);
|
|
382
|
-
let
|
|
383
|
-
if (!
|
|
153
|
+
let originalInfo = schemaInfo[option.name];
|
|
154
|
+
if (!originalInfo) return {
|
|
384
155
|
name: option.name,
|
|
385
156
|
value: option.value
|
|
386
157
|
};
|
|
387
|
-
let type =
|
|
158
|
+
let type = originalInfo.type;
|
|
388
159
|
if (type === "string" && typeof option.value !== "string") {
|
|
389
160
|
let opt = option;
|
|
390
161
|
let defaultValue = Object.getOwnPropertyDescriptor(alias, opt.name)?.value;
|
|
@@ -422,7 +193,15 @@ function parseCliArguments() {
|
|
|
422
193
|
configurable: true,
|
|
423
194
|
writable: true
|
|
424
195
|
});
|
|
425
|
-
else
|
|
196
|
+
else if (type === "union") {
|
|
197
|
+
let defaultValue = Object.getOwnPropertyDescriptor(alias, option.name)?.value;
|
|
198
|
+
Object.defineProperty(values, option.name, {
|
|
199
|
+
value: option.value ?? defaultValue?.default ?? "",
|
|
200
|
+
enumerable: true,
|
|
201
|
+
configurable: true,
|
|
202
|
+
writable: true
|
|
203
|
+
});
|
|
204
|
+
} else Object.defineProperty(values, option.name, {
|
|
426
205
|
value: option.value ?? "",
|
|
427
206
|
enumerable: true,
|
|
428
207
|
configurable: true,
|
|
@@ -463,68 +242,64 @@ function getClearScreenFunction(options$1) {
|
|
|
463
242
|
}
|
|
464
243
|
|
|
465
244
|
//#endregion
|
|
466
|
-
//#region
|
|
467
|
-
|
|
468
|
-
function
|
|
469
|
-
var
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
if (
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
d: o,
|
|
488
|
-
a: r$1
|
|
489
|
-
});
|
|
490
|
-
} else r$1 && n.push({
|
|
491
|
-
d: e$1,
|
|
245
|
+
//#region \0@oxc-project+runtime@0.90.0/helpers/usingCtx.js
|
|
246
|
+
function _usingCtx() {
|
|
247
|
+
var r = "function" == typeof SuppressedError ? SuppressedError : function(r$1, e$1) {
|
|
248
|
+
var n$1 = Error();
|
|
249
|
+
return n$1.name = "SuppressedError", n$1.error = r$1, n$1.suppressed = e$1, n$1;
|
|
250
|
+
}, e = {}, n = [];
|
|
251
|
+
function using(r$1, e$1) {
|
|
252
|
+
if (null != e$1) {
|
|
253
|
+
if (Object(e$1) !== e$1) throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");
|
|
254
|
+
if (r$1) var o = e$1[Symbol.asyncDispose || Symbol["for"]("Symbol.asyncDispose")];
|
|
255
|
+
if (void 0 === o && (o = e$1[Symbol.dispose || Symbol["for"]("Symbol.dispose")], r$1)) var t = o;
|
|
256
|
+
if ("function" != typeof o) throw new TypeError("Object is not disposable.");
|
|
257
|
+
t && (o = function o$1() {
|
|
258
|
+
try {
|
|
259
|
+
t.call(e$1);
|
|
260
|
+
} catch (r$2) {
|
|
261
|
+
return Promise.reject(r$2);
|
|
262
|
+
}
|
|
263
|
+
}), n.push({
|
|
264
|
+
v: e$1,
|
|
265
|
+
d: o,
|
|
492
266
|
a: r$1
|
|
493
267
|
});
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
function err(n$1) {
|
|
516
|
-
return t = t !== e ? new r(n$1, t) : n$1, next();
|
|
268
|
+
} else r$1 && n.push({
|
|
269
|
+
d: e$1,
|
|
270
|
+
a: r$1
|
|
271
|
+
});
|
|
272
|
+
return e$1;
|
|
273
|
+
}
|
|
274
|
+
return {
|
|
275
|
+
e,
|
|
276
|
+
u: using.bind(null, !1),
|
|
277
|
+
a: using.bind(null, !0),
|
|
278
|
+
d: function d() {
|
|
279
|
+
var o, t = this.e, s = 0;
|
|
280
|
+
function next() {
|
|
281
|
+
for (; o = n.pop();) try {
|
|
282
|
+
if (!o.a && 1 === s) return s = 0, n.push(o), Promise.resolve().then(next);
|
|
283
|
+
if (o.d) {
|
|
284
|
+
var r$1 = o.d.call(o.v);
|
|
285
|
+
if (o.a) return s |= 2, Promise.resolve(r$1).then(next, err);
|
|
286
|
+
} else s |= 1;
|
|
287
|
+
} catch (r$2) {
|
|
288
|
+
return err(r$2);
|
|
517
289
|
}
|
|
518
|
-
return
|
|
290
|
+
if (1 === s) return t !== e ? Promise.reject(t) : Promise.resolve();
|
|
291
|
+
if (t !== e) throw t;
|
|
519
292
|
}
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
293
|
+
function err(n$1) {
|
|
294
|
+
return t = t !== e ? new r(n$1, t) : n$1, next();
|
|
295
|
+
}
|
|
296
|
+
return next();
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
}
|
|
524
300
|
|
|
525
301
|
//#endregion
|
|
526
302
|
//#region src/cli/commands/bundle.ts
|
|
527
|
-
var import_usingCtx = /* @__PURE__ */ __toESM(require_usingCtx(), 1);
|
|
528
303
|
async function bundleWithConfig(configPath, cliOptions, rawArgs = {}) {
|
|
529
304
|
if (cliOptions.watch) {
|
|
530
305
|
process.env.ROLLUP_WATCH = "true";
|
|
@@ -541,7 +316,7 @@ async function bundleWithConfig(configPath, cliOptions, rawArgs = {}) {
|
|
|
541
316
|
}
|
|
542
317
|
async function bundleWithCliOptions(cliOptions) {
|
|
543
318
|
try {
|
|
544
|
-
var _usingCtx$1 = (
|
|
319
|
+
var _usingCtx$1 = _usingCtx();
|
|
545
320
|
if (cliOptions.output.dir || cliOptions.output.file) {
|
|
546
321
|
await (cliOptions.watch ? watchInner : bundleInner)({}, cliOptions);
|
|
547
322
|
return;
|
|
@@ -767,8 +542,18 @@ function showHelp() {
|
|
|
767
542
|
});
|
|
768
543
|
}
|
|
769
544
|
|
|
545
|
+
//#endregion
|
|
546
|
+
//#region src/cli/version-check.ts
|
|
547
|
+
function checkNodeVersion(nodeVersion) {
|
|
548
|
+
const currentVersion = nodeVersion.split(".");
|
|
549
|
+
const major = parseInt(currentVersion[0], 10);
|
|
550
|
+
const minor = parseInt(currentVersion[1], 10);
|
|
551
|
+
return major === 20 && minor >= 19 || major === 22 && minor >= 12 || major > 22;
|
|
552
|
+
}
|
|
553
|
+
|
|
770
554
|
//#endregion
|
|
771
555
|
//#region src/cli/index.ts
|
|
556
|
+
if (!checkNodeVersion(process$1.versions.node)) logger.warn(`You are using Node.js ${process$1.versions.node}. Rolldown requires Node.js version 20.19+ or 22.12+. Please upgrade your Node.js version.`);
|
|
772
557
|
async function main() {
|
|
773
558
|
const { rawArgs,...cliOptions } = parseCliArguments();
|
|
774
559
|
if (cliOptions.config || cliOptions.config === "") {
|
package/dist/config.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./shared/binding-
|
|
2
|
-
import { ConfigExport, defineConfig } from "./shared/define-config-
|
|
1
|
+
import "./shared/binding-aYdpw2Yk.mjs";
|
|
2
|
+
import { ConfigExport, defineConfig } from "./shared/define-config-DMtLQsA0.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-
|
|
2
|
-
import { defineConfig, version } from "./shared/src-
|
|
1
|
+
import "./shared/parse-ast-index-BzRh1cX7.mjs";
|
|
2
|
+
import { defineConfig, version } from "./shared/src-CC6sgydx.mjs";
|
|
3
3
|
import "./shared/misc-CQeo-AFx.mjs";
|
|
4
|
-
import { loadConfig } from "./shared/load-config-
|
|
4
|
+
import { loadConfig } from "./shared/load-config-BhonyBZl.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/config.ts
|
|
7
7
|
const VERSION = version;
|
|
@@ -1,8 +1,13 @@
|
|
|
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-
|
|
2
|
-
import { BuiltinPlugin, InputOptions, OutputOptions, StringOrRegExp, defineParallelPlugin } from "./shared/define-config-
|
|
1
|
+
import { BindingAssetPluginConfig, BindingBuildImportAnalysisPluginConfig, BindingDynamicImportVarsPluginConfig, BindingEsmExternalRequirePluginConfig, BindingHmrUpdate, BindingImportGlobPluginConfig, BindingIsolatedDeclarationPluginConfig, BindingJsonPluginConfig, BindingManifestPluginConfig, BindingModulePreloadPolyfillPluginConfig, BindingReactRefreshWrapperPluginConfig, BindingReplacePluginConfig, BindingReporterPluginConfig, BindingTransformPluginConfig, BindingViteResolvePluginConfig, BindingWasmHelperPluginConfig, IsolatedDeclarationsOptions, IsolatedDeclarationsResult, NapiResolveOptions, ResolveResult, ResolverFactory, TransformOptions, TransformResult, isolatedDeclaration, moduleRunnerTransform, transform } from "./shared/binding-aYdpw2Yk.mjs";
|
|
2
|
+
import { BuiltinPlugin, InputOptions, OutputOptions, StringOrRegExp, defineParallelPlugin } from "./shared/define-config-DMtLQsA0.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/api/dev/dev-options.d.ts
|
|
5
5
|
interface DevWatchOptions {
|
|
6
|
+
/**
|
|
7
|
+
* If `true`, files are not written to disk.
|
|
8
|
+
* @default false
|
|
9
|
+
*/
|
|
10
|
+
skipWrite?: boolean;
|
|
6
11
|
/**
|
|
7
12
|
* If `true`, use polling instead of native file system events for watching.
|
|
8
13
|
* @default false
|
|
@@ -49,7 +54,7 @@ declare class DevEngine {
|
|
|
49
54
|
private constructor();
|
|
50
55
|
run(): Promise<void>;
|
|
51
56
|
ensureCurrentBuildFinish(): Promise<void>;
|
|
52
|
-
|
|
57
|
+
ensureLatestBuildOutput(): Promise<void>;
|
|
53
58
|
/**
|
|
54
59
|
* Returns true if a new build is scheduled.
|
|
55
60
|
*/
|
|
@@ -66,7 +71,7 @@ declare var dev: typeof DevEngine.create;
|
|
|
66
71
|
*
|
|
67
72
|
* Calling this API will only execute the scan stage of rolldown.
|
|
68
73
|
*/
|
|
69
|
-
declare const
|
|
74
|
+
declare const scan: (input: InputOptions) => Promise<void>;
|
|
70
75
|
//#endregion
|
|
71
76
|
//#region src/builtin-plugin/constructors.d.ts
|
|
72
77
|
declare function modulePreloadPolyfillPlugin(config?: BindingModulePreloadPolyfillPluginConfig): BuiltinPlugin;
|
|
@@ -88,6 +93,11 @@ declare function isolatedDeclarationPlugin(config?: BindingIsolatedDeclarationPl
|
|
|
88
93
|
declare function assetPlugin(config?: BindingAssetPluginConfig): BuiltinPlugin;
|
|
89
94
|
declare function webWorkerPostPlugin(): BuiltinPlugin;
|
|
90
95
|
declare function esmExternalRequirePlugin(config?: BindingEsmExternalRequirePluginConfig): BuiltinPlugin;
|
|
96
|
+
type ReactRefreshWrapperPluginConfig = Omit<BindingReactRefreshWrapperPluginConfig, "include" | "exclude"> & {
|
|
97
|
+
include?: StringOrRegExp | StringOrRegExp[];
|
|
98
|
+
exclude?: StringOrRegExp | StringOrRegExp[];
|
|
99
|
+
};
|
|
100
|
+
declare function reactRefreshWrapperPlugin(config: ReactRefreshWrapperPluginConfig): BuiltinPlugin;
|
|
91
101
|
//#endregion
|
|
92
102
|
//#region src/builtin-plugin/alias-plugin.d.ts
|
|
93
103
|
type AliasPluginAlias = {
|
|
@@ -134,4 +144,4 @@ type TransformPluginConfig = Omit<BindingTransformPluginConfig, "include" | "exc
|
|
|
134
144
|
};
|
|
135
145
|
declare function transformPlugin(config?: TransformPluginConfig): BuiltinPlugin;
|
|
136
146
|
//#endregion
|
|
137
|
-
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,
|
|
147
|
+
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, reactRefreshWrapperPlugin, replacePlugin, reporterPlugin, scan, transform, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { BuiltinPlugin, PluginDriver,
|
|
1
|
+
import { BindingDevEngine, ResolverFactory, isolatedDeclaration, moduleRunnerTransform, transform } from "./shared/parse-ast-index-BzRh1cX7.mjs";
|
|
2
|
+
import { BuiltinPlugin, PluginDriver, RolldownBuild, createBundlerOptions, makeBuiltinPluginCallable, normalizedStringOrRegex } from "./shared/src-CC6sgydx.mjs";
|
|
3
3
|
import "./shared/misc-CQeo-AFx.mjs";
|
|
4
4
|
import { logger } from "./shared/logger-CiCY7ucm.mjs";
|
|
5
5
|
import { pathToFileURL } from "node:url";
|
|
@@ -14,6 +14,7 @@ var DevEngine = class DevEngine {
|
|
|
14
14
|
const bindingDevOptions = {
|
|
15
15
|
onHmrUpdates: devOptions.onHmrUpdates,
|
|
16
16
|
watch: devOptions.watch && {
|
|
17
|
+
skipWrite: devOptions.watch.skipWrite,
|
|
17
18
|
usePolling: devOptions.watch.usePolling,
|
|
18
19
|
pollInterval: devOptions.watch.pollInterval,
|
|
19
20
|
useDebounce: devOptions.watch.useDebounce,
|
|
@@ -39,8 +40,8 @@ var DevEngine = class DevEngine {
|
|
|
39
40
|
this.#cachedBuildFinishPromise = promise;
|
|
40
41
|
return promise;
|
|
41
42
|
}
|
|
42
|
-
async
|
|
43
|
-
await this.#inner.
|
|
43
|
+
async ensureLatestBuildOutput() {
|
|
44
|
+
await this.#inner.ensureLatestBuildOutput();
|
|
44
45
|
}
|
|
45
46
|
/**
|
|
46
47
|
* Returns true if a new build is scheduled.
|
|
@@ -68,12 +69,14 @@ var dev = DevEngine.create;
|
|
|
68
69
|
*
|
|
69
70
|
* Calling this API will only execute the scan stage of rolldown.
|
|
70
71
|
*/
|
|
71
|
-
const
|
|
72
|
+
const scan = async (input) => {
|
|
72
73
|
const inputOptions = await PluginDriver.callOptionsHook(input);
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
const build = new RolldownBuild(inputOptions);
|
|
75
|
+
try {
|
|
76
|
+
await build.scan();
|
|
77
|
+
} finally {
|
|
78
|
+
await build.close();
|
|
79
|
+
}
|
|
77
80
|
};
|
|
78
81
|
|
|
79
82
|
//#endregion
|
|
@@ -87,6 +90,69 @@ function defineParallelPlugin(pluginPath) {
|
|
|
87
90
|
};
|
|
88
91
|
}
|
|
89
92
|
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/builtin-plugin/constructors.ts
|
|
95
|
+
function modulePreloadPolyfillPlugin(config) {
|
|
96
|
+
return new BuiltinPlugin("builtin:module-preload-polyfill", config);
|
|
97
|
+
}
|
|
98
|
+
function dynamicImportVarsPlugin(config) {
|
|
99
|
+
if (config) {
|
|
100
|
+
config.include = normalizedStringOrRegex(config.include);
|
|
101
|
+
config.exclude = normalizedStringOrRegex(config.exclude);
|
|
102
|
+
}
|
|
103
|
+
return new BuiltinPlugin("builtin:dynamic-import-vars", config);
|
|
104
|
+
}
|
|
105
|
+
function importGlobPlugin(config) {
|
|
106
|
+
return new BuiltinPlugin("builtin:import-glob", config);
|
|
107
|
+
}
|
|
108
|
+
function reporterPlugin(config) {
|
|
109
|
+
return new BuiltinPlugin("builtin:reporter", config);
|
|
110
|
+
}
|
|
111
|
+
function manifestPlugin(config) {
|
|
112
|
+
return new BuiltinPlugin("builtin:manifest", config);
|
|
113
|
+
}
|
|
114
|
+
function wasmHelperPlugin(config) {
|
|
115
|
+
return new BuiltinPlugin("builtin:wasm-helper", config);
|
|
116
|
+
}
|
|
117
|
+
function wasmFallbackPlugin() {
|
|
118
|
+
const builtinPlugin = new BuiltinPlugin("builtin:wasm-fallback");
|
|
119
|
+
return makeBuiltinPluginCallable(builtinPlugin);
|
|
120
|
+
}
|
|
121
|
+
function loadFallbackPlugin() {
|
|
122
|
+
return new BuiltinPlugin("builtin:load-fallback");
|
|
123
|
+
}
|
|
124
|
+
function jsonPlugin(config) {
|
|
125
|
+
const builtinPlugin = new BuiltinPlugin("builtin:json", config);
|
|
126
|
+
return makeBuiltinPluginCallable(builtinPlugin);
|
|
127
|
+
}
|
|
128
|
+
function buildImportAnalysisPlugin(config) {
|
|
129
|
+
return new BuiltinPlugin("builtin:build-import-analysis", config);
|
|
130
|
+
}
|
|
131
|
+
function viteResolvePlugin(config) {
|
|
132
|
+
const builtinPlugin = new BuiltinPlugin("builtin:vite-resolve", config);
|
|
133
|
+
return makeBuiltinPluginCallable(builtinPlugin);
|
|
134
|
+
}
|
|
135
|
+
function isolatedDeclarationPlugin(config) {
|
|
136
|
+
return new BuiltinPlugin("builtin:isolated-declaration", config);
|
|
137
|
+
}
|
|
138
|
+
function assetPlugin(config) {
|
|
139
|
+
return new BuiltinPlugin("builtin:asset", config);
|
|
140
|
+
}
|
|
141
|
+
function webWorkerPostPlugin() {
|
|
142
|
+
return new BuiltinPlugin("builtin:web-worker-post");
|
|
143
|
+
}
|
|
144
|
+
function esmExternalRequirePlugin(config) {
|
|
145
|
+
return new BuiltinPlugin("builtin:esm-external-require", config);
|
|
146
|
+
}
|
|
147
|
+
function reactRefreshWrapperPlugin(config) {
|
|
148
|
+
if (config) {
|
|
149
|
+
config.include = normalizedStringOrRegex(config.include);
|
|
150
|
+
config.exclude = normalizedStringOrRegex(config.exclude);
|
|
151
|
+
}
|
|
152
|
+
const builtinPlugin = new BuiltinPlugin("builtin:react-refresh-wrapper", config);
|
|
153
|
+
return makeBuiltinPluginCallable(builtinPlugin);
|
|
154
|
+
}
|
|
155
|
+
|
|
90
156
|
//#endregion
|
|
91
157
|
//#region src/builtin-plugin/alias-plugin.ts
|
|
92
158
|
function aliasPlugin(config) {
|
|
@@ -147,4 +213,4 @@ function transformPlugin(config) {
|
|
|
147
213
|
}
|
|
148
214
|
|
|
149
215
|
//#endregion
|
|
150
|
-
export { DevEngine, ResolverFactory, aliasPlugin, assetPlugin, buildImportAnalysisPlugin, defineParallelPlugin, dev, dynamicImportVarsPlugin, esmExternalRequirePlugin, importGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, replacePlugin, reporterPlugin,
|
|
216
|
+
export { DevEngine, ResolverFactory, aliasPlugin, assetPlugin, buildImportAnalysisPlugin, defineParallelPlugin, dev, dynamicImportVarsPlugin, esmExternalRequirePlugin, importGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, reactRefreshWrapperPlugin, replacePlugin, reporterPlugin, scan, transform, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, webWorkerPostPlugin };
|
package/dist/filter-index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./shared/binding-
|
|
2
|
-
import { withFilter } from "./shared/define-config-
|
|
1
|
+
import "./shared/binding-aYdpw2Yk.mjs";
|
|
2
|
+
import { withFilter } from "./shared/define-config-DMtLQsA0.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 };
|