@rolldown/browser 1.0.0-beta.43 → 1.0.0-beta.45
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-setup.d.mts +1 -0
- package/dist/cli-setup.mjs +16 -0
- package/dist/cli.mjs +1049 -76
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +4 -4
- package/dist/experimental-index.browser.mjs +34 -453
- package/dist/experimental-index.d.mts +21 -6
- package/dist/experimental-index.mjs +39 -16
- package/dist/filter-index.d.mts +2 -2
- package/dist/filter-index.mjs +1 -1
- package/dist/index.browser.mjs +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +3 -3
- package/dist/parallel-plugin-worker.mjs +3 -3
- package/dist/parallel-plugin.d.mts +2 -2
- package/dist/parse-ast-index.d.mts +3 -3
- package/dist/parse-ast-index.mjs +1 -1
- package/dist/rolldown-binding.wasi-browser.js +1 -2
- package/dist/rolldown-binding.wasi.cjs +1 -2
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/shared/{binding-BkaKdpud.d.mts → binding-DRegrFdE.d.mts} +98 -22
- package/dist/shared/{dist-CU0dSkK2.mjs → composable-filters-D_PY7Qa7.mjs} +2 -2
- package/dist/shared/{define-config-D5LB7YAC.d.mts → define-config-C6-goOPh.d.mts} +217 -99
- package/dist/shared/{load-config-DBsf9ada.mjs → load-config-Z2MWPLZO.mjs} +4 -4
- package/dist/shared/{parse-ast-index-Gktxd-oi.mjs → parse-ast-index-Ck5SwMSC.mjs} +37 -6
- package/dist/shared/{prompt-B4e-jZUR.mjs → prompt-BDwA3jSr.mjs} +1 -1
- package/dist/shared/{src-Dqrw8WuH.mjs → src-B4ZmdjD5.mjs} +637 -669
- package/dist/{src-DXN0YLUN.js → src-CLWy1Uip.js} +871 -873
- package/package.json +1 -1
- package/dist/shared/logger-B83ocDok.mjs +0 -985
|
@@ -1,37 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { a as logCycleLoading, c as logDeprecatedInject, d as logInputHookInOutputPlugin, f as logInvalidLogPosition, h as styleText, i as error, l as logDeprecatedKeepNames, m as logPluginError, o as logDeprecatedDefine, p as logMultiplyNotifyOption, r as augmentCodeLocation, s as logDeprecatedDropLabels, t as parseAst, u as logDeprecatedProfilerNames } from "./parse-ast-index-Ck5SwMSC.mjs";
|
|
2
|
+
import { a as include, c as or, d as arraify, g as unsupported, h as unreachable, i as id, m as unimplemented, n as code, o as moduleType, p as noop, r as exclude, t as and } from "./composable-filters-D_PY7Qa7.mjs";
|
|
3
3
|
import { Worker, isMainThread } from "node:worker_threads";
|
|
4
|
-
import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingChunkModuleOrderBy,
|
|
4
|
+
import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingChunkModuleOrderBy, BindingLogLevel, BindingMagicString, BindingMagicString as BindingMagicString$1, BindingPluginOrder, BindingPropertyReadSideEffects, BindingPropertyWriteSideEffects, BindingWatcher, ParallelJsPluginRegistry, initTraceSubscriber, shutdownAsyncRuntime, startAsyncRuntime } from "../rolldown-binding.wasi.cjs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import fsp from "node:fs/promises";
|
|
7
7
|
import os from "node:os";
|
|
8
8
|
|
|
9
|
-
//#region rolldown:runtime
|
|
10
|
-
var __create = Object.create;
|
|
11
|
-
var __defProp = Object.defineProperty;
|
|
12
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
-
var __commonJS = (cb, mod) => function() {
|
|
17
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
18
|
-
};
|
|
19
|
-
var __copyProps = (to, from, except, desc) => {
|
|
20
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i$1 = 0, n$2 = keys.length, key; i$1 < n$2; i$1++) {
|
|
21
|
-
key = keys[i$1];
|
|
22
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
23
|
-
get: ((k) => from[k]).bind(null, key),
|
|
24
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
return to;
|
|
28
|
-
};
|
|
29
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
30
|
-
value: mod,
|
|
31
|
-
enumerable: true
|
|
32
|
-
}) : target, mod));
|
|
33
|
-
|
|
34
|
-
//#endregion
|
|
35
9
|
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
|
|
36
10
|
/**
|
|
37
11
|
* This is not the set of all possible signals.
|
|
@@ -95,12 +69,12 @@ var Emitter = class {
|
|
|
95
69
|
}
|
|
96
70
|
removeListener(ev, fn) {
|
|
97
71
|
const list = this.listeners[ev];
|
|
98
|
-
const i
|
|
72
|
+
const i = list.indexOf(fn);
|
|
99
73
|
/* c8 ignore start */
|
|
100
|
-
if (i
|
|
74
|
+
if (i === -1) return;
|
|
101
75
|
/* c8 ignore stop */
|
|
102
|
-
if (i
|
|
103
|
-
else list.splice(i
|
|
76
|
+
if (i === 0 && list.length === 1) list.length = 0;
|
|
77
|
+
else list.splice(i, 1);
|
|
104
78
|
}
|
|
105
79
|
emit(ev, code$1, signal) {
|
|
106
80
|
if (this.emitted[ev]) return false;
|
|
@@ -150,15 +124,15 @@ var SignalExit = class extends SignalExitBase {
|
|
|
150
124
|
const listeners = this.#process.listeners(sig);
|
|
151
125
|
let { count } = this.#emitter;
|
|
152
126
|
/* c8 ignore start */
|
|
153
|
-
const p
|
|
154
|
-
if (typeof p
|
|
127
|
+
const p = process$2;
|
|
128
|
+
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") count += p.__signal_exit_emitter__.count;
|
|
155
129
|
/* c8 ignore stop */
|
|
156
130
|
if (listeners.length === count) {
|
|
157
131
|
this.unload();
|
|
158
132
|
const ret = this.#emitter.emit("exit", null, sig);
|
|
159
133
|
/* c8 ignore start */
|
|
160
|
-
const s
|
|
161
|
-
if (!ret) process$2.kill(process$2.pid, s
|
|
134
|
+
const s = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
135
|
+
if (!ret) process$2.kill(process$2.pid, s);
|
|
162
136
|
}
|
|
163
137
|
};
|
|
164
138
|
this.#originalProcessReallyExit = process$2.reallyExit;
|
|
@@ -184,8 +158,8 @@ var SignalExit = class extends SignalExitBase {
|
|
|
184
158
|
const fn = this.#sigListeners[sig];
|
|
185
159
|
if (fn) this.#process.on(sig, fn);
|
|
186
160
|
} catch (_) {}
|
|
187
|
-
this.#process.emit = (ev, ...a
|
|
188
|
-
return this.#processEmit(ev, ...a
|
|
161
|
+
this.#process.emit = (ev, ...a) => {
|
|
162
|
+
return this.#processEmit(ev, ...a);
|
|
189
163
|
};
|
|
190
164
|
this.#process.reallyExit = (code$1) => {
|
|
191
165
|
return this.#processReallyExit(code$1);
|
|
@@ -243,7 +217,7 @@ if (isMainThread) {
|
|
|
243
217
|
|
|
244
218
|
//#endregion
|
|
245
219
|
//#region package.json
|
|
246
|
-
var version = "1.0.0-beta.
|
|
220
|
+
var version = "1.0.0-beta.45";
|
|
247
221
|
var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
248
222
|
|
|
249
223
|
//#endregion
|
|
@@ -260,9 +234,9 @@ function makeBuiltinPluginCallable(plugin) {
|
|
|
260
234
|
for (const key in callablePlugin) wrappedPlugin[key] = async function(...args$1) {
|
|
261
235
|
try {
|
|
262
236
|
return await callablePlugin[key](...args$1);
|
|
263
|
-
} catch (e$
|
|
264
|
-
if (e$
|
|
265
|
-
return error(logPluginError(e$
|
|
237
|
+
} catch (e$1) {
|
|
238
|
+
if (e$1 instanceof Error && !e$1.stack?.includes("at ")) Error.captureStackTrace(e$1, wrappedPlugin[key]);
|
|
239
|
+
return error(logPluginError(e$1, plugin.name, {
|
|
266
240
|
hook: key,
|
|
267
241
|
id: key === "transform" ? args$1[2] : void 0
|
|
268
242
|
}));
|
|
@@ -517,8 +491,8 @@ var MinimalPluginContextImpl = class {
|
|
|
517
491
|
watchMode
|
|
518
492
|
};
|
|
519
493
|
}
|
|
520
|
-
error(e$
|
|
521
|
-
return error(logPluginError(normalizeLog(e$
|
|
494
|
+
error(e$1) {
|
|
495
|
+
return error(logPluginError(normalizeLog(e$1), this.pluginName, { hook: this.hookName }));
|
|
522
496
|
}
|
|
523
497
|
};
|
|
524
498
|
|
|
@@ -589,117 +563,6 @@ function getSortedPlugins(hookName, plugins) {
|
|
|
589
563
|
];
|
|
590
564
|
}
|
|
591
565
|
|
|
592
|
-
//#endregion
|
|
593
|
-
//#region ../../node_modules/.pnpm/ansis@4.2.0/node_modules/ansis/index.cjs
|
|
594
|
-
var require_ansis = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ansis@4.2.0/node_modules/ansis/index.cjs": ((exports, module) => {
|
|
595
|
-
let e$1, t$2, r, { defineProperty: l, setPrototypeOf: n$1, create: o, keys: s } = Object, i = "", { round: c, max: a$1 } = Math, p = (e$2) => {
|
|
596
|
-
let t$3 = /([a-f\d]{3,6})/i.exec(e$2)?.[1], r$1 = t$3?.length, l$1 = parseInt(6 ^ r$1 ? 3 ^ r$1 ? "0" : t$3[0] + t$3[0] + t$3[1] + t$3[1] + t$3[2] + t$3[2] : t$3, 16);
|
|
597
|
-
return [
|
|
598
|
-
l$1 >> 16 & 255,
|
|
599
|
-
l$1 >> 8 & 255,
|
|
600
|
-
255 & l$1
|
|
601
|
-
];
|
|
602
|
-
}, u = (e$2, t$3, r$1) => e$2 ^ t$3 || t$3 ^ r$1 ? 16 + 36 * c(e$2 / 51) + 6 * c(t$3 / 51) + c(r$1 / 51) : 8 > e$2 ? 16 : e$2 > 248 ? 231 : c(24 * (e$2 - 8) / 247) + 232, d = (e$2) => {
|
|
603
|
-
let t$3, r$1, l$1, n$2, o$1;
|
|
604
|
-
return 8 > e$2 ? 30 + e$2 : 16 > e$2 ? e$2 - 8 + 90 : (232 > e$2 ? (o$1 = (e$2 -= 16) % 36, t$3 = (e$2 / 36 | 0) / 5, r$1 = (o$1 / 6 | 0) / 5, l$1 = o$1 % 6 / 5) : t$3 = r$1 = l$1 = (10 * (e$2 - 232) + 8) / 255, n$2 = 2 * a$1(t$3, r$1, l$1), n$2 ? 30 + (c(l$1) << 2 | c(r$1) << 1 | c(t$3)) + (2 ^ n$2 ? 0 : 60) : 30);
|
|
605
|
-
}, f = (() => {
|
|
606
|
-
let r$1 = (e$2) => o$1.some(((t$3) => e$2.test(t$3))), l$1 = globalThis, n$2 = l$1.process ?? {}, o$1 = n$2.argv ?? [], i$1 = n$2.env ?? {}, c$1 = -1;
|
|
607
|
-
try {
|
|
608
|
-
e$1 = "," + s(i$1).join(",");
|
|
609
|
-
} catch (e$2) {
|
|
610
|
-
i$1 = {}, c$1 = 0;
|
|
611
|
-
}
|
|
612
|
-
let a$2 = "FORCE_COLOR", p$1 = {
|
|
613
|
-
false: 0,
|
|
614
|
-
0: 0,
|
|
615
|
-
1: 1,
|
|
616
|
-
2: 2,
|
|
617
|
-
3: 3
|
|
618
|
-
}[i$1[a$2]] ?? -1, u$1 = a$2 in i$1 && p$1 || r$1(/^--color=?(true|always)?$/);
|
|
619
|
-
return u$1 && (c$1 = p$1), ~c$1 || (c$1 = ((r$2, l$2, n$3) => (t$2 = r$2.TERM, {
|
|
620
|
-
"24bit": 3,
|
|
621
|
-
truecolor: 3,
|
|
622
|
-
ansi256: 2,
|
|
623
|
-
ansi: 1
|
|
624
|
-
}[r$2.COLORTERM] || (r$2.CI ? /,GITHUB/.test(e$1) ? 3 : 1 : l$2 && "dumb" !== t$2 ? n$3 ? 3 : /-256/.test(t$2) ? 2 : 1 : 0)))(i$1, !!i$1.PM2_HOME || i$1.NEXT_RUNTIME?.includes("edge") || !!n$2.stdout?.isTTY, "win32" === n$2.platform)), !p$1 || i$1.NO_COLOR || r$1(/^--(no-color|color=(false|never))$/) ? 0 : l$1.window?.chrome || u$1 && !c$1 ? 3 : c$1;
|
|
625
|
-
})(), g = {
|
|
626
|
-
open: i,
|
|
627
|
-
close: i
|
|
628
|
-
}, h = 39, b = 49, O = {}, m = ({ p: e$2 }, { open: t$3, close: l$1 }) => {
|
|
629
|
-
let o$1 = (e$3, ...r$1) => {
|
|
630
|
-
if (!e$3) {
|
|
631
|
-
if (t$3 && t$3 === l$1) return t$3;
|
|
632
|
-
if ((e$3 ?? i) === i) return i;
|
|
633
|
-
}
|
|
634
|
-
let n$2, s$2 = e$3.raw ? String.raw({ raw: e$3 }, ...r$1) : i + e$3, c$2 = o$1.p, a$2 = c$2.o, p$1 = c$2.c;
|
|
635
|
-
if (s$2.includes("\x1B")) for (; c$2; c$2 = c$2.p) {
|
|
636
|
-
let { open: e$4, close: t$4 } = c$2, r$2 = t$4.length, l$2 = i, o$2 = 0;
|
|
637
|
-
if (r$2) for (; ~(n$2 = s$2.indexOf(t$4, o$2)); o$2 = n$2 + r$2) l$2 += s$2.slice(o$2, n$2) + e$4;
|
|
638
|
-
s$2 = l$2 + s$2.slice(o$2);
|
|
639
|
-
}
|
|
640
|
-
return a$2 + (s$2.includes("\n") ? s$2.replace(/(\r?\n)/g, p$1 + "$1" + a$2) : s$2) + p$1;
|
|
641
|
-
}, s$1 = t$3, c$1 = l$1;
|
|
642
|
-
return e$2 && (s$1 = e$2.o + t$3, c$1 = l$1 + e$2.c), n$1(o$1, r), o$1.p = {
|
|
643
|
-
open: t$3,
|
|
644
|
-
close: l$1,
|
|
645
|
-
o: s$1,
|
|
646
|
-
c: c$1,
|
|
647
|
-
p: e$2
|
|
648
|
-
}, o$1.open = s$1, o$1.close = c$1, o$1;
|
|
649
|
-
};
|
|
650
|
-
const w = new function e$2(t$3 = f) {
|
|
651
|
-
let s$1 = {
|
|
652
|
-
Ansis: e$2,
|
|
653
|
-
level: t$3,
|
|
654
|
-
isSupported: () => a$2,
|
|
655
|
-
strip: (e$3) => e$3.replace(/[][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, i),
|
|
656
|
-
extend(e$3) {
|
|
657
|
-
for (let t$4 in e$3) {
|
|
658
|
-
let r$1 = e$3[t$4], l$1 = (typeof r$1)[0];
|
|
659
|
-
"s" === l$1 ? (c$1(t$4, T(...p(r$1))), c$1(_(t$4), v(...p(r$1)))) : c$1(t$4, r$1, "f" === l$1);
|
|
660
|
-
}
|
|
661
|
-
return r = o({}, O), n$1(s$1, r), s$1;
|
|
662
|
-
}
|
|
663
|
-
}, c$1 = (e$3, t$4, r$1) => {
|
|
664
|
-
O[e$3] = { get() {
|
|
665
|
-
let n$2 = r$1 ? (...e$4) => m(this, t$4(...e$4)) : m(this, t$4);
|
|
666
|
-
return l(this, e$3, { value: n$2 }), n$2;
|
|
667
|
-
} };
|
|
668
|
-
}, a$2 = t$3 > 0, w$1 = (e$3, t$4) => a$2 ? {
|
|
669
|
-
open: `[${e$3}m`,
|
|
670
|
-
close: `[${t$4}m`
|
|
671
|
-
} : g, y = (e$3) => (t$4) => e$3(...p(t$4)), R = (e$3, t$4) => (r$1, l$1, n$2) => w$1(`${e$3}8;2;${r$1};${l$1};${n$2}`, t$4), $ = (e$3, t$4) => (r$1, l$1, n$2) => w$1(((e$4, t$5, r$2) => d(u(e$4, t$5, r$2)))(r$1, l$1, n$2) + e$3, t$4), x = (e$3) => (t$4, r$1, l$1) => e$3(u(t$4, r$1, l$1)), T = R(3, h), v = R(4, b), C = (e$3) => w$1("38;5;" + e$3, h), E = (e$3) => w$1("48;5;" + e$3, b);
|
|
672
|
-
2 === t$3 ? (T = x(C), v = x(E)) : 1 === t$3 && (T = $(0, h), v = $(10, b), C = (e$3) => w$1(d(e$3), h), E = (e$3) => w$1(d(e$3) + 10, b));
|
|
673
|
-
let M, I = {
|
|
674
|
-
fg: C,
|
|
675
|
-
bg: E,
|
|
676
|
-
rgb: T,
|
|
677
|
-
bgRgb: v,
|
|
678
|
-
hex: y(T),
|
|
679
|
-
bgHex: y(v),
|
|
680
|
-
visible: g,
|
|
681
|
-
reset: w$1(0, 0),
|
|
682
|
-
bold: w$1(1, 22),
|
|
683
|
-
dim: w$1(2, 22),
|
|
684
|
-
italic: w$1(3, 23),
|
|
685
|
-
underline: w$1(4, 24),
|
|
686
|
-
inverse: w$1(7, 27),
|
|
687
|
-
hidden: w$1(8, 28),
|
|
688
|
-
strikethrough: w$1(9, 29)
|
|
689
|
-
}, _ = (e$3) => "bg" + e$3[0].toUpperCase() + e$3.slice(1), k = "Bright";
|
|
690
|
-
return "black,red,green,yellow,blue,magenta,cyan,white,gray".split(",").map(((e$3, t$4) => {
|
|
691
|
-
M = _(e$3), 8 > t$4 ? (I[e$3 + k] = w$1(90 + t$4, h), I[M + k] = w$1(100 + t$4, b)) : t$4 = 60, I[e$3] = w$1(30 + t$4, h), I[M] = w$1(40 + t$4, b);
|
|
692
|
-
})), s$1.extend(I);
|
|
693
|
-
}();
|
|
694
|
-
module.exports = w, w.default = w;
|
|
695
|
-
}) });
|
|
696
|
-
|
|
697
|
-
//#endregion
|
|
698
|
-
//#region ../../node_modules/.pnpm/ansis@4.2.0/node_modules/ansis/index.mjs
|
|
699
|
-
var import_ansis = /* @__PURE__ */ __toESM(require_ansis(), 1);
|
|
700
|
-
var ansis_default = import_ansis.default;
|
|
701
|
-
const { Ansis, fg, bg, rgb, bgRgb, hex, bgHex, reset, inverse, hidden, visible, bold, dim, italic, underline, strikethrough, black, red, green, yellow, blue, magenta, cyan, white, gray, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bgGray, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright } = import_ansis.default;
|
|
702
|
-
|
|
703
566
|
//#endregion
|
|
704
567
|
//#region ../../node_modules/.pnpm/valibot@1.1.0_typescript@5.9.3/node_modules/valibot/dist/index.js
|
|
705
568
|
var store;
|
|
@@ -1518,6 +1381,25 @@ function tuple(items, message2) {
|
|
|
1518
1381
|
};
|
|
1519
1382
|
}
|
|
1520
1383
|
/* @__NO_SIDE_EFFECTS__ */
|
|
1384
|
+
function undefined_(message2) {
|
|
1385
|
+
return {
|
|
1386
|
+
kind: "schema",
|
|
1387
|
+
type: "undefined",
|
|
1388
|
+
reference: undefined_,
|
|
1389
|
+
expects: "undefined",
|
|
1390
|
+
async: false,
|
|
1391
|
+
message: message2,
|
|
1392
|
+
get "~standard"() {
|
|
1393
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
1394
|
+
},
|
|
1395
|
+
"~run"(dataset, config2) {
|
|
1396
|
+
if (dataset.value === void 0) dataset.typed = true;
|
|
1397
|
+
else _addIssue(this, "type", dataset, config2);
|
|
1398
|
+
return dataset;
|
|
1399
|
+
}
|
|
1400
|
+
};
|
|
1401
|
+
}
|
|
1402
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1521
1403
|
function _subIssues(datasets) {
|
|
1522
1404
|
let issues;
|
|
1523
1405
|
if (datasets) for (const dataset of datasets) if (issues) issues.push(...dataset.issues);
|
|
@@ -1769,6 +1651,9 @@ function flattenValibotSchema(schema, result = {}, prefix = "") {
|
|
|
1769
1651
|
//#endregion
|
|
1770
1652
|
//#region src/utils/validator.ts
|
|
1771
1653
|
const StringOrRegExpSchema = union([string(), instance(RegExp)]);
|
|
1654
|
+
function vFunction() {
|
|
1655
|
+
return function_();
|
|
1656
|
+
}
|
|
1772
1657
|
const LogLevelSchema = union([
|
|
1773
1658
|
literal("debug"),
|
|
1774
1659
|
literal("info"),
|
|
@@ -1783,14 +1668,15 @@ const InputOptionSchema = union([
|
|
|
1783
1668
|
array(string()),
|
|
1784
1669
|
record(string(), string())
|
|
1785
1670
|
]);
|
|
1786
|
-
const
|
|
1671
|
+
const ExternalOptionFunctionSchema = pipe(vFunction(), args(tuple([
|
|
1672
|
+
string(),
|
|
1673
|
+
optional(string()),
|
|
1674
|
+
boolean()
|
|
1675
|
+
])), returns(nullish(boolean())));
|
|
1676
|
+
const ExternalOptionSchema = union([
|
|
1787
1677
|
StringOrRegExpSchema,
|
|
1788
1678
|
array(StringOrRegExpSchema),
|
|
1789
|
-
|
|
1790
|
-
string(),
|
|
1791
|
-
optional(string()),
|
|
1792
|
-
boolean()
|
|
1793
|
-
])), returns(nullish(boolean())))
|
|
1679
|
+
ExternalOptionFunctionSchema
|
|
1794
1680
|
]);
|
|
1795
1681
|
const ModuleTypesSchema = record(string(), union([
|
|
1796
1682
|
literal("asset"),
|
|
@@ -1809,23 +1695,12 @@ const ModuleTypesSchema = record(string(), union([
|
|
|
1809
1695
|
const JsxOptionsSchema = strictObject({
|
|
1810
1696
|
runtime: pipe(optional(union([literal("classic"), literal("automatic")])), description("Which runtime to use")),
|
|
1811
1697
|
development: pipe(optional(boolean()), description("Development specific information")),
|
|
1812
|
-
throwIfNamespace: pipe(optional(
|
|
1698
|
+
throwIfNamespace: pipe(optional(boolean()), description("Toggles whether to throw an error when a tag name uses an XML namespace")),
|
|
1813
1699
|
importSource: pipe(optional(string()), description("Import the factory of element and fragment if mode is classic")),
|
|
1814
1700
|
pragma: pipe(optional(string()), description("Jsx element transformation")),
|
|
1815
1701
|
pragmaFrag: pipe(optional(string()), description("Jsx fragment transformation")),
|
|
1816
1702
|
refresh: pipe(optional(boolean()), description("Enable react fast refresh"))
|
|
1817
1703
|
});
|
|
1818
|
-
const RollupJsxOptionsSchema = strictObject({
|
|
1819
|
-
mode: optional(union([
|
|
1820
|
-
literal("classic"),
|
|
1821
|
-
literal("automatic"),
|
|
1822
|
-
literal("preserve")
|
|
1823
|
-
])),
|
|
1824
|
-
factory: optional(string()),
|
|
1825
|
-
fragment: optional(string()),
|
|
1826
|
-
importSource: optional(string()),
|
|
1827
|
-
jsxImportSource: optional(string())
|
|
1828
|
-
});
|
|
1829
1704
|
const HelperModeSchema = union([literal("Runtime"), literal("External")]);
|
|
1830
1705
|
const DecoratorOptionSchema = object({
|
|
1831
1706
|
legacy: optional(boolean()),
|
|
@@ -1861,8 +1736,17 @@ const TransformOptionsSchema = object({
|
|
|
1861
1736
|
typescript: optional(TypescriptSchema),
|
|
1862
1737
|
helpers: optional(HelpersSchema),
|
|
1863
1738
|
decorators: optional(DecoratorOptionSchema),
|
|
1864
|
-
jsx: optional(union([
|
|
1865
|
-
|
|
1739
|
+
jsx: optional(union([
|
|
1740
|
+
literal(false),
|
|
1741
|
+
literal("preserve"),
|
|
1742
|
+
literal("react"),
|
|
1743
|
+
literal("react-jsx"),
|
|
1744
|
+
JsxOptionsSchema
|
|
1745
|
+
])),
|
|
1746
|
+
target: pipe(optional(union([string(), array(string())])), description("The JavaScript target environment")),
|
|
1747
|
+
define: optional(record(string(), string())),
|
|
1748
|
+
inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
|
|
1749
|
+
dropLabels: pipe(optional(array(string())), description("Remove labeled statements with these label names"))
|
|
1866
1750
|
});
|
|
1867
1751
|
const WatchOptionsSchema = strictObject({
|
|
1868
1752
|
chokidar: optional(never(`The "watch.chokidar" option is deprecated, please use "watch.notify" instead of it`)),
|
|
@@ -1893,8 +1777,8 @@ const ChecksOptionsSchema = strictObject({
|
|
|
1893
1777
|
preferBuiltinFeature: pipe(optional(boolean()), description("Whether to emit warning when detecting prefer builtin feature"))
|
|
1894
1778
|
});
|
|
1895
1779
|
const CompressOptionsKeepNamesSchema = strictObject({
|
|
1896
|
-
function:
|
|
1897
|
-
class:
|
|
1780
|
+
function: boolean(),
|
|
1781
|
+
class: boolean()
|
|
1898
1782
|
});
|
|
1899
1783
|
const CompressOptionsSchema = strictObject({
|
|
1900
1784
|
target: optional(union([
|
|
@@ -1916,8 +1800,8 @@ const CompressOptionsSchema = strictObject({
|
|
|
1916
1800
|
unused: optional(union([boolean(), literal("keep_assign")]))
|
|
1917
1801
|
});
|
|
1918
1802
|
const MangleOptionsKeepNamesSchema = strictObject({
|
|
1919
|
-
function:
|
|
1920
|
-
class:
|
|
1803
|
+
function: boolean(),
|
|
1804
|
+
class: boolean()
|
|
1921
1805
|
});
|
|
1922
1806
|
const MangleOptionsSchema = strictObject({
|
|
1923
1807
|
toplevel: optional(boolean()),
|
|
@@ -1956,22 +1840,19 @@ const TreeshakingOptionsSchema = union([boolean(), looseObject({
|
|
|
1956
1840
|
propertyWriteSideEffects: optional(union([literal(false), literal("always")]))
|
|
1957
1841
|
})]);
|
|
1958
1842
|
const OptimizationOptionsSchema = strictObject({
|
|
1959
|
-
inlineConst: pipe(optional(union([
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
mode: optional(union([literal("all"), literal("smart")])),
|
|
1964
|
-
pass: optional(number())
|
|
1965
|
-
})
|
|
1966
|
-
])), description("Enable crossmodule constant inlining")),
|
|
1843
|
+
inlineConst: pipe(optional(union([boolean(), strictObject({
|
|
1844
|
+
mode: optional(union([literal("all"), literal("smart")])),
|
|
1845
|
+
pass: optional(number())
|
|
1846
|
+
})])), description("Enable crossmodule constant inlining")),
|
|
1967
1847
|
pifeForModuleWrappers: pipe(optional(boolean()), description("Use PIFE pattern for module wrappers"))
|
|
1968
1848
|
});
|
|
1969
|
-
const
|
|
1849
|
+
const LogOrStringHandlerSchema = pipe(vFunction(), args(tuple([LogLevelWithErrorSchema, RollupLogWithStringSchema])));
|
|
1850
|
+
const OnLogSchema = pipe(vFunction(), args(tuple([
|
|
1970
1851
|
LogLevelSchema,
|
|
1971
1852
|
RollupLogSchema,
|
|
1972
|
-
|
|
1853
|
+
LogOrStringHandlerSchema
|
|
1973
1854
|
])));
|
|
1974
|
-
const OnwarnSchema = pipe(
|
|
1855
|
+
const OnwarnSchema = pipe(vFunction(), args(tuple([RollupLogSchema, pipe(vFunction(), args(tuple([union([RollupLogWithStringSchema, pipe(vFunction(), returns(RollupLogWithStringSchema))])])))])));
|
|
1975
1856
|
const HmrSchema = union([boolean(), strictObject({
|
|
1976
1857
|
new: optional(boolean()),
|
|
1977
1858
|
port: optional(number()),
|
|
@@ -1981,7 +1862,7 @@ const HmrSchema = union([boolean(), strictObject({
|
|
|
1981
1862
|
const InputOptionsSchema = strictObject({
|
|
1982
1863
|
input: optional(InputOptionSchema),
|
|
1983
1864
|
plugins: optional(custom(() => true)),
|
|
1984
|
-
external: optional(
|
|
1865
|
+
external: optional(ExternalOptionSchema),
|
|
1985
1866
|
makeAbsoluteExternalsRelative: optional(union([boolean(), literal("ifRelativeSource")])),
|
|
1986
1867
|
resolve: optional(ResolveOptionsSchema),
|
|
1987
1868
|
cwd: pipe(optional(string()), description("Current working directory")),
|
|
@@ -1989,11 +1870,11 @@ const InputOptionsSchema = strictObject({
|
|
|
1989
1870
|
literal("browser"),
|
|
1990
1871
|
literal("neutral"),
|
|
1991
1872
|
literal("node")
|
|
1992
|
-
])), description(`Platform for which the code should be generated (node, ${
|
|
1873
|
+
])), description(`Platform for which the code should be generated (node, ${styleText("underline", "browser")}, neutral)`)),
|
|
1993
1874
|
shimMissingExports: pipe(optional(boolean()), description("Create shim variables for missing exports")),
|
|
1994
1875
|
treeshake: optional(TreeshakingOptionsSchema),
|
|
1995
1876
|
optimization: optional(OptimizationOptionsSchema),
|
|
1996
|
-
logLevel: pipe(optional(LogLevelOptionSchema), description(`Log level (${
|
|
1877
|
+
logLevel: pipe(optional(LogLevelOptionSchema), description(`Log level (${styleText("dim", "silent")}, ${styleText(["underline", "gray"], "info")}, debug, ${styleText("yellow", "warn")})`)),
|
|
1997
1878
|
onLog: optional(OnLogSchema),
|
|
1998
1879
|
onwarn: optional(OnwarnSchema),
|
|
1999
1880
|
moduleTypes: pipe(optional(ModuleTypesSchema), description("Module types for customized extensions")),
|
|
@@ -2021,13 +1902,6 @@ const InputOptionsSchema = strictObject({
|
|
|
2021
1902
|
define: pipe(optional(record(string(), string())), description("Define global variables")),
|
|
2022
1903
|
inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
|
|
2023
1904
|
profilerNames: optional(boolean()),
|
|
2024
|
-
jsx: optional(union([
|
|
2025
|
-
literal(false),
|
|
2026
|
-
literal("react"),
|
|
2027
|
-
literal("react-jsx"),
|
|
2028
|
-
literal("preserve"),
|
|
2029
|
-
RollupJsxOptionsSchema
|
|
2030
|
-
])),
|
|
2031
1905
|
transform: optional(TransformOptionsSchema),
|
|
2032
1906
|
watch: optional(union([WatchOptionsSchema, literal(false)])),
|
|
2033
1907
|
dropLabels: pipe(optional(array(string())), description("Remove labeled statements with these label names")),
|
|
@@ -2048,12 +1922,6 @@ const InputCliOverrideSchema = strictObject({
|
|
|
2048
1922
|
inject: pipe(optional(record(string(), string())), description("Inject import statements on demand")),
|
|
2049
1923
|
treeshake: pipe(optional(boolean()), description("enable treeshaking")),
|
|
2050
1924
|
makeAbsoluteExternalsRelative: pipe(optional(boolean()), description("Prevent normalization of external imports")),
|
|
2051
|
-
jsx: pipe(optional(union([
|
|
2052
|
-
literal(false),
|
|
2053
|
-
literal("react"),
|
|
2054
|
-
literal("react-jsx"),
|
|
2055
|
-
literal("preserve")
|
|
2056
|
-
])), description("Jsx options preset")),
|
|
2057
1925
|
preserveEntrySignatures: pipe(optional(literal(false)), description("Avoid facade chunks for entry points")),
|
|
2058
1926
|
context: pipe(optional(string()), description("The entity top-level `this` represents."))
|
|
2059
1927
|
});
|
|
@@ -2078,12 +1946,22 @@ const ModuleFormatSchema = union([
|
|
|
2078
1946
|
literal("iife"),
|
|
2079
1947
|
literal("umd")
|
|
2080
1948
|
]);
|
|
2081
|
-
const AddonFunctionSchema = pipe(
|
|
2082
|
-
const
|
|
2083
|
-
const
|
|
2084
|
-
const
|
|
2085
|
-
const
|
|
2086
|
-
const
|
|
1949
|
+
const AddonFunctionSchema = pipe(vFunction(), args(tuple([custom(() => true)])), returnsAsync(unionAsync([string(), pipeAsync(promise(), awaitAsync(), string())])));
|
|
1950
|
+
const ChunkFileNamesFunctionSchema = pipe(vFunction(), args(tuple([custom(() => true)])), returns(string()));
|
|
1951
|
+
const ChunkFileNamesSchema = union([string(), ChunkFileNamesFunctionSchema]);
|
|
1952
|
+
const AssetFileNamesFunctionSchema = pipe(vFunction(), args(tuple([custom(() => true)])), returns(string()));
|
|
1953
|
+
const AssetFileNamesSchema = union([string(), AssetFileNamesFunctionSchema]);
|
|
1954
|
+
const SanitizeFileNameFunctionSchema = pipe(vFunction(), args(tuple([string()])), returns(string()));
|
|
1955
|
+
const SanitizeFileNameSchema = union([boolean(), SanitizeFileNameFunctionSchema]);
|
|
1956
|
+
const GlobalsFunctionSchema = pipe(vFunction(), args(tuple([string()])), returns(string()));
|
|
1957
|
+
const PathsFunctionSchema = pipe(vFunction(), args(tuple([string()])), returns(string()));
|
|
1958
|
+
const ManualChunksFunctionSchema = pipe(vFunction(), args(tuple([string(), object({})])), returns(nullish(string())));
|
|
1959
|
+
const AdvancedChunksNameFunctionSchema = pipe(vFunction(), args(tuple([string(), object({})])), returns(nullish(string())));
|
|
1960
|
+
const AdvancedChunksTestFunctionSchema = pipe(vFunction(), args(tuple([string()])), returns(union([
|
|
1961
|
+
boolean(),
|
|
1962
|
+
void_(),
|
|
1963
|
+
undefined_()
|
|
1964
|
+
])));
|
|
2087
1965
|
const AdvancedChunksSchema = strictObject({
|
|
2088
1966
|
includeDependenciesRecursively: optional(boolean()),
|
|
2089
1967
|
minSize: optional(number()),
|
|
@@ -2092,12 +1970,8 @@ const AdvancedChunksSchema = strictObject({
|
|
|
2092
1970
|
maxModuleSize: optional(number()),
|
|
2093
1971
|
minShareCount: optional(number()),
|
|
2094
1972
|
groups: optional(array(strictObject({
|
|
2095
|
-
name: union([string(),
|
|
2096
|
-
test: optional(union([
|
|
2097
|
-
string(),
|
|
2098
|
-
instance(RegExp),
|
|
2099
|
-
pipe(function_(), args(tuple([string()])), returns(union([nullish(boolean()), void_()])))
|
|
2100
|
-
])),
|
|
1973
|
+
name: union([string(), AdvancedChunksNameFunctionSchema]),
|
|
1974
|
+
test: optional(union([StringOrRegExpSchema, AdvancedChunksTestFunctionSchema])),
|
|
2101
1975
|
priority: optional(number()),
|
|
2102
1976
|
minSize: optional(number()),
|
|
2103
1977
|
minShareCount: optional(number()),
|
|
@@ -2109,7 +1983,8 @@ const AdvancedChunksSchema = strictObject({
|
|
|
2109
1983
|
const GeneratedCodePresetSchema = union([literal("es5"), literal("es2015")]);
|
|
2110
1984
|
const GeneratedCodeOptionsSchema = strictObject({
|
|
2111
1985
|
symbols: pipe(optional(boolean()), description("Whether to use Symbol.toStringTag for namespace objects")),
|
|
2112
|
-
preset: GeneratedCodePresetSchema
|
|
1986
|
+
preset: GeneratedCodePresetSchema,
|
|
1987
|
+
profilerNames: pipe(optional(boolean()), description("Whether to add readable names to internal variables for profiling purposes"))
|
|
2113
1988
|
});
|
|
2114
1989
|
const OutputOptionsSchema = strictObject({
|
|
2115
1990
|
dir: pipe(optional(string()), description("Output directory, defaults to `dist` if `file` is not set")),
|
|
@@ -2119,18 +1994,18 @@ const OutputOptionsSchema = strictObject({
|
|
|
2119
1994
|
literal("named"),
|
|
2120
1995
|
literal("default"),
|
|
2121
1996
|
literal("none")
|
|
2122
|
-
])), description(`Specify a export mode (${
|
|
1997
|
+
])), description(`Specify a export mode (${styleText("underline", "auto")}, named, default, none)`)),
|
|
2123
1998
|
hashCharacters: pipe(optional(union([
|
|
2124
1999
|
literal("base64"),
|
|
2125
2000
|
literal("base36"),
|
|
2126
2001
|
literal("hex")
|
|
2127
2002
|
])), description("Use the specified character set for file hashes")),
|
|
2128
|
-
format: pipe(optional(ModuleFormatSchema), description(`Output format of the generated bundle (supports ${
|
|
2003
|
+
format: pipe(optional(ModuleFormatSchema), description(`Output format of the generated bundle (supports ${styleText("underline", "esm")}, cjs, and iife)`)),
|
|
2129
2004
|
sourcemap: pipe(optional(union([
|
|
2130
2005
|
boolean(),
|
|
2131
2006
|
literal("inline"),
|
|
2132
2007
|
literal("hidden")
|
|
2133
|
-
])), description(`Generate sourcemap (\`-s inline\` for inline, or ${
|
|
2008
|
+
])), description(`Generate sourcemap (\`-s inline\` for inline, or ${styleText("bold", "pass the `-s` on the last argument if you want to generate `.map` file")})`)),
|
|
2134
2009
|
sourcemapBaseUrl: pipe(optional(string()), description("Base URL used to prefix sourcemap paths")),
|
|
2135
2010
|
sourcemapDebugIds: pipe(optional(boolean()), description("Inject sourcemap debug IDs")),
|
|
2136
2011
|
sourcemapIgnoreList: optional(union([
|
|
@@ -2153,7 +2028,7 @@ const OutputOptionsSchema = strictObject({
|
|
|
2153
2028
|
sanitizeFileName: optional(SanitizeFileNameSchema),
|
|
2154
2029
|
minify: pipe(optional(union([
|
|
2155
2030
|
boolean(),
|
|
2156
|
-
|
|
2031
|
+
literal("dce-only"),
|
|
2157
2032
|
MinifyOptionsSchema
|
|
2158
2033
|
])), description("Minify the bundled file")),
|
|
2159
2034
|
name: pipe(optional(string()), description("Name for UMD / IIFE format outputs")),
|
|
@@ -2162,23 +2037,22 @@ const OutputOptionsSchema = strictObject({
|
|
|
2162
2037
|
generatedCode: pipe(optional(partial(GeneratedCodeOptionsSchema)), description("Generated code options")),
|
|
2163
2038
|
externalLiveBindings: pipe(optional(boolean()), description("external live bindings")),
|
|
2164
2039
|
inlineDynamicImports: pipe(optional(boolean()), description("Inline dynamic imports")),
|
|
2165
|
-
manualChunks: optional(
|
|
2040
|
+
manualChunks: optional(ManualChunksFunctionSchema),
|
|
2166
2041
|
advancedChunks: optional(AdvancedChunksSchema),
|
|
2167
2042
|
legalComments: pipe(optional(union([literal("none"), literal("inline")])), description("Control comments in the output")),
|
|
2168
2043
|
plugins: optional(custom(() => true)),
|
|
2169
2044
|
polyfillRequire: pipe(optional(boolean()), description("Disable require polyfill injection")),
|
|
2170
|
-
hoistTransitiveImports: optional(
|
|
2171
|
-
if (input) return false;
|
|
2172
|
-
return true;
|
|
2173
|
-
}, () => `The 'true' value is not supported`)),
|
|
2045
|
+
hoistTransitiveImports: optional(literal(false)),
|
|
2174
2046
|
preserveModules: pipe(optional(boolean()), description("Preserve module structure")),
|
|
2175
2047
|
preserveModulesRoot: pipe(optional(string()), description("Put preserved modules under this path at root level")),
|
|
2176
2048
|
virtualDirname: optional(string()),
|
|
2177
2049
|
minifyInternalExports: pipe(optional(boolean()), description("Minify internal exports")),
|
|
2178
|
-
topLevelVar: pipe(optional(boolean()), description("Rewrite top-level declarations to use `var`."))
|
|
2050
|
+
topLevelVar: pipe(optional(boolean()), description("Rewrite top-level declarations to use `var`.")),
|
|
2051
|
+
cleanDir: pipe(optional(boolean()), description("Clean output directory before emitting output")),
|
|
2052
|
+
keepNames: pipe(optional(boolean()), description("Keep function and class names after bundling"))
|
|
2179
2053
|
});
|
|
2180
2054
|
const getAddonDescription = (placement, wrapper) => {
|
|
2181
|
-
return `Code to insert the ${
|
|
2055
|
+
return `Code to insert the ${styleText("bold", placement)} of the bundled file (${styleText("bold", wrapper)} the wrapper function)`;
|
|
2182
2056
|
};
|
|
2183
2057
|
const OutputCliOverrideSchema = strictObject({
|
|
2184
2058
|
assetFileNames: pipe(optional(string()), description("Name pattern for asset files")),
|
|
@@ -2237,7 +2111,7 @@ function validateOption(key, options) {
|
|
|
2237
2111
|
let issueMsg = issue.message;
|
|
2238
2112
|
const issuePaths = issue.path.map((path$1) => path$1.key);
|
|
2239
2113
|
if (issue.type === "union") {
|
|
2240
|
-
const subIssue = issue.issues?.find((i
|
|
2114
|
+
const subIssue = issue.issues?.find((i) => !(i.type !== issue.received && i.input === issue.input));
|
|
2241
2115
|
if (subIssue) {
|
|
2242
2116
|
if (subIssue.path) issuePaths.push(subIssue.path.map((path$1) => path$1.key));
|
|
2243
2117
|
issueMsg = subIssue.message;
|
|
@@ -2269,8 +2143,8 @@ function bindingifySourcemap$1(map) {
|
|
|
2269
2143
|
file: map.file ?? void 0,
|
|
2270
2144
|
mappings: map.mappings,
|
|
2271
2145
|
sourceRoot: "sourceRoot" in map ? map.sourceRoot ?? void 0 : void 0,
|
|
2272
|
-
sources: map.sources?.map((s
|
|
2273
|
-
sourcesContent: map.sourcesContent?.map((s
|
|
2146
|
+
sources: map.sources?.map((s) => s ?? void 0),
|
|
2147
|
+
sourcesContent: map.sourcesContent?.map((s) => s ?? void 0),
|
|
2274
2148
|
names: map.names,
|
|
2275
2149
|
x_google_ignoreList: map.x_google_ignoreList,
|
|
2276
2150
|
debugId: "debugId" in map ? map.debugId : void 0
|
|
@@ -2278,166 +2152,468 @@ function bindingifySourcemap$1(map) {
|
|
|
2278
2152
|
}
|
|
2279
2153
|
|
|
2280
2154
|
//#endregion
|
|
2281
|
-
//#region src/utils/
|
|
2282
|
-
function
|
|
2283
|
-
|
|
2284
|
-
return container;
|
|
2285
|
-
}
|
|
2286
|
-
function normalizeBindingResult(container) {
|
|
2287
|
-
if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) return aggregateBindingErrorsIntoJsError(container.errors);
|
|
2288
|
-
return container;
|
|
2289
|
-
}
|
|
2290
|
-
function normalizeBindingError(e$2) {
|
|
2291
|
-
return e$2.type === "JsError" ? e$2.field0 : Object.assign(/* @__PURE__ */ new Error(), {
|
|
2292
|
-
kind: e$2.field0.kind,
|
|
2293
|
-
message: e$2.field0.message,
|
|
2294
|
-
stack: void 0
|
|
2295
|
-
});
|
|
2296
|
-
}
|
|
2297
|
-
function aggregateBindingErrorsIntoJsError(rawErrors) {
|
|
2298
|
-
const errors = rawErrors.map(normalizeBindingError);
|
|
2299
|
-
let summary = `Build failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
|
|
2300
|
-
for (let i$1 = 0; i$1 < errors.length; i$1++) {
|
|
2301
|
-
summary += "\n";
|
|
2302
|
-
if (i$1 >= 5) {
|
|
2303
|
-
summary += "...";
|
|
2304
|
-
break;
|
|
2305
|
-
}
|
|
2306
|
-
summary += getErrorMessage(errors[i$1]);
|
|
2307
|
-
}
|
|
2308
|
-
const wrapper = new Error(summary);
|
|
2309
|
-
Object.defineProperty(wrapper, "errors", {
|
|
2310
|
-
configurable: true,
|
|
2311
|
-
enumerable: true,
|
|
2312
|
-
get: () => errors,
|
|
2313
|
-
set: (value) => Object.defineProperty(wrapper, "errors", {
|
|
2314
|
-
configurable: true,
|
|
2315
|
-
enumerable: true,
|
|
2316
|
-
value
|
|
2317
|
-
})
|
|
2318
|
-
});
|
|
2319
|
-
return wrapper;
|
|
2320
|
-
}
|
|
2321
|
-
function getErrorMessage(e$2) {
|
|
2322
|
-
if (Object.hasOwn(e$2, "kind")) return e$2.message;
|
|
2323
|
-
let s$1 = "";
|
|
2324
|
-
if (e$2.plugin) s$1 += `[plugin ${e$2.plugin}]`;
|
|
2325
|
-
const id$1 = e$2.id ?? e$2.loc?.file;
|
|
2326
|
-
if (id$1) {
|
|
2327
|
-
s$1 += " " + id$1;
|
|
2328
|
-
if (e$2.loc) s$1 += `:${e$2.loc.line}:${e$2.loc.column}`;
|
|
2329
|
-
}
|
|
2330
|
-
if (s$1) s$1 += "\n";
|
|
2331
|
-
const message = `${e$2.name ?? "Error"}: ${e$2.message}`;
|
|
2332
|
-
s$1 += message;
|
|
2333
|
-
if (e$2.frame) s$1 = joinNewLine(s$1, e$2.frame);
|
|
2334
|
-
if (e$2.stack) s$1 = joinNewLine(s$1, e$2.stack.replace(message, ""));
|
|
2335
|
-
if (e$2.cause) {
|
|
2336
|
-
s$1 = joinNewLine(s$1, "Caused by:");
|
|
2337
|
-
s$1 = joinNewLine(s$1, getErrorMessage(e$2.cause).split("\n").map((line) => " " + line).join("\n"));
|
|
2338
|
-
}
|
|
2339
|
-
return s$1;
|
|
2155
|
+
//#region src/utils/asset-source.ts
|
|
2156
|
+
function transformAssetSource(bindingAssetSource$1) {
|
|
2157
|
+
return bindingAssetSource$1.inner;
|
|
2340
2158
|
}
|
|
2341
|
-
function
|
|
2342
|
-
return
|
|
2159
|
+
function bindingAssetSource(source) {
|
|
2160
|
+
return { inner: source };
|
|
2343
2161
|
}
|
|
2344
2162
|
|
|
2345
2163
|
//#endregion
|
|
2346
|
-
//#region src/utils/transform-module
|
|
2347
|
-
function
|
|
2164
|
+
//#region src/utils/transform-rendered-module.ts
|
|
2165
|
+
function transformToRenderedModule(bindingRenderedModule) {
|
|
2348
2166
|
return {
|
|
2349
|
-
get ast() {
|
|
2350
|
-
return unsupported("ModuleInfo#ast");
|
|
2351
|
-
},
|
|
2352
2167
|
get code() {
|
|
2353
|
-
return
|
|
2168
|
+
return bindingRenderedModule.code;
|
|
2354
2169
|
},
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
isEntry: info.isEntry,
|
|
2362
|
-
...option
|
|
2170
|
+
get renderedLength() {
|
|
2171
|
+
return bindingRenderedModule.code?.length || 0;
|
|
2172
|
+
},
|
|
2173
|
+
get renderedExports() {
|
|
2174
|
+
return bindingRenderedModule.renderedExports;
|
|
2175
|
+
}
|
|
2363
2176
|
};
|
|
2364
2177
|
}
|
|
2365
2178
|
|
|
2366
2179
|
//#endregion
|
|
2367
|
-
//#region src/utils/transform-
|
|
2368
|
-
function
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
}
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2180
|
+
//#region src/utils/transform-rendered-chunk.ts
|
|
2181
|
+
function transformRenderedChunk(chunk) {
|
|
2182
|
+
let modules = null;
|
|
2183
|
+
return {
|
|
2184
|
+
type: "chunk",
|
|
2185
|
+
get name() {
|
|
2186
|
+
return chunk.name;
|
|
2187
|
+
},
|
|
2188
|
+
get isEntry() {
|
|
2189
|
+
return chunk.isEntry;
|
|
2190
|
+
},
|
|
2191
|
+
get isDynamicEntry() {
|
|
2192
|
+
return chunk.isDynamicEntry;
|
|
2193
|
+
},
|
|
2194
|
+
get facadeModuleId() {
|
|
2195
|
+
return chunk.facadeModuleId;
|
|
2196
|
+
},
|
|
2197
|
+
get moduleIds() {
|
|
2198
|
+
return chunk.moduleIds;
|
|
2199
|
+
},
|
|
2200
|
+
get exports() {
|
|
2201
|
+
return chunk.exports;
|
|
2202
|
+
},
|
|
2203
|
+
get fileName() {
|
|
2204
|
+
return chunk.fileName;
|
|
2205
|
+
},
|
|
2206
|
+
get imports() {
|
|
2207
|
+
return chunk.imports;
|
|
2208
|
+
},
|
|
2209
|
+
get dynamicImports() {
|
|
2210
|
+
return chunk.dynamicImports;
|
|
2211
|
+
},
|
|
2212
|
+
get modules() {
|
|
2213
|
+
if (!modules) modules = transformChunkModules(chunk.modules);
|
|
2214
|
+
return modules;
|
|
2215
|
+
}
|
|
2216
|
+
};
|
|
2398
2217
|
}
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2218
|
+
function transformChunkModules(modules) {
|
|
2219
|
+
const result = {};
|
|
2220
|
+
for (let i = 0; i < modules.values.length; i++) {
|
|
2221
|
+
let key = modules.keys[i];
|
|
2222
|
+
const mod = modules.values[i];
|
|
2223
|
+
result[key] = transformToRenderedModule(mod);
|
|
2224
|
+
}
|
|
2225
|
+
return result;
|
|
2404
2226
|
}
|
|
2405
|
-
const n = (e$2, t$3) => {
|
|
2406
|
-
let n$2 = [[], []];
|
|
2407
|
-
for (let [r$1, i$1] of e$2.entries()) t$3(i$1, r$1, e$2) ? n$2[0].push(i$1) : n$2[1].push(i$1);
|
|
2408
|
-
return n$2;
|
|
2409
|
-
};
|
|
2410
2227
|
|
|
2411
2228
|
//#endregion
|
|
2412
|
-
//#region src/
|
|
2413
|
-
function
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2229
|
+
//#region src/utils/transform-to-rollup-output.ts
|
|
2230
|
+
function transformToRollupSourceMap(map) {
|
|
2231
|
+
const obj = {
|
|
2232
|
+
...JSON.parse(map),
|
|
2233
|
+
toString() {
|
|
2234
|
+
return JSON.stringify(obj);
|
|
2235
|
+
},
|
|
2236
|
+
toUrl() {
|
|
2237
|
+
return `data:application/json;charset=utf-8;base64,${Buffer.from(obj.toString(), "utf-8").toString("base64")}`;
|
|
2238
|
+
}
|
|
2239
|
+
};
|
|
2240
|
+
return obj;
|
|
2420
2241
|
}
|
|
2421
|
-
function
|
|
2422
|
-
|
|
2242
|
+
function transformToRollupOutputChunk(bindingChunk) {
|
|
2243
|
+
const chunk = {
|
|
2244
|
+
type: "chunk",
|
|
2245
|
+
get code() {
|
|
2246
|
+
return bindingChunk.code;
|
|
2247
|
+
},
|
|
2248
|
+
fileName: bindingChunk.fileName,
|
|
2249
|
+
name: bindingChunk.name,
|
|
2250
|
+
get modules() {
|
|
2251
|
+
return transformChunkModules(bindingChunk.modules);
|
|
2252
|
+
},
|
|
2253
|
+
get imports() {
|
|
2254
|
+
return bindingChunk.imports;
|
|
2255
|
+
},
|
|
2256
|
+
get dynamicImports() {
|
|
2257
|
+
return bindingChunk.dynamicImports;
|
|
2258
|
+
},
|
|
2259
|
+
exports: bindingChunk.exports,
|
|
2260
|
+
isEntry: bindingChunk.isEntry,
|
|
2261
|
+
facadeModuleId: bindingChunk.facadeModuleId || null,
|
|
2262
|
+
isDynamicEntry: bindingChunk.isDynamicEntry,
|
|
2263
|
+
get moduleIds() {
|
|
2264
|
+
return bindingChunk.moduleIds;
|
|
2265
|
+
},
|
|
2266
|
+
get map() {
|
|
2267
|
+
return bindingChunk.map ? transformToRollupSourceMap(bindingChunk.map) : null;
|
|
2268
|
+
},
|
|
2269
|
+
sourcemapFileName: bindingChunk.sourcemapFileName || null,
|
|
2270
|
+
preliminaryFileName: bindingChunk.preliminaryFileName
|
|
2271
|
+
};
|
|
2272
|
+
const cache = {};
|
|
2273
|
+
return new Proxy(chunk, {
|
|
2274
|
+
get(target, p) {
|
|
2275
|
+
if (p in cache) return cache[p];
|
|
2276
|
+
const value = target[p];
|
|
2277
|
+
cache[p] = value;
|
|
2278
|
+
return value;
|
|
2279
|
+
},
|
|
2280
|
+
has(target, p) {
|
|
2281
|
+
if (p in cache) return true;
|
|
2282
|
+
return p in target;
|
|
2283
|
+
}
|
|
2284
|
+
});
|
|
2423
2285
|
}
|
|
2424
|
-
function
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2286
|
+
function transformToMutableRollupOutputChunk(bindingChunk, changed) {
|
|
2287
|
+
const chunk = {
|
|
2288
|
+
type: "chunk",
|
|
2289
|
+
get code() {
|
|
2290
|
+
return bindingChunk.code;
|
|
2291
|
+
},
|
|
2292
|
+
fileName: bindingChunk.fileName,
|
|
2293
|
+
name: bindingChunk.name,
|
|
2294
|
+
get modules() {
|
|
2295
|
+
return transformChunkModules(bindingChunk.modules);
|
|
2296
|
+
},
|
|
2297
|
+
get imports() {
|
|
2298
|
+
return bindingChunk.imports;
|
|
2299
|
+
},
|
|
2300
|
+
get dynamicImports() {
|
|
2301
|
+
return bindingChunk.dynamicImports;
|
|
2302
|
+
},
|
|
2303
|
+
exports: bindingChunk.exports,
|
|
2304
|
+
isEntry: bindingChunk.isEntry,
|
|
2305
|
+
facadeModuleId: bindingChunk.facadeModuleId || null,
|
|
2306
|
+
isDynamicEntry: bindingChunk.isDynamicEntry,
|
|
2307
|
+
get moduleIds() {
|
|
2308
|
+
return bindingChunk.moduleIds;
|
|
2309
|
+
},
|
|
2310
|
+
get map() {
|
|
2311
|
+
return bindingChunk.map ? transformToRollupSourceMap(bindingChunk.map) : null;
|
|
2312
|
+
},
|
|
2313
|
+
sourcemapFileName: bindingChunk.sourcemapFileName || null,
|
|
2314
|
+
preliminaryFileName: bindingChunk.preliminaryFileName
|
|
2315
|
+
};
|
|
2316
|
+
const cache = {};
|
|
2317
|
+
return new Proxy(chunk, {
|
|
2318
|
+
get(target, p) {
|
|
2319
|
+
if (p in cache) return cache[p];
|
|
2320
|
+
const value = target[p];
|
|
2321
|
+
cache[p] = value;
|
|
2322
|
+
return value;
|
|
2323
|
+
},
|
|
2324
|
+
set(_target, p, newValue) {
|
|
2325
|
+
cache[p] = newValue;
|
|
2326
|
+
changed.updated.add(bindingChunk.fileName);
|
|
2327
|
+
return true;
|
|
2328
|
+
},
|
|
2329
|
+
has(target, p) {
|
|
2330
|
+
if (p in cache) return true;
|
|
2331
|
+
return p in target;
|
|
2332
|
+
}
|
|
2333
|
+
});
|
|
2334
|
+
}
|
|
2335
|
+
function transformToRollupOutputAsset(bindingAsset) {
|
|
2336
|
+
const asset = {
|
|
2337
|
+
type: "asset",
|
|
2338
|
+
fileName: bindingAsset.fileName,
|
|
2339
|
+
originalFileName: bindingAsset.originalFileName || null,
|
|
2340
|
+
originalFileNames: bindingAsset.originalFileNames,
|
|
2341
|
+
get source() {
|
|
2342
|
+
return transformAssetSource(bindingAsset.source);
|
|
2343
|
+
},
|
|
2344
|
+
name: bindingAsset.name ?? void 0,
|
|
2345
|
+
names: bindingAsset.names
|
|
2346
|
+
};
|
|
2347
|
+
const cache = {};
|
|
2348
|
+
return new Proxy(asset, { get(target, p) {
|
|
2349
|
+
if (p in cache) return cache[p];
|
|
2350
|
+
const value = target[p];
|
|
2351
|
+
cache[p] = value;
|
|
2352
|
+
return value;
|
|
2353
|
+
} });
|
|
2354
|
+
}
|
|
2355
|
+
function transformToMutableRollupOutputAsset(bindingAsset, changed) {
|
|
2356
|
+
const asset = {
|
|
2357
|
+
type: "asset",
|
|
2358
|
+
fileName: bindingAsset.fileName,
|
|
2359
|
+
originalFileName: bindingAsset.originalFileName || null,
|
|
2360
|
+
originalFileNames: bindingAsset.originalFileNames,
|
|
2361
|
+
get source() {
|
|
2362
|
+
return transformAssetSource(bindingAsset.source);
|
|
2363
|
+
},
|
|
2364
|
+
name: bindingAsset.name ?? void 0,
|
|
2365
|
+
names: bindingAsset.names
|
|
2366
|
+
};
|
|
2367
|
+
const cache = {};
|
|
2368
|
+
return new Proxy(asset, {
|
|
2369
|
+
get(target, p) {
|
|
2370
|
+
if (p in cache) return cache[p];
|
|
2371
|
+
const value = target[p];
|
|
2372
|
+
cache[p] = value;
|
|
2373
|
+
return value;
|
|
2374
|
+
},
|
|
2375
|
+
set(_target, p, newValue) {
|
|
2376
|
+
cache[p] = newValue;
|
|
2377
|
+
changed.updated.add(bindingAsset.fileName);
|
|
2378
|
+
return true;
|
|
2379
|
+
}
|
|
2380
|
+
});
|
|
2381
|
+
}
|
|
2382
|
+
function transformToRollupOutput(output) {
|
|
2383
|
+
const { chunks, assets } = output;
|
|
2384
|
+
return { output: [...chunks.map((chunk) => transformToRollupOutputChunk(chunk)), ...assets.map((asset) => transformToRollupOutputAsset(asset))] };
|
|
2385
|
+
}
|
|
2386
|
+
function transformToMutableRollupOutput(output, changed) {
|
|
2387
|
+
const { chunks, assets } = output;
|
|
2388
|
+
return { output: [...chunks.map((chunk) => transformToMutableRollupOutputChunk(chunk, changed)), ...assets.map((asset) => transformToMutableRollupOutputAsset(asset, changed))] };
|
|
2389
|
+
}
|
|
2390
|
+
function transformToOutputBundle(context, output, changed) {
|
|
2391
|
+
const bundle = Object.fromEntries(transformToMutableRollupOutput(output, changed).output.map((item) => [item.fileName, item]));
|
|
2392
|
+
return new Proxy(bundle, {
|
|
2393
|
+
set(_target, _p, _newValue, _receiver) {
|
|
2394
|
+
const originalStackTraceLimit = Error.stackTraceLimit;
|
|
2395
|
+
Error.stackTraceLimit = 2;
|
|
2396
|
+
const message = "This plugin assigns to bundle variable. This is discouraged by Rollup and is not supported by Rolldown. This will be ignored. https://rollupjs.org/plugin-development/#generatebundle:~:text=DANGER,this.emitFile.";
|
|
2397
|
+
const stack = new Error(message).stack ?? message;
|
|
2398
|
+
Error.stackTraceLimit = originalStackTraceLimit;
|
|
2399
|
+
context.warn({
|
|
2400
|
+
message: stack,
|
|
2401
|
+
code: "UNSUPPORTED_BUNDLE_ASSIGNMENT"
|
|
2402
|
+
});
|
|
2403
|
+
return true;
|
|
2404
|
+
},
|
|
2405
|
+
deleteProperty(target, property) {
|
|
2406
|
+
if (typeof property === "string") changed.deleted.add(property);
|
|
2407
|
+
return true;
|
|
2408
|
+
}
|
|
2409
|
+
});
|
|
2410
|
+
}
|
|
2411
|
+
function collectChangedBundle(changed, bundle) {
|
|
2412
|
+
const changes = {};
|
|
2413
|
+
for (const key in bundle) {
|
|
2414
|
+
if (changed.deleted.has(key) || !changed.updated.has(key)) continue;
|
|
2415
|
+
const item = bundle[key];
|
|
2416
|
+
if (item.type === "asset") changes[key] = {
|
|
2417
|
+
filename: item.fileName,
|
|
2418
|
+
originalFileNames: item.originalFileNames,
|
|
2419
|
+
source: bindingAssetSource(item.source),
|
|
2420
|
+
names: item.names
|
|
2421
|
+
};
|
|
2422
|
+
else changes[key] = {
|
|
2423
|
+
code: item.code,
|
|
2424
|
+
filename: item.fileName,
|
|
2425
|
+
name: item.name,
|
|
2426
|
+
isEntry: item.isEntry,
|
|
2427
|
+
exports: item.exports,
|
|
2428
|
+
modules: {},
|
|
2429
|
+
imports: item.imports,
|
|
2430
|
+
dynamicImports: item.dynamicImports,
|
|
2431
|
+
facadeModuleId: item.facadeModuleId || void 0,
|
|
2432
|
+
isDynamicEntry: item.isDynamicEntry,
|
|
2433
|
+
moduleIds: item.moduleIds,
|
|
2434
|
+
map: bindingifySourcemap$1(item.map),
|
|
2435
|
+
sourcemapFilename: item.sourcemapFileName || void 0,
|
|
2436
|
+
preliminaryFilename: item.preliminaryFileName
|
|
2437
|
+
};
|
|
2438
|
+
}
|
|
2439
|
+
return {
|
|
2440
|
+
changes,
|
|
2441
|
+
deleted: changed.deleted
|
|
2442
|
+
};
|
|
2443
|
+
}
|
|
2444
|
+
|
|
2445
|
+
//#endregion
|
|
2446
|
+
//#region src/types/rolldown-output-impl.ts
|
|
2447
|
+
var RolldownOutputImpl = class {
|
|
2448
|
+
constructor(bindingOutputs) {
|
|
2449
|
+
this.bindingOutputs = bindingOutputs;
|
|
2450
|
+
}
|
|
2451
|
+
get output() {
|
|
2452
|
+
return transformToRollupOutput(this.bindingOutputs).output;
|
|
2453
|
+
}
|
|
2454
|
+
};
|
|
2455
|
+
|
|
2456
|
+
//#endregion
|
|
2457
|
+
//#region src/utils/error.ts
|
|
2458
|
+
function unwrapBindingResult(container) {
|
|
2459
|
+
if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) throw aggregateBindingErrorsIntoJsError(container.errors);
|
|
2460
|
+
return container;
|
|
2461
|
+
}
|
|
2462
|
+
function normalizeBindingResult(container) {
|
|
2463
|
+
if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) return aggregateBindingErrorsIntoJsError(container.errors);
|
|
2464
|
+
return container;
|
|
2465
|
+
}
|
|
2466
|
+
function normalizeBindingError(e$1) {
|
|
2467
|
+
return e$1.type === "JsError" ? e$1.field0 : Object.assign(/* @__PURE__ */ new Error(), {
|
|
2468
|
+
kind: e$1.field0.kind,
|
|
2469
|
+
message: e$1.field0.message,
|
|
2470
|
+
stack: void 0
|
|
2471
|
+
});
|
|
2472
|
+
}
|
|
2473
|
+
function aggregateBindingErrorsIntoJsError(rawErrors) {
|
|
2474
|
+
const errors = rawErrors.map(normalizeBindingError);
|
|
2475
|
+
let summary = `Build failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
|
|
2476
|
+
for (let i = 0; i < errors.length; i++) {
|
|
2477
|
+
summary += "\n";
|
|
2478
|
+
if (i >= 5) {
|
|
2479
|
+
summary += "...";
|
|
2480
|
+
break;
|
|
2481
|
+
}
|
|
2482
|
+
summary += getErrorMessage(errors[i]);
|
|
2483
|
+
}
|
|
2484
|
+
const wrapper = new Error(summary);
|
|
2485
|
+
Object.defineProperty(wrapper, "errors", {
|
|
2486
|
+
configurable: true,
|
|
2487
|
+
enumerable: true,
|
|
2488
|
+
get: () => errors,
|
|
2489
|
+
set: (value) => Object.defineProperty(wrapper, "errors", {
|
|
2490
|
+
configurable: true,
|
|
2491
|
+
enumerable: true,
|
|
2492
|
+
value
|
|
2493
|
+
})
|
|
2494
|
+
});
|
|
2495
|
+
return wrapper;
|
|
2496
|
+
}
|
|
2497
|
+
function getErrorMessage(e$1) {
|
|
2498
|
+
if (Object.hasOwn(e$1, "kind")) return e$1.message;
|
|
2499
|
+
let s = "";
|
|
2500
|
+
if (e$1.plugin) s += `[plugin ${e$1.plugin}]`;
|
|
2501
|
+
const id$1 = e$1.id ?? e$1.loc?.file;
|
|
2502
|
+
if (id$1) {
|
|
2503
|
+
s += " " + id$1;
|
|
2504
|
+
if (e$1.loc) s += `:${e$1.loc.line}:${e$1.loc.column}`;
|
|
2505
|
+
}
|
|
2506
|
+
if (s) s += "\n";
|
|
2507
|
+
const message = `${e$1.name ?? "Error"}: ${e$1.message}`;
|
|
2508
|
+
s += message;
|
|
2509
|
+
if (e$1.frame) s = joinNewLine(s, e$1.frame);
|
|
2510
|
+
if (e$1.stack) s = joinNewLine(s, e$1.stack.replace(message, ""));
|
|
2511
|
+
if (e$1.cause) {
|
|
2512
|
+
s = joinNewLine(s, "Caused by:");
|
|
2513
|
+
s = joinNewLine(s, getErrorMessage(e$1.cause).split("\n").map((line) => " " + line).join("\n"));
|
|
2514
|
+
}
|
|
2515
|
+
return s;
|
|
2516
|
+
}
|
|
2517
|
+
function joinNewLine(s1, s2) {
|
|
2518
|
+
return s1.replace(/\n+$/, "") + "\n" + s2.replace(/^\n+/, "");
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2521
|
+
//#endregion
|
|
2522
|
+
//#region src/utils/transform-module-info.ts
|
|
2523
|
+
function transformModuleInfo(info, option) {
|
|
2524
|
+
return {
|
|
2525
|
+
get ast() {
|
|
2526
|
+
return unsupported("ModuleInfo#ast");
|
|
2527
|
+
},
|
|
2528
|
+
get code() {
|
|
2529
|
+
return info.code;
|
|
2530
|
+
},
|
|
2531
|
+
id: info.id,
|
|
2532
|
+
importers: info.importers,
|
|
2533
|
+
dynamicImporters: info.dynamicImporters,
|
|
2534
|
+
importedIds: info.importedIds,
|
|
2535
|
+
dynamicallyImportedIds: info.dynamicallyImportedIds,
|
|
2536
|
+
exports: info.exports,
|
|
2537
|
+
isEntry: info.isEntry,
|
|
2538
|
+
...option
|
|
2539
|
+
};
|
|
2540
|
+
}
|
|
2541
|
+
|
|
2542
|
+
//#endregion
|
|
2543
|
+
//#region src/utils/transform-sourcemap.ts
|
|
2544
|
+
function isEmptySourcemapFiled(array$1) {
|
|
2545
|
+
if (!array$1) return true;
|
|
2546
|
+
if (array$1.length === 0 || !array$1[0]) return true;
|
|
2547
|
+
return false;
|
|
2548
|
+
}
|
|
2549
|
+
function normalizeTransformHookSourcemap(id$1, originalCode, rawMap) {
|
|
2550
|
+
if (!rawMap) return;
|
|
2551
|
+
let map = typeof rawMap === "object" ? rawMap : JSON.parse(rawMap);
|
|
2552
|
+
if (isEmptySourcemapFiled(map.sourcesContent)) map.sourcesContent = [originalCode];
|
|
2553
|
+
if (isEmptySourcemapFiled(map.sources) || map.sources && map.sources.length === 1 && map.sources[0] !== id$1) map.sources = [id$1];
|
|
2554
|
+
return map;
|
|
2555
|
+
}
|
|
2556
|
+
|
|
2557
|
+
//#endregion
|
|
2558
|
+
//#region ../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/lazyDataLastImpl-BDhrIOwR.js
|
|
2559
|
+
function e(e$1, t$2, n$1) {
|
|
2560
|
+
let r = (n$2) => e$1(n$2, ...t$2);
|
|
2561
|
+
return n$1 === void 0 ? r : Object.assign(r, {
|
|
2562
|
+
lazy: n$1,
|
|
2563
|
+
lazyArgs: t$2
|
|
2564
|
+
});
|
|
2565
|
+
}
|
|
2566
|
+
|
|
2567
|
+
//#endregion
|
|
2568
|
+
//#region ../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/purry-DH9cw9sy.js
|
|
2569
|
+
function t(t$2, n$1, r) {
|
|
2570
|
+
let i = t$2.length - n$1.length;
|
|
2571
|
+
if (i === 0) return t$2(...n$1);
|
|
2572
|
+
if (i === 1) return e(t$2, n$1, r);
|
|
2573
|
+
throw Error(`Wrong number of arguments`);
|
|
2574
|
+
}
|
|
2575
|
+
|
|
2576
|
+
//#endregion
|
|
2577
|
+
//#region ../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/partition-DAu403JQ.js
|
|
2578
|
+
function t$1(...t$2) {
|
|
2579
|
+
return t(n, t$2);
|
|
2580
|
+
}
|
|
2581
|
+
const n = (e$1, t$2) => {
|
|
2582
|
+
let n$1 = [[], []];
|
|
2583
|
+
for (let [r, i] of e$1.entries()) t$2(i, r, e$1) ? n$1[0].push(i) : n$1[1].push(i);
|
|
2584
|
+
return n$1;
|
|
2585
|
+
};
|
|
2586
|
+
|
|
2587
|
+
//#endregion
|
|
2588
|
+
//#region src/plugin/bindingify-hook-filter.ts
|
|
2589
|
+
function generalHookFilterMatcherToFilterExprs(matcher, stringKind) {
|
|
2590
|
+
if (typeof matcher === "string" || matcher instanceof RegExp) return [include(generateAtomMatcher(stringKind, matcher))];
|
|
2591
|
+
if (Array.isArray(matcher)) return matcher.map((m) => include(generateAtomMatcher(stringKind, m)));
|
|
2592
|
+
let ret = [];
|
|
2593
|
+
if (matcher.exclude) ret.push(...arraify(matcher.exclude).map((m) => exclude(generateAtomMatcher(stringKind, m))));
|
|
2594
|
+
if (matcher.include) ret.push(...arraify(matcher.include).map((m) => include(generateAtomMatcher(stringKind, m))));
|
|
2595
|
+
return ret;
|
|
2596
|
+
}
|
|
2597
|
+
function generateAtomMatcher(kind, matcher) {
|
|
2598
|
+
return kind === "code" ? code(matcher) : id(matcher);
|
|
2599
|
+
}
|
|
2600
|
+
function transformFilterMatcherToFilterExprs(filterOption) {
|
|
2601
|
+
if (!filterOption) return;
|
|
2602
|
+
if (Array.isArray(filterOption)) return filterOption;
|
|
2603
|
+
const { id: id$1, code: code$1, moduleType: moduleType$1 } = filterOption;
|
|
2604
|
+
let ret = [];
|
|
2605
|
+
let idIncludes = [];
|
|
2606
|
+
let idExcludes = [];
|
|
2607
|
+
let codeIncludes = [];
|
|
2608
|
+
let codeExcludes = [];
|
|
2609
|
+
if (id$1) [idIncludes, idExcludes] = t$1(generalHookFilterMatcherToFilterExprs(id$1, "id") ?? [], (m) => m.kind === "include");
|
|
2610
|
+
if (code$1) [codeIncludes, codeExcludes] = t$1(generalHookFilterMatcherToFilterExprs(code$1, "code") ?? [], (m) => m.kind === "include");
|
|
2611
|
+
ret.push(...idExcludes);
|
|
2436
2612
|
ret.push(...codeExcludes);
|
|
2437
2613
|
let andExprList = [];
|
|
2438
2614
|
if (moduleType$1) {
|
|
2439
2615
|
let moduleTypes = Array.isArray(moduleType$1) ? moduleType$1 : moduleType$1.include ?? [];
|
|
2440
|
-
andExprList.push(or(...moduleTypes.map((m
|
|
2616
|
+
andExprList.push(or(...moduleTypes.map((m) => moduleType(m))));
|
|
2441
2617
|
}
|
|
2442
2618
|
if (idIncludes.length) andExprList.push(or(...idIncludes.map((item) => item.expr)));
|
|
2443
2619
|
if (codeIncludes.length) andExprList.push(or(...codeIncludes.map((item) => item.expr)));
|
|
@@ -2459,7 +2635,7 @@ function bindingifyFilterExprImpl(expr, list) {
|
|
|
2459
2635
|
switch (expr.kind) {
|
|
2460
2636
|
case "and": {
|
|
2461
2637
|
let args$1 = expr.args;
|
|
2462
|
-
for (let i
|
|
2638
|
+
for (let i = args$1.length - 1; i >= 0; i--) bindingifyFilterExprImpl(args$1[i], list);
|
|
2463
2639
|
list.push({
|
|
2464
2640
|
kind: "And",
|
|
2465
2641
|
payload: args$1.length
|
|
@@ -2468,7 +2644,7 @@ function bindingifyFilterExprImpl(expr, list) {
|
|
|
2468
2644
|
}
|
|
2469
2645
|
case "or": {
|
|
2470
2646
|
let args$1 = expr.args;
|
|
2471
|
-
for (let i
|
|
2647
|
+
for (let i = args$1.length - 1; i >= 0; i--) bindingifyFilterExprImpl(args$1[i], list);
|
|
2472
2648
|
list.push({
|
|
2473
2649
|
kind: "Or",
|
|
2474
2650
|
payload: args$1.length
|
|
@@ -2557,15 +2733,6 @@ function bindingPluginOrder(order) {
|
|
|
2557
2733
|
}
|
|
2558
2734
|
}
|
|
2559
2735
|
|
|
2560
|
-
//#endregion
|
|
2561
|
-
//#region src/utils/asset-source.ts
|
|
2562
|
-
function transformAssetSource(bindingAssetSource$1) {
|
|
2563
|
-
return bindingAssetSource$1.inner;
|
|
2564
|
-
}
|
|
2565
|
-
function bindingAssetSource(source) {
|
|
2566
|
-
return { inner: source };
|
|
2567
|
-
}
|
|
2568
|
-
|
|
2569
2736
|
//#endregion
|
|
2570
2737
|
//#region src/plugin/fs.ts
|
|
2571
2738
|
const fsModule = {
|
|
@@ -2700,12 +2867,12 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
|
|
|
2700
2867
|
this.warn = getLogHandler$1(this.warn);
|
|
2701
2868
|
this.info = getLogHandler$1(this.info);
|
|
2702
2869
|
}
|
|
2703
|
-
error(e$
|
|
2704
|
-
if (typeof e$
|
|
2705
|
-
if (pos) augmentCodeLocation(e$
|
|
2706
|
-
e$
|
|
2707
|
-
e$
|
|
2708
|
-
return error(logPluginError(normalizeLog(e$
|
|
2870
|
+
error(e$1, pos) {
|
|
2871
|
+
if (typeof e$1 === "string") e$1 = { message: e$1 };
|
|
2872
|
+
if (pos) augmentCodeLocation(e$1, pos, this.moduleSource, this.moduleId);
|
|
2873
|
+
e$1.id = this.moduleId;
|
|
2874
|
+
e$1.hook = "transform";
|
|
2875
|
+
return error(logPluginError(normalizeLog(e$1), this.pluginName));
|
|
2709
2876
|
}
|
|
2710
2877
|
getCombinedSourcemap() {
|
|
2711
2878
|
return JSON.parse(this.inner.getCombinedSourcemap());
|
|
@@ -2713,8 +2880,8 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
|
|
|
2713
2880
|
addWatchFile(id$1) {
|
|
2714
2881
|
this.inner.addWatchFile(id$1);
|
|
2715
2882
|
}
|
|
2716
|
-
sendMagicString(s
|
|
2717
|
-
this.inner.sendMagicString(s
|
|
2883
|
+
sendMagicString(s) {
|
|
2884
|
+
this.inner.sendMagicString(s);
|
|
2718
2885
|
}
|
|
2719
2886
|
};
|
|
2720
2887
|
|
|
@@ -2913,220 +3080,6 @@ function bindingifyModuleParsed(args$1) {
|
|
|
2913
3080
|
};
|
|
2914
3081
|
}
|
|
2915
3082
|
|
|
2916
|
-
//#endregion
|
|
2917
|
-
//#region src/utils/transform-rendered-module.ts
|
|
2918
|
-
function transformToRenderedModule(bindingRenderedModule) {
|
|
2919
|
-
return {
|
|
2920
|
-
get code() {
|
|
2921
|
-
return bindingRenderedModule.code;
|
|
2922
|
-
},
|
|
2923
|
-
get renderedLength() {
|
|
2924
|
-
return bindingRenderedModule.code?.length || 0;
|
|
2925
|
-
},
|
|
2926
|
-
get renderedExports() {
|
|
2927
|
-
return bindingRenderedModule.renderedExports;
|
|
2928
|
-
}
|
|
2929
|
-
};
|
|
2930
|
-
}
|
|
2931
|
-
|
|
2932
|
-
//#endregion
|
|
2933
|
-
//#region src/utils/transform-rendered-chunk.ts
|
|
2934
|
-
function transformRenderedChunk(chunk) {
|
|
2935
|
-
let modules = null;
|
|
2936
|
-
return {
|
|
2937
|
-
type: "chunk",
|
|
2938
|
-
get name() {
|
|
2939
|
-
return chunk.name;
|
|
2940
|
-
},
|
|
2941
|
-
get isEntry() {
|
|
2942
|
-
return chunk.isEntry;
|
|
2943
|
-
},
|
|
2944
|
-
get isDynamicEntry() {
|
|
2945
|
-
return chunk.isDynamicEntry;
|
|
2946
|
-
},
|
|
2947
|
-
get facadeModuleId() {
|
|
2948
|
-
return chunk.facadeModuleId;
|
|
2949
|
-
},
|
|
2950
|
-
get moduleIds() {
|
|
2951
|
-
return chunk.moduleIds;
|
|
2952
|
-
},
|
|
2953
|
-
get exports() {
|
|
2954
|
-
return chunk.exports;
|
|
2955
|
-
},
|
|
2956
|
-
get fileName() {
|
|
2957
|
-
return chunk.fileName;
|
|
2958
|
-
},
|
|
2959
|
-
get imports() {
|
|
2960
|
-
return chunk.imports;
|
|
2961
|
-
},
|
|
2962
|
-
get dynamicImports() {
|
|
2963
|
-
return chunk.dynamicImports;
|
|
2964
|
-
},
|
|
2965
|
-
get modules() {
|
|
2966
|
-
if (!modules) modules = transformChunkModules(chunk.modules);
|
|
2967
|
-
return modules;
|
|
2968
|
-
}
|
|
2969
|
-
};
|
|
2970
|
-
}
|
|
2971
|
-
function transformChunkModules(modules) {
|
|
2972
|
-
const result = {};
|
|
2973
|
-
for (let i$1 = 0; i$1 < modules.values.length; i$1++) {
|
|
2974
|
-
let key = modules.keys[i$1];
|
|
2975
|
-
const mod = modules.values[i$1];
|
|
2976
|
-
result[key] = transformToRenderedModule(mod);
|
|
2977
|
-
}
|
|
2978
|
-
return result;
|
|
2979
|
-
}
|
|
2980
|
-
|
|
2981
|
-
//#endregion
|
|
2982
|
-
//#region src/utils/transform-to-rollup-output.ts
|
|
2983
|
-
function transformToRollupSourceMap(map) {
|
|
2984
|
-
const obj = {
|
|
2985
|
-
...JSON.parse(map),
|
|
2986
|
-
toString() {
|
|
2987
|
-
return JSON.stringify(obj);
|
|
2988
|
-
},
|
|
2989
|
-
toUrl() {
|
|
2990
|
-
return `data:application/json;charset=utf-8;base64,${Buffer.from(obj.toString(), "utf-8").toString("base64")}`;
|
|
2991
|
-
}
|
|
2992
|
-
};
|
|
2993
|
-
return obj;
|
|
2994
|
-
}
|
|
2995
|
-
function transformToRollupOutputChunk(bindingChunk, changed) {
|
|
2996
|
-
const chunk = {
|
|
2997
|
-
type: "chunk",
|
|
2998
|
-
get code() {
|
|
2999
|
-
return bindingChunk.code;
|
|
3000
|
-
},
|
|
3001
|
-
fileName: bindingChunk.fileName,
|
|
3002
|
-
name: bindingChunk.name,
|
|
3003
|
-
get modules() {
|
|
3004
|
-
return transformChunkModules(bindingChunk.modules);
|
|
3005
|
-
},
|
|
3006
|
-
get imports() {
|
|
3007
|
-
return bindingChunk.imports;
|
|
3008
|
-
},
|
|
3009
|
-
get dynamicImports() {
|
|
3010
|
-
return bindingChunk.dynamicImports;
|
|
3011
|
-
},
|
|
3012
|
-
exports: bindingChunk.exports,
|
|
3013
|
-
isEntry: bindingChunk.isEntry,
|
|
3014
|
-
facadeModuleId: bindingChunk.facadeModuleId || null,
|
|
3015
|
-
isDynamicEntry: bindingChunk.isDynamicEntry,
|
|
3016
|
-
get moduleIds() {
|
|
3017
|
-
return bindingChunk.moduleIds;
|
|
3018
|
-
},
|
|
3019
|
-
get map() {
|
|
3020
|
-
return bindingChunk.map ? transformToRollupSourceMap(bindingChunk.map) : null;
|
|
3021
|
-
},
|
|
3022
|
-
sourcemapFileName: bindingChunk.sourcemapFileName || null,
|
|
3023
|
-
preliminaryFileName: bindingChunk.preliminaryFileName
|
|
3024
|
-
};
|
|
3025
|
-
const cache = {};
|
|
3026
|
-
return new Proxy(chunk, {
|
|
3027
|
-
get(target, p$1) {
|
|
3028
|
-
if (p$1 in cache) return cache[p$1];
|
|
3029
|
-
const value = target[p$1];
|
|
3030
|
-
cache[p$1] = value;
|
|
3031
|
-
return value;
|
|
3032
|
-
},
|
|
3033
|
-
set(_target, p$1, newValue) {
|
|
3034
|
-
cache[p$1] = newValue;
|
|
3035
|
-
changed?.updated.add(bindingChunk.fileName);
|
|
3036
|
-
return true;
|
|
3037
|
-
},
|
|
3038
|
-
has(target, p$1) {
|
|
3039
|
-
if (p$1 in cache) return true;
|
|
3040
|
-
return p$1 in target;
|
|
3041
|
-
}
|
|
3042
|
-
});
|
|
3043
|
-
}
|
|
3044
|
-
function transformToRollupOutputAsset(bindingAsset, changed) {
|
|
3045
|
-
const asset = {
|
|
3046
|
-
type: "asset",
|
|
3047
|
-
fileName: bindingAsset.fileName,
|
|
3048
|
-
originalFileName: bindingAsset.originalFileName || null,
|
|
3049
|
-
originalFileNames: bindingAsset.originalFileNames,
|
|
3050
|
-
get source() {
|
|
3051
|
-
return transformAssetSource(bindingAsset.source);
|
|
3052
|
-
},
|
|
3053
|
-
name: bindingAsset.name ?? void 0,
|
|
3054
|
-
names: bindingAsset.names
|
|
3055
|
-
};
|
|
3056
|
-
const cache = {};
|
|
3057
|
-
return new Proxy(asset, {
|
|
3058
|
-
get(target, p$1) {
|
|
3059
|
-
if (p$1 in cache) return cache[p$1];
|
|
3060
|
-
const value = target[p$1];
|
|
3061
|
-
cache[p$1] = value;
|
|
3062
|
-
return value;
|
|
3063
|
-
},
|
|
3064
|
-
set(_target, p$1, newValue) {
|
|
3065
|
-
cache[p$1] = newValue;
|
|
3066
|
-
changed?.updated.add(bindingAsset.fileName);
|
|
3067
|
-
return true;
|
|
3068
|
-
}
|
|
3069
|
-
});
|
|
3070
|
-
}
|
|
3071
|
-
function transformToRollupOutput(output, changed) {
|
|
3072
|
-
const { chunks, assets } = output;
|
|
3073
|
-
return { output: [...chunks.map((chunk) => transformToRollupOutputChunk(chunk, changed)), ...assets.map((asset) => transformToRollupOutputAsset(asset, changed))] };
|
|
3074
|
-
}
|
|
3075
|
-
function transformToOutputBundle(context, output, changed) {
|
|
3076
|
-
const bundle = Object.fromEntries(transformToRollupOutput(output, changed).output.map((item) => [item.fileName, item]));
|
|
3077
|
-
return new Proxy(bundle, {
|
|
3078
|
-
set(_target, _p, _newValue, _receiver) {
|
|
3079
|
-
const originalStackTraceLimit = Error.stackTraceLimit;
|
|
3080
|
-
Error.stackTraceLimit = 2;
|
|
3081
|
-
const message = "This plugin assigns to bundle variable. This is discouraged by Rollup and is not supported by Rolldown. This will be ignored. https://rollupjs.org/plugin-development/#generatebundle:~:text=DANGER,this.emitFile.";
|
|
3082
|
-
const stack = new Error(message).stack ?? message;
|
|
3083
|
-
Error.stackTraceLimit = originalStackTraceLimit;
|
|
3084
|
-
context.warn({
|
|
3085
|
-
message: stack,
|
|
3086
|
-
code: "UNSUPPORTED_BUNDLE_ASSIGNMENT"
|
|
3087
|
-
});
|
|
3088
|
-
return true;
|
|
3089
|
-
},
|
|
3090
|
-
deleteProperty(target, property) {
|
|
3091
|
-
if (typeof property === "string") changed.deleted.add(property);
|
|
3092
|
-
return true;
|
|
3093
|
-
}
|
|
3094
|
-
});
|
|
3095
|
-
}
|
|
3096
|
-
function collectChangedBundle(changed, bundle) {
|
|
3097
|
-
const changes = {};
|
|
3098
|
-
for (const key in bundle) {
|
|
3099
|
-
if (changed.deleted.has(key) || !changed.updated.has(key)) continue;
|
|
3100
|
-
const item = bundle[key];
|
|
3101
|
-
if (item.type === "asset") changes[key] = {
|
|
3102
|
-
filename: item.fileName,
|
|
3103
|
-
originalFileNames: item.originalFileNames,
|
|
3104
|
-
source: bindingAssetSource(item.source),
|
|
3105
|
-
names: item.names
|
|
3106
|
-
};
|
|
3107
|
-
else changes[key] = {
|
|
3108
|
-
code: item.code,
|
|
3109
|
-
filename: item.fileName,
|
|
3110
|
-
name: item.name,
|
|
3111
|
-
isEntry: item.isEntry,
|
|
3112
|
-
exports: item.exports,
|
|
3113
|
-
modules: {},
|
|
3114
|
-
imports: item.imports,
|
|
3115
|
-
dynamicImports: item.dynamicImports,
|
|
3116
|
-
facadeModuleId: item.facadeModuleId || void 0,
|
|
3117
|
-
isDynamicEntry: item.isDynamicEntry,
|
|
3118
|
-
moduleIds: item.moduleIds,
|
|
3119
|
-
map: bindingifySourcemap$1(item.map),
|
|
3120
|
-
sourcemapFilename: item.sourcemapFileName || void 0,
|
|
3121
|
-
preliminaryFilename: item.preliminaryFileName
|
|
3122
|
-
};
|
|
3123
|
-
}
|
|
3124
|
-
return {
|
|
3125
|
-
changes,
|
|
3126
|
-
deleted: changed.deleted
|
|
3127
|
-
};
|
|
3128
|
-
}
|
|
3129
|
-
|
|
3130
3083
|
//#endregion
|
|
3131
3084
|
//#region src/plugin/bindingify-output-hooks.ts
|
|
3132
3085
|
function bindingifyRenderStart(args$1) {
|
|
@@ -3166,7 +3119,7 @@ function bindingifyAugmentChunkHash(args$1) {
|
|
|
3166
3119
|
const { handler, meta } = normalizeHook(hook);
|
|
3167
3120
|
return {
|
|
3168
3121
|
plugin: async (ctx, chunk) => {
|
|
3169
|
-
return
|
|
3122
|
+
return handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), transformRenderedChunk(chunk));
|
|
3170
3123
|
},
|
|
3171
3124
|
meta: bindingifyPluginHookMeta(meta)
|
|
3172
3125
|
};
|
|
@@ -3474,8 +3427,8 @@ function wrapHandlers(plugin) {
|
|
|
3474
3427
|
if (handler) plugin[hookName] = async (...args$1) => {
|
|
3475
3428
|
try {
|
|
3476
3429
|
return await handler(...args$1);
|
|
3477
|
-
} catch (e$
|
|
3478
|
-
return error(logPluginError(e$
|
|
3430
|
+
} catch (e$1) {
|
|
3431
|
+
return error(logPluginError(e$1, plugin.name, {
|
|
3479
3432
|
hook: hookName,
|
|
3480
3433
|
id: hookName === "transform" ? args$1[2] : void 0
|
|
3481
3434
|
}));
|
|
@@ -3746,6 +3699,49 @@ function isReadonlyArray(input) {
|
|
|
3746
3699
|
return Array.isArray(input);
|
|
3747
3700
|
}
|
|
3748
3701
|
|
|
3702
|
+
//#endregion
|
|
3703
|
+
//#region src/utils/normalize-transform-options.ts
|
|
3704
|
+
/**
|
|
3705
|
+
* Normalizes transform options by extracting `define`, `inject`, and `dropLabels` separately from OXC transform options.
|
|
3706
|
+
*
|
|
3707
|
+
* Prioritizes values from `transform.define`, `transform.inject`, and `transform.dropLabels` over deprecated top-level options.
|
|
3708
|
+
*/
|
|
3709
|
+
function normalizeTransformOptions(inputOptions, onLog) {
|
|
3710
|
+
const transform = inputOptions.transform;
|
|
3711
|
+
let define;
|
|
3712
|
+
if (transform?.define) define = Object.entries(transform.define);
|
|
3713
|
+
else if (inputOptions.define) {
|
|
3714
|
+
onLog(LOG_LEVEL_WARN, logDeprecatedDefine());
|
|
3715
|
+
define = Object.entries(inputOptions.define);
|
|
3716
|
+
}
|
|
3717
|
+
let inject;
|
|
3718
|
+
if (transform?.inject) inject = transform.inject;
|
|
3719
|
+
else if (inputOptions.inject) {
|
|
3720
|
+
onLog(LOG_LEVEL_WARN, logDeprecatedInject());
|
|
3721
|
+
inject = inputOptions.inject;
|
|
3722
|
+
}
|
|
3723
|
+
let dropLabels;
|
|
3724
|
+
if (transform?.dropLabels) dropLabels = transform.dropLabels;
|
|
3725
|
+
else if (inputOptions.dropLabels) {
|
|
3726
|
+
onLog(LOG_LEVEL_WARN, logDeprecatedDropLabels());
|
|
3727
|
+
dropLabels = inputOptions.dropLabels;
|
|
3728
|
+
}
|
|
3729
|
+
let oxcTransformOptions;
|
|
3730
|
+
if (transform) {
|
|
3731
|
+
const { define: _define, inject: _inject, dropLabels: _dropLabels,...rest } = transform;
|
|
3732
|
+
if (Object.keys(rest).length > 0) {
|
|
3733
|
+
if (rest.jsx === false) rest.jsx = "disable";
|
|
3734
|
+
oxcTransformOptions = rest;
|
|
3735
|
+
}
|
|
3736
|
+
}
|
|
3737
|
+
return {
|
|
3738
|
+
define,
|
|
3739
|
+
inject,
|
|
3740
|
+
dropLabels,
|
|
3741
|
+
oxcTransformOptions
|
|
3742
|
+
};
|
|
3743
|
+
}
|
|
3744
|
+
|
|
3749
3745
|
//#endregion
|
|
3750
3746
|
//#region src/utils/bindingify-input-options.ts
|
|
3751
3747
|
function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode) {
|
|
@@ -3755,7 +3751,19 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
3755
3751
|
if (plugin instanceof BuiltinPlugin) return bindingifyBuiltInPlugin(plugin);
|
|
3756
3752
|
return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode);
|
|
3757
3753
|
});
|
|
3758
|
-
const
|
|
3754
|
+
const normalizedTransform = normalizeTransformOptions(inputOptions, onLog);
|
|
3755
|
+
let profilerNames;
|
|
3756
|
+
if (outputOptions.generatedCode?.profilerNames !== void 0) profilerNames = outputOptions.generatedCode.profilerNames;
|
|
3757
|
+
else if (inputOptions.profilerNames !== void 0) {
|
|
3758
|
+
onLog(LOG_LEVEL_WARN, logDeprecatedProfilerNames());
|
|
3759
|
+
profilerNames = inputOptions.profilerNames;
|
|
3760
|
+
}
|
|
3761
|
+
let keepNames;
|
|
3762
|
+
if (outputOptions.keepNames !== void 0) keepNames = outputOptions.keepNames;
|
|
3763
|
+
else if (inputOptions.keepNames !== void 0) {
|
|
3764
|
+
onLog(LOG_LEVEL_WARN, logDeprecatedKeepNames());
|
|
3765
|
+
keepNames = inputOptions.keepNames;
|
|
3766
|
+
}
|
|
3759
3767
|
return {
|
|
3760
3768
|
input: bindingifyInput(inputOptions.input),
|
|
3761
3769
|
plugins,
|
|
@@ -3768,15 +3776,14 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
3768
3776
|
onLog: async (level, log) => onLog(level, log),
|
|
3769
3777
|
treeshake: bindingifyTreeshakeOptions(inputOptions.treeshake),
|
|
3770
3778
|
moduleTypes: inputOptions.moduleTypes,
|
|
3771
|
-
define:
|
|
3772
|
-
inject: bindingifyInject(
|
|
3779
|
+
define: normalizedTransform.define,
|
|
3780
|
+
inject: bindingifyInject(normalizedTransform.inject),
|
|
3773
3781
|
experimental: bindingifyExperimental(inputOptions.experimental),
|
|
3774
|
-
profilerNames
|
|
3775
|
-
|
|
3776
|
-
transform,
|
|
3782
|
+
profilerNames,
|
|
3783
|
+
transform: normalizedTransform.oxcTransformOptions,
|
|
3777
3784
|
watch: bindingifyWatch(inputOptions.watch),
|
|
3778
|
-
dropLabels:
|
|
3779
|
-
keepNames
|
|
3785
|
+
dropLabels: normalizedTransform.dropLabels,
|
|
3786
|
+
keepNames,
|
|
3780
3787
|
checks: inputOptions.checks,
|
|
3781
3788
|
deferSyncScanData: () => {
|
|
3782
3789
|
let ret = [];
|
|
@@ -3905,46 +3912,6 @@ function bindingifyInput(input) {
|
|
|
3905
3912
|
};
|
|
3906
3913
|
});
|
|
3907
3914
|
}
|
|
3908
|
-
function bindingifyJsx(onLog, input, transform) {
|
|
3909
|
-
if (transform?.jsx) {
|
|
3910
|
-
if (input !== void 0) onLog(LOG_LEVEL_WARN, logDuplicateJsxConfig());
|
|
3911
|
-
return { transform };
|
|
3912
|
-
}
|
|
3913
|
-
if (typeof input === "object") {
|
|
3914
|
-
if (input.mode === "preserve") return {
|
|
3915
|
-
jsx: BindingJsx.Preserve,
|
|
3916
|
-
transform
|
|
3917
|
-
};
|
|
3918
|
-
const mode = input.mode ?? "automatic";
|
|
3919
|
-
transform ??= {};
|
|
3920
|
-
transform.jsx = {
|
|
3921
|
-
runtime: mode,
|
|
3922
|
-
pragma: input.factory,
|
|
3923
|
-
pragmaFrag: input.fragment,
|
|
3924
|
-
importSource: mode === "classic" ? input.importSource : mode === "automatic" ? input.jsxImportSource : void 0
|
|
3925
|
-
};
|
|
3926
|
-
return { transform };
|
|
3927
|
-
}
|
|
3928
|
-
let jsx;
|
|
3929
|
-
switch (input) {
|
|
3930
|
-
case false:
|
|
3931
|
-
jsx = BindingJsx.Disable;
|
|
3932
|
-
break;
|
|
3933
|
-
case "react":
|
|
3934
|
-
jsx = BindingJsx.React;
|
|
3935
|
-
break;
|
|
3936
|
-
case "react-jsx":
|
|
3937
|
-
jsx = BindingJsx.ReactJsx;
|
|
3938
|
-
break;
|
|
3939
|
-
case "preserve":
|
|
3940
|
-
jsx = BindingJsx.Preserve;
|
|
3941
|
-
break;
|
|
3942
|
-
}
|
|
3943
|
-
return {
|
|
3944
|
-
jsx,
|
|
3945
|
-
transform
|
|
3946
|
-
};
|
|
3947
|
-
}
|
|
3948
3915
|
function bindingifyWatch(watch$1) {
|
|
3949
3916
|
if (watch$1) return {
|
|
3950
3917
|
buildDelay: watch$1.buildDelay,
|
|
@@ -4031,7 +3998,7 @@ var ChunkingContextImpl = class {
|
|
|
4031
3998
|
//#endregion
|
|
4032
3999
|
//#region src/utils/bindingify-output-options.ts
|
|
4033
4000
|
function bindingifyOutputOptions(outputOptions) {
|
|
4034
|
-
const { dir, format, exports, hashCharacters, sourcemap, sourcemapBaseUrl, sourcemapDebugIds, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, cssEntryFileNames, cssChunkFileNames, banner, footer, intro, outro, esModule, globals, paths, generatedCode, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, preserveModulesRoot, manualChunks, topLevelVar } = outputOptions;
|
|
4001
|
+
const { dir, format, exports, hashCharacters, sourcemap, sourcemapBaseUrl, sourcemapDebugIds, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, cssEntryFileNames, cssChunkFileNames, banner, footer, intro, outro, esModule, globals, paths, generatedCode, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, preserveModulesRoot, manualChunks, topLevelVar, cleanDir } = outputOptions;
|
|
4035
4002
|
const advancedChunks = bindingifyAdvancedChunks(outputOptions.advancedChunks, manualChunks);
|
|
4036
4003
|
return {
|
|
4037
4004
|
dir,
|
|
@@ -4071,7 +4038,8 @@ function bindingifyOutputOptions(outputOptions) {
|
|
|
4071
4038
|
legalComments,
|
|
4072
4039
|
preserveModulesRoot,
|
|
4073
4040
|
topLevelVar,
|
|
4074
|
-
minifyInternalExports: outputOptions.minifyInternalExports
|
|
4041
|
+
minifyInternalExports: outputOptions.minifyInternalExports,
|
|
4042
|
+
cleanDir
|
|
4075
4043
|
};
|
|
4076
4044
|
}
|
|
4077
4045
|
function bindingifyAddon(configAddon) {
|
|
@@ -4161,7 +4129,7 @@ async function initializeParallelPlugins(plugins) {
|
|
|
4161
4129
|
};
|
|
4162
4130
|
}
|
|
4163
4131
|
function initializeWorkers(registryId, count, pluginInfos) {
|
|
4164
|
-
return Promise.all(Array.from({ length: count }, (_, i
|
|
4132
|
+
return Promise.all(Array.from({ length: count }, (_, i) => initializeWorker(registryId, pluginInfos, i)));
|
|
4165
4133
|
}
|
|
4166
4134
|
async function initializeWorker(registryId, pluginInfos, threadNumber) {
|
|
4167
4135
|
const urlString = import.meta.resolve("#parallel-plugin-worker");
|
|
@@ -4181,9 +4149,9 @@ async function initializeWorker(registryId, pluginInfos, threadNumber) {
|
|
|
4181
4149
|
});
|
|
4182
4150
|
});
|
|
4183
4151
|
return worker;
|
|
4184
|
-
} catch (e$
|
|
4152
|
+
} catch (e$1) {
|
|
4185
4153
|
worker?.terminate();
|
|
4186
|
-
throw e$
|
|
4154
|
+
throw e$1;
|
|
4187
4155
|
}
|
|
4188
4156
|
}
|
|
4189
4157
|
const availableParallelism = () => {
|
|
@@ -4219,9 +4187,9 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
|
|
|
4219
4187
|
onLog,
|
|
4220
4188
|
stopWorkers: parallelPluginInitResult?.stopWorkers
|
|
4221
4189
|
};
|
|
4222
|
-
} catch (e$
|
|
4190
|
+
} catch (e$1) {
|
|
4223
4191
|
await parallelPluginInitResult?.stopWorkers();
|
|
4224
|
-
throw e$
|
|
4192
|
+
throw e$1;
|
|
4225
4193
|
}
|
|
4226
4194
|
}
|
|
4227
4195
|
|
|
@@ -4253,9 +4221,9 @@ var RolldownBuild = class RolldownBuild {
|
|
|
4253
4221
|
RolldownBuild.asyncRuntimeShutdown = true;
|
|
4254
4222
|
}
|
|
4255
4223
|
};
|
|
4256
|
-
} catch (e$
|
|
4224
|
+
} catch (e$1) {
|
|
4257
4225
|
await option.stopWorkers?.();
|
|
4258
|
-
throw e$
|
|
4226
|
+
throw e$1;
|
|
4259
4227
|
}
|
|
4260
4228
|
}
|
|
4261
4229
|
async scan() {
|
|
@@ -4265,12 +4233,12 @@ var RolldownBuild = class RolldownBuild {
|
|
|
4265
4233
|
async generate(outputOptions = {}) {
|
|
4266
4234
|
validateOption("output", outputOptions);
|
|
4267
4235
|
const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
|
|
4268
|
-
return
|
|
4236
|
+
return new RolldownOutputImpl(unwrapBindingResult(await impl.generate()));
|
|
4269
4237
|
}
|
|
4270
4238
|
async write(outputOptions = {}) {
|
|
4271
4239
|
validateOption("output", outputOptions);
|
|
4272
4240
|
const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
|
|
4273
|
-
return
|
|
4241
|
+
return new RolldownOutputImpl(unwrapBindingResult(await impl.write()));
|
|
4274
4242
|
}
|
|
4275
4243
|
async close() {
|
|
4276
4244
|
if (this.#bundlerImpl) {
|
|
@@ -4451,4 +4419,4 @@ function defineConfig(config) {
|
|
|
4451
4419
|
const VERSION = version;
|
|
4452
4420
|
|
|
4453
4421
|
//#endregion
|
|
4454
|
-
export {
|
|
4422
|
+
export { version as C, description$1 as S, getOutputCliKeys as _, build as a, BuiltinPlugin as b, createBundlerOptions as c, bindingifyPlugin as d, normalizeBindingResult as f, getInputCliKeys as g, getCliSchemaInfo as h, watch as i, normalizedStringOrRegex as l, bindingifySourcemap$1 as m, VERSION as n, rolldown as o, transformToRollupOutput as p, defineConfig as r, RolldownBuild as s, BindingMagicString$1 as t, PluginContextData as u, validateCliOptions as v, onExit as w, makeBuiltinPluginCallable as x, PluginDriver as y };
|