@rolldown/browser 1.0.0-beta.22 → 1.0.0-beta.23
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.cjs +3 -3
- package/dist/cli.mjs +3 -3
- package/dist/config.cjs +3 -3
- package/dist/config.d.cts +2 -2
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +3 -3
- package/dist/experimental-index.browser.mjs +2 -2
- package/dist/experimental-index.cjs +2 -3
- package/dist/experimental-index.d.cts +3 -6
- package/dist/experimental-index.d.mts +3 -6
- package/dist/experimental-index.mjs +3 -3
- package/dist/filter-index.cjs +1 -1
- package/dist/filter-index.d.cts +2 -2
- 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.cjs +2 -2
- package/dist/index.d.cts +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +2 -2
- package/dist/parallel-plugin-worker.cjs +3 -3
- package/dist/parallel-plugin-worker.mjs +3 -3
- package/dist/parallel-plugin.d.cts +2 -2
- package/dist/parallel-plugin.d.mts +2 -2
- package/dist/parse-ast-index.d.cts +1 -1
- package/dist/parse-ast-index.d.mts +1 -1
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/shared/{binding-B8kHDLfO.d.mts → binding-CMKStSph.d.cts} +4 -14
- package/dist/shared/{binding-CbR_BHh9.d.cts → binding-DB58iXP8.d.mts} +4 -14
- package/dist/shared/{define-config-DZVEpUTF.d.cts → define-config-BRkYSF9E.d.cts} +11 -21
- package/dist/shared/{define-config-DsN80oVh.d.mts → define-config-CqVfqfZQ.d.mts} +11 -21
- package/dist/shared/{dist-BMVjvV-v.cjs → dist-BVAp8sOm.cjs} +0 -9
- package/dist/shared/{dist-BoWaIc-K.mjs → dist-DvBwroyk.mjs} +1 -4
- package/dist/shared/{load-config-_2H4hlKT.mjs → load-config-BWbXOTbl.mjs} +1 -1
- package/dist/shared/{load-config-BgXwAVNp.cjs → load-config-Bh2dNRk9.cjs} +1 -1
- package/dist/shared/{src-C_vfq91X.mjs → src-BA5CL--T.mjs} +454 -775
- package/dist/shared/{src-DT8g8X-x.cjs → src-Co_Bf7DL.cjs} +354 -681
- package/dist/{src-DJeuVN_z.js → src-C1KTaRyZ.js} +483 -807
- package/package.json +1 -1
|
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
|
|
28
28
|
//#endregion
|
|
29
29
|
//#region package.json
|
|
30
|
-
var version = "1.0.0-beta.
|
|
30
|
+
var version = "1.0.0-beta.23";
|
|
31
31
|
|
|
32
32
|
//#endregion
|
|
33
33
|
//#region src/builtin-plugin/utils.ts
|
|
@@ -69,8 +69,8 @@ function reporterPlugin(config) {
|
|
|
69
69
|
function manifestPlugin(config) {
|
|
70
70
|
return new BuiltinPlugin("builtin:manifest", config);
|
|
71
71
|
}
|
|
72
|
-
function wasmHelperPlugin() {
|
|
73
|
-
return new BuiltinPlugin("builtin:wasm-helper");
|
|
72
|
+
function wasmHelperPlugin(config) {
|
|
73
|
+
return new BuiltinPlugin("builtin:wasm-helper", config);
|
|
74
74
|
}
|
|
75
75
|
function wasmFallbackPlugin() {
|
|
76
76
|
const builtinPlugin = new BuiltinPlugin("builtin:wasm-fallback");
|
|
@@ -131,9 +131,9 @@ let _lazyMatch = () => {
|
|
|
131
131
|
enumerable: true
|
|
132
132
|
});
|
|
133
133
|
}, H = (r$1, e$1, n$1, a$2) => {
|
|
134
|
-
if (e$1 && typeof e$1 == "object" || typeof e$1 == "function") for (let t$
|
|
135
|
-
get: () => e$1[t$
|
|
136
|
-
enumerable: !(a$2 = V(e$1, t$
|
|
134
|
+
if (e$1 && typeof e$1 == "object" || typeof e$1 == "function") for (let t$1 of G(e$1)) !T.call(r$1, t$1) && t$1 !== n$1 && m$1(r$1, t$1, {
|
|
135
|
+
get: () => e$1[t$1],
|
|
136
|
+
enumerable: !(a$2 = V(e$1, t$1)) || a$2.enumerable
|
|
137
137
|
});
|
|
138
138
|
return r$1;
|
|
139
139
|
}, J = (r$1) => H(m$1({}, "__esModule", { value: true }), r$1), w$1 = {};
|
|
@@ -143,8 +143,8 @@ let _lazyMatch = () => {
|
|
|
143
143
|
return (n$1) => {
|
|
144
144
|
const a$2 = e$1.get(n$1);
|
|
145
145
|
if (a$2) return a$2;
|
|
146
|
-
const t$
|
|
147
|
-
return e$1.set(n$1, t$
|
|
146
|
+
const t$1 = r$1(n$1);
|
|
147
|
+
return e$1.set(n$1, t$1), t$1;
|
|
148
148
|
};
|
|
149
149
|
}, rr = (r$1, e$1, n$1 = {}) => {
|
|
150
150
|
const a$2 = {
|
|
@@ -161,16 +161,16 @@ let _lazyMatch = () => {
|
|
|
161
161
|
const n$1 = {};
|
|
162
162
|
for (const a$2 of r$1) {
|
|
163
163
|
if (a$2.length !== 1) throw new Error(`Invalid character: "${a$2}"`);
|
|
164
|
-
const t$
|
|
165
|
-
n$1[t$
|
|
164
|
+
const t$1 = a$2.charCodeAt(0);
|
|
165
|
+
n$1[t$1] = true;
|
|
166
166
|
}
|
|
167
167
|
return (a$2) => {
|
|
168
|
-
const t$
|
|
168
|
+
const t$1 = a$2.index, o$1 = a$2.input;
|
|
169
169
|
for (; a$2.index < o$1.length && o$1.charCodeAt(a$2.index) in n$1;) a$2.index += 1;
|
|
170
170
|
const u$3 = a$2.index;
|
|
171
|
-
if (u$3 > t$
|
|
171
|
+
if (u$3 > t$1) {
|
|
172
172
|
if (!h$1(e$1) && !a$2.options.silent) {
|
|
173
|
-
const s$1 = a$2.input.slice(t$
|
|
173
|
+
const s$1 = a$2.input.slice(t$1, u$3), c$1 = d$2(e$1) ? e$1(s$1, o$1, String(t$1)) : e$1;
|
|
174
174
|
h$1(c$1) || a$2.output.push(c$1);
|
|
175
175
|
}
|
|
176
176
|
a$2.indexMax = Math.max(a$2.indexMax, a$2.index);
|
|
@@ -178,10 +178,10 @@ let _lazyMatch = () => {
|
|
|
178
178
|
return true;
|
|
179
179
|
};
|
|
180
180
|
}, nr = (r$1, e$1) => {
|
|
181
|
-
const n$1 = r$1.source, a$2 = r$1.flags.replace(/y|$/, "y"), t$
|
|
181
|
+
const n$1 = r$1.source, a$2 = r$1.flags.replace(/y|$/, "y"), t$1 = new RegExp(n$1, a$2);
|
|
182
182
|
return g$1((o$1) => {
|
|
183
|
-
t$
|
|
184
|
-
const u$3 = t$
|
|
183
|
+
t$1.lastIndex = o$1.index;
|
|
184
|
+
const u$3 = t$1.exec(o$1.input);
|
|
185
185
|
if (u$3) {
|
|
186
186
|
if (!h$1(e$1) && !o$1.options.silent) {
|
|
187
187
|
const s$1 = d$2(e$1) ? e$1(...u$3, o$1.input, String(o$1.index)) : e$1;
|
|
@@ -193,38 +193,38 @@ let _lazyMatch = () => {
|
|
|
193
193
|
}, ar = (r$1, e$1) => (n$1) => {
|
|
194
194
|
if (n$1.input.startsWith(r$1, n$1.index)) {
|
|
195
195
|
if (!h$1(e$1) && !n$1.options.silent) {
|
|
196
|
-
const t$
|
|
197
|
-
h$1(t$
|
|
196
|
+
const t$1 = d$2(e$1) ? e$1(r$1, n$1.input, String(n$1.index)) : e$1;
|
|
197
|
+
h$1(t$1) || n$1.output.push(t$1);
|
|
198
198
|
}
|
|
199
199
|
return n$1.index += r$1.length, n$1.indexMax = Math.max(n$1.indexMax, n$1.index), true;
|
|
200
200
|
} else return false;
|
|
201
201
|
}, C = (r$1, e$1, n$1, a$2) => {
|
|
202
|
-
const t$
|
|
202
|
+
const t$1 = v(r$1);
|
|
203
203
|
return g$1(_(M((o$1) => {
|
|
204
204
|
let u$3 = 0;
|
|
205
205
|
for (; u$3 < n$1;) {
|
|
206
206
|
const s$1 = o$1.index;
|
|
207
|
-
if (!t$
|
|
207
|
+
if (!t$1(o$1) || (u$3 += 1, o$1.index === s$1)) break;
|
|
208
208
|
}
|
|
209
209
|
return u$3 >= e$1;
|
|
210
210
|
})));
|
|
211
211
|
}, tr = (r$1, e$1) => C(r$1, 0, 1), f$1 = (r$1, e$1) => C(r$1, 0, Infinity), x = (r$1, e$1) => {
|
|
212
212
|
const n$1 = r$1.map(v);
|
|
213
213
|
return g$1(_(M((a$2) => {
|
|
214
|
-
for (let t$
|
|
214
|
+
for (let t$1 = 0, o$1 = n$1.length; t$1 < o$1; t$1++) if (!n$1[t$1](a$2)) return false;
|
|
215
215
|
return true;
|
|
216
216
|
})));
|
|
217
217
|
}, l$1 = (r$1, e$1) => {
|
|
218
218
|
const n$1 = r$1.map(v);
|
|
219
219
|
return g$1(_((a$2) => {
|
|
220
|
-
for (let t$
|
|
220
|
+
for (let t$1 = 0, o$1 = n$1.length; t$1 < o$1; t$1++) if (n$1[t$1](a$2)) return true;
|
|
221
221
|
return false;
|
|
222
222
|
}));
|
|
223
223
|
}, M = (r$1, e$1 = false) => {
|
|
224
224
|
const n$1 = v(r$1);
|
|
225
225
|
return (a$2) => {
|
|
226
|
-
const t$
|
|
227
|
-
return (!u$3 || e$1) && (a$2.index = t$
|
|
226
|
+
const t$1 = a$2.index, o$1 = a$2.output.length, u$3 = n$1(a$2);
|
|
227
|
+
return (!u$3 || e$1) && (a$2.index = t$1, a$2.output.length !== o$1 && (a$2.output.length = o$1)), u$3;
|
|
228
228
|
};
|
|
229
229
|
}, _ = (r$1, e$1) => {
|
|
230
230
|
const n$1 = v(r$1);
|
|
@@ -233,19 +233,19 @@ let _lazyMatch = () => {
|
|
|
233
233
|
let r$1 = 0;
|
|
234
234
|
return (e$1) => {
|
|
235
235
|
const n$1 = v(e$1), a$2 = r$1 += 1;
|
|
236
|
-
return (t$
|
|
236
|
+
return (t$1) => {
|
|
237
237
|
var o$1;
|
|
238
|
-
if (t$
|
|
239
|
-
const u$3 = t$
|
|
238
|
+
if (t$1.options.memoization === false) return n$1(t$1);
|
|
239
|
+
const u$3 = t$1.index, s$1 = (o$1 = t$1.cache)[a$2] || (o$1[a$2] = /* @__PURE__ */ new Map()), c$1 = s$1.get(u$3);
|
|
240
240
|
if (c$1 === false) return false;
|
|
241
|
-
if (W(c$1)) return t$
|
|
242
|
-
if (c$1) return t$
|
|
241
|
+
if (W(c$1)) return t$1.index = c$1, true;
|
|
242
|
+
if (c$1) return t$1.index = c$1.index, c$1.output?.length && t$1.output.push(...c$1.output), true;
|
|
243
243
|
{
|
|
244
|
-
const Z = t$
|
|
245
|
-
if (n$1(t$
|
|
246
|
-
const D = t$
|
|
244
|
+
const Z = t$1.output.length;
|
|
245
|
+
if (n$1(t$1)) {
|
|
246
|
+
const D = t$1.index, U = t$1.output.length;
|
|
247
247
|
if (U > Z) {
|
|
248
|
-
const ee = t$
|
|
248
|
+
const ee = t$1.output.slice(Z, U);
|
|
249
249
|
s$1.set(u$3, {
|
|
250
250
|
index: D,
|
|
251
251
|
output: ee
|
|
@@ -345,7 +345,7 @@ let _lazyMatch = () => {
|
|
|
345
345
|
])), Kr = Wr, Xr = z(Kr), Yr = Xr, $ = (r$1, e$1) => {
|
|
346
346
|
const n$1 = Array.isArray(r$1) ? r$1 : [r$1];
|
|
347
347
|
if (!n$1.length) return false;
|
|
348
|
-
const a$2 = n$1.map($.compile), t$
|
|
348
|
+
const a$2 = n$1.map($.compile), t$1 = n$1.every((s$1) => /(\/(?:\*\*)?|\[\/\])$/.test(s$1)), o$1 = e$1.replace(/[\\\/]+/g, "/").replace(/\/$/, t$1 ? "/" : "");
|
|
349
349
|
return a$2.some((s$1) => s$1.test(o$1));
|
|
350
350
|
};
|
|
351
351
|
$.compile = (r$1) => new RegExp(`^${L(Yr(r$1))}$`, "s");
|
|
@@ -580,9 +580,6 @@ const win32 = /* @__PURE__ */ mix(";");
|
|
|
580
580
|
function arraify(value) {
|
|
581
581
|
return Array.isArray(value) ? value : [value];
|
|
582
582
|
}
|
|
583
|
-
function isNullish(value) {
|
|
584
|
-
return value === null || value === void 0;
|
|
585
|
-
}
|
|
586
583
|
function unimplemented(info) {
|
|
587
584
|
if (info) throw new Error(`unimplemented: ${info}`);
|
|
588
585
|
throw new Error("unimplemented");
|
|
@@ -2059,18 +2056,18 @@ function safeParse(schema, input, config2) {
|
|
|
2059
2056
|
//#endregion
|
|
2060
2057
|
//#region ../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.cjs
|
|
2061
2058
|
var require_ansis = __commonJS({ "../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.cjs"(exports, module) {
|
|
2062
|
-
let e, t
|
|
2063
|
-
let t$
|
|
2059
|
+
let e, t, r, { defineProperty: n, setPrototypeOf: l, create: o, keys: s } = Object, i$1 = "", { round: c, max: a$1 } = Math, p = (e$1) => {
|
|
2060
|
+
let t$1 = /([a-f\d]{3,6})/i.exec(e$1)?.[1], r$1 = t$1?.length, n$1 = parseInt(6 ^ r$1 ? 3 ^ r$1 ? "0" : t$1[0] + t$1[0] + t$1[1] + t$1[1] + t$1[2] + t$1[2] : t$1, 16);
|
|
2064
2061
|
return [
|
|
2065
2062
|
n$1 >> 16 & 255,
|
|
2066
2063
|
n$1 >> 8 & 255,
|
|
2067
2064
|
255 & n$1
|
|
2068
2065
|
];
|
|
2069
|
-
}, u$2 = (e$1, t$
|
|
2070
|
-
let t$
|
|
2071
|
-
return 8 > e$1 ? 30 + e$1 : 16 > e$1 ? e$1 - 8 + 90 : (232 > e$1 ? (o$1 = (e$1 -= 16) % 36, t$
|
|
2066
|
+
}, u$2 = (e$1, t$1, r$1) => e$1 ^ t$1 || t$1 ^ r$1 ? 16 + 36 * c(e$1 / 51) + 6 * c(t$1 / 51) + c(r$1 / 51) : 8 > e$1 ? 16 : e$1 > 248 ? 231 : c(24 * (e$1 - 8) / 247) + 232, d$1 = (e$1) => {
|
|
2067
|
+
let t$1, r$1, n$1, l$1, o$1;
|
|
2068
|
+
return 8 > e$1 ? 30 + e$1 : 16 > e$1 ? e$1 - 8 + 90 : (232 > e$1 ? (o$1 = (e$1 -= 16) % 36, t$1 = (e$1 / 36 | 0) / 5, r$1 = (o$1 / 6 | 0) / 5, n$1 = o$1 % 6 / 5) : t$1 = r$1 = n$1 = (10 * (e$1 - 232) + 8) / 255, l$1 = 2 * a$1(t$1, r$1, n$1), l$1 ? 30 + (c(n$1) << 2 | c(r$1) << 1 | c(t$1)) + (2 ^ l$1 ? 0 : 60) : 30);
|
|
2072
2069
|
}, g = (() => {
|
|
2073
|
-
let r$1 = (e$1) => o$1.some((t$
|
|
2070
|
+
let r$1 = (e$1) => o$1.some((t$1) => e$1.test(t$1)), n$1 = globalThis, l$1 = n$1.process ?? {}, o$1 = l$1.argv ?? [], i$2 = l$1.env ?? {}, c$1 = -1;
|
|
2074
2071
|
try {
|
|
2075
2072
|
e = "," + s(i$2).join(",");
|
|
2076
2073
|
} catch (e$1) {
|
|
@@ -2083,31 +2080,31 @@ var require_ansis = __commonJS({ "../../node_modules/.pnpm/ansis@4.1.0/node_modu
|
|
|
2083
2080
|
2: 2,
|
|
2084
2081
|
3: 3
|
|
2085
2082
|
}[i$2[a$2]] ?? -1, u$3 = a$2 in i$2 && p$1 || r$1(/^--color=?(true|always)?$/);
|
|
2086
|
-
return u$3 && (c$1 = p$1), ~c$1 || (c$1 = ((r$2, n$2, l$2) => (t
|
|
2083
|
+
return u$3 && (c$1 = p$1), ~c$1 || (c$1 = ((r$2, n$2, l$2) => (t = r$2.TERM, {
|
|
2087
2084
|
"24bit": 3,
|
|
2088
2085
|
truecolor: 3,
|
|
2089
2086
|
ansi256: 2,
|
|
2090
2087
|
ansi: 1
|
|
2091
|
-
}[r$2.COLORTERM] || (r$2.CI ? /,GITHUB/.test(e) ? 3 : 1 : n$2 && "dumb" !== t
|
|
2088
|
+
}[r$2.COLORTERM] || (r$2.CI ? /,GITHUB/.test(e) ? 3 : 1 : n$2 && "dumb" !== t ? l$2 ? 3 : /-256/.test(t) ? 2 : 1 : 0)))(i$2, !!i$2.PM2_HOME || i$2.NEXT_RUNTIME?.includes("edge") || !!l$1.stdout?.isTTY, "win32" === l$1.platform)), !p$1 || i$2.NO_COLOR || r$1(/^--(no-color|color=(false|never))$/) ? 0 : n$1.window?.chrome || u$3 && !c$1 ? 3 : c$1;
|
|
2092
2089
|
})(), f = {
|
|
2093
2090
|
open: i$1,
|
|
2094
2091
|
close: i$1
|
|
2095
|
-
}, h = 39, b = 49, O = {}, m = ({ p: e$1 }, { open: t$
|
|
2092
|
+
}, h = 39, b = 49, O = {}, m = ({ p: e$1 }, { open: t$1, close: n$1 }) => {
|
|
2096
2093
|
let o$1 = (e$2, ...r$1) => {
|
|
2097
2094
|
if (!e$2) {
|
|
2098
|
-
if (t$
|
|
2095
|
+
if (t$1 && t$1 === n$1) return t$1;
|
|
2099
2096
|
if ((e$2 ?? i$1) === i$1) return i$1;
|
|
2100
2097
|
}
|
|
2101
2098
|
let l$1, s$2 = e$2.raw ? String.raw({ raw: e$2 }, ...r$1) : i$1 + e$2, c$2 = o$1.p, a$2 = c$2.o, p$1 = c$2.c;
|
|
2102
2099
|
if (s$2.includes("\x1B")) for (; c$2; c$2 = c$2.p) {
|
|
2103
|
-
let { open: e$3, close: t$
|
|
2104
|
-
if (r$2) for (; ~(l$1 = s$2.indexOf(t$
|
|
2100
|
+
let { open: e$3, close: t$2 } = c$2, r$2 = t$2.length, n$2 = i$1, o$2 = 0;
|
|
2101
|
+
if (r$2) for (; ~(l$1 = s$2.indexOf(t$2, o$2)); o$2 = l$1 + r$2) n$2 += s$2.slice(o$2, l$1) + e$3;
|
|
2105
2102
|
s$2 = n$2 + s$2.slice(o$2);
|
|
2106
2103
|
}
|
|
2107
2104
|
return a$2 + (s$2.includes("\n") ? s$2.replace(/(\r?\n)/g, p$1 + "$1" + a$2) : s$2) + p$1;
|
|
2108
|
-
}, s$1 = t$
|
|
2109
|
-
return e$1 && (s$1 = e$1.o + t$
|
|
2110
|
-
open: t$
|
|
2105
|
+
}, s$1 = t$1, c$1 = n$1;
|
|
2106
|
+
return e$1 && (s$1 = e$1.o + t$1, c$1 = n$1 + e$1.c), l(o$1, r), o$1.p = {
|
|
2107
|
+
open: t$1,
|
|
2111
2108
|
close: n$1,
|
|
2112
2109
|
o: s$1,
|
|
2113
2110
|
c: c$1,
|
|
@@ -2115,27 +2112,27 @@ var require_ansis = __commonJS({ "../../node_modules/.pnpm/ansis@4.1.0/node_modu
|
|
|
2115
2112
|
}, o$1.open = s$1, o$1.close = c$1, o$1;
|
|
2116
2113
|
};
|
|
2117
2114
|
const w = function(e$1 = g) {
|
|
2118
|
-
let t$
|
|
2115
|
+
let t$1 = {
|
|
2119
2116
|
Ansis: w,
|
|
2120
2117
|
level: e$1,
|
|
2121
2118
|
isSupported: () => s$1,
|
|
2122
2119
|
strip: (e$2) => e$2.replace(/[][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, i$1),
|
|
2123
2120
|
extend(e$2) {
|
|
2124
|
-
for (let t$
|
|
2125
|
-
let r$1 = e$2[t$
|
|
2126
|
-
O[t$
|
|
2121
|
+
for (let t$2 in e$2) {
|
|
2122
|
+
let r$1 = e$2[t$2], l$1 = (typeof r$1)[0], o$1 = "s" === l$1 ? x(...p(r$1)) : r$1;
|
|
2123
|
+
O[t$2] = "f" === l$1 ? { get() {
|
|
2127
2124
|
return (...e$3) => m(this, r$1(...e$3));
|
|
2128
2125
|
} } : { get() {
|
|
2129
2126
|
let e$3 = m(this, o$1);
|
|
2130
|
-
return n(this, t$
|
|
2127
|
+
return n(this, t$2, { value: e$3 }), e$3;
|
|
2131
2128
|
} };
|
|
2132
2129
|
}
|
|
2133
|
-
return r = o({}, O), l(t$
|
|
2130
|
+
return r = o({}, O), l(t$1, r), t$1;
|
|
2134
2131
|
}
|
|
2135
|
-
}, s$1 = e$1 > 0, c$1 = (e$2, t$
|
|
2132
|
+
}, s$1 = e$1 > 0, c$1 = (e$2, t$2) => s$1 ? {
|
|
2136
2133
|
open: `[${e$2}m`,
|
|
2137
|
-
close: `[${t$
|
|
2138
|
-
} : f, a$2 = (e$2) => (t$
|
|
2134
|
+
close: `[${t$2}m`
|
|
2135
|
+
} : f, a$2 = (e$2) => (t$2) => e$2(...p(t$2)), y$1 = (e$2, t$2) => (r$1, n$1, l$1) => c$1(`${e$2}8;2;${r$1};${n$1};${l$1}`, t$2), R = (e$2, t$2) => (r$1, n$1, l$1) => c$1(((e$3, t$3, r$2) => d$1(u$2(e$3, t$3, r$2)))(r$1, n$1, l$1) + e$2, t$2), $ = (e$2) => (t$2, r$1, n$1) => e$2(u$2(t$2, r$1, n$1)), x = y$1(3, h), T = y$1(4, b), v = (e$2) => c$1("38;5;" + e$2, h), C = (e$2) => c$1("48;5;" + e$2, b);
|
|
2139
2136
|
2 === e$1 ? (x = $(v), T = $(C)) : 1 === e$1 && (x = R(0, h), T = R(10, b), v = (e$2) => c$1(d$1(e$2), h), C = (e$2) => c$1(d$1(e$2) + 10, b));
|
|
2140
2137
|
let E, M = {
|
|
2141
2138
|
fg: v,
|
|
@@ -2154,9 +2151,9 @@ var require_ansis = __commonJS({ "../../node_modules/.pnpm/ansis@4.1.0/node_modu
|
|
|
2154
2151
|
hidden: c$1(8, 28),
|
|
2155
2152
|
strikethrough: c$1(9, 29)
|
|
2156
2153
|
}, I = "Bright";
|
|
2157
|
-
return "black,red,green,yellow,blue,magenta,cyan,white,gray".split(",").map((e$2, t$
|
|
2158
|
-
E = "bg" + e$2[0].toUpperCase() + e$2.slice(1), 8 > t$
|
|
2159
|
-
}), t$
|
|
2154
|
+
return "black,red,green,yellow,blue,magenta,cyan,white,gray".split(",").map((e$2, t$2) => {
|
|
2155
|
+
E = "bg" + e$2[0].toUpperCase() + e$2.slice(1), 8 > t$2 ? (M[e$2 + I] = c$1(90 + t$2, h), M[E + I] = c$1(100 + t$2, b)) : t$2 = 60, M[e$2] = c$1(30 + t$2, h), M[E] = c$1(40 + t$2, b);
|
|
2156
|
+
}), t$1.extend(M);
|
|
2160
2157
|
}, y = new w();
|
|
2161
2158
|
module.exports = y, y.default = y;
|
|
2162
2159
|
} });
|
|
@@ -2560,41 +2557,9 @@ function validateOption(key, options) {
|
|
|
2560
2557
|
}
|
|
2561
2558
|
}
|
|
2562
2559
|
|
|
2563
|
-
//#endregion
|
|
2564
|
-
//#region src/constants/plugin-context.ts
|
|
2565
|
-
/**
|
|
2566
|
-
* If Composed plugins call `this.resolve` with `skipSelf: true`, the composed plugins will be skipped as a whole.
|
|
2567
|
-
* To prevent that, we use this symbol to store the actual caller of `this.resolve` with `skipSelf: true`. And we
|
|
2568
|
-
* will modify the skipSelf option to `false` and use this symbol to skip the caller itself in the composed plugins
|
|
2569
|
-
* internally.
|
|
2570
|
-
*/
|
|
2571
|
-
const SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF = Symbol("plugin-context-resolve-caller");
|
|
2572
|
-
|
|
2573
|
-
//#endregion
|
|
2574
|
-
//#region src/options/normalized-input-options.ts
|
|
2575
|
-
var NormalizedInputOptionsImpl = class {
|
|
2576
|
-
inner;
|
|
2577
|
-
constructor(inner, onLog) {
|
|
2578
|
-
this.onLog = onLog;
|
|
2579
|
-
this.inner = inner;
|
|
2580
|
-
}
|
|
2581
|
-
get shimMissingExports() {
|
|
2582
|
-
return this.inner.shimMissingExports;
|
|
2583
|
-
}
|
|
2584
|
-
get input() {
|
|
2585
|
-
return this.inner.input;
|
|
2586
|
-
}
|
|
2587
|
-
get cwd() {
|
|
2588
|
-
return this.inner.cwd ?? void 0;
|
|
2589
|
-
}
|
|
2590
|
-
get platform() {
|
|
2591
|
-
return this.inner.platform;
|
|
2592
|
-
}
|
|
2593
|
-
};
|
|
2594
|
-
|
|
2595
2560
|
//#endregion
|
|
2596
2561
|
//#region src/types/sourcemap.ts
|
|
2597
|
-
function bindingifySourcemap(map) {
|
|
2562
|
+
function bindingifySourcemap$1(map) {
|
|
2598
2563
|
if (map == null) return;
|
|
2599
2564
|
return { inner: typeof map === "string" ? map : {
|
|
2600
2565
|
file: map.file ?? void 0,
|
|
@@ -2794,8 +2759,8 @@ function exclude(expr) {
|
|
|
2794
2759
|
//#endregion
|
|
2795
2760
|
//#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-D6FCK2GA.js
|
|
2796
2761
|
function u$1(o$1, n$1, a$2) {
|
|
2797
|
-
let t$
|
|
2798
|
-
return a$2 === void 0 ? t$
|
|
2762
|
+
let t$1 = (r$1) => o$1(r$1, ...n$1);
|
|
2763
|
+
return a$2 === void 0 ? t$1 : Object.assign(t$1, {
|
|
2799
2764
|
lazy: a$2,
|
|
2800
2765
|
lazyArgs: n$1
|
|
2801
2766
|
});
|
|
@@ -2815,18 +2780,12 @@ function u(r$1, n$1, o$1) {
|
|
|
2815
2780
|
function d(...r$1) {
|
|
2816
2781
|
return u(i, r$1);
|
|
2817
2782
|
}
|
|
2818
|
-
var i = (r$1, t$
|
|
2783
|
+
var i = (r$1, t$1) => {
|
|
2819
2784
|
let a$2 = [[], []];
|
|
2820
|
-
for (let [o$1, e$1] of r$1.entries()) t$
|
|
2785
|
+
for (let [o$1, e$1] of r$1.entries()) t$1(e$1, o$1, r$1) ? a$2[0].push(e$1) : a$2[1].push(e$1);
|
|
2821
2786
|
return a$2;
|
|
2822
2787
|
};
|
|
2823
2788
|
|
|
2824
|
-
//#endregion
|
|
2825
|
-
//#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-5NQBDF4H.js
|
|
2826
|
-
function t(...n$1) {
|
|
2827
|
-
return u(Object.keys, n$1);
|
|
2828
|
-
}
|
|
2829
|
-
|
|
2830
2789
|
//#endregion
|
|
2831
2790
|
//#region src/plugin/bindingify-hook-filter.ts
|
|
2832
2791
|
function generalHookFilterMatcherToFilterExprs(matcher, stringKind) {
|
|
@@ -3202,7 +3161,7 @@ function bindingifyBuildStart(args$1) {
|
|
|
3202
3161
|
const { handler, meta } = normalizeHook(hook);
|
|
3203
3162
|
return {
|
|
3204
3163
|
plugin: async (ctx, opts) => {
|
|
3205
|
-
await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode),
|
|
3164
|
+
await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), args$1.pluginContextData.getInputOptions(opts));
|
|
3206
3165
|
},
|
|
3207
3166
|
meta: bindingifyPluginHookMeta(meta)
|
|
3208
3167
|
};
|
|
@@ -3225,12 +3184,10 @@ function bindingifyResolveId(args$1) {
|
|
|
3225
3184
|
return {
|
|
3226
3185
|
plugin: async (ctx, specifier, importer, extraOptions) => {
|
|
3227
3186
|
const contextResolveOptions = extraOptions.custom != null ? args$1.pluginContextData.getSavedResolveOptions(extraOptions.custom) : void 0;
|
|
3228
|
-
const
|
|
3187
|
+
const ret = await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), specifier, importer ?? void 0, {
|
|
3229
3188
|
...extraOptions,
|
|
3230
|
-
custom: contextResolveOptions?.custom
|
|
3231
|
-
|
|
3232
|
-
};
|
|
3233
|
-
const ret = await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), specifier, importer ?? void 0, newExtraOptions);
|
|
3189
|
+
custom: contextResolveOptions?.custom
|
|
3190
|
+
});
|
|
3234
3191
|
if (ret == null) return;
|
|
3235
3192
|
if (ret === false) return {
|
|
3236
3193
|
id: specifier,
|
|
@@ -3301,7 +3258,7 @@ function bindingifyTransform(args$1) {
|
|
|
3301
3258
|
});
|
|
3302
3259
|
return {
|
|
3303
3260
|
code: ret.code,
|
|
3304
|
-
map: bindingifySourcemap(normalizeTransformHookSourcemap(id$1, code$1, ret.map)),
|
|
3261
|
+
map: bindingifySourcemap$1(normalizeTransformHookSourcemap(id$1, code$1, ret.map)),
|
|
3305
3262
|
sideEffects: bindingifySideEffects(moduleOption.moduleSideEffects),
|
|
3306
3263
|
moduleType: ret.moduleType
|
|
3307
3264
|
};
|
|
@@ -3327,7 +3284,7 @@ function bindingifyLoad(args$1) {
|
|
|
3327
3284
|
let map = preProcessSourceMap(ret, id$1);
|
|
3328
3285
|
return {
|
|
3329
3286
|
code: ret.code,
|
|
3330
|
-
map: bindingifySourcemap(map),
|
|
3287
|
+
map: bindingifySourcemap$1(map),
|
|
3331
3288
|
moduleType: ret.moduleType,
|
|
3332
3289
|
sideEffects: bindingifySideEffects(moduleOption.moduleSideEffects)
|
|
3333
3290
|
};
|
|
@@ -3358,25 +3315,6 @@ function bindingifyModuleParsed(args$1) {
|
|
|
3358
3315
|
};
|
|
3359
3316
|
}
|
|
3360
3317
|
|
|
3361
|
-
//#endregion
|
|
3362
|
-
//#region src/types/chunking-context.ts
|
|
3363
|
-
var ChunkingContext = class {
|
|
3364
|
-
constructor(context) {
|
|
3365
|
-
this.context = context;
|
|
3366
|
-
}
|
|
3367
|
-
getModuleInfo(moduleId) {
|
|
3368
|
-
const bindingInfo = this.context.getModuleInfo(moduleId);
|
|
3369
|
-
if (bindingInfo) {
|
|
3370
|
-
const info = transformModuleInfo(bindingInfo, {
|
|
3371
|
-
moduleSideEffects: null,
|
|
3372
|
-
meta: {}
|
|
3373
|
-
});
|
|
3374
|
-
return info;
|
|
3375
|
-
}
|
|
3376
|
-
return null;
|
|
3377
|
-
}
|
|
3378
|
-
};
|
|
3379
|
-
|
|
3380
3318
|
//#endregion
|
|
3381
3319
|
//#region src/utils/transform-rendered-module.ts
|
|
3382
3320
|
function transformToRenderedModule(bindingRenderedModule) {
|
|
@@ -3443,338 +3381,125 @@ function transformChunkModules(modules) {
|
|
|
3443
3381
|
}
|
|
3444
3382
|
|
|
3445
3383
|
//#endregion
|
|
3446
|
-
//#region src/utils/
|
|
3447
|
-
function
|
|
3448
|
-
const
|
|
3449
|
-
const
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
sourcemapDebugIds,
|
|
3458
|
-
sourcemapIgnoreList: bindingifySourcemapIgnoreList(sourcemapIgnoreList),
|
|
3459
|
-
sourcemapPathTransform,
|
|
3460
|
-
banner: bindingifyAddon(banner),
|
|
3461
|
-
footer: bindingifyAddon(footer),
|
|
3462
|
-
intro: bindingifyAddon(intro),
|
|
3463
|
-
outro: bindingifyAddon(outro),
|
|
3464
|
-
extend: outputOptions.extend,
|
|
3465
|
-
globals,
|
|
3466
|
-
esModule,
|
|
3467
|
-
name,
|
|
3468
|
-
assetFileNames: bindingifyAssetFilenames(assetFileNames),
|
|
3469
|
-
entryFileNames,
|
|
3470
|
-
chunkFileNames,
|
|
3471
|
-
cssEntryFileNames,
|
|
3472
|
-
cssChunkFileNames,
|
|
3473
|
-
plugins: [],
|
|
3474
|
-
minify: outputOptions.minify,
|
|
3475
|
-
externalLiveBindings: outputOptions.externalLiveBindings,
|
|
3476
|
-
inlineDynamicImports: outputOptions.inlineDynamicImports,
|
|
3477
|
-
advancedChunks,
|
|
3478
|
-
polyfillRequire: outputOptions.polyfillRequire,
|
|
3479
|
-
sanitizeFileName,
|
|
3480
|
-
preserveModules,
|
|
3481
|
-
virtualDirname,
|
|
3482
|
-
legalComments,
|
|
3483
|
-
preserveModulesRoot
|
|
3384
|
+
//#region src/utils/transform-to-rollup-output.ts
|
|
3385
|
+
function transformToRollupSourceMap(map) {
|
|
3386
|
+
const parsed = JSON.parse(map);
|
|
3387
|
+
const obj = {
|
|
3388
|
+
...parsed,
|
|
3389
|
+
toString() {
|
|
3390
|
+
return JSON.stringify(obj);
|
|
3391
|
+
},
|
|
3392
|
+
toUrl() {
|
|
3393
|
+
return `data:application/json;charset=utf-8;base64,${Buffer.from(obj.toString(), "utf-8").toString("base64")}`;
|
|
3394
|
+
}
|
|
3484
3395
|
};
|
|
3396
|
+
return obj;
|
|
3485
3397
|
}
|
|
3486
|
-
function
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3398
|
+
function transformToRollupOutputChunk(bindingChunk, changed) {
|
|
3399
|
+
const chunk = {
|
|
3400
|
+
type: "chunk",
|
|
3401
|
+
get code() {
|
|
3402
|
+
return bindingChunk.code;
|
|
3403
|
+
},
|
|
3404
|
+
fileName: bindingChunk.fileName,
|
|
3405
|
+
name: bindingChunk.name,
|
|
3406
|
+
get modules() {
|
|
3407
|
+
return transformChunkModules(bindingChunk.modules);
|
|
3408
|
+
},
|
|
3409
|
+
get imports() {
|
|
3410
|
+
return bindingChunk.imports;
|
|
3411
|
+
},
|
|
3412
|
+
get dynamicImports() {
|
|
3413
|
+
return bindingChunk.dynamicImports;
|
|
3414
|
+
},
|
|
3415
|
+
exports: bindingChunk.exports,
|
|
3416
|
+
isEntry: bindingChunk.isEntry,
|
|
3417
|
+
facadeModuleId: bindingChunk.facadeModuleId || null,
|
|
3418
|
+
isDynamicEntry: bindingChunk.isDynamicEntry,
|
|
3419
|
+
get moduleIds() {
|
|
3420
|
+
return bindingChunk.moduleIds;
|
|
3421
|
+
},
|
|
3422
|
+
get map() {
|
|
3423
|
+
return bindingChunk.map ? transformToRollupSourceMap(bindingChunk.map) : null;
|
|
3424
|
+
},
|
|
3425
|
+
sourcemapFileName: bindingChunk.sourcemapFileName || null,
|
|
3426
|
+
preliminaryFileName: bindingChunk.preliminaryFileName
|
|
3490
3427
|
};
|
|
3428
|
+
const cache = {};
|
|
3429
|
+
return new Proxy(chunk, {
|
|
3430
|
+
get(target, p$1) {
|
|
3431
|
+
if (p$1 in cache) return cache[p$1];
|
|
3432
|
+
const value = target[p$1];
|
|
3433
|
+
cache[p$1] = value;
|
|
3434
|
+
return value;
|
|
3435
|
+
},
|
|
3436
|
+
set(target, p$1, newValue) {
|
|
3437
|
+
cache[p$1] = newValue;
|
|
3438
|
+
changed?.updated.add(bindingChunk.fileName);
|
|
3439
|
+
return true;
|
|
3440
|
+
},
|
|
3441
|
+
has(target, p$1) {
|
|
3442
|
+
if (p$1 in cache) return true;
|
|
3443
|
+
return p$1 in target;
|
|
3444
|
+
}
|
|
3445
|
+
});
|
|
3491
3446
|
}
|
|
3492
|
-
function
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
}
|
|
3504
|
-
}
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3447
|
+
function transformToRollupOutputAsset(bindingAsset, changed) {
|
|
3448
|
+
const asset = {
|
|
3449
|
+
type: "asset",
|
|
3450
|
+
fileName: bindingAsset.fileName,
|
|
3451
|
+
originalFileName: bindingAsset.originalFileName || null,
|
|
3452
|
+
originalFileNames: bindingAsset.originalFileNames,
|
|
3453
|
+
get source() {
|
|
3454
|
+
return transformAssetSource(bindingAsset.source);
|
|
3455
|
+
},
|
|
3456
|
+
name: bindingAsset.name ?? void 0,
|
|
3457
|
+
names: bindingAsset.names
|
|
3458
|
+
};
|
|
3459
|
+
const cache = {};
|
|
3460
|
+
return new Proxy(asset, {
|
|
3461
|
+
get(target, p$1) {
|
|
3462
|
+
if (p$1 in cache) return cache[p$1];
|
|
3463
|
+
const value = target[p$1];
|
|
3464
|
+
cache[p$1] = value;
|
|
3465
|
+
return value;
|
|
3466
|
+
},
|
|
3467
|
+
set(target, p$1, newValue) {
|
|
3468
|
+
cache[p$1] = newValue;
|
|
3469
|
+
changed?.updated.add(bindingAsset.fileName);
|
|
3470
|
+
return true;
|
|
3471
|
+
}
|
|
3472
|
+
});
|
|
3514
3473
|
}
|
|
3515
|
-
function
|
|
3516
|
-
|
|
3474
|
+
function transformToRollupOutput(output, changed) {
|
|
3475
|
+
handleOutputErrors(output);
|
|
3476
|
+
const { chunks, assets } = output;
|
|
3477
|
+
return { output: [...chunks.map((chunk) => transformToRollupOutputChunk(chunk, changed)), ...assets.map((asset) => transformToRollupOutputAsset(asset, changed))] };
|
|
3517
3478
|
}
|
|
3518
|
-
function
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
names: asset.names,
|
|
3522
|
-
originalFileNames: asset.originalFileNames,
|
|
3523
|
-
source: transformAssetSource(asset.source),
|
|
3524
|
-
type: "asset"
|
|
3525
|
-
});
|
|
3526
|
-
};
|
|
3527
|
-
return assetFileNames;
|
|
3479
|
+
function handleOutputErrors(output) {
|
|
3480
|
+
const rawErrors = output.errors;
|
|
3481
|
+
if (rawErrors.length > 0) throw normalizeErrors(rawErrors);
|
|
3528
3482
|
}
|
|
3529
|
-
function
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
//#region src/options/normalized-output-options.ts
|
|
3550
|
-
var NormalizedOutputOptionsImpl = class {
|
|
3551
|
-
constructor(inner, outputOptions, normalizedOutputPlugins) {
|
|
3552
|
-
this.inner = inner;
|
|
3553
|
-
this.outputOptions = outputOptions;
|
|
3554
|
-
this.normalizedOutputPlugins = normalizedOutputPlugins;
|
|
3555
|
-
}
|
|
3556
|
-
get dir() {
|
|
3557
|
-
return this.inner.dir ?? void 0;
|
|
3558
|
-
}
|
|
3559
|
-
get entryFileNames() {
|
|
3560
|
-
return this.inner.entryFilenames || this.outputOptions.entryFileNames;
|
|
3561
|
-
}
|
|
3562
|
-
get chunkFileNames() {
|
|
3563
|
-
return this.inner.chunkFilenames || this.outputOptions.chunkFileNames;
|
|
3564
|
-
}
|
|
3565
|
-
get assetFileNames() {
|
|
3566
|
-
return this.inner.assetFilenames || this.outputOptions.assetFileNames;
|
|
3567
|
-
}
|
|
3568
|
-
get format() {
|
|
3569
|
-
return this.inner.format;
|
|
3570
|
-
}
|
|
3571
|
-
get exports() {
|
|
3572
|
-
return this.inner.exports;
|
|
3573
|
-
}
|
|
3574
|
-
get sourcemap() {
|
|
3575
|
-
return this.inner.sourcemap;
|
|
3576
|
-
}
|
|
3577
|
-
get cssEntryFileNames() {
|
|
3578
|
-
return this.inner.cssEntryFilenames || this.outputOptions.cssEntryFileNames;
|
|
3579
|
-
}
|
|
3580
|
-
get cssChunkFileNames() {
|
|
3581
|
-
return this.inner.cssChunkFilenames || this.outputOptions.cssChunkFileNames;
|
|
3582
|
-
}
|
|
3583
|
-
get shimMissingExports() {
|
|
3584
|
-
return this.inner.shimMissingExports;
|
|
3585
|
-
}
|
|
3586
|
-
get name() {
|
|
3587
|
-
return this.inner.name ?? void 0;
|
|
3588
|
-
}
|
|
3589
|
-
get file() {
|
|
3590
|
-
return this.inner.file ?? void 0;
|
|
3591
|
-
}
|
|
3592
|
-
get inlineDynamicImports() {
|
|
3593
|
-
return this.inner.inlineDynamicImports;
|
|
3594
|
-
}
|
|
3595
|
-
get externalLiveBindings() {
|
|
3596
|
-
return this.inner.externalLiveBindings;
|
|
3597
|
-
}
|
|
3598
|
-
get banner() {
|
|
3599
|
-
return normalizeAddon(this.outputOptions.banner);
|
|
3600
|
-
}
|
|
3601
|
-
get footer() {
|
|
3602
|
-
return normalizeAddon(this.outputOptions.footer);
|
|
3603
|
-
}
|
|
3604
|
-
get intro() {
|
|
3605
|
-
return normalizeAddon(this.outputOptions.intro);
|
|
3606
|
-
}
|
|
3607
|
-
get outro() {
|
|
3608
|
-
return normalizeAddon(this.outputOptions.outro);
|
|
3609
|
-
}
|
|
3610
|
-
get esModule() {
|
|
3611
|
-
return this.inner.esModule;
|
|
3612
|
-
}
|
|
3613
|
-
get extend() {
|
|
3614
|
-
return this.inner.extend;
|
|
3615
|
-
}
|
|
3616
|
-
get globals() {
|
|
3617
|
-
return this.inner.globals || this.outputOptions.globals;
|
|
3618
|
-
}
|
|
3619
|
-
get hashCharacters() {
|
|
3620
|
-
return this.inner.hashCharacters;
|
|
3621
|
-
}
|
|
3622
|
-
get sourcemapDebugIds() {
|
|
3623
|
-
return this.inner.sourcemapDebugIds;
|
|
3624
|
-
}
|
|
3625
|
-
get sourcemapIgnoreList() {
|
|
3626
|
-
return bindingifySourcemapIgnoreList(this.outputOptions.sourcemapIgnoreList);
|
|
3627
|
-
}
|
|
3628
|
-
get sourcemapPathTransform() {
|
|
3629
|
-
return this.outputOptions.sourcemapPathTransform;
|
|
3630
|
-
}
|
|
3631
|
-
get minify() {
|
|
3632
|
-
return this.inner.minify;
|
|
3633
|
-
}
|
|
3634
|
-
get legalComments() {
|
|
3635
|
-
return this.inner.legalComments;
|
|
3636
|
-
}
|
|
3637
|
-
get polyfillRequire() {
|
|
3638
|
-
return this.inner.polyfillRequire;
|
|
3639
|
-
}
|
|
3640
|
-
get plugins() {
|
|
3641
|
-
return this.normalizedOutputPlugins;
|
|
3642
|
-
}
|
|
3643
|
-
get preserveModules() {
|
|
3644
|
-
return this.inner.preserveModules;
|
|
3645
|
-
}
|
|
3646
|
-
get preserveModulesRoot() {
|
|
3647
|
-
return this.inner.preserveModulesRoot;
|
|
3648
|
-
}
|
|
3649
|
-
get virtualDirname() {
|
|
3650
|
-
return this.inner.virtualDirname;
|
|
3651
|
-
}
|
|
3652
|
-
};
|
|
3653
|
-
function normalizeAddon(value) {
|
|
3654
|
-
if (typeof value === "function") return value;
|
|
3655
|
-
return () => value || "";
|
|
3656
|
-
}
|
|
3657
|
-
|
|
3658
|
-
//#endregion
|
|
3659
|
-
//#region src/utils/transform-to-rollup-output.ts
|
|
3660
|
-
function transformToRollupSourceMap(map) {
|
|
3661
|
-
const parsed = JSON.parse(map);
|
|
3662
|
-
const obj = {
|
|
3663
|
-
...parsed,
|
|
3664
|
-
toString() {
|
|
3665
|
-
return JSON.stringify(obj);
|
|
3666
|
-
},
|
|
3667
|
-
toUrl() {
|
|
3668
|
-
return `data:application/json;charset=utf-8;base64,${Buffer.from(obj.toString(), "utf-8").toString("base64")}`;
|
|
3669
|
-
}
|
|
3670
|
-
};
|
|
3671
|
-
return obj;
|
|
3672
|
-
}
|
|
3673
|
-
function transformToRollupOutputChunk(bindingChunk, changed) {
|
|
3674
|
-
const chunk = {
|
|
3675
|
-
type: "chunk",
|
|
3676
|
-
get code() {
|
|
3677
|
-
return bindingChunk.code;
|
|
3678
|
-
},
|
|
3679
|
-
fileName: bindingChunk.fileName,
|
|
3680
|
-
name: bindingChunk.name,
|
|
3681
|
-
get modules() {
|
|
3682
|
-
return transformChunkModules(bindingChunk.modules);
|
|
3683
|
-
},
|
|
3684
|
-
get imports() {
|
|
3685
|
-
return bindingChunk.imports;
|
|
3686
|
-
},
|
|
3687
|
-
get dynamicImports() {
|
|
3688
|
-
return bindingChunk.dynamicImports;
|
|
3689
|
-
},
|
|
3690
|
-
exports: bindingChunk.exports,
|
|
3691
|
-
isEntry: bindingChunk.isEntry,
|
|
3692
|
-
facadeModuleId: bindingChunk.facadeModuleId || null,
|
|
3693
|
-
isDynamicEntry: bindingChunk.isDynamicEntry,
|
|
3694
|
-
get moduleIds() {
|
|
3695
|
-
return bindingChunk.moduleIds;
|
|
3696
|
-
},
|
|
3697
|
-
get map() {
|
|
3698
|
-
return bindingChunk.map ? transformToRollupSourceMap(bindingChunk.map) : null;
|
|
3699
|
-
},
|
|
3700
|
-
sourcemapFileName: bindingChunk.sourcemapFileName || null,
|
|
3701
|
-
preliminaryFileName: bindingChunk.preliminaryFileName
|
|
3702
|
-
};
|
|
3703
|
-
const cache = {};
|
|
3704
|
-
return new Proxy(chunk, {
|
|
3705
|
-
get(target, p$1) {
|
|
3706
|
-
if (p$1 in cache) return cache[p$1];
|
|
3707
|
-
const value = target[p$1];
|
|
3708
|
-
cache[p$1] = value;
|
|
3709
|
-
return value;
|
|
3710
|
-
},
|
|
3711
|
-
set(target, p$1, newValue) {
|
|
3712
|
-
cache[p$1] = newValue;
|
|
3713
|
-
changed?.updated.add(bindingChunk.fileName);
|
|
3714
|
-
return true;
|
|
3715
|
-
},
|
|
3716
|
-
has(target, p$1) {
|
|
3717
|
-
if (p$1 in cache) return true;
|
|
3718
|
-
return p$1 in target;
|
|
3719
|
-
}
|
|
3720
|
-
});
|
|
3721
|
-
}
|
|
3722
|
-
function transformToRollupOutputAsset(bindingAsset, changed) {
|
|
3723
|
-
const asset = {
|
|
3724
|
-
type: "asset",
|
|
3725
|
-
fileName: bindingAsset.fileName,
|
|
3726
|
-
originalFileName: bindingAsset.originalFileName || null,
|
|
3727
|
-
originalFileNames: bindingAsset.originalFileNames,
|
|
3728
|
-
get source() {
|
|
3729
|
-
return transformAssetSource(bindingAsset.source);
|
|
3730
|
-
},
|
|
3731
|
-
name: bindingAsset.name ?? void 0,
|
|
3732
|
-
names: bindingAsset.names
|
|
3733
|
-
};
|
|
3734
|
-
const cache = {};
|
|
3735
|
-
return new Proxy(asset, {
|
|
3736
|
-
get(target, p$1) {
|
|
3737
|
-
if (p$1 in cache) return cache[p$1];
|
|
3738
|
-
const value = target[p$1];
|
|
3739
|
-
cache[p$1] = value;
|
|
3740
|
-
return value;
|
|
3741
|
-
},
|
|
3742
|
-
set(target, p$1, newValue) {
|
|
3743
|
-
cache[p$1] = newValue;
|
|
3744
|
-
changed?.updated.add(bindingAsset.fileName);
|
|
3745
|
-
return true;
|
|
3746
|
-
}
|
|
3747
|
-
});
|
|
3748
|
-
}
|
|
3749
|
-
function transformToRollupOutput(output, changed) {
|
|
3750
|
-
handleOutputErrors(output);
|
|
3751
|
-
const { chunks, assets } = output;
|
|
3752
|
-
return { output: [...chunks.map((chunk) => transformToRollupOutputChunk(chunk, changed)), ...assets.map((asset) => transformToRollupOutputAsset(asset, changed))] };
|
|
3753
|
-
}
|
|
3754
|
-
function handleOutputErrors(output) {
|
|
3755
|
-
const rawErrors = output.errors;
|
|
3756
|
-
if (rawErrors.length > 0) throw normalizeErrors(rawErrors);
|
|
3757
|
-
}
|
|
3758
|
-
function transformToOutputBundle(context, output, changed) {
|
|
3759
|
-
const bundle = Object.fromEntries(transformToRollupOutput(output, changed).output.map((item) => [item.fileName, item]));
|
|
3760
|
-
return new Proxy(bundle, {
|
|
3761
|
-
set(_target, _p, _newValue, _receiver) {
|
|
3762
|
-
const originalStackTraceLimit = Error.stackTraceLimit;
|
|
3763
|
-
Error.stackTraceLimit = 2;
|
|
3764
|
-
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.";
|
|
3765
|
-
const stack = new Error(message).stack ?? message;
|
|
3766
|
-
Error.stackTraceLimit = originalStackTraceLimit;
|
|
3767
|
-
context.warn({
|
|
3768
|
-
message: stack,
|
|
3769
|
-
code: "UNSUPPORTED_BUNDLE_ASSIGNMENT"
|
|
3770
|
-
});
|
|
3771
|
-
return true;
|
|
3772
|
-
},
|
|
3773
|
-
deleteProperty(target, property) {
|
|
3774
|
-
if (typeof property === "string") changed.deleted.add(property);
|
|
3775
|
-
return true;
|
|
3776
|
-
}
|
|
3777
|
-
});
|
|
3483
|
+
function transformToOutputBundle(context, output, changed) {
|
|
3484
|
+
const bundle = Object.fromEntries(transformToRollupOutput(output, changed).output.map((item) => [item.fileName, item]));
|
|
3485
|
+
return new Proxy(bundle, {
|
|
3486
|
+
set(_target, _p, _newValue, _receiver) {
|
|
3487
|
+
const originalStackTraceLimit = Error.stackTraceLimit;
|
|
3488
|
+
Error.stackTraceLimit = 2;
|
|
3489
|
+
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.";
|
|
3490
|
+
const stack = new Error(message).stack ?? message;
|
|
3491
|
+
Error.stackTraceLimit = originalStackTraceLimit;
|
|
3492
|
+
context.warn({
|
|
3493
|
+
message: stack,
|
|
3494
|
+
code: "UNSUPPORTED_BUNDLE_ASSIGNMENT"
|
|
3495
|
+
});
|
|
3496
|
+
return true;
|
|
3497
|
+
},
|
|
3498
|
+
deleteProperty(target, property) {
|
|
3499
|
+
if (typeof property === "string") changed.deleted.add(property);
|
|
3500
|
+
return true;
|
|
3501
|
+
}
|
|
3502
|
+
});
|
|
3778
3503
|
}
|
|
3779
3504
|
function collectChangedBundle(changed, bundle) {
|
|
3780
3505
|
const assets = [];
|
|
@@ -3800,7 +3525,7 @@ function collectChangedBundle(changed, bundle) {
|
|
|
3800
3525
|
facadeModuleId: item.facadeModuleId || void 0,
|
|
3801
3526
|
isDynamicEntry: item.isDynamicEntry,
|
|
3802
3527
|
moduleIds: item.moduleIds,
|
|
3803
|
-
map: bindingifySourcemap(item.map),
|
|
3528
|
+
map: bindingifySourcemap$1(item.map),
|
|
3804
3529
|
sourcemapFilename: item.sourcemapFileName || void 0,
|
|
3805
3530
|
preliminaryFilename: item.preliminaryFileName
|
|
3806
3531
|
});
|
|
@@ -3820,7 +3545,7 @@ function bindingifyRenderStart(args$1) {
|
|
|
3820
3545
|
const { handler, meta } = normalizeHook(hook);
|
|
3821
3546
|
return {
|
|
3822
3547
|
plugin: async (ctx, opts) => {
|
|
3823
|
-
handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode),
|
|
3548
|
+
handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), args$1.pluginContextData.getOutputOptions(opts), args$1.pluginContextData.getInputOptions(opts));
|
|
3824
3549
|
},
|
|
3825
3550
|
meta: bindingifyPluginHookMeta(meta)
|
|
3826
3551
|
};
|
|
@@ -3832,13 +3557,13 @@ function bindingifyRenderChunk(args$1) {
|
|
|
3832
3557
|
return {
|
|
3833
3558
|
plugin: async (ctx, code$1, chunk, opts, meta$1) => {
|
|
3834
3559
|
if (args$1.pluginContextData.getRenderChunkMeta() == null) args$1.pluginContextData.setRenderChunkMeta({ chunks: Object.fromEntries(Object.entries(meta$1.chunks).map(([key, value]) => [key, transformRenderedChunk(value)])) });
|
|
3835
|
-
const ret = await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), code$1, transformRenderedChunk(chunk),
|
|
3560
|
+
const ret = await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), code$1, transformRenderedChunk(chunk), args$1.pluginContextData.getOutputOptions(opts), args$1.pluginContextData.getRenderChunkMeta());
|
|
3836
3561
|
if (ret == null) return;
|
|
3837
3562
|
if (typeof ret === "string") return { code: ret };
|
|
3838
3563
|
if (!ret.map) return { code: ret.code };
|
|
3839
3564
|
return {
|
|
3840
3565
|
code: ret.code,
|
|
3841
|
-
map: bindingifySourcemap(ret.map)
|
|
3566
|
+
map: bindingifySourcemap$1(ret.map)
|
|
3842
3567
|
};
|
|
3843
3568
|
},
|
|
3844
3569
|
meta: bindingifyPluginHookMeta(meta),
|
|
@@ -3879,7 +3604,7 @@ function bindingifyGenerateBundle(args$1) {
|
|
|
3879
3604
|
};
|
|
3880
3605
|
const context = new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode);
|
|
3881
3606
|
const output = transformToOutputBundle(context, bundle, changed);
|
|
3882
|
-
await handler.call(context,
|
|
3607
|
+
await handler.call(context, args$1.pluginContextData.getOutputOptions(opts), output, isWrite);
|
|
3883
3608
|
return collectChangedBundle(changed, output);
|
|
3884
3609
|
},
|
|
3885
3610
|
meta: bindingifyPluginHookMeta(meta)
|
|
@@ -3897,7 +3622,7 @@ function bindingifyWriteBundle(args$1) {
|
|
|
3897
3622
|
};
|
|
3898
3623
|
const context = new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode);
|
|
3899
3624
|
const output = transformToOutputBundle(context, bundle, changed);
|
|
3900
|
-
await handler.call(context,
|
|
3625
|
+
await handler.call(context, args$1.pluginContextData.getOutputOptions(opts), output);
|
|
3901
3626
|
return collectChangedBundle(changed, output);
|
|
3902
3627
|
},
|
|
3903
3628
|
meta: bindingifyPluginHookMeta(meta)
|
|
@@ -4172,29 +3897,290 @@ function wrapHandlers(plugin) {
|
|
|
4172
3897
|
}
|
|
4173
3898
|
|
|
4174
3899
|
//#endregion
|
|
4175
|
-
//#region src/
|
|
4176
|
-
var
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
renderedChunkMeta = null;
|
|
4182
|
-
updateModuleOption(id$1, option) {
|
|
4183
|
-
const existing = this.moduleOptionMap.get(id$1);
|
|
4184
|
-
if (existing) {
|
|
4185
|
-
if (option.moduleSideEffects != null) existing.moduleSideEffects = option.moduleSideEffects;
|
|
4186
|
-
if (option.meta != null) Object.assign(existing.meta, option.meta);
|
|
4187
|
-
if (option.invalidate != null) existing.invalidate = option.invalidate;
|
|
4188
|
-
} else {
|
|
4189
|
-
this.moduleOptionMap.set(id$1, option);
|
|
4190
|
-
return option;
|
|
4191
|
-
}
|
|
4192
|
-
return existing;
|
|
3900
|
+
//#region src/options/normalized-input-options.ts
|
|
3901
|
+
var NormalizedInputOptionsImpl = class {
|
|
3902
|
+
inner;
|
|
3903
|
+
constructor(inner, onLog) {
|
|
3904
|
+
this.onLog = onLog;
|
|
3905
|
+
this.inner = inner;
|
|
4193
3906
|
}
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
3907
|
+
get shimMissingExports() {
|
|
3908
|
+
return this.inner.shimMissingExports;
|
|
3909
|
+
}
|
|
3910
|
+
get input() {
|
|
3911
|
+
return this.inner.input;
|
|
3912
|
+
}
|
|
3913
|
+
get cwd() {
|
|
3914
|
+
return this.inner.cwd ?? void 0;
|
|
3915
|
+
}
|
|
3916
|
+
get platform() {
|
|
3917
|
+
return this.inner.platform;
|
|
3918
|
+
}
|
|
3919
|
+
};
|
|
3920
|
+
|
|
3921
|
+
//#endregion
|
|
3922
|
+
//#region src/types/chunking-context.ts
|
|
3923
|
+
var ChunkingContextImpl = class {
|
|
3924
|
+
constructor(context) {
|
|
3925
|
+
this.context = context;
|
|
3926
|
+
}
|
|
3927
|
+
getModuleInfo(moduleId) {
|
|
3928
|
+
const bindingInfo = this.context.getModuleInfo(moduleId);
|
|
3929
|
+
if (bindingInfo) {
|
|
3930
|
+
const info = transformModuleInfo(bindingInfo, {
|
|
3931
|
+
moduleSideEffects: null,
|
|
3932
|
+
meta: {}
|
|
3933
|
+
});
|
|
3934
|
+
return info;
|
|
3935
|
+
}
|
|
3936
|
+
return null;
|
|
3937
|
+
}
|
|
3938
|
+
};
|
|
3939
|
+
|
|
3940
|
+
//#endregion
|
|
3941
|
+
//#region src/utils/bindingify-output-options.ts
|
|
3942
|
+
function bindingifyOutputOptions(outputOptions) {
|
|
3943
|
+
const { dir, format: format$1, exports, hashCharacters, sourcemap, sourcemapDebugIds, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, cssEntryFileNames, cssChunkFileNames, banner, footer, intro, outro, esModule, globals, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, preserveModulesRoot, manualChunks } = outputOptions;
|
|
3944
|
+
const advancedChunks = bindingifyAdvancedChunks(outputOptions.advancedChunks, manualChunks);
|
|
3945
|
+
return {
|
|
3946
|
+
dir,
|
|
3947
|
+
file: file == null ? void 0 : file,
|
|
3948
|
+
format: bindingifyFormat(format$1),
|
|
3949
|
+
exports,
|
|
3950
|
+
hashCharacters,
|
|
3951
|
+
sourcemap: bindingifySourcemap(sourcemap),
|
|
3952
|
+
sourcemapDebugIds,
|
|
3953
|
+
sourcemapIgnoreList: bindingifySourcemapIgnoreList(sourcemapIgnoreList),
|
|
3954
|
+
sourcemapPathTransform,
|
|
3955
|
+
banner: bindingifyAddon(banner),
|
|
3956
|
+
footer: bindingifyAddon(footer),
|
|
3957
|
+
intro: bindingifyAddon(intro),
|
|
3958
|
+
outro: bindingifyAddon(outro),
|
|
3959
|
+
extend: outputOptions.extend,
|
|
3960
|
+
globals,
|
|
3961
|
+
esModule,
|
|
3962
|
+
name,
|
|
3963
|
+
assetFileNames: bindingifyAssetFilenames(assetFileNames),
|
|
3964
|
+
entryFileNames,
|
|
3965
|
+
chunkFileNames,
|
|
3966
|
+
cssEntryFileNames,
|
|
3967
|
+
cssChunkFileNames,
|
|
3968
|
+
plugins: [],
|
|
3969
|
+
minify: outputOptions.minify,
|
|
3970
|
+
externalLiveBindings: outputOptions.externalLiveBindings,
|
|
3971
|
+
inlineDynamicImports: outputOptions.inlineDynamicImports,
|
|
3972
|
+
advancedChunks,
|
|
3973
|
+
polyfillRequire: outputOptions.polyfillRequire,
|
|
3974
|
+
sanitizeFileName,
|
|
3975
|
+
preserveModules,
|
|
3976
|
+
virtualDirname,
|
|
3977
|
+
legalComments,
|
|
3978
|
+
preserveModulesRoot
|
|
3979
|
+
};
|
|
3980
|
+
}
|
|
3981
|
+
function bindingifyAddon(configAddon) {
|
|
3982
|
+
return async (chunk) => {
|
|
3983
|
+
if (typeof configAddon === "function") return configAddon(transformRenderedChunk(chunk));
|
|
3984
|
+
return configAddon || "";
|
|
3985
|
+
};
|
|
3986
|
+
}
|
|
3987
|
+
function bindingifyFormat(format$1) {
|
|
3988
|
+
switch (format$1) {
|
|
3989
|
+
case void 0:
|
|
3990
|
+
case "es":
|
|
3991
|
+
case "esm":
|
|
3992
|
+
case "module": return "es";
|
|
3993
|
+
case "cjs":
|
|
3994
|
+
case "commonjs": return "cjs";
|
|
3995
|
+
case "iife": return "iife";
|
|
3996
|
+
case "umd": return "umd";
|
|
3997
|
+
default: unimplemented(`output.format: ${format$1}`);
|
|
3998
|
+
}
|
|
3999
|
+
}
|
|
4000
|
+
function bindingifySourcemap(sourcemap) {
|
|
4001
|
+
switch (sourcemap) {
|
|
4002
|
+
case true: return "file";
|
|
4003
|
+
case "inline": return "inline";
|
|
4004
|
+
case false:
|
|
4005
|
+
case void 0: return void 0;
|
|
4006
|
+
case "hidden": return "hidden";
|
|
4007
|
+
default: throw new Error(`unknown sourcemap: ${sourcemap}`);
|
|
4008
|
+
}
|
|
4009
|
+
}
|
|
4010
|
+
function bindingifySourcemapIgnoreList(sourcemapIgnoreList) {
|
|
4011
|
+
return typeof sourcemapIgnoreList === "function" ? sourcemapIgnoreList : sourcemapIgnoreList === false ? () => false : (relativeSourcePath, _sourcemapPath) => relativeSourcePath.includes("node_modules");
|
|
4012
|
+
}
|
|
4013
|
+
function bindingifyAssetFilenames(assetFileNames) {
|
|
4014
|
+
if (typeof assetFileNames === "function") return (asset) => {
|
|
4015
|
+
return assetFileNames({
|
|
4016
|
+
names: asset.names,
|
|
4017
|
+
originalFileNames: asset.originalFileNames,
|
|
4018
|
+
source: transformAssetSource(asset.source),
|
|
4019
|
+
type: "asset"
|
|
4020
|
+
});
|
|
4021
|
+
};
|
|
4022
|
+
return assetFileNames;
|
|
4023
|
+
}
|
|
4024
|
+
function bindingifyAdvancedChunks(advancedChunks, manualChunks) {
|
|
4025
|
+
if (manualChunks != null && advancedChunks != null) console.warn("`manualChunks` option is ignored due to `advancedChunks` option is specified.");
|
|
4026
|
+
else if (manualChunks != null) advancedChunks = { groups: [{ name(moduleId, ctx) {
|
|
4027
|
+
return manualChunks(moduleId, { getModuleInfo: (id$1) => ctx.getModuleInfo(id$1) });
|
|
4028
|
+
} }] };
|
|
4029
|
+
if (advancedChunks == null) return void 0;
|
|
4030
|
+
const { groups,...restAdvancedChunks } = advancedChunks;
|
|
4031
|
+
return {
|
|
4032
|
+
...restAdvancedChunks,
|
|
4033
|
+
groups: groups?.map((group) => {
|
|
4034
|
+
const { name,...restGroup } = group;
|
|
4035
|
+
return {
|
|
4036
|
+
...restGroup,
|
|
4037
|
+
name: typeof name === "function" ? (id$1, ctx) => name(id$1, new ChunkingContextImpl(ctx)) : name
|
|
4038
|
+
};
|
|
4039
|
+
})
|
|
4040
|
+
};
|
|
4041
|
+
}
|
|
4042
|
+
|
|
4043
|
+
//#endregion
|
|
4044
|
+
//#region src/options/normalized-output-options.ts
|
|
4045
|
+
var NormalizedOutputOptionsImpl = class {
|
|
4046
|
+
constructor(inner, outputOptions, normalizedOutputPlugins) {
|
|
4047
|
+
this.inner = inner;
|
|
4048
|
+
this.outputOptions = outputOptions;
|
|
4049
|
+
this.normalizedOutputPlugins = normalizedOutputPlugins;
|
|
4050
|
+
}
|
|
4051
|
+
get dir() {
|
|
4052
|
+
return this.inner.dir ?? void 0;
|
|
4053
|
+
}
|
|
4054
|
+
get entryFileNames() {
|
|
4055
|
+
return this.inner.entryFilenames || this.outputOptions.entryFileNames;
|
|
4056
|
+
}
|
|
4057
|
+
get chunkFileNames() {
|
|
4058
|
+
return this.inner.chunkFilenames || this.outputOptions.chunkFileNames;
|
|
4059
|
+
}
|
|
4060
|
+
get assetFileNames() {
|
|
4061
|
+
return this.inner.assetFilenames || this.outputOptions.assetFileNames;
|
|
4062
|
+
}
|
|
4063
|
+
get format() {
|
|
4064
|
+
return this.inner.format;
|
|
4065
|
+
}
|
|
4066
|
+
get exports() {
|
|
4067
|
+
return this.inner.exports;
|
|
4068
|
+
}
|
|
4069
|
+
get sourcemap() {
|
|
4070
|
+
return this.inner.sourcemap;
|
|
4071
|
+
}
|
|
4072
|
+
get cssEntryFileNames() {
|
|
4073
|
+
return this.inner.cssEntryFilenames || this.outputOptions.cssEntryFileNames;
|
|
4074
|
+
}
|
|
4075
|
+
get cssChunkFileNames() {
|
|
4076
|
+
return this.inner.cssChunkFilenames || this.outputOptions.cssChunkFileNames;
|
|
4077
|
+
}
|
|
4078
|
+
get shimMissingExports() {
|
|
4079
|
+
return this.inner.shimMissingExports;
|
|
4080
|
+
}
|
|
4081
|
+
get name() {
|
|
4082
|
+
return this.inner.name ?? void 0;
|
|
4083
|
+
}
|
|
4084
|
+
get file() {
|
|
4085
|
+
return this.inner.file ?? void 0;
|
|
4086
|
+
}
|
|
4087
|
+
get inlineDynamicImports() {
|
|
4088
|
+
return this.inner.inlineDynamicImports;
|
|
4089
|
+
}
|
|
4090
|
+
get externalLiveBindings() {
|
|
4091
|
+
return this.inner.externalLiveBindings;
|
|
4092
|
+
}
|
|
4093
|
+
get banner() {
|
|
4094
|
+
return normalizeAddon(this.outputOptions.banner);
|
|
4095
|
+
}
|
|
4096
|
+
get footer() {
|
|
4097
|
+
return normalizeAddon(this.outputOptions.footer);
|
|
4098
|
+
}
|
|
4099
|
+
get intro() {
|
|
4100
|
+
return normalizeAddon(this.outputOptions.intro);
|
|
4101
|
+
}
|
|
4102
|
+
get outro() {
|
|
4103
|
+
return normalizeAddon(this.outputOptions.outro);
|
|
4104
|
+
}
|
|
4105
|
+
get esModule() {
|
|
4106
|
+
return this.inner.esModule;
|
|
4107
|
+
}
|
|
4108
|
+
get extend() {
|
|
4109
|
+
return this.inner.extend;
|
|
4110
|
+
}
|
|
4111
|
+
get globals() {
|
|
4112
|
+
return this.inner.globals || this.outputOptions.globals;
|
|
4113
|
+
}
|
|
4114
|
+
get hashCharacters() {
|
|
4115
|
+
return this.inner.hashCharacters;
|
|
4116
|
+
}
|
|
4117
|
+
get sourcemapDebugIds() {
|
|
4118
|
+
return this.inner.sourcemapDebugIds;
|
|
4119
|
+
}
|
|
4120
|
+
get sourcemapIgnoreList() {
|
|
4121
|
+
return bindingifySourcemapIgnoreList(this.outputOptions.sourcemapIgnoreList);
|
|
4122
|
+
}
|
|
4123
|
+
get sourcemapPathTransform() {
|
|
4124
|
+
return this.outputOptions.sourcemapPathTransform;
|
|
4125
|
+
}
|
|
4126
|
+
get minify() {
|
|
4127
|
+
return this.inner.minify;
|
|
4128
|
+
}
|
|
4129
|
+
get legalComments() {
|
|
4130
|
+
return this.inner.legalComments;
|
|
4131
|
+
}
|
|
4132
|
+
get polyfillRequire() {
|
|
4133
|
+
return this.inner.polyfillRequire;
|
|
4134
|
+
}
|
|
4135
|
+
get plugins() {
|
|
4136
|
+
return this.normalizedOutputPlugins;
|
|
4137
|
+
}
|
|
4138
|
+
get preserveModules() {
|
|
4139
|
+
return this.inner.preserveModules;
|
|
4140
|
+
}
|
|
4141
|
+
get preserveModulesRoot() {
|
|
4142
|
+
return this.inner.preserveModulesRoot;
|
|
4143
|
+
}
|
|
4144
|
+
get virtualDirname() {
|
|
4145
|
+
return this.inner.virtualDirname;
|
|
4146
|
+
}
|
|
4147
|
+
};
|
|
4148
|
+
function normalizeAddon(value) {
|
|
4149
|
+
if (typeof value === "function") return value;
|
|
4150
|
+
return () => value || "";
|
|
4151
|
+
}
|
|
4152
|
+
|
|
4153
|
+
//#endregion
|
|
4154
|
+
//#region src/plugin/plugin-context-data.ts
|
|
4155
|
+
var PluginContextData = class {
|
|
4156
|
+
moduleOptionMap = /* @__PURE__ */ new Map();
|
|
4157
|
+
resolveOptionsMap = /* @__PURE__ */ new Map();
|
|
4158
|
+
loadModulePromiseMap = /* @__PURE__ */ new Map();
|
|
4159
|
+
loadModulePromiseResolveFnMap = /* @__PURE__ */ new Map();
|
|
4160
|
+
renderedChunkMeta = null;
|
|
4161
|
+
normalizedInputOptions = null;
|
|
4162
|
+
normalizedOutputOptions = null;
|
|
4163
|
+
constructor(onLog, outputOptions, normalizedOutputPlugins) {
|
|
4164
|
+
this.onLog = onLog;
|
|
4165
|
+
this.outputOptions = outputOptions;
|
|
4166
|
+
this.normalizedOutputPlugins = normalizedOutputPlugins;
|
|
4167
|
+
}
|
|
4168
|
+
updateModuleOption(id$1, option) {
|
|
4169
|
+
const existing = this.moduleOptionMap.get(id$1);
|
|
4170
|
+
if (existing) {
|
|
4171
|
+
if (option.moduleSideEffects != null) existing.moduleSideEffects = option.moduleSideEffects;
|
|
4172
|
+
if (option.meta != null) Object.assign(existing.meta, option.meta);
|
|
4173
|
+
if (option.invalidate != null) existing.invalidate = option.invalidate;
|
|
4174
|
+
} else {
|
|
4175
|
+
this.moduleOptionMap.set(id$1, option);
|
|
4176
|
+
return option;
|
|
4177
|
+
}
|
|
4178
|
+
return existing;
|
|
4179
|
+
}
|
|
4180
|
+
getModuleOption(id$1) {
|
|
4181
|
+
const option = this.moduleOptionMap.get(id$1);
|
|
4182
|
+
if (!option) {
|
|
4183
|
+
const raw = {
|
|
4198
4184
|
moduleSideEffects: null,
|
|
4199
4185
|
meta: {}
|
|
4200
4186
|
};
|
|
@@ -4249,6 +4235,14 @@ var PluginContextData = class {
|
|
|
4249
4235
|
getRenderChunkMeta() {
|
|
4250
4236
|
return this.renderedChunkMeta;
|
|
4251
4237
|
}
|
|
4238
|
+
getInputOptions(opts) {
|
|
4239
|
+
this.normalizedInputOptions ??= new NormalizedInputOptionsImpl(opts, this.onLog);
|
|
4240
|
+
return this.normalizedInputOptions;
|
|
4241
|
+
}
|
|
4242
|
+
getOutputOptions(opts) {
|
|
4243
|
+
this.normalizedOutputOptions ??= new NormalizedOutputOptionsImpl(opts, this.outputOptions, this.normalizedOutputPlugins);
|
|
4244
|
+
return this.normalizedOutputOptions;
|
|
4245
|
+
}
|
|
4252
4246
|
markModuleLoaded(id$1, _success) {
|
|
4253
4247
|
const resolve$1 = this.loadModulePromiseResolveFnMap.get(id$1);
|
|
4254
4248
|
if (resolve$1) resolve$1();
|
|
@@ -4274,7 +4268,7 @@ function isReadonlyArray(input) {
|
|
|
4274
4268
|
//#endregion
|
|
4275
4269
|
//#region src/utils/bindingify-input-options.ts
|
|
4276
4270
|
function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode) {
|
|
4277
|
-
const pluginContextData = new PluginContextData();
|
|
4271
|
+
const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedOutputPlugins);
|
|
4278
4272
|
const plugins = rawPlugins.map((plugin) => {
|
|
4279
4273
|
if ("_parallel" in plugin) return void 0;
|
|
4280
4274
|
if (plugin instanceof BuiltinPlugin) return bindingifyBuiltInPlugin(plugin);
|
|
@@ -4482,323 +4476,6 @@ function bindingifyPreserveEntrySignatures(preserveEntrySignatures) {
|
|
|
4482
4476
|
};
|
|
4483
4477
|
}
|
|
4484
4478
|
|
|
4485
|
-
//#endregion
|
|
4486
|
-
//#region src/utils/plugin/index.ts
|
|
4487
|
-
const isPluginHookName = function() {
|
|
4488
|
-
const PLUGIN_HOOK_NAMES_SET = new Set(ENUMERATED_PLUGIN_HOOK_NAMES);
|
|
4489
|
-
return function isPluginHookName$1(hookName) {
|
|
4490
|
-
return PLUGIN_HOOK_NAMES_SET.has(hookName);
|
|
4491
|
-
};
|
|
4492
|
-
}();
|
|
4493
|
-
|
|
4494
|
-
//#endregion
|
|
4495
|
-
//#region src/utils/compose-js-plugins.ts
|
|
4496
|
-
const unsupportedHookName = [
|
|
4497
|
-
"augmentChunkHash",
|
|
4498
|
-
"generateBundle",
|
|
4499
|
-
"moduleParsed",
|
|
4500
|
-
"onLog",
|
|
4501
|
-
"options",
|
|
4502
|
-
"outputOptions",
|
|
4503
|
-
"renderError",
|
|
4504
|
-
"renderStart",
|
|
4505
|
-
"resolveDynamicImport",
|
|
4506
|
-
"writeBundle"
|
|
4507
|
-
];
|
|
4508
|
-
const unsupportedHooks = new Set(unsupportedHookName);
|
|
4509
|
-
function isUnsupportedHooks(hookName) {
|
|
4510
|
-
return unsupportedHooks.has(hookName);
|
|
4511
|
-
}
|
|
4512
|
-
function createComposedPlugin(plugins) {
|
|
4513
|
-
const names = [];
|
|
4514
|
-
const batchedHooks = {};
|
|
4515
|
-
plugins.forEach((plugin, index) => {
|
|
4516
|
-
const pluginName = plugin.name || `Anonymous(index: ${index})`;
|
|
4517
|
-
names.push(pluginName);
|
|
4518
|
-
t(plugin).forEach((pluginProp) => {
|
|
4519
|
-
if (isUnsupportedHooks(pluginProp)) throw new Error(`Failed to compose js plugins. Plugin ${pluginName} has an unsupported hook: ${pluginProp}`);
|
|
4520
|
-
if (!isPluginHookName(pluginProp)) return;
|
|
4521
|
-
switch (pluginProp) {
|
|
4522
|
-
case "buildStart": {
|
|
4523
|
-
const handlers = batchedHooks.buildStart ?? [];
|
|
4524
|
-
batchedHooks.buildStart = handlers;
|
|
4525
|
-
if (plugin.buildStart) handlers.push([plugin.buildStart, plugin]);
|
|
4526
|
-
break;
|
|
4527
|
-
}
|
|
4528
|
-
case "load": {
|
|
4529
|
-
const handlers = batchedHooks.load ?? [];
|
|
4530
|
-
batchedHooks.load = handlers;
|
|
4531
|
-
if (plugin.load) handlers.push([plugin.load, plugin]);
|
|
4532
|
-
break;
|
|
4533
|
-
}
|
|
4534
|
-
case "transform": {
|
|
4535
|
-
const handlers = batchedHooks.transform ?? [];
|
|
4536
|
-
batchedHooks.transform = handlers;
|
|
4537
|
-
if (plugin.transform) handlers.push([plugin.transform, plugin]);
|
|
4538
|
-
break;
|
|
4539
|
-
}
|
|
4540
|
-
case "resolveId": {
|
|
4541
|
-
const handlers = batchedHooks.resolveId ?? [];
|
|
4542
|
-
batchedHooks.resolveId = handlers;
|
|
4543
|
-
if (plugin.resolveId) handlers.push([plugin.resolveId, plugin]);
|
|
4544
|
-
break;
|
|
4545
|
-
}
|
|
4546
|
-
case "buildEnd": {
|
|
4547
|
-
const handlers = batchedHooks.buildEnd ?? [];
|
|
4548
|
-
batchedHooks.buildEnd = handlers;
|
|
4549
|
-
if (plugin.buildEnd) handlers.push([plugin.buildEnd, plugin]);
|
|
4550
|
-
break;
|
|
4551
|
-
}
|
|
4552
|
-
case "renderChunk": {
|
|
4553
|
-
const handlers = batchedHooks.renderChunk ?? [];
|
|
4554
|
-
batchedHooks.renderChunk = handlers;
|
|
4555
|
-
if (plugin.renderChunk) handlers.push([plugin.renderChunk, plugin]);
|
|
4556
|
-
break;
|
|
4557
|
-
}
|
|
4558
|
-
case "banner":
|
|
4559
|
-
case "footer":
|
|
4560
|
-
case "intro":
|
|
4561
|
-
case "outro": {
|
|
4562
|
-
const hook = plugin[pluginProp];
|
|
4563
|
-
if (hook) (batchedHooks[pluginProp] ??= []).push([hook, plugin]);
|
|
4564
|
-
break;
|
|
4565
|
-
}
|
|
4566
|
-
case "closeBundle": {
|
|
4567
|
-
const handlers = batchedHooks.closeBundle ?? [];
|
|
4568
|
-
batchedHooks.closeBundle = handlers;
|
|
4569
|
-
if (plugin.closeBundle) handlers.push([plugin.closeBundle, plugin]);
|
|
4570
|
-
break;
|
|
4571
|
-
}
|
|
4572
|
-
case "watchChange": {
|
|
4573
|
-
const handlers = batchedHooks.watchChange ?? [];
|
|
4574
|
-
batchedHooks.watchChange = handlers;
|
|
4575
|
-
if (plugin.watchChange) handlers.push([plugin.watchChange, plugin]);
|
|
4576
|
-
break;
|
|
4577
|
-
}
|
|
4578
|
-
case "closeWatcher": {
|
|
4579
|
-
const handlers = batchedHooks.closeWatcher ?? [];
|
|
4580
|
-
batchedHooks.closeWatcher = handlers;
|
|
4581
|
-
if (plugin.closeWatcher) handlers.push([plugin.closeWatcher, plugin]);
|
|
4582
|
-
break;
|
|
4583
|
-
}
|
|
4584
|
-
default: {}
|
|
4585
|
-
}
|
|
4586
|
-
});
|
|
4587
|
-
});
|
|
4588
|
-
const composed = { name: `Composed(${names.join(", ")})` };
|
|
4589
|
-
const createFixedPluginResolveFnMap = /* @__PURE__ */ new Map();
|
|
4590
|
-
function applyFixedPluginResolveFn(ctx, plugin) {
|
|
4591
|
-
const createFixedPluginResolveFn = createFixedPluginResolveFnMap.get(plugin);
|
|
4592
|
-
if (createFixedPluginResolveFn) ctx.resolve = createFixedPluginResolveFn(ctx, ctx.resolve.bind(ctx));
|
|
4593
|
-
return ctx;
|
|
4594
|
-
}
|
|
4595
|
-
if (batchedHooks.resolveId) {
|
|
4596
|
-
const batchedHandlers = batchedHooks.resolveId;
|
|
4597
|
-
const handlerSymbols = batchedHandlers.map(([_handler, plugin]) => Symbol(plugin.name ?? `Anonymous`));
|
|
4598
|
-
for (let handlerIdx = 0; handlerIdx < batchedHandlers.length; handlerIdx++) {
|
|
4599
|
-
const [_handler, plugin] = batchedHandlers[handlerIdx];
|
|
4600
|
-
const handlerSymbol = handlerSymbols[handlerIdx];
|
|
4601
|
-
const createFixedPluginResolveFn = (ctx, resolve$1) => {
|
|
4602
|
-
return (source, importer, rawContextResolveOptions) => {
|
|
4603
|
-
const contextResolveOptions = rawContextResolveOptions ?? {};
|
|
4604
|
-
if (contextResolveOptions.skipSelf) {
|
|
4605
|
-
contextResolveOptions[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF] = handlerSymbol;
|
|
4606
|
-
contextResolveOptions.skipSelf = false;
|
|
4607
|
-
}
|
|
4608
|
-
return resolve$1(source, importer, contextResolveOptions);
|
|
4609
|
-
};
|
|
4610
|
-
};
|
|
4611
|
-
createFixedPluginResolveFnMap.set(plugin, createFixedPluginResolveFn);
|
|
4612
|
-
}
|
|
4613
|
-
composed.resolveId = async function(source, importer, rawHookResolveIdOptions) {
|
|
4614
|
-
const hookResolveIdOptions = rawHookResolveIdOptions;
|
|
4615
|
-
const symbolForCallerThatSkipSelf = hookResolveIdOptions?.[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF];
|
|
4616
|
-
for (let handlerIdx = 0; handlerIdx < batchedHandlers.length; handlerIdx++) {
|
|
4617
|
-
const [handler, plugin] = batchedHandlers[handlerIdx];
|
|
4618
|
-
const handlerSymbol = handlerSymbols[handlerIdx];
|
|
4619
|
-
if (symbolForCallerThatSkipSelf === handlerSymbol) continue;
|
|
4620
|
-
const { handler: handlerFn } = normalizeHook(handler);
|
|
4621
|
-
const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), source, importer, rawHookResolveIdOptions);
|
|
4622
|
-
if (!isNullish(result)) return result;
|
|
4623
|
-
}
|
|
4624
|
-
};
|
|
4625
|
-
}
|
|
4626
|
-
t(batchedHooks).forEach((hookName) => {
|
|
4627
|
-
switch (hookName) {
|
|
4628
|
-
case "resolveId": break;
|
|
4629
|
-
case "buildStart": {
|
|
4630
|
-
if (batchedHooks.buildStart) {
|
|
4631
|
-
const batchedHandlers = batchedHooks.buildStart;
|
|
4632
|
-
composed.buildStart = async function(options) {
|
|
4633
|
-
await Promise.all(batchedHandlers.map(([handler, plugin]) => {
|
|
4634
|
-
const { handler: handlerFn } = normalizeHook(handler);
|
|
4635
|
-
return handlerFn.call(applyFixedPluginResolveFn(this, plugin), options);
|
|
4636
|
-
}));
|
|
4637
|
-
};
|
|
4638
|
-
}
|
|
4639
|
-
break;
|
|
4640
|
-
}
|
|
4641
|
-
case "load": {
|
|
4642
|
-
if (batchedHooks.load) {
|
|
4643
|
-
const batchedHandlers = batchedHooks.load;
|
|
4644
|
-
composed.load = async function(id$1) {
|
|
4645
|
-
for (const [handler, plugin] of batchedHandlers) {
|
|
4646
|
-
const { handler: handlerFn } = normalizeHook(handler);
|
|
4647
|
-
const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), id$1);
|
|
4648
|
-
if (!isNullish(result)) return result;
|
|
4649
|
-
}
|
|
4650
|
-
};
|
|
4651
|
-
}
|
|
4652
|
-
break;
|
|
4653
|
-
}
|
|
4654
|
-
case "transform": {
|
|
4655
|
-
if (batchedHooks.transform) {
|
|
4656
|
-
const batchedHandlers = batchedHooks.transform;
|
|
4657
|
-
composed.transform = async function(initialCode, id$1, moduleType$1) {
|
|
4658
|
-
let code$1 = initialCode;
|
|
4659
|
-
let moduleSideEffects = void 0;
|
|
4660
|
-
function updateOutput(newCode, newModuleSideEffects) {
|
|
4661
|
-
code$1 = newCode;
|
|
4662
|
-
moduleSideEffects = newModuleSideEffects ?? void 0;
|
|
4663
|
-
}
|
|
4664
|
-
for (const [handler, plugin] of batchedHandlers) {
|
|
4665
|
-
const { handler: handlerFn } = normalizeHook(handler);
|
|
4666
|
-
this.getCombinedSourcemap = () => {
|
|
4667
|
-
throw new Error(`The getCombinedSourcemap is not implement in transform hook at composedJsPlugins`);
|
|
4668
|
-
};
|
|
4669
|
-
const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code$1, id$1, moduleType$1);
|
|
4670
|
-
if (!isNullish(result)) {
|
|
4671
|
-
if (typeof result === "string") updateOutput(result);
|
|
4672
|
-
else if (result.code) updateOutput(result.code, result.moduleSideEffects);
|
|
4673
|
-
}
|
|
4674
|
-
}
|
|
4675
|
-
return {
|
|
4676
|
-
code: code$1,
|
|
4677
|
-
moduleSideEffects
|
|
4678
|
-
};
|
|
4679
|
-
};
|
|
4680
|
-
}
|
|
4681
|
-
break;
|
|
4682
|
-
}
|
|
4683
|
-
case "buildEnd": {
|
|
4684
|
-
if (batchedHooks.buildEnd) {
|
|
4685
|
-
const batchedHandlers = batchedHooks.buildEnd;
|
|
4686
|
-
composed.buildEnd = async function(err) {
|
|
4687
|
-
await Promise.all(batchedHandlers.map(([handler, plugin]) => {
|
|
4688
|
-
const { handler: handlerFn } = normalizeHook(handler);
|
|
4689
|
-
return handlerFn.call(applyFixedPluginResolveFn(this, plugin), err);
|
|
4690
|
-
}));
|
|
4691
|
-
};
|
|
4692
|
-
}
|
|
4693
|
-
break;
|
|
4694
|
-
}
|
|
4695
|
-
case "renderChunk": {
|
|
4696
|
-
if (batchedHooks.renderChunk) {
|
|
4697
|
-
const batchedHandlers = batchedHooks.renderChunk;
|
|
4698
|
-
composed.renderChunk = async function(code$1, chunk, options, meta) {
|
|
4699
|
-
for (const [handler, plugin] of batchedHandlers) {
|
|
4700
|
-
const { handler: handlerFn } = normalizeHook(handler);
|
|
4701
|
-
const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code$1, chunk, options, meta);
|
|
4702
|
-
if (!isNullish(result)) return result;
|
|
4703
|
-
}
|
|
4704
|
-
};
|
|
4705
|
-
}
|
|
4706
|
-
break;
|
|
4707
|
-
}
|
|
4708
|
-
case "banner":
|
|
4709
|
-
case "footer":
|
|
4710
|
-
case "intro":
|
|
4711
|
-
case "outro": {
|
|
4712
|
-
const hooks = batchedHooks[hookName];
|
|
4713
|
-
if (hooks?.length) composed[hookName] = async function(chunk) {
|
|
4714
|
-
const ret = [];
|
|
4715
|
-
for (const [hook, plugin] of hooks) {
|
|
4716
|
-
const { handler } = normalizeHook(hook);
|
|
4717
|
-
ret.push(typeof handler === "string" ? handler : await handler.call(applyFixedPluginResolveFn(this, plugin), chunk));
|
|
4718
|
-
}
|
|
4719
|
-
return ret.join("\n");
|
|
4720
|
-
};
|
|
4721
|
-
break;
|
|
4722
|
-
}
|
|
4723
|
-
case "closeBundle": {
|
|
4724
|
-
if (batchedHooks.closeBundle) {
|
|
4725
|
-
const batchedHandlers = batchedHooks.closeBundle;
|
|
4726
|
-
composed.closeBundle = async function() {
|
|
4727
|
-
await Promise.all(batchedHandlers.map(([handler, plugin]) => {
|
|
4728
|
-
const { handler: handlerFn } = normalizeHook(handler);
|
|
4729
|
-
return handlerFn.call(applyFixedPluginResolveFn(this, plugin));
|
|
4730
|
-
}));
|
|
4731
|
-
};
|
|
4732
|
-
}
|
|
4733
|
-
break;
|
|
4734
|
-
}
|
|
4735
|
-
case "watchChange": {
|
|
4736
|
-
if (batchedHooks.watchChange) {
|
|
4737
|
-
const batchedHandlers = batchedHooks.watchChange;
|
|
4738
|
-
composed.watchChange = async function(id$1, event) {
|
|
4739
|
-
await Promise.all(batchedHandlers.map(([handler, plugin]) => {
|
|
4740
|
-
const { handler: handlerFn } = normalizeHook(handler);
|
|
4741
|
-
return handlerFn.call(applyFixedPluginResolveFn(this, plugin), id$1, event);
|
|
4742
|
-
}));
|
|
4743
|
-
};
|
|
4744
|
-
}
|
|
4745
|
-
break;
|
|
4746
|
-
}
|
|
4747
|
-
case "closeWatcher": {
|
|
4748
|
-
if (batchedHooks.closeWatcher) {
|
|
4749
|
-
const batchedHandlers = batchedHooks.closeWatcher;
|
|
4750
|
-
composed.closeWatcher = async function() {
|
|
4751
|
-
await Promise.all(batchedHandlers.map(([handler, plugin]) => {
|
|
4752
|
-
const { handler: handlerFn } = normalizeHook(handler);
|
|
4753
|
-
return handlerFn.call(applyFixedPluginResolveFn(this, plugin));
|
|
4754
|
-
}));
|
|
4755
|
-
};
|
|
4756
|
-
}
|
|
4757
|
-
break;
|
|
4758
|
-
}
|
|
4759
|
-
default: {}
|
|
4760
|
-
}
|
|
4761
|
-
});
|
|
4762
|
-
return composed;
|
|
4763
|
-
}
|
|
4764
|
-
function isComposablePlugin(plugin) {
|
|
4765
|
-
if (plugin instanceof BuiltinPlugin) return false;
|
|
4766
|
-
if ("_parallel" in plugin) return false;
|
|
4767
|
-
const hasNotComposablePattern = t(plugin).some((hookName) => {
|
|
4768
|
-
if (!isPluginHookName(hookName)) return false;
|
|
4769
|
-
const OK_TO_COMPOSE = false;
|
|
4770
|
-
if (isUnsupportedHooks(hookName)) return true;
|
|
4771
|
-
if (plugin[hookName]) {
|
|
4772
|
-
const { meta } = normalizeHook(plugin[hookName]);
|
|
4773
|
-
if (meta.order === "pre" || meta.order === "post") return true;
|
|
4774
|
-
}
|
|
4775
|
-
return OK_TO_COMPOSE;
|
|
4776
|
-
});
|
|
4777
|
-
if (hasNotComposablePattern) return false;
|
|
4778
|
-
return true;
|
|
4779
|
-
}
|
|
4780
|
-
function composeJsPlugins(plugins) {
|
|
4781
|
-
const newPlugins = [];
|
|
4782
|
-
const toBeComposed = [];
|
|
4783
|
-
plugins.forEach((plugin) => {
|
|
4784
|
-
if (isComposablePlugin(plugin)) toBeComposed.push(plugin);
|
|
4785
|
-
else {
|
|
4786
|
-
if (toBeComposed.length > 0) {
|
|
4787
|
-
if (toBeComposed.length > 1) newPlugins.push(createComposedPlugin(toBeComposed));
|
|
4788
|
-
else newPlugins.push(toBeComposed[0]);
|
|
4789
|
-
toBeComposed.length = 0;
|
|
4790
|
-
}
|
|
4791
|
-
newPlugins.push(plugin);
|
|
4792
|
-
}
|
|
4793
|
-
});
|
|
4794
|
-
if (toBeComposed.length > 0) {
|
|
4795
|
-
if (toBeComposed.length > 1) newPlugins.push(createComposedPlugin(toBeComposed));
|
|
4796
|
-
else newPlugins.push(toBeComposed[0]);
|
|
4797
|
-
toBeComposed.length = 0;
|
|
4798
|
-
}
|
|
4799
|
-
return newPlugins;
|
|
4800
|
-
}
|
|
4801
|
-
|
|
4802
4479
|
//#endregion
|
|
4803
4480
|
//#region src/utils/create-bundler-option.ts
|
|
4804
4481
|
async function createBundlerOptions(inputOptions, outputOptions, watchMode, isClose) {
|
|
@@ -4813,7 +4490,6 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode, isCl
|
|
|
4813
4490
|
...normalizePlugins(inputPlugins, ANONYMOUS_PLUGIN_PREFIX),
|
|
4814
4491
|
...checkOutputPluginOption(normalizePlugins(normalizedOutputPlugins, ANONYMOUS_OUTPUT_PLUGIN_PREFIX), onLog)
|
|
4815
4492
|
];
|
|
4816
|
-
if (inputOptions.experimental?.enableComposingJsPlugins ?? false) plugins = composeJsPlugins(plugins);
|
|
4817
4493
|
const parallelPluginInitResult = void 0;
|
|
4818
4494
|
try {
|
|
4819
4495
|
const bindingInputOptions = bindingifyInputOptions(plugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode);
|
|
@@ -5083,4 +4759,4 @@ function defineConfig(config) {
|
|
|
5083
4759
|
const VERSION = version;
|
|
5084
4760
|
|
|
5085
4761
|
//#endregion
|
|
5086
|
-
export { BuiltinPlugin, PluginDriver, VERSION, assetPlugin, build, buildImportAnalysisPlugin,
|
|
4762
|
+
export { BuiltinPlugin, PluginDriver, VERSION, assetPlugin, build, buildImportAnalysisPlugin, createBundlerImpl, defineConfig, dynamicImportVarsPlugin, handleOutputErrors, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, reporterPlugin, rolldown, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch, webWorkerPostPlugin };
|