@rolldown/browser 1.0.0-beta.37 → 1.0.0-beta.38
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.browser.mjs +74 -30
- package/dist/experimental-index.d.mts +14 -4
- package/dist/experimental-index.mjs +74 -9
- package/dist/filter-index.d.mts +2 -2
- package/dist/index.browser.mjs +1 -1
- 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 +3 -3
- 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/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/shared/{binding-Cjs27cfu.d.mts → binding-D6vpD1fz.d.mts} +9 -24
- package/dist/shared/{define-config-DzsPS4fI.d.mts → define-config-D-OneP9q.d.mts} +5 -3
- package/dist/shared/{load-config-efyGD8HY.mjs → load-config-BGatf3rT.mjs} +2 -2
- package/dist/shared/{parse-ast-index-C3TkGcEQ.mjs → parse-ast-index-CR2E9ZQS.mjs} +2 -2
- package/dist/shared/{src-kVjGhYdF.mjs → src-E1KQKxjT.mjs} +438 -622
- package/dist/{src-C2GHZXDs.js → src-DE1CLQYz.js} +160 -223
- package/package.json +5 -6
package/dist/cli.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export { };
|
package/dist/cli.mjs
CHANGED
|
@@ -1,214 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./shared/parse-ast-index-
|
|
1
|
+
import { ansis_default, description, getCliSchemaInfo, getInputCliKeys, getOutputCliKeys, onExit, rolldown, validateCliOptions, version, watch } from "./shared/src-E1KQKxjT.mjs";
|
|
2
|
+
import "./shared/parse-ast-index-CR2E9ZQS.mjs";
|
|
3
3
|
import { arraify } from "./shared/dist-CHTC3-kR.mjs";
|
|
4
4
|
import { logger } from "./shared/logger-CiCY7ucm.mjs";
|
|
5
|
-
import { loadConfig } from "./shared/load-config-
|
|
5
|
+
import { loadConfig } from "./shared/load-config-BGatf3rT.mjs";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { parseArgs } from "node:util";
|
|
8
8
|
import process$1 from "node:process";
|
|
9
9
|
import { performance } from "node:perf_hooks";
|
|
10
10
|
|
|
11
|
-
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
|
|
12
|
-
/**
|
|
13
|
-
* This is not the set of all possible signals.
|
|
14
|
-
*
|
|
15
|
-
* It IS, however, the set of all signals that trigger
|
|
16
|
-
* an exit on either Linux or BSD systems. Linux is a
|
|
17
|
-
* superset of the signal names supported on BSD, and
|
|
18
|
-
* the unknown signals just fail to register, so we can
|
|
19
|
-
* catch that easily enough.
|
|
20
|
-
*
|
|
21
|
-
* Windows signals are a different set, since there are
|
|
22
|
-
* signals that terminate Windows processes, but don't
|
|
23
|
-
* terminate (or don't even exist) on Posix systems.
|
|
24
|
-
*
|
|
25
|
-
* Don't bother with SIGKILL. It's uncatchable, which
|
|
26
|
-
* means that we can't fire any callbacks anyway.
|
|
27
|
-
*
|
|
28
|
-
* If a user does happen to register a handler on a non-
|
|
29
|
-
* fatal signal like SIGWINCH or something, and then
|
|
30
|
-
* exit, it'll end up firing `process.emit('exit')`, so
|
|
31
|
-
* the handler will be fired anyway.
|
|
32
|
-
*
|
|
33
|
-
* SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
|
|
34
|
-
* artificially, inherently leave the process in a
|
|
35
|
-
* state from which it is not safe to try and enter JS
|
|
36
|
-
* listeners.
|
|
37
|
-
*/
|
|
38
|
-
const signals = [];
|
|
39
|
-
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
40
|
-
if (process.platform !== "win32") signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
|
|
41
|
-
if (process.platform === "linux") signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
42
|
-
|
|
43
|
-
//#endregion
|
|
44
|
-
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
|
|
45
|
-
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";
|
|
46
|
-
const kExitEmitter = Symbol.for("signal-exit emitter");
|
|
47
|
-
const global = globalThis;
|
|
48
|
-
const ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
49
|
-
var Emitter = class {
|
|
50
|
-
emitted = {
|
|
51
|
-
afterExit: false,
|
|
52
|
-
exit: false
|
|
53
|
-
};
|
|
54
|
-
listeners = {
|
|
55
|
-
afterExit: [],
|
|
56
|
-
exit: []
|
|
57
|
-
};
|
|
58
|
-
count = 0;
|
|
59
|
-
id = Math.random();
|
|
60
|
-
constructor() {
|
|
61
|
-
if (global[kExitEmitter]) return global[kExitEmitter];
|
|
62
|
-
ObjectDefineProperty(global, kExitEmitter, {
|
|
63
|
-
value: this,
|
|
64
|
-
writable: false,
|
|
65
|
-
enumerable: false,
|
|
66
|
-
configurable: false
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
on(ev, fn) {
|
|
70
|
-
this.listeners[ev].push(fn);
|
|
71
|
-
}
|
|
72
|
-
removeListener(ev, fn) {
|
|
73
|
-
const list = this.listeners[ev];
|
|
74
|
-
const i = list.indexOf(fn);
|
|
75
|
-
/* c8 ignore start */
|
|
76
|
-
if (i === -1) return;
|
|
77
|
-
/* c8 ignore stop */
|
|
78
|
-
if (i === 0 && list.length === 1) list.length = 0;
|
|
79
|
-
else list.splice(i, 1);
|
|
80
|
-
}
|
|
81
|
-
emit(ev, code, signal) {
|
|
82
|
-
if (this.emitted[ev]) return false;
|
|
83
|
-
this.emitted[ev] = true;
|
|
84
|
-
let ret = false;
|
|
85
|
-
for (const fn of this.listeners[ev]) ret = fn(code, signal) === true || ret;
|
|
86
|
-
if (ev === "exit") ret = this.emit("afterExit", code, signal) || ret;
|
|
87
|
-
return ret;
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
var SignalExitBase = class {};
|
|
91
|
-
const signalExitWrap = (handler) => {
|
|
92
|
-
return {
|
|
93
|
-
onExit(cb, opts) {
|
|
94
|
-
return handler.onExit(cb, opts);
|
|
95
|
-
},
|
|
96
|
-
load() {
|
|
97
|
-
return handler.load();
|
|
98
|
-
},
|
|
99
|
-
unload() {
|
|
100
|
-
return handler.unload();
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
};
|
|
104
|
-
var SignalExitFallback = class extends SignalExitBase {
|
|
105
|
-
onExit() {
|
|
106
|
-
return () => {};
|
|
107
|
-
}
|
|
108
|
-
load() {}
|
|
109
|
-
unload() {}
|
|
110
|
-
};
|
|
111
|
-
var SignalExit = class extends SignalExitBase {
|
|
112
|
-
/* c8 ignore start */
|
|
113
|
-
#hupSig = process$2.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
114
|
-
/* c8 ignore stop */
|
|
115
|
-
#emitter = new Emitter();
|
|
116
|
-
#process;
|
|
117
|
-
#originalProcessEmit;
|
|
118
|
-
#originalProcessReallyExit;
|
|
119
|
-
#sigListeners = {};
|
|
120
|
-
#loaded = false;
|
|
121
|
-
constructor(process$3) {
|
|
122
|
-
super();
|
|
123
|
-
this.#process = process$3;
|
|
124
|
-
this.#sigListeners = {};
|
|
125
|
-
for (const sig of signals) this.#sigListeners[sig] = () => {
|
|
126
|
-
const listeners = this.#process.listeners(sig);
|
|
127
|
-
let { count } = this.#emitter;
|
|
128
|
-
/* c8 ignore start */
|
|
129
|
-
const p = process$3;
|
|
130
|
-
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") count += p.__signal_exit_emitter__.count;
|
|
131
|
-
/* c8 ignore stop */
|
|
132
|
-
if (listeners.length === count) {
|
|
133
|
-
this.unload();
|
|
134
|
-
const ret = this.#emitter.emit("exit", null, sig);
|
|
135
|
-
/* c8 ignore start */
|
|
136
|
-
const s = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
137
|
-
if (!ret) process$3.kill(process$3.pid, s);
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
this.#originalProcessReallyExit = process$3.reallyExit;
|
|
141
|
-
this.#originalProcessEmit = process$3.emit;
|
|
142
|
-
}
|
|
143
|
-
onExit(cb, opts) {
|
|
144
|
-
/* c8 ignore start */
|
|
145
|
-
if (!processOk(this.#process)) return () => {};
|
|
146
|
-
/* c8 ignore stop */
|
|
147
|
-
if (this.#loaded === false) this.load();
|
|
148
|
-
const ev = opts?.alwaysLast ? "afterExit" : "exit";
|
|
149
|
-
this.#emitter.on(ev, cb);
|
|
150
|
-
return () => {
|
|
151
|
-
this.#emitter.removeListener(ev, cb);
|
|
152
|
-
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) this.unload();
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
load() {
|
|
156
|
-
if (this.#loaded) return;
|
|
157
|
-
this.#loaded = true;
|
|
158
|
-
this.#emitter.count += 1;
|
|
159
|
-
for (const sig of signals) try {
|
|
160
|
-
const fn = this.#sigListeners[sig];
|
|
161
|
-
if (fn) this.#process.on(sig, fn);
|
|
162
|
-
} catch (_) {}
|
|
163
|
-
this.#process.emit = (ev, ...a) => {
|
|
164
|
-
return this.#processEmit(ev, ...a);
|
|
165
|
-
};
|
|
166
|
-
this.#process.reallyExit = (code) => {
|
|
167
|
-
return this.#processReallyExit(code);
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
unload() {
|
|
171
|
-
if (!this.#loaded) return;
|
|
172
|
-
this.#loaded = false;
|
|
173
|
-
signals.forEach((sig) => {
|
|
174
|
-
const listener = this.#sigListeners[sig];
|
|
175
|
-
/* c8 ignore start */
|
|
176
|
-
if (!listener) throw new Error("Listener not defined for signal: " + sig);
|
|
177
|
-
/* c8 ignore stop */
|
|
178
|
-
try {
|
|
179
|
-
this.#process.removeListener(sig, listener);
|
|
180
|
-
} catch (_) {}
|
|
181
|
-
/* c8 ignore stop */
|
|
182
|
-
});
|
|
183
|
-
this.#process.emit = this.#originalProcessEmit;
|
|
184
|
-
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
185
|
-
this.#emitter.count -= 1;
|
|
186
|
-
}
|
|
187
|
-
#processReallyExit(code) {
|
|
188
|
-
/* c8 ignore start */
|
|
189
|
-
if (!processOk(this.#process)) return 0;
|
|
190
|
-
this.#process.exitCode = code || 0;
|
|
191
|
-
/* c8 ignore stop */
|
|
192
|
-
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
193
|
-
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
194
|
-
}
|
|
195
|
-
#processEmit(ev, ...args) {
|
|
196
|
-
const og = this.#originalProcessEmit;
|
|
197
|
-
if (ev === "exit" && processOk(this.#process)) {
|
|
198
|
-
if (typeof args[0] === "number") this.#process.exitCode = args[0];
|
|
199
|
-
/* c8 ignore start */
|
|
200
|
-
const ret = og.call(this.#process, ev, ...args);
|
|
201
|
-
/* c8 ignore start */
|
|
202
|
-
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
203
|
-
/* c8 ignore stop */
|
|
204
|
-
return ret;
|
|
205
|
-
} else return og.call(this.#process, ev, ...args);
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
const process$2 = globalThis.process;
|
|
209
|
-
const { onExit, load, unload } = signalExitWrap(processOk(process$2) ? new SignalExit(process$2) : new SignalExitFallback());
|
|
210
|
-
|
|
211
|
-
//#endregion
|
|
212
11
|
//#region src/cli/arguments/alias.ts
|
|
213
12
|
const alias = {
|
|
214
13
|
config: {
|
|
@@ -250,33 +49,6 @@ const alias = {
|
|
|
250
49
|
|
|
251
50
|
//#endregion
|
|
252
51
|
//#region src/cli/arguments/utils.ts
|
|
253
|
-
const priority = [
|
|
254
|
-
"object",
|
|
255
|
-
"array",
|
|
256
|
-
"string",
|
|
257
|
-
"number",
|
|
258
|
-
"boolean"
|
|
259
|
-
];
|
|
260
|
-
function getSchemaType(schema) {
|
|
261
|
-
if ("anyOf" in schema) {
|
|
262
|
-
const types = schema.anyOf.map(getSchemaType);
|
|
263
|
-
let result = priority.find((type) => types.includes(type));
|
|
264
|
-
if (result) return result;
|
|
265
|
-
}
|
|
266
|
-
if ("type" in schema) return schema.type;
|
|
267
|
-
if ("const" in schema) return typeof schema.const;
|
|
268
|
-
return "never";
|
|
269
|
-
}
|
|
270
|
-
function flattenSchema(schema, base = {}, parent = "") {
|
|
271
|
-
if (schema === void 0) return base;
|
|
272
|
-
for (const [k, value] of Object.entries(schema)) {
|
|
273
|
-
const key = parent ? `${parent}.${k}` : k;
|
|
274
|
-
if (getSchemaType(value) === "object") if ("properties" in value) flattenSchema(value.properties, base, key);
|
|
275
|
-
else base[key] = value;
|
|
276
|
-
else base[key] = value;
|
|
277
|
-
}
|
|
278
|
-
return base;
|
|
279
|
-
}
|
|
280
52
|
function setNestedProperty(obj, path$1, value) {
|
|
281
53
|
const keys = path$1.split(".");
|
|
282
54
|
let current = obj;
|
|
@@ -342,13 +114,12 @@ function normalizeCliOptions(cliOptions, positionals) {
|
|
|
342
114
|
|
|
343
115
|
//#endregion
|
|
344
116
|
//#region src/cli/arguments/index.ts
|
|
345
|
-
const
|
|
346
|
-
const
|
|
347
|
-
const options = Object.fromEntries(Object.entries(flattenedSchema).filter(([_key, schema]) => getSchemaType(schema) !== "never").map(([key, schema]) => {
|
|
117
|
+
const schemaInfo = getCliSchemaInfo();
|
|
118
|
+
const options = Object.fromEntries(Object.entries(schemaInfo).filter(([_key, info]) => info.type !== "never").map(([key, info]) => {
|
|
348
119
|
const config = Object.getOwnPropertyDescriptor(alias, key)?.value;
|
|
349
120
|
const result = {
|
|
350
|
-
type:
|
|
351
|
-
description:
|
|
121
|
+
type: info.type === "boolean" ? "boolean" : "string",
|
|
122
|
+
description: info?.description ?? config?.description ?? "",
|
|
352
123
|
hint: config?.hint
|
|
353
124
|
};
|
|
354
125
|
if (config && config?.abbreviation) result.short = config?.abbreviation;
|
|
@@ -370,7 +141,7 @@ function parseCliArguments() {
|
|
|
370
141
|
let negative = false;
|
|
371
142
|
if (option.name.startsWith("no-")) {
|
|
372
143
|
const name = kebabCaseToCamelCase(option.name.substring(3));
|
|
373
|
-
if (name in
|
|
144
|
+
if (name in schemaInfo) {
|
|
374
145
|
delete values[option.name];
|
|
375
146
|
option.name = name;
|
|
376
147
|
negative = true;
|
|
@@ -378,12 +149,12 @@ function parseCliArguments() {
|
|
|
378
149
|
}
|
|
379
150
|
delete values[option.name];
|
|
380
151
|
option.name = kebabCaseToCamelCase(option.name);
|
|
381
|
-
let
|
|
382
|
-
if (!
|
|
152
|
+
let originalInfo = schemaInfo[option.name];
|
|
153
|
+
if (!originalInfo) return {
|
|
383
154
|
name: option.name,
|
|
384
155
|
value: option.value
|
|
385
156
|
};
|
|
386
|
-
let type =
|
|
157
|
+
let type = originalInfo.type;
|
|
387
158
|
if (type === "string" && typeof option.value !== "string") {
|
|
388
159
|
let opt = option;
|
|
389
160
|
let defaultValue = Object.getOwnPropertyDescriptor(alias, opt.name)?.value;
|
|
@@ -421,7 +192,15 @@ function parseCliArguments() {
|
|
|
421
192
|
configurable: true,
|
|
422
193
|
writable: true
|
|
423
194
|
});
|
|
424
|
-
else
|
|
195
|
+
else if (type === "union") {
|
|
196
|
+
let defaultValue = Object.getOwnPropertyDescriptor(alias, option.name)?.value;
|
|
197
|
+
Object.defineProperty(values, option.name, {
|
|
198
|
+
value: option.value ?? defaultValue?.default ?? "",
|
|
199
|
+
enumerable: true,
|
|
200
|
+
configurable: true,
|
|
201
|
+
writable: true
|
|
202
|
+
});
|
|
203
|
+
} else Object.defineProperty(values, option.name, {
|
|
425
204
|
value: option.value ?? "",
|
|
426
205
|
enumerable: true,
|
|
427
206
|
configurable: true,
|
|
@@ -462,68 +241,64 @@ function getClearScreenFunction(options$1) {
|
|
|
462
241
|
}
|
|
463
242
|
|
|
464
243
|
//#endregion
|
|
465
|
-
//#region
|
|
466
|
-
|
|
467
|
-
function
|
|
468
|
-
var
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
if (
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
d: o,
|
|
487
|
-
a: r$1
|
|
488
|
-
});
|
|
489
|
-
} else r$1 && n.push({
|
|
490
|
-
d: e$1,
|
|
244
|
+
//#region \0@oxc-project+runtime@0.89.0/helpers/usingCtx.js
|
|
245
|
+
function _usingCtx() {
|
|
246
|
+
var r = "function" == typeof SuppressedError ? SuppressedError : function(r$1, e$1) {
|
|
247
|
+
var n$1 = Error();
|
|
248
|
+
return n$1.name = "SuppressedError", n$1.error = r$1, n$1.suppressed = e$1, n$1;
|
|
249
|
+
}, e = {}, n = [];
|
|
250
|
+
function using(r$1, e$1) {
|
|
251
|
+
if (null != e$1) {
|
|
252
|
+
if (Object(e$1) !== e$1) throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");
|
|
253
|
+
if (r$1) var o = e$1[Symbol.asyncDispose || Symbol["for"]("Symbol.asyncDispose")];
|
|
254
|
+
if (void 0 === o && (o = e$1[Symbol.dispose || Symbol["for"]("Symbol.dispose")], r$1)) var t = o;
|
|
255
|
+
if ("function" != typeof o) throw new TypeError("Object is not disposable.");
|
|
256
|
+
t && (o = function o$1() {
|
|
257
|
+
try {
|
|
258
|
+
t.call(e$1);
|
|
259
|
+
} catch (r$2) {
|
|
260
|
+
return Promise.reject(r$2);
|
|
261
|
+
}
|
|
262
|
+
}), n.push({
|
|
263
|
+
v: e$1,
|
|
264
|
+
d: o,
|
|
491
265
|
a: r$1
|
|
492
266
|
});
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
function err(n$1) {
|
|
515
|
-
return t = t !== e ? new r(n$1, t) : n$1, next();
|
|
267
|
+
} else r$1 && n.push({
|
|
268
|
+
d: e$1,
|
|
269
|
+
a: r$1
|
|
270
|
+
});
|
|
271
|
+
return e$1;
|
|
272
|
+
}
|
|
273
|
+
return {
|
|
274
|
+
e,
|
|
275
|
+
u: using.bind(null, !1),
|
|
276
|
+
a: using.bind(null, !0),
|
|
277
|
+
d: function d() {
|
|
278
|
+
var o, t = this.e, s = 0;
|
|
279
|
+
function next() {
|
|
280
|
+
for (; o = n.pop();) try {
|
|
281
|
+
if (!o.a && 1 === s) return s = 0, n.push(o), Promise.resolve().then(next);
|
|
282
|
+
if (o.d) {
|
|
283
|
+
var r$1 = o.d.call(o.v);
|
|
284
|
+
if (o.a) return s |= 2, Promise.resolve(r$1).then(next, err);
|
|
285
|
+
} else s |= 1;
|
|
286
|
+
} catch (r$2) {
|
|
287
|
+
return err(r$2);
|
|
516
288
|
}
|
|
517
|
-
return
|
|
289
|
+
if (1 === s) return t !== e ? Promise.reject(t) : Promise.resolve();
|
|
290
|
+
if (t !== e) throw t;
|
|
518
291
|
}
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
292
|
+
function err(n$1) {
|
|
293
|
+
return t = t !== e ? new r(n$1, t) : n$1, next();
|
|
294
|
+
}
|
|
295
|
+
return next();
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
}
|
|
523
299
|
|
|
524
300
|
//#endregion
|
|
525
301
|
//#region src/cli/commands/bundle.ts
|
|
526
|
-
var import_usingCtx = /* @__PURE__ */ __toESM(require_usingCtx(), 1);
|
|
527
302
|
async function bundleWithConfig(configPath, cliOptions, rawArgs = {}) {
|
|
528
303
|
if (cliOptions.watch) {
|
|
529
304
|
process.env.ROLLUP_WATCH = "true";
|
|
@@ -540,7 +315,7 @@ async function bundleWithConfig(configPath, cliOptions, rawArgs = {}) {
|
|
|
540
315
|
}
|
|
541
316
|
async function bundleWithCliOptions(cliOptions) {
|
|
542
317
|
try {
|
|
543
|
-
var _usingCtx$1 = (
|
|
318
|
+
var _usingCtx$1 = _usingCtx();
|
|
544
319
|
if (cliOptions.output.dir || cliOptions.output.file) {
|
|
545
320
|
await (cliOptions.watch ? watchInner : bundleInner)({}, cliOptions);
|
|
546
321
|
return;
|
|
@@ -766,8 +541,18 @@ function showHelp() {
|
|
|
766
541
|
});
|
|
767
542
|
}
|
|
768
543
|
|
|
544
|
+
//#endregion
|
|
545
|
+
//#region src/cli/version-check.ts
|
|
546
|
+
function checkNodeVersion(nodeVersion) {
|
|
547
|
+
const currentVersion = nodeVersion.split(".");
|
|
548
|
+
const major = parseInt(currentVersion[0], 10);
|
|
549
|
+
const minor = parseInt(currentVersion[1], 10);
|
|
550
|
+
return major === 20 && minor >= 19 || major === 22 && minor >= 12 || major > 22;
|
|
551
|
+
}
|
|
552
|
+
|
|
769
553
|
//#endregion
|
|
770
554
|
//#region src/cli/index.ts
|
|
555
|
+
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.`);
|
|
771
556
|
async function main() {
|
|
772
557
|
const { rawArgs,...cliOptions } = parseCliArguments();
|
|
773
558
|
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-D6vpD1fz.mjs";
|
|
2
|
+
import { ConfigExport, defineConfig } from "./shared/define-config-D-OneP9q.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 { defineConfig, version } from "./shared/src-
|
|
2
|
-
import "./shared/parse-ast-index-
|
|
1
|
+
import { defineConfig, version } from "./shared/src-E1KQKxjT.mjs";
|
|
2
|
+
import "./shared/parse-ast-index-CR2E9ZQS.mjs";
|
|
3
3
|
import "./shared/dist-CHTC3-kR.mjs";
|
|
4
|
-
import { loadConfig } from "./shared/load-config-
|
|
4
|
+
import { loadConfig } from "./shared/load-config-BGatf3rT.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/config.ts
|
|
7
7
|
const VERSION = version;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BuiltinPlugin, PluginDriver,
|
|
2
|
-
import {
|
|
1
|
+
import { BuiltinPlugin, PluginDriver, RolldownBuild, createBundlerOptions, makeBuiltinPluginCallable, normalizedStringOrRegex } from "./src-DE1CLQYz.js";
|
|
2
|
+
import { BindingDevEngine, ResolverFactory, isolatedDeclaration, moduleRunnerTransform, transform } from "./rolldown-binding.wasi-browser.js";
|
|
3
3
|
|
|
4
4
|
//#region src/api/dev/dev-engine.ts
|
|
5
5
|
var DevEngine = class DevEngine {
|
|
@@ -11,6 +11,7 @@ var DevEngine = class DevEngine {
|
|
|
11
11
|
const bindingDevOptions = {
|
|
12
12
|
onHmrUpdates: devOptions.onHmrUpdates,
|
|
13
13
|
watch: devOptions.watch && {
|
|
14
|
+
skipWrite: devOptions.watch.skipWrite,
|
|
14
15
|
usePolling: devOptions.watch.usePolling,
|
|
15
16
|
pollInterval: devOptions.watch.pollInterval,
|
|
16
17
|
useDebounce: devOptions.watch.useDebounce,
|
|
@@ -65,12 +66,14 @@ var dev = DevEngine.create;
|
|
|
65
66
|
*
|
|
66
67
|
* Calling this API will only execute the scan stage of rolldown.
|
|
67
68
|
*/
|
|
68
|
-
const
|
|
69
|
+
const scan = async (input) => {
|
|
69
70
|
const inputOptions = await PluginDriver.callOptionsHook(input);
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
const build = new RolldownBuild(inputOptions);
|
|
72
|
+
try {
|
|
73
|
+
await build.scan();
|
|
74
|
+
} finally {
|
|
75
|
+
await build.close();
|
|
76
|
+
}
|
|
74
77
|
};
|
|
75
78
|
|
|
76
79
|
//#endregion
|
|
@@ -79,6 +82,68 @@ function defineParallelPlugin(pluginPath) {
|
|
|
79
82
|
throw new Error("`defineParallelPlugin` is not supported in browser build");
|
|
80
83
|
}
|
|
81
84
|
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region src/builtin-plugin/constructors.ts
|
|
87
|
+
function modulePreloadPolyfillPlugin(config) {
|
|
88
|
+
return new BuiltinPlugin("builtin:module-preload-polyfill", config);
|
|
89
|
+
}
|
|
90
|
+
function dynamicImportVarsPlugin(config) {
|
|
91
|
+
if (config) {
|
|
92
|
+
config.include = normalizedStringOrRegex(config.include);
|
|
93
|
+
config.exclude = normalizedStringOrRegex(config.exclude);
|
|
94
|
+
}
|
|
95
|
+
return new BuiltinPlugin("builtin:dynamic-import-vars", config);
|
|
96
|
+
}
|
|
97
|
+
function importGlobPlugin(config) {
|
|
98
|
+
return new BuiltinPlugin("builtin:import-glob", config);
|
|
99
|
+
}
|
|
100
|
+
function reporterPlugin(config) {
|
|
101
|
+
return new BuiltinPlugin("builtin:reporter", config);
|
|
102
|
+
}
|
|
103
|
+
function manifestPlugin(config) {
|
|
104
|
+
return new BuiltinPlugin("builtin:manifest", config);
|
|
105
|
+
}
|
|
106
|
+
function wasmHelperPlugin(config) {
|
|
107
|
+
return new BuiltinPlugin("builtin:wasm-helper", config);
|
|
108
|
+
}
|
|
109
|
+
function wasmFallbackPlugin() {
|
|
110
|
+
const builtinPlugin = new BuiltinPlugin("builtin:wasm-fallback");
|
|
111
|
+
return makeBuiltinPluginCallable(builtinPlugin);
|
|
112
|
+
}
|
|
113
|
+
function loadFallbackPlugin() {
|
|
114
|
+
return new BuiltinPlugin("builtin:load-fallback");
|
|
115
|
+
}
|
|
116
|
+
function jsonPlugin(config) {
|
|
117
|
+
const builtinPlugin = new BuiltinPlugin("builtin:json", config);
|
|
118
|
+
return makeBuiltinPluginCallable(builtinPlugin);
|
|
119
|
+
}
|
|
120
|
+
function buildImportAnalysisPlugin(config) {
|
|
121
|
+
return new BuiltinPlugin("builtin:build-import-analysis", config);
|
|
122
|
+
}
|
|
123
|
+
function viteResolvePlugin(config) {
|
|
124
|
+
const builtinPlugin = new BuiltinPlugin("builtin:vite-resolve", config);
|
|
125
|
+
return makeBuiltinPluginCallable(builtinPlugin);
|
|
126
|
+
}
|
|
127
|
+
function isolatedDeclarationPlugin(config) {
|
|
128
|
+
return new BuiltinPlugin("builtin:isolated-declaration", config);
|
|
129
|
+
}
|
|
130
|
+
function assetPlugin(config) {
|
|
131
|
+
return new BuiltinPlugin("builtin:asset", config);
|
|
132
|
+
}
|
|
133
|
+
function webWorkerPostPlugin() {
|
|
134
|
+
return new BuiltinPlugin("builtin:web-worker-post");
|
|
135
|
+
}
|
|
136
|
+
function esmExternalRequirePlugin(config) {
|
|
137
|
+
return new BuiltinPlugin("builtin:esm-external-require", config);
|
|
138
|
+
}
|
|
139
|
+
function reactRefreshWrapperPlugin(config) {
|
|
140
|
+
if (config) {
|
|
141
|
+
config.include = normalizedStringOrRegex(config.include);
|
|
142
|
+
config.exclude = normalizedStringOrRegex(config.exclude);
|
|
143
|
+
}
|
|
144
|
+
return new BuiltinPlugin("builtin:react-refresh-wrapper", config);
|
|
145
|
+
}
|
|
146
|
+
|
|
82
147
|
//#endregion
|
|
83
148
|
//#region src/builtin-plugin/alias-plugin.ts
|
|
84
149
|
function aliasPlugin(config) {
|
|
@@ -526,28 +591,7 @@ const consola = createConsola();
|
|
|
526
591
|
/**
|
|
527
592
|
* Console logger
|
|
528
593
|
*/
|
|
529
|
-
const logger =
|
|
530
|
-
function createTestingLogger() {
|
|
531
|
-
const types = [
|
|
532
|
-
"silent",
|
|
533
|
-
"fatal",
|
|
534
|
-
"error",
|
|
535
|
-
"warn",
|
|
536
|
-
"log",
|
|
537
|
-
"info",
|
|
538
|
-
"success",
|
|
539
|
-
"fail",
|
|
540
|
-
"ready",
|
|
541
|
-
"start",
|
|
542
|
-
"box",
|
|
543
|
-
"debug",
|
|
544
|
-
"trace",
|
|
545
|
-
"verbose"
|
|
546
|
-
];
|
|
547
|
-
const ret = Object.create(null);
|
|
548
|
-
for (const type of types) ret[type] = console.log;
|
|
549
|
-
return ret;
|
|
550
|
-
}
|
|
594
|
+
const logger = createConsola({ formatOptions: { date: false } });
|
|
551
595
|
|
|
552
596
|
//#endregion
|
|
553
597
|
//#region src/builtin-plugin/replace-plugin.ts
|
|
@@ -603,4 +647,4 @@ function transformPlugin(config) {
|
|
|
603
647
|
}
|
|
604
648
|
|
|
605
649
|
//#endregion
|
|
606
|
-
export { DevEngine, ResolverFactory, aliasPlugin, assetPlugin, buildImportAnalysisPlugin, defineParallelPlugin, dev, dynamicImportVarsPlugin, esmExternalRequirePlugin, importGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, replacePlugin, reporterPlugin,
|
|
650
|
+
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 };
|
|
@@ -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-D6vpD1fz.mjs";
|
|
2
|
+
import { BuiltinPlugin, InputOptions, OutputOptions, StringOrRegExp, defineParallelPlugin } from "./shared/define-config-D-OneP9q.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
|
|
@@ -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 };
|