@rolldown/browser 1.0.0-beta.42 → 1.0.0-beta.44
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 +1046 -67
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +4 -4
- package/dist/experimental-index.browser.mjs +51 -453
- package/dist/experimental-index.d.mts +26 -5
- package/dist/experimental-index.mjs +56 -16
- package/dist/filter-index.d.mts +2 -2
- package/dist/filter-index.mjs +1 -1
- package/dist/index.browser.mjs +2 -2
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +4 -4
- 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.wasi-browser.js +2 -3
- package/dist/rolldown-binding.wasi.cjs +2 -3
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/shared/{binding-CtbNz6TD.d.mts → binding-0m41EAn-.d.mts} +108 -17
- package/dist/shared/{define-config-xBdWOg15.d.mts → define-config-BbwLmCDX.d.mts} +250 -87
- package/dist/shared/{dist-CU0dSkK2.mjs → dist-DNFKY37q.mjs} +1 -1
- package/dist/shared/{load-config-B4-CoeU7.mjs → load-config-B3FsKQ_6.mjs} +2 -2
- 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-DbG0hppv.mjs → src-BnIhK3nA.mjs} +234 -328
- package/dist/{src-D_rsgcbb.js → src-CIeG_TGR.js} +506 -570
- 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 "./dist-DNFKY37q.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.44";
|
|
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;
|
|
@@ -1815,17 +1678,6 @@ const JsxOptionsSchema = strictObject({
|
|
|
1815
1678
|
pragmaFrag: pipe(optional(string()), description("Jsx fragment transformation")),
|
|
1816
1679
|
refresh: pipe(optional(boolean()), description("Enable react fast refresh"))
|
|
1817
1680
|
});
|
|
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
1681
|
const HelperModeSchema = union([literal("Runtime"), literal("External")]);
|
|
1830
1682
|
const DecoratorOptionSchema = object({
|
|
1831
1683
|
legacy: optional(boolean()),
|
|
@@ -1862,7 +1714,10 @@ const TransformOptionsSchema = object({
|
|
|
1862
1714
|
helpers: optional(HelpersSchema),
|
|
1863
1715
|
decorators: optional(DecoratorOptionSchema),
|
|
1864
1716
|
jsx: optional(union([literal("preserve"), JsxOptionsSchema])),
|
|
1865
|
-
target: pipe(optional(union([string(), array(string())])), description("The JavaScript target environment"))
|
|
1717
|
+
target: pipe(optional(union([string(), array(string())])), description("The JavaScript target environment")),
|
|
1718
|
+
define: optional(record(string(), string())),
|
|
1719
|
+
inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
|
|
1720
|
+
dropLabels: pipe(optional(array(string())), description("Remove labeled statements with these label names"))
|
|
1866
1721
|
});
|
|
1867
1722
|
const WatchOptionsSchema = strictObject({
|
|
1868
1723
|
chokidar: optional(never(`The "watch.chokidar" option is deprecated, please use "watch.notify" instead of it`)),
|
|
@@ -1989,11 +1844,11 @@ const InputOptionsSchema = strictObject({
|
|
|
1989
1844
|
literal("browser"),
|
|
1990
1845
|
literal("neutral"),
|
|
1991
1846
|
literal("node")
|
|
1992
|
-
])), description(`Platform for which the code should be generated (node, ${
|
|
1847
|
+
])), description(`Platform for which the code should be generated (node, ${styleText("underline", "browser")}, neutral)`)),
|
|
1993
1848
|
shimMissingExports: pipe(optional(boolean()), description("Create shim variables for missing exports")),
|
|
1994
1849
|
treeshake: optional(TreeshakingOptionsSchema),
|
|
1995
1850
|
optimization: optional(OptimizationOptionsSchema),
|
|
1996
|
-
logLevel: pipe(optional(LogLevelOptionSchema), description(`Log level (${
|
|
1851
|
+
logLevel: pipe(optional(LogLevelOptionSchema), description(`Log level (${styleText("dim", "silent")}, ${styleText(["underline", "gray"], "info")}, debug, ${styleText("yellow", "warn")})`)),
|
|
1997
1852
|
onLog: optional(OnLogSchema),
|
|
1998
1853
|
onwarn: optional(OnwarnSchema),
|
|
1999
1854
|
moduleTypes: pipe(optional(ModuleTypesSchema), description("Module types for customized extensions")),
|
|
@@ -2015,18 +1870,12 @@ const InputOptionsSchema = strictObject({
|
|
|
2015
1870
|
chunkImportMap: optional(union([boolean(), object({
|
|
2016
1871
|
baseUrl: optional(string()),
|
|
2017
1872
|
fileName: optional(string())
|
|
2018
|
-
})]))
|
|
1873
|
+
})])),
|
|
1874
|
+
nativeMagicString: optional(boolean())
|
|
2019
1875
|
})),
|
|
2020
1876
|
define: pipe(optional(record(string(), string())), description("Define global variables")),
|
|
2021
1877
|
inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
|
|
2022
1878
|
profilerNames: optional(boolean()),
|
|
2023
|
-
jsx: optional(union([
|
|
2024
|
-
literal(false),
|
|
2025
|
-
literal("react"),
|
|
2026
|
-
literal("react-jsx"),
|
|
2027
|
-
literal("preserve"),
|
|
2028
|
-
RollupJsxOptionsSchema
|
|
2029
|
-
])),
|
|
2030
1879
|
transform: optional(TransformOptionsSchema),
|
|
2031
1880
|
watch: optional(union([WatchOptionsSchema, literal(false)])),
|
|
2032
1881
|
dropLabels: pipe(optional(array(string())), description("Remove labeled statements with these label names")),
|
|
@@ -2047,12 +1896,6 @@ const InputCliOverrideSchema = strictObject({
|
|
|
2047
1896
|
inject: pipe(optional(record(string(), string())), description("Inject import statements on demand")),
|
|
2048
1897
|
treeshake: pipe(optional(boolean()), description("enable treeshaking")),
|
|
2049
1898
|
makeAbsoluteExternalsRelative: pipe(optional(boolean()), description("Prevent normalization of external imports")),
|
|
2050
|
-
jsx: pipe(optional(union([
|
|
2051
|
-
literal(false),
|
|
2052
|
-
literal("react"),
|
|
2053
|
-
literal("react-jsx"),
|
|
2054
|
-
literal("preserve")
|
|
2055
|
-
])), description("Jsx options preset")),
|
|
2056
1899
|
preserveEntrySignatures: pipe(optional(literal(false)), description("Avoid facade chunks for entry points")),
|
|
2057
1900
|
context: pipe(optional(string()), description("The entity top-level `this` represents."))
|
|
2058
1901
|
});
|
|
@@ -2082,6 +1925,7 @@ const ChunkFileNamesSchema = union([string(), pipe(function_(), args(tuple([cust
|
|
|
2082
1925
|
const AssetFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
|
|
2083
1926
|
const SanitizeFileNameSchema = union([boolean(), pipe(function_(), args(tuple([string()])), returns(string()))]);
|
|
2084
1927
|
const GlobalsFunctionSchema = pipe(function_(), args(tuple([string()])), returns(string()));
|
|
1928
|
+
const PathsFunctionSchema = pipe(function_(), args(tuple([string()])), returns(string()));
|
|
2085
1929
|
const AdvancedChunksSchema = strictObject({
|
|
2086
1930
|
includeDependenciesRecursively: optional(boolean()),
|
|
2087
1931
|
minSize: optional(number()),
|
|
@@ -2107,7 +1951,8 @@ const AdvancedChunksSchema = strictObject({
|
|
|
2107
1951
|
const GeneratedCodePresetSchema = union([literal("es5"), literal("es2015")]);
|
|
2108
1952
|
const GeneratedCodeOptionsSchema = strictObject({
|
|
2109
1953
|
symbols: pipe(optional(boolean()), description("Whether to use Symbol.toStringTag for namespace objects")),
|
|
2110
|
-
preset: GeneratedCodePresetSchema
|
|
1954
|
+
preset: GeneratedCodePresetSchema,
|
|
1955
|
+
profilerNames: pipe(optional(boolean()), description("Whether to add readable names to internal variables for profiling purposes"))
|
|
2111
1956
|
});
|
|
2112
1957
|
const OutputOptionsSchema = strictObject({
|
|
2113
1958
|
dir: pipe(optional(string()), description("Output directory, defaults to `dist` if `file` is not set")),
|
|
@@ -2117,18 +1962,18 @@ const OutputOptionsSchema = strictObject({
|
|
|
2117
1962
|
literal("named"),
|
|
2118
1963
|
literal("default"),
|
|
2119
1964
|
literal("none")
|
|
2120
|
-
])), description(`Specify a export mode (${
|
|
1965
|
+
])), description(`Specify a export mode (${styleText("underline", "auto")}, named, default, none)`)),
|
|
2121
1966
|
hashCharacters: pipe(optional(union([
|
|
2122
1967
|
literal("base64"),
|
|
2123
1968
|
literal("base36"),
|
|
2124
1969
|
literal("hex")
|
|
2125
1970
|
])), description("Use the specified character set for file hashes")),
|
|
2126
|
-
format: pipe(optional(ModuleFormatSchema), description(`Output format of the generated bundle (supports ${
|
|
1971
|
+
format: pipe(optional(ModuleFormatSchema), description(`Output format of the generated bundle (supports ${styleText("underline", "esm")}, cjs, and iife)`)),
|
|
2127
1972
|
sourcemap: pipe(optional(union([
|
|
2128
1973
|
boolean(),
|
|
2129
1974
|
literal("inline"),
|
|
2130
1975
|
literal("hidden")
|
|
2131
|
-
])), description(`Generate sourcemap (\`-s inline\` for inline, or ${
|
|
1976
|
+
])), description(`Generate sourcemap (\`-s inline\` for inline, or ${styleText("bold", "pass the `-s` on the last argument if you want to generate `.map` file")})`)),
|
|
2132
1977
|
sourcemapBaseUrl: pipe(optional(string()), description("Base URL used to prefix sourcemap paths")),
|
|
2133
1978
|
sourcemapDebugIds: pipe(optional(boolean()), description("Inject sourcemap debug IDs")),
|
|
2134
1979
|
sourcemapIgnoreList: optional(union([
|
|
@@ -2156,6 +2001,7 @@ const OutputOptionsSchema = strictObject({
|
|
|
2156
2001
|
])), description("Minify the bundled file")),
|
|
2157
2002
|
name: pipe(optional(string()), description("Name for UMD / IIFE format outputs")),
|
|
2158
2003
|
globals: pipe(optional(union([record(string(), string()), GlobalsFunctionSchema])), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2004
|
+
paths: pipe(optional(union([record(string(), string()), PathsFunctionSchema])), description("Maps external module IDs to paths")),
|
|
2159
2005
|
generatedCode: pipe(optional(partial(GeneratedCodeOptionsSchema)), description("Generated code options")),
|
|
2160
2006
|
externalLiveBindings: pipe(optional(boolean()), description("external live bindings")),
|
|
2161
2007
|
inlineDynamicImports: pipe(optional(boolean()), description("Inline dynamic imports")),
|
|
@@ -2172,10 +2018,12 @@ const OutputOptionsSchema = strictObject({
|
|
|
2172
2018
|
preserveModulesRoot: pipe(optional(string()), description("Put preserved modules under this path at root level")),
|
|
2173
2019
|
virtualDirname: optional(string()),
|
|
2174
2020
|
minifyInternalExports: pipe(optional(boolean()), description("Minify internal exports")),
|
|
2175
|
-
topLevelVar: pipe(optional(boolean()), description("Rewrite top-level declarations to use `var`."))
|
|
2021
|
+
topLevelVar: pipe(optional(boolean()), description("Rewrite top-level declarations to use `var`.")),
|
|
2022
|
+
cleanDir: pipe(optional(boolean()), description("Clean output directory before emitting output")),
|
|
2023
|
+
keepNames: pipe(optional(boolean()), description("Keep function and class names after bundling"))
|
|
2176
2024
|
});
|
|
2177
2025
|
const getAddonDescription = (placement, wrapper) => {
|
|
2178
|
-
return `Code to insert the ${
|
|
2026
|
+
return `Code to insert the ${styleText("bold", placement)} of the bundled file (${styleText("bold", wrapper)} the wrapper function)`;
|
|
2179
2027
|
};
|
|
2180
2028
|
const OutputCliOverrideSchema = strictObject({
|
|
2181
2029
|
assetFileNames: pipe(optional(string()), description("Name pattern for asset files")),
|
|
@@ -2234,7 +2082,7 @@ function validateOption(key, options) {
|
|
|
2234
2082
|
let issueMsg = issue.message;
|
|
2235
2083
|
const issuePaths = issue.path.map((path$1) => path$1.key);
|
|
2236
2084
|
if (issue.type === "union") {
|
|
2237
|
-
const subIssue = issue.issues?.find((i
|
|
2085
|
+
const subIssue = issue.issues?.find((i) => !(i.type !== issue.received && i.input === issue.input));
|
|
2238
2086
|
if (subIssue) {
|
|
2239
2087
|
if (subIssue.path) issuePaths.push(subIssue.path.map((path$1) => path$1.key));
|
|
2240
2088
|
issueMsg = subIssue.message;
|
|
@@ -2266,8 +2114,8 @@ function bindingifySourcemap$1(map) {
|
|
|
2266
2114
|
file: map.file ?? void 0,
|
|
2267
2115
|
mappings: map.mappings,
|
|
2268
2116
|
sourceRoot: "sourceRoot" in map ? map.sourceRoot ?? void 0 : void 0,
|
|
2269
|
-
sources: map.sources?.map((s
|
|
2270
|
-
sourcesContent: map.sourcesContent?.map((s
|
|
2117
|
+
sources: map.sources?.map((s) => s ?? void 0),
|
|
2118
|
+
sourcesContent: map.sourcesContent?.map((s) => s ?? void 0),
|
|
2271
2119
|
names: map.names,
|
|
2272
2120
|
x_google_ignoreList: map.x_google_ignoreList,
|
|
2273
2121
|
debugId: "debugId" in map ? map.debugId : void 0
|
|
@@ -2280,23 +2128,27 @@ function unwrapBindingResult(container) {
|
|
|
2280
2128
|
if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) throw aggregateBindingErrorsIntoJsError(container.errors);
|
|
2281
2129
|
return container;
|
|
2282
2130
|
}
|
|
2283
|
-
function
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2131
|
+
function normalizeBindingResult(container) {
|
|
2132
|
+
if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) return aggregateBindingErrorsIntoJsError(container.errors);
|
|
2133
|
+
return container;
|
|
2134
|
+
}
|
|
2135
|
+
function normalizeBindingError(e$1) {
|
|
2136
|
+
return e$1.type === "JsError" ? e$1.field0 : Object.assign(/* @__PURE__ */ new Error(), {
|
|
2137
|
+
kind: e$1.field0.kind,
|
|
2138
|
+
message: e$1.field0.message,
|
|
2287
2139
|
stack: void 0
|
|
2288
2140
|
});
|
|
2289
2141
|
}
|
|
2290
2142
|
function aggregateBindingErrorsIntoJsError(rawErrors) {
|
|
2291
2143
|
const errors = rawErrors.map(normalizeBindingError);
|
|
2292
2144
|
let summary = `Build failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
|
|
2293
|
-
for (let i
|
|
2145
|
+
for (let i = 0; i < errors.length; i++) {
|
|
2294
2146
|
summary += "\n";
|
|
2295
|
-
if (i
|
|
2147
|
+
if (i >= 5) {
|
|
2296
2148
|
summary += "...";
|
|
2297
2149
|
break;
|
|
2298
2150
|
}
|
|
2299
|
-
summary += getErrorMessage(errors[i
|
|
2151
|
+
summary += getErrorMessage(errors[i]);
|
|
2300
2152
|
}
|
|
2301
2153
|
const wrapper = new Error(summary);
|
|
2302
2154
|
Object.defineProperty(wrapper, "errors", {
|
|
@@ -2311,25 +2163,25 @@ function aggregateBindingErrorsIntoJsError(rawErrors) {
|
|
|
2311
2163
|
});
|
|
2312
2164
|
return wrapper;
|
|
2313
2165
|
}
|
|
2314
|
-
function getErrorMessage(e$
|
|
2315
|
-
if (Object.hasOwn(e$
|
|
2316
|
-
let s
|
|
2317
|
-
if (e$
|
|
2318
|
-
const id$1 = e$
|
|
2166
|
+
function getErrorMessage(e$1) {
|
|
2167
|
+
if (Object.hasOwn(e$1, "kind")) return e$1.message;
|
|
2168
|
+
let s = "";
|
|
2169
|
+
if (e$1.plugin) s += `[plugin ${e$1.plugin}]`;
|
|
2170
|
+
const id$1 = e$1.id ?? e$1.loc?.file;
|
|
2319
2171
|
if (id$1) {
|
|
2320
|
-
s
|
|
2321
|
-
if (e$
|
|
2172
|
+
s += " " + id$1;
|
|
2173
|
+
if (e$1.loc) s += `:${e$1.loc.line}:${e$1.loc.column}`;
|
|
2322
2174
|
}
|
|
2323
|
-
if (s
|
|
2324
|
-
const message = `${e$
|
|
2325
|
-
s
|
|
2326
|
-
if (e$
|
|
2327
|
-
if (e$
|
|
2328
|
-
if (e$
|
|
2329
|
-
s
|
|
2330
|
-
s
|
|
2175
|
+
if (s) s += "\n";
|
|
2176
|
+
const message = `${e$1.name ?? "Error"}: ${e$1.message}`;
|
|
2177
|
+
s += message;
|
|
2178
|
+
if (e$1.frame) s = joinNewLine(s, e$1.frame);
|
|
2179
|
+
if (e$1.stack) s = joinNewLine(s, e$1.stack.replace(message, ""));
|
|
2180
|
+
if (e$1.cause) {
|
|
2181
|
+
s = joinNewLine(s, "Caused by:");
|
|
2182
|
+
s = joinNewLine(s, getErrorMessage(e$1.cause).split("\n").map((line) => " " + line).join("\n"));
|
|
2331
2183
|
}
|
|
2332
|
-
return s
|
|
2184
|
+
return s;
|
|
2333
2185
|
}
|
|
2334
2186
|
function joinNewLine(s1, s2) {
|
|
2335
2187
|
return s1.replace(/\n+$/, "") + "\n" + s2.replace(/^\n+/, "");
|
|
@@ -2373,42 +2225,42 @@ function normalizeTransformHookSourcemap(id$1, originalCode, rawMap) {
|
|
|
2373
2225
|
|
|
2374
2226
|
//#endregion
|
|
2375
2227
|
//#region ../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/lazyDataLastImpl-BDhrIOwR.js
|
|
2376
|
-
function e(e$
|
|
2377
|
-
let r
|
|
2378
|
-
return n$
|
|
2379
|
-
lazy: n$
|
|
2380
|
-
lazyArgs: t$
|
|
2228
|
+
function e(e$1, t$2, n$1) {
|
|
2229
|
+
let r = (n$2) => e$1(n$2, ...t$2);
|
|
2230
|
+
return n$1 === void 0 ? r : Object.assign(r, {
|
|
2231
|
+
lazy: n$1,
|
|
2232
|
+
lazyArgs: t$2
|
|
2381
2233
|
});
|
|
2382
2234
|
}
|
|
2383
2235
|
|
|
2384
2236
|
//#endregion
|
|
2385
2237
|
//#region ../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/purry-DH9cw9sy.js
|
|
2386
|
-
function t(t$
|
|
2387
|
-
let i
|
|
2388
|
-
if (i
|
|
2389
|
-
if (i
|
|
2238
|
+
function t(t$2, n$1, r) {
|
|
2239
|
+
let i = t$2.length - n$1.length;
|
|
2240
|
+
if (i === 0) return t$2(...n$1);
|
|
2241
|
+
if (i === 1) return e(t$2, n$1, r);
|
|
2390
2242
|
throw Error(`Wrong number of arguments`);
|
|
2391
2243
|
}
|
|
2392
2244
|
|
|
2393
2245
|
//#endregion
|
|
2394
2246
|
//#region ../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/partition-DAu403JQ.js
|
|
2395
|
-
function t$1(...t$
|
|
2396
|
-
return t(n, t$
|
|
2247
|
+
function t$1(...t$2) {
|
|
2248
|
+
return t(n, t$2);
|
|
2397
2249
|
}
|
|
2398
|
-
const n = (e$
|
|
2399
|
-
let n$
|
|
2400
|
-
for (let [r
|
|
2401
|
-
return n$
|
|
2250
|
+
const n = (e$1, t$2) => {
|
|
2251
|
+
let n$1 = [[], []];
|
|
2252
|
+
for (let [r, i] of e$1.entries()) t$2(i, r, e$1) ? n$1[0].push(i) : n$1[1].push(i);
|
|
2253
|
+
return n$1;
|
|
2402
2254
|
};
|
|
2403
2255
|
|
|
2404
2256
|
//#endregion
|
|
2405
2257
|
//#region src/plugin/bindingify-hook-filter.ts
|
|
2406
2258
|
function generalHookFilterMatcherToFilterExprs(matcher, stringKind) {
|
|
2407
2259
|
if (typeof matcher === "string" || matcher instanceof RegExp) return [include(generateAtomMatcher(stringKind, matcher))];
|
|
2408
|
-
if (Array.isArray(matcher)) return matcher.map((m
|
|
2260
|
+
if (Array.isArray(matcher)) return matcher.map((m) => include(generateAtomMatcher(stringKind, m)));
|
|
2409
2261
|
let ret = [];
|
|
2410
|
-
if (matcher.exclude) ret.push(...arraify(matcher.exclude).map((m
|
|
2411
|
-
if (matcher.include) ret.push(...arraify(matcher.include).map((m
|
|
2262
|
+
if (matcher.exclude) ret.push(...arraify(matcher.exclude).map((m) => exclude(generateAtomMatcher(stringKind, m))));
|
|
2263
|
+
if (matcher.include) ret.push(...arraify(matcher.include).map((m) => include(generateAtomMatcher(stringKind, m))));
|
|
2412
2264
|
return ret;
|
|
2413
2265
|
}
|
|
2414
2266
|
function generateAtomMatcher(kind, matcher) {
|
|
@@ -2423,14 +2275,14 @@ function transformFilterMatcherToFilterExprs(filterOption) {
|
|
|
2423
2275
|
let idExcludes = [];
|
|
2424
2276
|
let codeIncludes = [];
|
|
2425
2277
|
let codeExcludes = [];
|
|
2426
|
-
if (id$1) [idIncludes, idExcludes] = t$1(generalHookFilterMatcherToFilterExprs(id$1, "id") ?? [], (m
|
|
2427
|
-
if (code$1) [codeIncludes, codeExcludes] = t$1(generalHookFilterMatcherToFilterExprs(code$1, "code") ?? [], (m
|
|
2278
|
+
if (id$1) [idIncludes, idExcludes] = t$1(generalHookFilterMatcherToFilterExprs(id$1, "id") ?? [], (m) => m.kind === "include");
|
|
2279
|
+
if (code$1) [codeIncludes, codeExcludes] = t$1(generalHookFilterMatcherToFilterExprs(code$1, "code") ?? [], (m) => m.kind === "include");
|
|
2428
2280
|
ret.push(...idExcludes);
|
|
2429
2281
|
ret.push(...codeExcludes);
|
|
2430
2282
|
let andExprList = [];
|
|
2431
2283
|
if (moduleType$1) {
|
|
2432
2284
|
let moduleTypes = Array.isArray(moduleType$1) ? moduleType$1 : moduleType$1.include ?? [];
|
|
2433
|
-
andExprList.push(or(...moduleTypes.map((m
|
|
2285
|
+
andExprList.push(or(...moduleTypes.map((m) => moduleType(m))));
|
|
2434
2286
|
}
|
|
2435
2287
|
if (idIncludes.length) andExprList.push(or(...idIncludes.map((item) => item.expr)));
|
|
2436
2288
|
if (codeIncludes.length) andExprList.push(or(...codeIncludes.map((item) => item.expr)));
|
|
@@ -2452,7 +2304,7 @@ function bindingifyFilterExprImpl(expr, list) {
|
|
|
2452
2304
|
switch (expr.kind) {
|
|
2453
2305
|
case "and": {
|
|
2454
2306
|
let args$1 = expr.args;
|
|
2455
|
-
for (let i
|
|
2307
|
+
for (let i = args$1.length - 1; i >= 0; i--) bindingifyFilterExprImpl(args$1[i], list);
|
|
2456
2308
|
list.push({
|
|
2457
2309
|
kind: "And",
|
|
2458
2310
|
payload: args$1.length
|
|
@@ -2461,7 +2313,7 @@ function bindingifyFilterExprImpl(expr, list) {
|
|
|
2461
2313
|
}
|
|
2462
2314
|
case "or": {
|
|
2463
2315
|
let args$1 = expr.args;
|
|
2464
|
-
for (let i
|
|
2316
|
+
for (let i = args$1.length - 1; i >= 0; i--) bindingifyFilterExprImpl(args$1[i], list);
|
|
2465
2317
|
list.push({
|
|
2466
2318
|
kind: "Or",
|
|
2467
2319
|
payload: args$1.length
|
|
@@ -2604,7 +2456,7 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
|
|
|
2604
2456
|
this.data.updateModuleOption(id$1, rawOptions);
|
|
2605
2457
|
let loadPromise = this.data.loadModulePromiseMap.get(id$1);
|
|
2606
2458
|
if (!loadPromise) {
|
|
2607
|
-
loadPromise = this.context.load(id$1, options.moduleSideEffects ?? void 0).catch(() => {
|
|
2459
|
+
loadPromise = this.context.load(id$1, options.moduleSideEffects ?? void 0, options.packageJsonPath ?? void 0).catch(() => {
|
|
2608
2460
|
this.data.loadModulePromiseMap.delete(id$1);
|
|
2609
2461
|
});
|
|
2610
2462
|
this.data.loadModulePromiseMap.set(id$1, loadPromise);
|
|
@@ -2693,12 +2545,12 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
|
|
|
2693
2545
|
this.warn = getLogHandler$1(this.warn);
|
|
2694
2546
|
this.info = getLogHandler$1(this.info);
|
|
2695
2547
|
}
|
|
2696
|
-
error(e$
|
|
2697
|
-
if (typeof e$
|
|
2698
|
-
if (pos) augmentCodeLocation(e$
|
|
2699
|
-
e$
|
|
2700
|
-
e$
|
|
2701
|
-
return error(logPluginError(normalizeLog(e$
|
|
2548
|
+
error(e$1, pos) {
|
|
2549
|
+
if (typeof e$1 === "string") e$1 = { message: e$1 };
|
|
2550
|
+
if (pos) augmentCodeLocation(e$1, pos, this.moduleSource, this.moduleId);
|
|
2551
|
+
e$1.id = this.moduleId;
|
|
2552
|
+
e$1.hook = "transform";
|
|
2553
|
+
return error(logPluginError(normalizeLog(e$1), this.pluginName));
|
|
2702
2554
|
}
|
|
2703
2555
|
getCombinedSourcemap() {
|
|
2704
2556
|
return JSON.parse(this.inner.getCombinedSourcemap());
|
|
@@ -2706,6 +2558,9 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
|
|
|
2706
2558
|
addWatchFile(id$1) {
|
|
2707
2559
|
this.inner.addWatchFile(id$1);
|
|
2708
2560
|
}
|
|
2561
|
+
sendMagicString(s) {
|
|
2562
|
+
this.inner.sendMagicString(s);
|
|
2563
|
+
}
|
|
2709
2564
|
};
|
|
2710
2565
|
|
|
2711
2566
|
//#endregion
|
|
@@ -2805,7 +2660,29 @@ function bindingifyTransform(args$1) {
|
|
|
2805
2660
|
const { handler, meta, options } = normalizeHook(hook);
|
|
2806
2661
|
return {
|
|
2807
2662
|
plugin: async (ctx, code$1, id$1, meta$1) => {
|
|
2808
|
-
|
|
2663
|
+
Object.defineProperties(meta$1, {
|
|
2664
|
+
magicString: { get() {
|
|
2665
|
+
return new BindingMagicString(code$1);
|
|
2666
|
+
} },
|
|
2667
|
+
ast: { get() {
|
|
2668
|
+
let lang = "js";
|
|
2669
|
+
switch (meta$1.moduleType) {
|
|
2670
|
+
case "js":
|
|
2671
|
+
case "jsx":
|
|
2672
|
+
case "ts":
|
|
2673
|
+
case "tsx":
|
|
2674
|
+
lang = meta$1.moduleType;
|
|
2675
|
+
break;
|
|
2676
|
+
default: break;
|
|
2677
|
+
}
|
|
2678
|
+
return parseAst(code$1, {
|
|
2679
|
+
astType: meta$1.moduleType.includes("ts") ? "ts" : "js",
|
|
2680
|
+
lang
|
|
2681
|
+
});
|
|
2682
|
+
} }
|
|
2683
|
+
});
|
|
2684
|
+
const transformCtx = new TransformPluginContextImpl(args$1.outputOptions, ctx.inner(), args$1.plugin, args$1.pluginContextData, ctx, id$1, code$1, args$1.onLog, args$1.logLevel, args$1.watchMode);
|
|
2685
|
+
const ret = await handler.call(transformCtx, code$1, id$1, meta$1);
|
|
2809
2686
|
if (ret == null) return;
|
|
2810
2687
|
if (typeof ret === "string") return { code: ret };
|
|
2811
2688
|
let moduleOption = args$1.pluginContextData.updateModuleOption(id$1, {
|
|
@@ -2813,9 +2690,18 @@ function bindingifyTransform(args$1) {
|
|
|
2813
2690
|
moduleSideEffects: ret.moduleSideEffects ?? null,
|
|
2814
2691
|
invalidate: false
|
|
2815
2692
|
});
|
|
2693
|
+
let normalizedCode = void 0;
|
|
2694
|
+
let map = ret.map;
|
|
2695
|
+
if (typeof ret.code === "string") normalizedCode = ret.code;
|
|
2696
|
+
else if (ret.code instanceof BindingMagicString) {
|
|
2697
|
+
let magicString = ret.code;
|
|
2698
|
+
normalizedCode = magicString.toString();
|
|
2699
|
+
let fallbackSourcemap = ctx.sendMagicString(magicString);
|
|
2700
|
+
if (fallbackSourcemap != void 0) map = fallbackSourcemap;
|
|
2701
|
+
}
|
|
2816
2702
|
return {
|
|
2817
|
-
code:
|
|
2818
|
-
map: bindingifySourcemap$1(normalizeTransformHookSourcemap(id$1, code$1,
|
|
2703
|
+
code: normalizedCode,
|
|
2704
|
+
map: bindingifySourcemap$1(normalizeTransformHookSourcemap(id$1, code$1, map)),
|
|
2819
2705
|
moduleSideEffects: moduleOption.moduleSideEffects ?? void 0,
|
|
2820
2706
|
moduleType: ret.moduleType
|
|
2821
2707
|
};
|
|
@@ -2929,9 +2815,9 @@ function transformRenderedChunk(chunk) {
|
|
|
2929
2815
|
}
|
|
2930
2816
|
function transformChunkModules(modules) {
|
|
2931
2817
|
const result = {};
|
|
2932
|
-
for (let i
|
|
2933
|
-
let key = modules.keys[i
|
|
2934
|
-
const mod = modules.values[i
|
|
2818
|
+
for (let i = 0; i < modules.values.length; i++) {
|
|
2819
|
+
let key = modules.keys[i];
|
|
2820
|
+
const mod = modules.values[i];
|
|
2935
2821
|
result[key] = transformToRenderedModule(mod);
|
|
2936
2822
|
}
|
|
2937
2823
|
return result;
|
|
@@ -2983,20 +2869,20 @@ function transformToRollupOutputChunk(bindingChunk, changed) {
|
|
|
2983
2869
|
};
|
|
2984
2870
|
const cache = {};
|
|
2985
2871
|
return new Proxy(chunk, {
|
|
2986
|
-
get(target, p
|
|
2987
|
-
if (p
|
|
2988
|
-
const value = target[p
|
|
2989
|
-
cache[p
|
|
2872
|
+
get(target, p) {
|
|
2873
|
+
if (p in cache) return cache[p];
|
|
2874
|
+
const value = target[p];
|
|
2875
|
+
cache[p] = value;
|
|
2990
2876
|
return value;
|
|
2991
2877
|
},
|
|
2992
|
-
set(_target, p
|
|
2993
|
-
cache[p
|
|
2878
|
+
set(_target, p, newValue) {
|
|
2879
|
+
cache[p] = newValue;
|
|
2994
2880
|
changed?.updated.add(bindingChunk.fileName);
|
|
2995
2881
|
return true;
|
|
2996
2882
|
},
|
|
2997
|
-
has(target, p
|
|
2998
|
-
if (p
|
|
2999
|
-
return p
|
|
2883
|
+
has(target, p) {
|
|
2884
|
+
if (p in cache) return true;
|
|
2885
|
+
return p in target;
|
|
3000
2886
|
}
|
|
3001
2887
|
});
|
|
3002
2888
|
}
|
|
@@ -3014,14 +2900,14 @@ function transformToRollupOutputAsset(bindingAsset, changed) {
|
|
|
3014
2900
|
};
|
|
3015
2901
|
const cache = {};
|
|
3016
2902
|
return new Proxy(asset, {
|
|
3017
|
-
get(target, p
|
|
3018
|
-
if (p
|
|
3019
|
-
const value = target[p
|
|
3020
|
-
cache[p
|
|
2903
|
+
get(target, p) {
|
|
2904
|
+
if (p in cache) return cache[p];
|
|
2905
|
+
const value = target[p];
|
|
2906
|
+
cache[p] = value;
|
|
3021
2907
|
return value;
|
|
3022
2908
|
},
|
|
3023
|
-
set(_target, p
|
|
3024
|
-
cache[p
|
|
2909
|
+
set(_target, p, newValue) {
|
|
2910
|
+
cache[p] = newValue;
|
|
3025
2911
|
changed?.updated.add(bindingAsset.fileName);
|
|
3026
2912
|
return true;
|
|
3027
2913
|
}
|
|
@@ -3433,8 +3319,8 @@ function wrapHandlers(plugin) {
|
|
|
3433
3319
|
if (handler) plugin[hookName] = async (...args$1) => {
|
|
3434
3320
|
try {
|
|
3435
3321
|
return await handler(...args$1);
|
|
3436
|
-
} catch (e$
|
|
3437
|
-
return error(logPluginError(e$
|
|
3322
|
+
} catch (e$1) {
|
|
3323
|
+
return error(logPluginError(e$1, plugin.name, {
|
|
3438
3324
|
hook: hookName,
|
|
3439
3325
|
id: hookName === "transform" ? args$1[2] : void 0
|
|
3440
3326
|
}));
|
|
@@ -3543,6 +3429,9 @@ var NormalizedOutputOptionsImpl = class {
|
|
|
3543
3429
|
get globals() {
|
|
3544
3430
|
return this.inner.globals || this.outputOptions.globals;
|
|
3545
3431
|
}
|
|
3432
|
+
get paths() {
|
|
3433
|
+
return this.outputOptions.paths;
|
|
3434
|
+
}
|
|
3546
3435
|
get hashCharacters() {
|
|
3547
3436
|
return this.inner.hashCharacters;
|
|
3548
3437
|
}
|
|
@@ -3702,6 +3591,49 @@ function isReadonlyArray(input) {
|
|
|
3702
3591
|
return Array.isArray(input);
|
|
3703
3592
|
}
|
|
3704
3593
|
|
|
3594
|
+
//#endregion
|
|
3595
|
+
//#region src/utils/normalize-transform-options.ts
|
|
3596
|
+
/**
|
|
3597
|
+
* Normalizes transform options by extracting `define`, `inject`, and `dropLabels` separately from OXC transform options.
|
|
3598
|
+
*
|
|
3599
|
+
* Prioritizes values from `transform.define`, `transform.inject`, and `transform.dropLabels` over deprecated top-level options.
|
|
3600
|
+
*/
|
|
3601
|
+
function normalizeTransformOptions(inputOptions, onLog) {
|
|
3602
|
+
const transform = inputOptions.transform;
|
|
3603
|
+
let define;
|
|
3604
|
+
if (transform?.define) define = Object.entries(transform.define);
|
|
3605
|
+
else if (inputOptions.define) {
|
|
3606
|
+
onLog(LOG_LEVEL_WARN, logDeprecatedDefine());
|
|
3607
|
+
define = Object.entries(inputOptions.define);
|
|
3608
|
+
}
|
|
3609
|
+
let inject;
|
|
3610
|
+
if (transform?.inject) inject = transform.inject;
|
|
3611
|
+
else if (inputOptions.inject) {
|
|
3612
|
+
onLog(LOG_LEVEL_WARN, logDeprecatedInject());
|
|
3613
|
+
inject = inputOptions.inject;
|
|
3614
|
+
}
|
|
3615
|
+
let dropLabels;
|
|
3616
|
+
if (transform?.dropLabels) dropLabels = transform.dropLabels;
|
|
3617
|
+
else if (inputOptions.dropLabels) {
|
|
3618
|
+
onLog(LOG_LEVEL_WARN, logDeprecatedDropLabels());
|
|
3619
|
+
dropLabels = inputOptions.dropLabels;
|
|
3620
|
+
}
|
|
3621
|
+
let oxcTransformOptions;
|
|
3622
|
+
if (transform) {
|
|
3623
|
+
const { define: _define, inject: _inject, dropLabels: _dropLabels,...rest } = transform;
|
|
3624
|
+
if (Object.keys(rest).length > 0) {
|
|
3625
|
+
if (rest.jsx === false) rest.jsx = "disable";
|
|
3626
|
+
oxcTransformOptions = rest;
|
|
3627
|
+
}
|
|
3628
|
+
}
|
|
3629
|
+
return {
|
|
3630
|
+
define,
|
|
3631
|
+
inject,
|
|
3632
|
+
dropLabels,
|
|
3633
|
+
oxcTransformOptions
|
|
3634
|
+
};
|
|
3635
|
+
}
|
|
3636
|
+
|
|
3705
3637
|
//#endregion
|
|
3706
3638
|
//#region src/utils/bindingify-input-options.ts
|
|
3707
3639
|
function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode) {
|
|
@@ -3711,7 +3643,19 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
3711
3643
|
if (plugin instanceof BuiltinPlugin) return bindingifyBuiltInPlugin(plugin);
|
|
3712
3644
|
return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode);
|
|
3713
3645
|
});
|
|
3714
|
-
const
|
|
3646
|
+
const normalizedTransform = normalizeTransformOptions(inputOptions, onLog);
|
|
3647
|
+
let profilerNames;
|
|
3648
|
+
if (outputOptions.generatedCode?.profilerNames !== void 0) profilerNames = outputOptions.generatedCode.profilerNames;
|
|
3649
|
+
else if (inputOptions.profilerNames !== void 0) {
|
|
3650
|
+
onLog(LOG_LEVEL_WARN, logDeprecatedProfilerNames());
|
|
3651
|
+
profilerNames = inputOptions.profilerNames;
|
|
3652
|
+
}
|
|
3653
|
+
let keepNames;
|
|
3654
|
+
if (outputOptions.keepNames !== void 0) keepNames = outputOptions.keepNames;
|
|
3655
|
+
else if (inputOptions.keepNames !== void 0) {
|
|
3656
|
+
onLog(LOG_LEVEL_WARN, logDeprecatedKeepNames());
|
|
3657
|
+
keepNames = inputOptions.keepNames;
|
|
3658
|
+
}
|
|
3715
3659
|
return {
|
|
3716
3660
|
input: bindingifyInput(inputOptions.input),
|
|
3717
3661
|
plugins,
|
|
@@ -3724,15 +3668,14 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
3724
3668
|
onLog: async (level, log) => onLog(level, log),
|
|
3725
3669
|
treeshake: bindingifyTreeshakeOptions(inputOptions.treeshake),
|
|
3726
3670
|
moduleTypes: inputOptions.moduleTypes,
|
|
3727
|
-
define:
|
|
3728
|
-
inject: bindingifyInject(
|
|
3671
|
+
define: normalizedTransform.define,
|
|
3672
|
+
inject: bindingifyInject(normalizedTransform.inject),
|
|
3729
3673
|
experimental: bindingifyExperimental(inputOptions.experimental),
|
|
3730
|
-
profilerNames
|
|
3731
|
-
|
|
3732
|
-
transform,
|
|
3674
|
+
profilerNames,
|
|
3675
|
+
transform: normalizedTransform.oxcTransformOptions,
|
|
3733
3676
|
watch: bindingifyWatch(inputOptions.watch),
|
|
3734
|
-
dropLabels:
|
|
3735
|
-
keepNames
|
|
3677
|
+
dropLabels: normalizedTransform.dropLabels,
|
|
3678
|
+
keepNames,
|
|
3736
3679
|
checks: inputOptions.checks,
|
|
3737
3680
|
deferSyncScanData: () => {
|
|
3738
3681
|
let ret = [];
|
|
@@ -3797,7 +3740,8 @@ function bindingifyExperimental(experimental) {
|
|
|
3797
3740
|
chunkModulesOrder,
|
|
3798
3741
|
chunkImportMap: experimental?.chunkImportMap,
|
|
3799
3742
|
onDemandWrapping: experimental?.onDemandWrapping,
|
|
3800
|
-
incrementalBuild: experimental?.incrementalBuild
|
|
3743
|
+
incrementalBuild: experimental?.incrementalBuild,
|
|
3744
|
+
nativeMagicString: experimental?.nativeMagicString
|
|
3801
3745
|
};
|
|
3802
3746
|
}
|
|
3803
3747
|
function bindingifyResolve(resolve) {
|
|
@@ -3860,46 +3804,6 @@ function bindingifyInput(input) {
|
|
|
3860
3804
|
};
|
|
3861
3805
|
});
|
|
3862
3806
|
}
|
|
3863
|
-
function bindingifyJsx(onLog, input, transform) {
|
|
3864
|
-
if (transform?.jsx) {
|
|
3865
|
-
if (input !== void 0) onLog(LOG_LEVEL_WARN, logDuplicateJsxConfig());
|
|
3866
|
-
return { transform };
|
|
3867
|
-
}
|
|
3868
|
-
if (typeof input === "object") {
|
|
3869
|
-
if (input.mode === "preserve") return {
|
|
3870
|
-
jsx: BindingJsx.Preserve,
|
|
3871
|
-
transform
|
|
3872
|
-
};
|
|
3873
|
-
const mode = input.mode ?? "automatic";
|
|
3874
|
-
transform ??= {};
|
|
3875
|
-
transform.jsx = {
|
|
3876
|
-
runtime: mode,
|
|
3877
|
-
pragma: input.factory,
|
|
3878
|
-
pragmaFrag: input.fragment,
|
|
3879
|
-
importSource: mode === "classic" ? input.importSource : mode === "automatic" ? input.jsxImportSource : void 0
|
|
3880
|
-
};
|
|
3881
|
-
return { transform };
|
|
3882
|
-
}
|
|
3883
|
-
let jsx;
|
|
3884
|
-
switch (input) {
|
|
3885
|
-
case false:
|
|
3886
|
-
jsx = BindingJsx.Disable;
|
|
3887
|
-
break;
|
|
3888
|
-
case "react":
|
|
3889
|
-
jsx = BindingJsx.React;
|
|
3890
|
-
break;
|
|
3891
|
-
case "react-jsx":
|
|
3892
|
-
jsx = BindingJsx.ReactJsx;
|
|
3893
|
-
break;
|
|
3894
|
-
case "preserve":
|
|
3895
|
-
jsx = BindingJsx.Preserve;
|
|
3896
|
-
break;
|
|
3897
|
-
}
|
|
3898
|
-
return {
|
|
3899
|
-
jsx,
|
|
3900
|
-
transform
|
|
3901
|
-
};
|
|
3902
|
-
}
|
|
3903
3807
|
function bindingifyWatch(watch$1) {
|
|
3904
3808
|
if (watch$1) return {
|
|
3905
3809
|
buildDelay: watch$1.buildDelay,
|
|
@@ -3986,7 +3890,7 @@ var ChunkingContextImpl = class {
|
|
|
3986
3890
|
//#endregion
|
|
3987
3891
|
//#region src/utils/bindingify-output-options.ts
|
|
3988
3892
|
function bindingifyOutputOptions(outputOptions) {
|
|
3989
|
-
const { dir, format, exports, hashCharacters, sourcemap, sourcemapBaseUrl, sourcemapDebugIds, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, cssEntryFileNames, cssChunkFileNames, banner, footer, intro, outro, esModule, globals, generatedCode, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, preserveModulesRoot, manualChunks, topLevelVar } = outputOptions;
|
|
3893
|
+
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;
|
|
3990
3894
|
const advancedChunks = bindingifyAdvancedChunks(outputOptions.advancedChunks, manualChunks);
|
|
3991
3895
|
return {
|
|
3992
3896
|
dir,
|
|
@@ -4005,6 +3909,7 @@ function bindingifyOutputOptions(outputOptions) {
|
|
|
4005
3909
|
outro: bindingifyAddon(outro),
|
|
4006
3910
|
extend: outputOptions.extend,
|
|
4007
3911
|
globals,
|
|
3912
|
+
paths,
|
|
4008
3913
|
generatedCode,
|
|
4009
3914
|
esModule,
|
|
4010
3915
|
name,
|
|
@@ -4025,7 +3930,8 @@ function bindingifyOutputOptions(outputOptions) {
|
|
|
4025
3930
|
legalComments,
|
|
4026
3931
|
preserveModulesRoot,
|
|
4027
3932
|
topLevelVar,
|
|
4028
|
-
minifyInternalExports: outputOptions.minifyInternalExports
|
|
3933
|
+
minifyInternalExports: outputOptions.minifyInternalExports,
|
|
3934
|
+
cleanDir
|
|
4029
3935
|
};
|
|
4030
3936
|
}
|
|
4031
3937
|
function bindingifyAddon(configAddon) {
|
|
@@ -4115,7 +4021,7 @@ async function initializeParallelPlugins(plugins) {
|
|
|
4115
4021
|
};
|
|
4116
4022
|
}
|
|
4117
4023
|
function initializeWorkers(registryId, count, pluginInfos) {
|
|
4118
|
-
return Promise.all(Array.from({ length: count }, (_, i
|
|
4024
|
+
return Promise.all(Array.from({ length: count }, (_, i) => initializeWorker(registryId, pluginInfos, i)));
|
|
4119
4025
|
}
|
|
4120
4026
|
async function initializeWorker(registryId, pluginInfos, threadNumber) {
|
|
4121
4027
|
const urlString = import.meta.resolve("#parallel-plugin-worker");
|
|
@@ -4135,9 +4041,9 @@ async function initializeWorker(registryId, pluginInfos, threadNumber) {
|
|
|
4135
4041
|
});
|
|
4136
4042
|
});
|
|
4137
4043
|
return worker;
|
|
4138
|
-
} catch (e$
|
|
4044
|
+
} catch (e$1) {
|
|
4139
4045
|
worker?.terminate();
|
|
4140
|
-
throw e$
|
|
4046
|
+
throw e$1;
|
|
4141
4047
|
}
|
|
4142
4048
|
}
|
|
4143
4049
|
const availableParallelism = () => {
|
|
@@ -4173,9 +4079,9 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
|
|
|
4173
4079
|
onLog,
|
|
4174
4080
|
stopWorkers: parallelPluginInitResult?.stopWorkers
|
|
4175
4081
|
};
|
|
4176
|
-
} catch (e$
|
|
4082
|
+
} catch (e$1) {
|
|
4177
4083
|
await parallelPluginInitResult?.stopWorkers();
|
|
4178
|
-
throw e$
|
|
4084
|
+
throw e$1;
|
|
4179
4085
|
}
|
|
4180
4086
|
}
|
|
4181
4087
|
|
|
@@ -4207,9 +4113,9 @@ var RolldownBuild = class RolldownBuild {
|
|
|
4207
4113
|
RolldownBuild.asyncRuntimeShutdown = true;
|
|
4208
4114
|
}
|
|
4209
4115
|
};
|
|
4210
|
-
} catch (e$
|
|
4116
|
+
} catch (e$1) {
|
|
4211
4117
|
await option.stopWorkers?.();
|
|
4212
|
-
throw e$
|
|
4118
|
+
throw e$1;
|
|
4213
4119
|
}
|
|
4214
4120
|
}
|
|
4215
4121
|
async scan() {
|
|
@@ -4405,4 +4311,4 @@ function defineConfig(config) {
|
|
|
4405
4311
|
const VERSION = version;
|
|
4406
4312
|
|
|
4407
4313
|
//#endregion
|
|
4408
|
-
export {
|
|
4314
|
+
export { version as C, description$1 as S, getOutputCliKeys as _, build as a, BuiltinPlugin as b, createBundlerOptions as c, bindingifyPlugin as d, transformToRollupOutput as f, getInputCliKeys as g, getCliSchemaInfo as h, watch as i, normalizedStringOrRegex as l, bindingifySourcemap$1 as m, VERSION as n, rolldown as o, normalizeBindingResult 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 };
|