@rolldown/browser 1.0.0-beta.22 → 1.0.0-beta.24
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 +8 -8
- package/dist/cli.mjs +8 -8
- package/dist/config.cjs +4 -4
- package/dist/config.d.cts +2 -2
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +4 -4
- package/dist/experimental-index.browser.mjs +2 -2
- package/dist/experimental-index.cjs +3 -4
- package/dist/experimental-index.d.cts +3 -6
- package/dist/experimental-index.d.mts +3 -6
- package/dist/experimental-index.mjs +4 -4
- package/dist/experimental-runtime-types.d.ts +1 -2
- 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 +3 -3
- package/dist/index.d.cts +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +3 -3
- package/dist/parallel-plugin-worker.cjs +4 -4
- package/dist/parallel-plugin-worker.mjs +4 -4
- package/dist/parallel-plugin.d.cts +2 -2
- package/dist/parallel-plugin.d.mts +2 -2
- package/dist/parse-ast-index.cjs +1 -1
- package/dist/parse-ast-index.d.cts +1 -1
- package/dist/parse-ast-index.d.mts +1 -1
- package/dist/parse-ast-index.mjs +1 -1
- package/dist/rolldown-binding.wasi-browser.js +0 -3
- package/dist/rolldown-binding.wasi.cjs +0 -3
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/shared/{binding-B8kHDLfO.d.mts → binding-DG3bbtXG.d.cts} +4 -22
- package/dist/shared/{binding-CbR_BHh9.d.cts → binding-cECB-Ts3.d.mts} +4 -22
- package/dist/shared/{define-config-DZVEpUTF.d.cts → define-config-BnlWQIlM.d.cts} +20 -22
- package/dist/shared/{define-config-DsN80oVh.d.mts → define-config-Dipre2WB.d.mts} +20 -22
- 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-BgXwAVNp.cjs → load-config-B-Wrkmqo.cjs} +1 -1
- package/dist/shared/{load-config-_2H4hlKT.mjs → load-config-FXcGLoFh.mjs} +1 -1
- package/dist/shared/{parse-ast-index-CGTVCgvx.cjs → parse-ast-index-B0vXlNs8.cjs} +14 -2
- package/dist/shared/{parse-ast-index-BzdtcWzA.mjs → parse-ast-index-DQEVpsUG.mjs} +9 -3
- package/dist/shared/{src-C_vfq91X.mjs → src-DmJCtJ15.mjs} +499 -793
- package/dist/shared/{src-DT8g8X-x.cjs → src-dEUToPiW.cjs} +482 -782
- package/dist/{src-DJeuVN_z.js → src-BHNQaKQh.js} +532 -823
- package/package.json +2 -2
|
@@ -27,7 +27,18 @@ 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.24";
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/utils/normalize-string-or-regex.ts
|
|
34
|
+
function normalizedStringOrRegex(pattern) {
|
|
35
|
+
if (!pattern) return void 0;
|
|
36
|
+
if (!isReadonlyArray(pattern)) return [pattern];
|
|
37
|
+
return pattern;
|
|
38
|
+
}
|
|
39
|
+
function isReadonlyArray(input) {
|
|
40
|
+
return Array.isArray(input);
|
|
41
|
+
}
|
|
31
42
|
|
|
32
43
|
//#endregion
|
|
33
44
|
//#region src/builtin-plugin/utils.ts
|
|
@@ -58,6 +69,10 @@ function modulePreloadPolyfillPlugin(config) {
|
|
|
58
69
|
return new BuiltinPlugin("builtin:module-preload-polyfill", config);
|
|
59
70
|
}
|
|
60
71
|
function dynamicImportVarsPlugin(config) {
|
|
72
|
+
if (config) {
|
|
73
|
+
config.include = normalizedStringOrRegex(config.include);
|
|
74
|
+
config.exclude = normalizedStringOrRegex(config.exclude);
|
|
75
|
+
}
|
|
61
76
|
return new BuiltinPlugin("builtin:dynamic-import-vars", config);
|
|
62
77
|
}
|
|
63
78
|
function importGlobPlugin(config) {
|
|
@@ -69,8 +84,8 @@ function reporterPlugin(config) {
|
|
|
69
84
|
function manifestPlugin(config) {
|
|
70
85
|
return new BuiltinPlugin("builtin:manifest", config);
|
|
71
86
|
}
|
|
72
|
-
function wasmHelperPlugin() {
|
|
73
|
-
return new BuiltinPlugin("builtin:wasm-helper");
|
|
87
|
+
function wasmHelperPlugin(config) {
|
|
88
|
+
return new BuiltinPlugin("builtin:wasm-helper", config);
|
|
74
89
|
}
|
|
75
90
|
function wasmFallbackPlugin() {
|
|
76
91
|
const builtinPlugin = new BuiltinPlugin("builtin:wasm-fallback");
|
|
@@ -131,9 +146,9 @@ let _lazyMatch = () => {
|
|
|
131
146
|
enumerable: true
|
|
132
147
|
});
|
|
133
148
|
}, 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$
|
|
149
|
+
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, {
|
|
150
|
+
get: () => e$1[t$1],
|
|
151
|
+
enumerable: !(a$2 = V(e$1, t$1)) || a$2.enumerable
|
|
137
152
|
});
|
|
138
153
|
return r$1;
|
|
139
154
|
}, J = (r$1) => H(m$1({}, "__esModule", { value: true }), r$1), w$1 = {};
|
|
@@ -143,8 +158,8 @@ let _lazyMatch = () => {
|
|
|
143
158
|
return (n$1) => {
|
|
144
159
|
const a$2 = e$1.get(n$1);
|
|
145
160
|
if (a$2) return a$2;
|
|
146
|
-
const t$
|
|
147
|
-
return e$1.set(n$1, t$
|
|
161
|
+
const t$1 = r$1(n$1);
|
|
162
|
+
return e$1.set(n$1, t$1), t$1;
|
|
148
163
|
};
|
|
149
164
|
}, rr = (r$1, e$1, n$1 = {}) => {
|
|
150
165
|
const a$2 = {
|
|
@@ -161,16 +176,16 @@ let _lazyMatch = () => {
|
|
|
161
176
|
const n$1 = {};
|
|
162
177
|
for (const a$2 of r$1) {
|
|
163
178
|
if (a$2.length !== 1) throw new Error(`Invalid character: "${a$2}"`);
|
|
164
|
-
const t$
|
|
165
|
-
n$1[t$
|
|
179
|
+
const t$1 = a$2.charCodeAt(0);
|
|
180
|
+
n$1[t$1] = true;
|
|
166
181
|
}
|
|
167
182
|
return (a$2) => {
|
|
168
|
-
const t$
|
|
183
|
+
const t$1 = a$2.index, o$1 = a$2.input;
|
|
169
184
|
for (; a$2.index < o$1.length && o$1.charCodeAt(a$2.index) in n$1;) a$2.index += 1;
|
|
170
185
|
const u$3 = a$2.index;
|
|
171
|
-
if (u$3 > t$
|
|
186
|
+
if (u$3 > t$1) {
|
|
172
187
|
if (!h$1(e$1) && !a$2.options.silent) {
|
|
173
|
-
const s$1 = a$2.input.slice(t$
|
|
188
|
+
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
189
|
h$1(c$1) || a$2.output.push(c$1);
|
|
175
190
|
}
|
|
176
191
|
a$2.indexMax = Math.max(a$2.indexMax, a$2.index);
|
|
@@ -178,10 +193,10 @@ let _lazyMatch = () => {
|
|
|
178
193
|
return true;
|
|
179
194
|
};
|
|
180
195
|
}, nr = (r$1, e$1) => {
|
|
181
|
-
const n$1 = r$1.source, a$2 = r$1.flags.replace(/y|$/, "y"), t$
|
|
196
|
+
const n$1 = r$1.source, a$2 = r$1.flags.replace(/y|$/, "y"), t$1 = new RegExp(n$1, a$2);
|
|
182
197
|
return g$1((o$1) => {
|
|
183
|
-
t$
|
|
184
|
-
const u$3 = t$
|
|
198
|
+
t$1.lastIndex = o$1.index;
|
|
199
|
+
const u$3 = t$1.exec(o$1.input);
|
|
185
200
|
if (u$3) {
|
|
186
201
|
if (!h$1(e$1) && !o$1.options.silent) {
|
|
187
202
|
const s$1 = d$2(e$1) ? e$1(...u$3, o$1.input, String(o$1.index)) : e$1;
|
|
@@ -193,38 +208,38 @@ let _lazyMatch = () => {
|
|
|
193
208
|
}, ar = (r$1, e$1) => (n$1) => {
|
|
194
209
|
if (n$1.input.startsWith(r$1, n$1.index)) {
|
|
195
210
|
if (!h$1(e$1) && !n$1.options.silent) {
|
|
196
|
-
const t$
|
|
197
|
-
h$1(t$
|
|
211
|
+
const t$1 = d$2(e$1) ? e$1(r$1, n$1.input, String(n$1.index)) : e$1;
|
|
212
|
+
h$1(t$1) || n$1.output.push(t$1);
|
|
198
213
|
}
|
|
199
214
|
return n$1.index += r$1.length, n$1.indexMax = Math.max(n$1.indexMax, n$1.index), true;
|
|
200
215
|
} else return false;
|
|
201
216
|
}, C = (r$1, e$1, n$1, a$2) => {
|
|
202
|
-
const t$
|
|
217
|
+
const t$1 = v(r$1);
|
|
203
218
|
return g$1(_(M((o$1) => {
|
|
204
219
|
let u$3 = 0;
|
|
205
220
|
for (; u$3 < n$1;) {
|
|
206
221
|
const s$1 = o$1.index;
|
|
207
|
-
if (!t$
|
|
222
|
+
if (!t$1(o$1) || (u$3 += 1, o$1.index === s$1)) break;
|
|
208
223
|
}
|
|
209
224
|
return u$3 >= e$1;
|
|
210
225
|
})));
|
|
211
226
|
}, 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
227
|
const n$1 = r$1.map(v);
|
|
213
228
|
return g$1(_(M((a$2) => {
|
|
214
|
-
for (let t$
|
|
229
|
+
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
230
|
return true;
|
|
216
231
|
})));
|
|
217
232
|
}, l$1 = (r$1, e$1) => {
|
|
218
233
|
const n$1 = r$1.map(v);
|
|
219
234
|
return g$1(_((a$2) => {
|
|
220
|
-
for (let t$
|
|
235
|
+
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
236
|
return false;
|
|
222
237
|
}));
|
|
223
238
|
}, M = (r$1, e$1 = false) => {
|
|
224
239
|
const n$1 = v(r$1);
|
|
225
240
|
return (a$2) => {
|
|
226
|
-
const t$
|
|
227
|
-
return (!u$3 || e$1) && (a$2.index = t$
|
|
241
|
+
const t$1 = a$2.index, o$1 = a$2.output.length, u$3 = n$1(a$2);
|
|
242
|
+
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
243
|
};
|
|
229
244
|
}, _ = (r$1, e$1) => {
|
|
230
245
|
const n$1 = v(r$1);
|
|
@@ -233,19 +248,19 @@ let _lazyMatch = () => {
|
|
|
233
248
|
let r$1 = 0;
|
|
234
249
|
return (e$1) => {
|
|
235
250
|
const n$1 = v(e$1), a$2 = r$1 += 1;
|
|
236
|
-
return (t$
|
|
251
|
+
return (t$1) => {
|
|
237
252
|
var o$1;
|
|
238
|
-
if (t$
|
|
239
|
-
const u$3 = t$
|
|
253
|
+
if (t$1.options.memoization === false) return n$1(t$1);
|
|
254
|
+
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
255
|
if (c$1 === false) return false;
|
|
241
|
-
if (W(c$1)) return t$
|
|
242
|
-
if (c$1) return t$
|
|
256
|
+
if (W(c$1)) return t$1.index = c$1, true;
|
|
257
|
+
if (c$1) return t$1.index = c$1.index, c$1.output?.length && t$1.output.push(...c$1.output), true;
|
|
243
258
|
{
|
|
244
|
-
const Z = t$
|
|
245
|
-
if (n$1(t$
|
|
246
|
-
const D = t$
|
|
259
|
+
const Z = t$1.output.length;
|
|
260
|
+
if (n$1(t$1)) {
|
|
261
|
+
const D = t$1.index, U = t$1.output.length;
|
|
247
262
|
if (U > Z) {
|
|
248
|
-
const ee = t$
|
|
263
|
+
const ee = t$1.output.slice(Z, U);
|
|
249
264
|
s$1.set(u$3, {
|
|
250
265
|
index: D,
|
|
251
266
|
output: ee
|
|
@@ -345,7 +360,7 @@ let _lazyMatch = () => {
|
|
|
345
360
|
])), Kr = Wr, Xr = z(Kr), Yr = Xr, $ = (r$1, e$1) => {
|
|
346
361
|
const n$1 = Array.isArray(r$1) ? r$1 : [r$1];
|
|
347
362
|
if (!n$1.length) return false;
|
|
348
|
-
const a$2 = n$1.map($.compile), t$
|
|
363
|
+
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
364
|
return a$2.some((s$1) => s$1.test(o$1));
|
|
350
365
|
};
|
|
351
366
|
$.compile = (r$1) => new RegExp(`^${L(Yr(r$1))}$`, "s");
|
|
@@ -580,9 +595,6 @@ const win32 = /* @__PURE__ */ mix(";");
|
|
|
580
595
|
function arraify(value) {
|
|
581
596
|
return Array.isArray(value) ? value : [value];
|
|
582
597
|
}
|
|
583
|
-
function isNullish(value) {
|
|
584
|
-
return value === null || value === void 0;
|
|
585
|
-
}
|
|
586
598
|
function unimplemented(info) {
|
|
587
599
|
if (info) throw new Error(`unimplemented: ${info}`);
|
|
588
600
|
throw new Error("unimplemented");
|
|
@@ -712,7 +724,7 @@ function locate(source, search, options) {
|
|
|
712
724
|
|
|
713
725
|
//#endregion
|
|
714
726
|
//#region src/log/logs.ts
|
|
715
|
-
const INVALID_LOG_POSITION = "INVALID_LOG_POSITION", PLUGIN_ERROR = "PLUGIN_ERROR", INPUT_HOOK_IN_OUTPUT_PLUGIN = "INPUT_HOOK_IN_OUTPUT_PLUGIN", CYCLE_LOADING = "CYCLE_LOADING", MULTIPLY_NOTIFY_OPTION = "MULTIPLY_NOTIFY_OPTION", PARSE_ERROR = "PARSE_ERROR";
|
|
727
|
+
const INVALID_LOG_POSITION = "INVALID_LOG_POSITION", PLUGIN_ERROR = "PLUGIN_ERROR", INPUT_HOOK_IN_OUTPUT_PLUGIN = "INPUT_HOOK_IN_OUTPUT_PLUGIN", CYCLE_LOADING = "CYCLE_LOADING", MULTIPLY_NOTIFY_OPTION = "MULTIPLY_NOTIFY_OPTION", PARSE_ERROR = "PARSE_ERROR", DUPLICATE_JSX_CONFIG = "DUPLICATE_JSX_CONFIG";
|
|
716
728
|
function logParseError(message) {
|
|
717
729
|
return {
|
|
718
730
|
code: PARSE_ERROR,
|
|
@@ -743,6 +755,12 @@ function logMultiplyNotifyOption() {
|
|
|
743
755
|
message: `Found multiply notify option at watch options, using first one to start notify watcher.`
|
|
744
756
|
};
|
|
745
757
|
}
|
|
758
|
+
function logDuplicateJsxConfig() {
|
|
759
|
+
return {
|
|
760
|
+
code: DUPLICATE_JSX_CONFIG,
|
|
761
|
+
message: "Both `options.jsx` and `options.transform.jsx` are set so `options.jsx` is ignored"
|
|
762
|
+
};
|
|
763
|
+
}
|
|
746
764
|
function logPluginError(error$1, plugin, { hook, id: id$1 } = {}) {
|
|
747
765
|
try {
|
|
748
766
|
const code$1 = error$1.code;
|
|
@@ -2059,18 +2077,18 @@ function safeParse(schema, input, config2) {
|
|
|
2059
2077
|
//#endregion
|
|
2060
2078
|
//#region ../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.cjs
|
|
2061
2079
|
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$
|
|
2080
|
+
let e, t, r, { defineProperty: n, setPrototypeOf: l, create: o, keys: s } = Object, i$1 = "", { round: c, max: a$1 } = Math, p = (e$1) => {
|
|
2081
|
+
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
2082
|
return [
|
|
2065
2083
|
n$1 >> 16 & 255,
|
|
2066
2084
|
n$1 >> 8 & 255,
|
|
2067
2085
|
255 & n$1
|
|
2068
2086
|
];
|
|
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$
|
|
2087
|
+
}, 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) => {
|
|
2088
|
+
let t$1, r$1, n$1, l$1, o$1;
|
|
2089
|
+
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
2090
|
}, g = (() => {
|
|
2073
|
-
let r$1 = (e$1) => o$1.some((t$
|
|
2091
|
+
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
2092
|
try {
|
|
2075
2093
|
e = "," + s(i$2).join(",");
|
|
2076
2094
|
} catch (e$1) {
|
|
@@ -2083,31 +2101,31 @@ var require_ansis = __commonJS({ "../../node_modules/.pnpm/ansis@4.1.0/node_modu
|
|
|
2083
2101
|
2: 2,
|
|
2084
2102
|
3: 3
|
|
2085
2103
|
}[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
|
|
2104
|
+
return u$3 && (c$1 = p$1), ~c$1 || (c$1 = ((r$2, n$2, l$2) => (t = r$2.TERM, {
|
|
2087
2105
|
"24bit": 3,
|
|
2088
2106
|
truecolor: 3,
|
|
2089
2107
|
ansi256: 2,
|
|
2090
2108
|
ansi: 1
|
|
2091
|
-
}[r$2.COLORTERM] || (r$2.CI ? /,GITHUB/.test(e) ? 3 : 1 : n$2 && "dumb" !== t
|
|
2109
|
+
}[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
2110
|
})(), f = {
|
|
2093
2111
|
open: i$1,
|
|
2094
2112
|
close: i$1
|
|
2095
|
-
}, h = 39, b = 49, O = {}, m = ({ p: e$1 }, { open: t$
|
|
2113
|
+
}, h = 39, b = 49, O = {}, m = ({ p: e$1 }, { open: t$1, close: n$1 }) => {
|
|
2096
2114
|
let o$1 = (e$2, ...r$1) => {
|
|
2097
2115
|
if (!e$2) {
|
|
2098
|
-
if (t$
|
|
2116
|
+
if (t$1 && t$1 === n$1) return t$1;
|
|
2099
2117
|
if ((e$2 ?? i$1) === i$1) return i$1;
|
|
2100
2118
|
}
|
|
2101
2119
|
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
2120
|
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$
|
|
2121
|
+
let { open: e$3, close: t$2 } = c$2, r$2 = t$2.length, n$2 = i$1, o$2 = 0;
|
|
2122
|
+
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
2123
|
s$2 = n$2 + s$2.slice(o$2);
|
|
2106
2124
|
}
|
|
2107
2125
|
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$
|
|
2126
|
+
}, s$1 = t$1, c$1 = n$1;
|
|
2127
|
+
return e$1 && (s$1 = e$1.o + t$1, c$1 = n$1 + e$1.c), l(o$1, r), o$1.p = {
|
|
2128
|
+
open: t$1,
|
|
2111
2129
|
close: n$1,
|
|
2112
2130
|
o: s$1,
|
|
2113
2131
|
c: c$1,
|
|
@@ -2115,27 +2133,27 @@ var require_ansis = __commonJS({ "../../node_modules/.pnpm/ansis@4.1.0/node_modu
|
|
|
2115
2133
|
}, o$1.open = s$1, o$1.close = c$1, o$1;
|
|
2116
2134
|
};
|
|
2117
2135
|
const w = function(e$1 = g) {
|
|
2118
|
-
let t$
|
|
2136
|
+
let t$1 = {
|
|
2119
2137
|
Ansis: w,
|
|
2120
2138
|
level: e$1,
|
|
2121
2139
|
isSupported: () => s$1,
|
|
2122
2140
|
strip: (e$2) => e$2.replace(/[][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, i$1),
|
|
2123
2141
|
extend(e$2) {
|
|
2124
|
-
for (let t$
|
|
2125
|
-
let r$1 = e$2[t$
|
|
2126
|
-
O[t$
|
|
2142
|
+
for (let t$2 in e$2) {
|
|
2143
|
+
let r$1 = e$2[t$2], l$1 = (typeof r$1)[0], o$1 = "s" === l$1 ? x(...p(r$1)) : r$1;
|
|
2144
|
+
O[t$2] = "f" === l$1 ? { get() {
|
|
2127
2145
|
return (...e$3) => m(this, r$1(...e$3));
|
|
2128
2146
|
} } : { get() {
|
|
2129
2147
|
let e$3 = m(this, o$1);
|
|
2130
|
-
return n(this, t$
|
|
2148
|
+
return n(this, t$2, { value: e$3 }), e$3;
|
|
2131
2149
|
} };
|
|
2132
2150
|
}
|
|
2133
|
-
return r = o({}, O), l(t$
|
|
2151
|
+
return r = o({}, O), l(t$1, r), t$1;
|
|
2134
2152
|
}
|
|
2135
|
-
}, s$1 = e$1 > 0, c$1 = (e$2, t$
|
|
2153
|
+
}, s$1 = e$1 > 0, c$1 = (e$2, t$2) => s$1 ? {
|
|
2136
2154
|
open: `[${e$2}m`,
|
|
2137
|
-
close: `[${t$
|
|
2138
|
-
} : f, a$2 = (e$2) => (t$
|
|
2155
|
+
close: `[${t$2}m`
|
|
2156
|
+
} : 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
2157
|
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
2158
|
let E, M = {
|
|
2141
2159
|
fg: v,
|
|
@@ -2154,9 +2172,9 @@ var require_ansis = __commonJS({ "../../node_modules/.pnpm/ansis@4.1.0/node_modu
|
|
|
2154
2172
|
hidden: c$1(8, 28),
|
|
2155
2173
|
strikethrough: c$1(9, 29)
|
|
2156
2174
|
}, 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$
|
|
2175
|
+
return "black,red,green,yellow,blue,magenta,cyan,white,gray".split(",").map((e$2, t$2) => {
|
|
2176
|
+
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);
|
|
2177
|
+
}), t$1.extend(M);
|
|
2160
2178
|
}, y = new w();
|
|
2161
2179
|
module.exports = y, y.default = y;
|
|
2162
2180
|
} });
|
|
@@ -2313,6 +2331,7 @@ const TreeshakingOptionsSchema = union([boolean(), looseObject({
|
|
|
2313
2331
|
unknownGlobalSideEffects: optional(boolean()),
|
|
2314
2332
|
commonjs: optional(boolean())
|
|
2315
2333
|
})]);
|
|
2334
|
+
const OptimizationOptionsSchema = strictObject({ inlineConst: pipe(optional(boolean()), description("Enable crossmodule constant inlining")) });
|
|
2316
2335
|
const OnLogSchema = pipe(function_(), args(tuple([
|
|
2317
2336
|
LogLevelSchema,
|
|
2318
2337
|
RollupLogSchema,
|
|
@@ -2338,6 +2357,7 @@ const InputOptionsSchema = strictObject({
|
|
|
2338
2357
|
])), description(`Platform for which the code should be generated (node, ${ansis_default.underline("browser")}, neutral)`)),
|
|
2339
2358
|
shimMissingExports: pipe(optional(boolean()), description("Create shim variables for missing exports")),
|
|
2340
2359
|
treeshake: optional(TreeshakingOptionsSchema),
|
|
2360
|
+
optimization: optional(OptimizationOptionsSchema),
|
|
2341
2361
|
logLevel: pipe(optional(LogLevelOptionSchema), description(`Log level (${ansis_default.dim("silent")}, ${ansis_default.underline(ansis_default.gray("info"))}, debug, ${ansis_default.yellow("warn")})`)),
|
|
2342
2362
|
onLog: optional(OnLogSchema),
|
|
2343
2363
|
onwarn: optional(OnwarnSchema),
|
|
@@ -2560,41 +2580,9 @@ function validateOption(key, options) {
|
|
|
2560
2580
|
}
|
|
2561
2581
|
}
|
|
2562
2582
|
|
|
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
2583
|
//#endregion
|
|
2596
2584
|
//#region src/types/sourcemap.ts
|
|
2597
|
-
function bindingifySourcemap(map) {
|
|
2585
|
+
function bindingifySourcemap$1(map) {
|
|
2598
2586
|
if (map == null) return;
|
|
2599
2587
|
return { inner: typeof map === "string" ? map : {
|
|
2600
2588
|
file: map.file ?? void 0,
|
|
@@ -2794,8 +2782,8 @@ function exclude(expr) {
|
|
|
2794
2782
|
//#endregion
|
|
2795
2783
|
//#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-D6FCK2GA.js
|
|
2796
2784
|
function u$1(o$1, n$1, a$2) {
|
|
2797
|
-
let t$
|
|
2798
|
-
return a$2 === void 0 ? t$
|
|
2785
|
+
let t$1 = (r$1) => o$1(r$1, ...n$1);
|
|
2786
|
+
return a$2 === void 0 ? t$1 : Object.assign(t$1, {
|
|
2799
2787
|
lazy: a$2,
|
|
2800
2788
|
lazyArgs: n$1
|
|
2801
2789
|
});
|
|
@@ -2815,18 +2803,12 @@ function u(r$1, n$1, o$1) {
|
|
|
2815
2803
|
function d(...r$1) {
|
|
2816
2804
|
return u(i, r$1);
|
|
2817
2805
|
}
|
|
2818
|
-
var i = (r$1, t$
|
|
2806
|
+
var i = (r$1, t$1) => {
|
|
2819
2807
|
let a$2 = [[], []];
|
|
2820
|
-
for (let [o$1, e$1] of r$1.entries()) t$
|
|
2808
|
+
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
2809
|
return a$2;
|
|
2822
2810
|
};
|
|
2823
2811
|
|
|
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
2812
|
//#endregion
|
|
2831
2813
|
//#region src/plugin/bindingify-hook-filter.ts
|
|
2832
2814
|
function generalHookFilterMatcherToFilterExprs(matcher, stringKind) {
|
|
@@ -2984,7 +2966,7 @@ function bindingPluginOrder(order) {
|
|
|
2984
2966
|
}
|
|
2985
2967
|
|
|
2986
2968
|
//#endregion
|
|
2987
|
-
//#region ../../node_modules/.pnpm/oxc-parser@0.75.
|
|
2969
|
+
//#region ../../node_modules/.pnpm/oxc-parser@0.75.1/node_modules/oxc-parser/wrap.mjs
|
|
2988
2970
|
function wrap$1(result) {
|
|
2989
2971
|
let program, module$1, comments, errors;
|
|
2990
2972
|
return {
|
|
@@ -3202,7 +3184,7 @@ function bindingifyBuildStart(args$1) {
|
|
|
3202
3184
|
const { handler, meta } = normalizeHook(hook);
|
|
3203
3185
|
return {
|
|
3204
3186
|
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),
|
|
3187
|
+
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
3188
|
},
|
|
3207
3189
|
meta: bindingifyPluginHookMeta(meta)
|
|
3208
3190
|
};
|
|
@@ -3225,12 +3207,10 @@ function bindingifyResolveId(args$1) {
|
|
|
3225
3207
|
return {
|
|
3226
3208
|
plugin: async (ctx, specifier, importer, extraOptions) => {
|
|
3227
3209
|
const contextResolveOptions = extraOptions.custom != null ? args$1.pluginContextData.getSavedResolveOptions(extraOptions.custom) : void 0;
|
|
3228
|
-
const
|
|
3210
|
+
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
3211
|
...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);
|
|
3212
|
+
custom: contextResolveOptions?.custom
|
|
3213
|
+
});
|
|
3234
3214
|
if (ret == null) return;
|
|
3235
3215
|
if (ret === false) return {
|
|
3236
3216
|
id: specifier,
|
|
@@ -3301,7 +3281,7 @@ function bindingifyTransform(args$1) {
|
|
|
3301
3281
|
});
|
|
3302
3282
|
return {
|
|
3303
3283
|
code: ret.code,
|
|
3304
|
-
map: bindingifySourcemap(normalizeTransformHookSourcemap(id$1, code$1, ret.map)),
|
|
3284
|
+
map: bindingifySourcemap$1(normalizeTransformHookSourcemap(id$1, code$1, ret.map)),
|
|
3305
3285
|
sideEffects: bindingifySideEffects(moduleOption.moduleSideEffects),
|
|
3306
3286
|
moduleType: ret.moduleType
|
|
3307
3287
|
};
|
|
@@ -3327,7 +3307,7 @@ function bindingifyLoad(args$1) {
|
|
|
3327
3307
|
let map = preProcessSourceMap(ret, id$1);
|
|
3328
3308
|
return {
|
|
3329
3309
|
code: ret.code,
|
|
3330
|
-
map: bindingifySourcemap(map),
|
|
3310
|
+
map: bindingifySourcemap$1(map),
|
|
3331
3311
|
moduleType: ret.moduleType,
|
|
3332
3312
|
sideEffects: bindingifySideEffects(moduleOption.moduleSideEffects)
|
|
3333
3313
|
};
|
|
@@ -3358,25 +3338,6 @@ function bindingifyModuleParsed(args$1) {
|
|
|
3358
3338
|
};
|
|
3359
3339
|
}
|
|
3360
3340
|
|
|
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
3341
|
//#endregion
|
|
3381
3342
|
//#region src/utils/transform-rendered-module.ts
|
|
3382
3343
|
function transformToRenderedModule(bindingRenderedModule) {
|
|
@@ -3443,338 +3404,125 @@ function transformChunkModules(modules) {
|
|
|
3443
3404
|
}
|
|
3444
3405
|
|
|
3445
3406
|
//#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
|
|
3407
|
+
//#region src/utils/transform-to-rollup-output.ts
|
|
3408
|
+
function transformToRollupSourceMap(map) {
|
|
3409
|
+
const parsed = JSON.parse(map);
|
|
3410
|
+
const obj = {
|
|
3411
|
+
...parsed,
|
|
3412
|
+
toString() {
|
|
3413
|
+
return JSON.stringify(obj);
|
|
3414
|
+
},
|
|
3415
|
+
toUrl() {
|
|
3416
|
+
return `data:application/json;charset=utf-8;base64,${Buffer.from(obj.toString(), "utf-8").toString("base64")}`;
|
|
3417
|
+
}
|
|
3484
3418
|
};
|
|
3419
|
+
return obj;
|
|
3485
3420
|
}
|
|
3486
|
-
function
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3421
|
+
function transformToRollupOutputChunk(bindingChunk, changed) {
|
|
3422
|
+
const chunk = {
|
|
3423
|
+
type: "chunk",
|
|
3424
|
+
get code() {
|
|
3425
|
+
return bindingChunk.code;
|
|
3426
|
+
},
|
|
3427
|
+
fileName: bindingChunk.fileName,
|
|
3428
|
+
name: bindingChunk.name,
|
|
3429
|
+
get modules() {
|
|
3430
|
+
return transformChunkModules(bindingChunk.modules);
|
|
3431
|
+
},
|
|
3432
|
+
get imports() {
|
|
3433
|
+
return bindingChunk.imports;
|
|
3434
|
+
},
|
|
3435
|
+
get dynamicImports() {
|
|
3436
|
+
return bindingChunk.dynamicImports;
|
|
3437
|
+
},
|
|
3438
|
+
exports: bindingChunk.exports,
|
|
3439
|
+
isEntry: bindingChunk.isEntry,
|
|
3440
|
+
facadeModuleId: bindingChunk.facadeModuleId || null,
|
|
3441
|
+
isDynamicEntry: bindingChunk.isDynamicEntry,
|
|
3442
|
+
get moduleIds() {
|
|
3443
|
+
return bindingChunk.moduleIds;
|
|
3444
|
+
},
|
|
3445
|
+
get map() {
|
|
3446
|
+
return bindingChunk.map ? transformToRollupSourceMap(bindingChunk.map) : null;
|
|
3447
|
+
},
|
|
3448
|
+
sourcemapFileName: bindingChunk.sourcemapFileName || null,
|
|
3449
|
+
preliminaryFileName: bindingChunk.preliminaryFileName
|
|
3490
3450
|
};
|
|
3451
|
+
const cache = {};
|
|
3452
|
+
return new Proxy(chunk, {
|
|
3453
|
+
get(target, p$1) {
|
|
3454
|
+
if (p$1 in cache) return cache[p$1];
|
|
3455
|
+
const value = target[p$1];
|
|
3456
|
+
cache[p$1] = value;
|
|
3457
|
+
return value;
|
|
3458
|
+
},
|
|
3459
|
+
set(target, p$1, newValue) {
|
|
3460
|
+
cache[p$1] = newValue;
|
|
3461
|
+
changed?.updated.add(bindingChunk.fileName);
|
|
3462
|
+
return true;
|
|
3463
|
+
},
|
|
3464
|
+
has(target, p$1) {
|
|
3465
|
+
if (p$1 in cache) return true;
|
|
3466
|
+
return p$1 in target;
|
|
3467
|
+
}
|
|
3468
|
+
});
|
|
3491
3469
|
}
|
|
3492
|
-
function
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
}
|
|
3470
|
+
function transformToRollupOutputAsset(bindingAsset, changed) {
|
|
3471
|
+
const asset = {
|
|
3472
|
+
type: "asset",
|
|
3473
|
+
fileName: bindingAsset.fileName,
|
|
3474
|
+
originalFileName: bindingAsset.originalFileName || null,
|
|
3475
|
+
originalFileNames: bindingAsset.originalFileNames,
|
|
3476
|
+
get source() {
|
|
3477
|
+
return transformAssetSource(bindingAsset.source);
|
|
3478
|
+
},
|
|
3479
|
+
name: bindingAsset.name ?? void 0,
|
|
3480
|
+
names: bindingAsset.names
|
|
3481
|
+
};
|
|
3482
|
+
const cache = {};
|
|
3483
|
+
return new Proxy(asset, {
|
|
3484
|
+
get(target, p$1) {
|
|
3485
|
+
if (p$1 in cache) return cache[p$1];
|
|
3486
|
+
const value = target[p$1];
|
|
3487
|
+
cache[p$1] = value;
|
|
3488
|
+
return value;
|
|
3489
|
+
},
|
|
3490
|
+
set(target, p$1, newValue) {
|
|
3491
|
+
cache[p$1] = newValue;
|
|
3492
|
+
changed?.updated.add(bindingAsset.fileName);
|
|
3493
|
+
return true;
|
|
3494
|
+
}
|
|
3495
|
+
});
|
|
3504
3496
|
}
|
|
3505
|
-
function
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
case false:
|
|
3510
|
-
case void 0: return void 0;
|
|
3511
|
-
case "hidden": return "hidden";
|
|
3512
|
-
default: throw new Error(`unknown sourcemap: ${sourcemap}`);
|
|
3513
|
-
}
|
|
3497
|
+
function transformToRollupOutput(output, changed) {
|
|
3498
|
+
handleOutputErrors(output);
|
|
3499
|
+
const { chunks, assets } = output;
|
|
3500
|
+
return { output: [...chunks.map((chunk) => transformToRollupOutputChunk(chunk, changed)), ...assets.map((asset) => transformToRollupOutputAsset(asset, changed))] };
|
|
3514
3501
|
}
|
|
3515
|
-
function
|
|
3516
|
-
|
|
3502
|
+
function handleOutputErrors(output) {
|
|
3503
|
+
const rawErrors = output.errors;
|
|
3504
|
+
if (rawErrors.length > 0) throw normalizeErrors(rawErrors);
|
|
3517
3505
|
}
|
|
3518
|
-
function
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
groups: groups?.map((group) => {
|
|
3539
|
-
const { name,...restGroup } = group;
|
|
3540
|
-
return {
|
|
3541
|
-
...restGroup,
|
|
3542
|
-
name: typeof name === "function" ? (id$1, ctx) => name(id$1, new ChunkingContext(ctx)) : name
|
|
3543
|
-
};
|
|
3544
|
-
})
|
|
3545
|
-
};
|
|
3546
|
-
}
|
|
3547
|
-
|
|
3548
|
-
//#endregion
|
|
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
|
-
});
|
|
3506
|
+
function transformToOutputBundle(context, output, changed) {
|
|
3507
|
+
const bundle = Object.fromEntries(transformToRollupOutput(output, changed).output.map((item) => [item.fileName, item]));
|
|
3508
|
+
return new Proxy(bundle, {
|
|
3509
|
+
set(_target, _p, _newValue, _receiver) {
|
|
3510
|
+
const originalStackTraceLimit = Error.stackTraceLimit;
|
|
3511
|
+
Error.stackTraceLimit = 2;
|
|
3512
|
+
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.";
|
|
3513
|
+
const stack = new Error(message).stack ?? message;
|
|
3514
|
+
Error.stackTraceLimit = originalStackTraceLimit;
|
|
3515
|
+
context.warn({
|
|
3516
|
+
message: stack,
|
|
3517
|
+
code: "UNSUPPORTED_BUNDLE_ASSIGNMENT"
|
|
3518
|
+
});
|
|
3519
|
+
return true;
|
|
3520
|
+
},
|
|
3521
|
+
deleteProperty(target, property) {
|
|
3522
|
+
if (typeof property === "string") changed.deleted.add(property);
|
|
3523
|
+
return true;
|
|
3524
|
+
}
|
|
3525
|
+
});
|
|
3778
3526
|
}
|
|
3779
3527
|
function collectChangedBundle(changed, bundle) {
|
|
3780
3528
|
const assets = [];
|
|
@@ -3800,7 +3548,7 @@ function collectChangedBundle(changed, bundle) {
|
|
|
3800
3548
|
facadeModuleId: item.facadeModuleId || void 0,
|
|
3801
3549
|
isDynamicEntry: item.isDynamicEntry,
|
|
3802
3550
|
moduleIds: item.moduleIds,
|
|
3803
|
-
map: bindingifySourcemap(item.map),
|
|
3551
|
+
map: bindingifySourcemap$1(item.map),
|
|
3804
3552
|
sourcemapFilename: item.sourcemapFileName || void 0,
|
|
3805
3553
|
preliminaryFilename: item.preliminaryFileName
|
|
3806
3554
|
});
|
|
@@ -3820,7 +3568,7 @@ function bindingifyRenderStart(args$1) {
|
|
|
3820
3568
|
const { handler, meta } = normalizeHook(hook);
|
|
3821
3569
|
return {
|
|
3822
3570
|
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),
|
|
3571
|
+
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
3572
|
},
|
|
3825
3573
|
meta: bindingifyPluginHookMeta(meta)
|
|
3826
3574
|
};
|
|
@@ -3832,13 +3580,13 @@ function bindingifyRenderChunk(args$1) {
|
|
|
3832
3580
|
return {
|
|
3833
3581
|
plugin: async (ctx, code$1, chunk, opts, meta$1) => {
|
|
3834
3582
|
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),
|
|
3583
|
+
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
3584
|
if (ret == null) return;
|
|
3837
3585
|
if (typeof ret === "string") return { code: ret };
|
|
3838
3586
|
if (!ret.map) return { code: ret.code };
|
|
3839
3587
|
return {
|
|
3840
3588
|
code: ret.code,
|
|
3841
|
-
map: bindingifySourcemap(ret.map)
|
|
3589
|
+
map: bindingifySourcemap$1(ret.map)
|
|
3842
3590
|
};
|
|
3843
3591
|
},
|
|
3844
3592
|
meta: bindingifyPluginHookMeta(meta),
|
|
@@ -3879,7 +3627,7 @@ function bindingifyGenerateBundle(args$1) {
|
|
|
3879
3627
|
};
|
|
3880
3628
|
const context = new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode);
|
|
3881
3629
|
const output = transformToOutputBundle(context, bundle, changed);
|
|
3882
|
-
await handler.call(context,
|
|
3630
|
+
await handler.call(context, args$1.pluginContextData.getOutputOptions(opts), output, isWrite);
|
|
3883
3631
|
return collectChangedBundle(changed, output);
|
|
3884
3632
|
},
|
|
3885
3633
|
meta: bindingifyPluginHookMeta(meta)
|
|
@@ -3897,7 +3645,7 @@ function bindingifyWriteBundle(args$1) {
|
|
|
3897
3645
|
};
|
|
3898
3646
|
const context = new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode);
|
|
3899
3647
|
const output = transformToOutputBundle(context, bundle, changed);
|
|
3900
|
-
await handler.call(context,
|
|
3648
|
+
await handler.call(context, args$1.pluginContextData.getOutputOptions(opts), output);
|
|
3901
3649
|
return collectChangedBundle(changed, output);
|
|
3902
3650
|
},
|
|
3903
3651
|
meta: bindingifyPluginHookMeta(meta)
|
|
@@ -4172,19 +3920,280 @@ function wrapHandlers(plugin) {
|
|
|
4172
3920
|
}
|
|
4173
3921
|
|
|
4174
3922
|
//#endregion
|
|
4175
|
-
//#region src/
|
|
4176
|
-
var
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
3923
|
+
//#region src/options/normalized-input-options.ts
|
|
3924
|
+
var NormalizedInputOptionsImpl = class {
|
|
3925
|
+
inner;
|
|
3926
|
+
constructor(inner, onLog) {
|
|
3927
|
+
this.onLog = onLog;
|
|
3928
|
+
this.inner = inner;
|
|
3929
|
+
}
|
|
3930
|
+
get shimMissingExports() {
|
|
3931
|
+
return this.inner.shimMissingExports;
|
|
3932
|
+
}
|
|
3933
|
+
get input() {
|
|
3934
|
+
return this.inner.input;
|
|
3935
|
+
}
|
|
3936
|
+
get cwd() {
|
|
3937
|
+
return this.inner.cwd ?? void 0;
|
|
3938
|
+
}
|
|
3939
|
+
get platform() {
|
|
3940
|
+
return this.inner.platform;
|
|
3941
|
+
}
|
|
3942
|
+
};
|
|
3943
|
+
|
|
3944
|
+
//#endregion
|
|
3945
|
+
//#region src/types/chunking-context.ts
|
|
3946
|
+
var ChunkingContextImpl = class {
|
|
3947
|
+
constructor(context) {
|
|
3948
|
+
this.context = context;
|
|
3949
|
+
}
|
|
3950
|
+
getModuleInfo(moduleId) {
|
|
3951
|
+
const bindingInfo = this.context.getModuleInfo(moduleId);
|
|
3952
|
+
if (bindingInfo) {
|
|
3953
|
+
const info = transformModuleInfo(bindingInfo, {
|
|
3954
|
+
moduleSideEffects: null,
|
|
3955
|
+
meta: {}
|
|
3956
|
+
});
|
|
3957
|
+
return info;
|
|
3958
|
+
}
|
|
3959
|
+
return null;
|
|
3960
|
+
}
|
|
3961
|
+
};
|
|
3962
|
+
|
|
3963
|
+
//#endregion
|
|
3964
|
+
//#region src/utils/bindingify-output-options.ts
|
|
3965
|
+
function bindingifyOutputOptions(outputOptions) {
|
|
3966
|
+
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;
|
|
3967
|
+
const advancedChunks = bindingifyAdvancedChunks(outputOptions.advancedChunks, manualChunks);
|
|
3968
|
+
return {
|
|
3969
|
+
dir,
|
|
3970
|
+
file: file == null ? void 0 : file,
|
|
3971
|
+
format: bindingifyFormat(format$1),
|
|
3972
|
+
exports,
|
|
3973
|
+
hashCharacters,
|
|
3974
|
+
sourcemap: bindingifySourcemap(sourcemap),
|
|
3975
|
+
sourcemapDebugIds,
|
|
3976
|
+
sourcemapIgnoreList: bindingifySourcemapIgnoreList(sourcemapIgnoreList),
|
|
3977
|
+
sourcemapPathTransform,
|
|
3978
|
+
banner: bindingifyAddon(banner),
|
|
3979
|
+
footer: bindingifyAddon(footer),
|
|
3980
|
+
intro: bindingifyAddon(intro),
|
|
3981
|
+
outro: bindingifyAddon(outro),
|
|
3982
|
+
extend: outputOptions.extend,
|
|
3983
|
+
globals,
|
|
3984
|
+
esModule,
|
|
3985
|
+
name,
|
|
3986
|
+
assetFileNames: bindingifyAssetFilenames(assetFileNames),
|
|
3987
|
+
entryFileNames,
|
|
3988
|
+
chunkFileNames,
|
|
3989
|
+
cssEntryFileNames,
|
|
3990
|
+
cssChunkFileNames,
|
|
3991
|
+
plugins: [],
|
|
3992
|
+
minify: outputOptions.minify,
|
|
3993
|
+
externalLiveBindings: outputOptions.externalLiveBindings,
|
|
3994
|
+
inlineDynamicImports: outputOptions.inlineDynamicImports,
|
|
3995
|
+
advancedChunks,
|
|
3996
|
+
polyfillRequire: outputOptions.polyfillRequire,
|
|
3997
|
+
sanitizeFileName,
|
|
3998
|
+
preserveModules,
|
|
3999
|
+
virtualDirname,
|
|
4000
|
+
legalComments,
|
|
4001
|
+
preserveModulesRoot
|
|
4002
|
+
};
|
|
4003
|
+
}
|
|
4004
|
+
function bindingifyAddon(configAddon) {
|
|
4005
|
+
return async (chunk) => {
|
|
4006
|
+
if (typeof configAddon === "function") return configAddon(transformRenderedChunk(chunk));
|
|
4007
|
+
return configAddon || "";
|
|
4008
|
+
};
|
|
4009
|
+
}
|
|
4010
|
+
function bindingifyFormat(format$1) {
|
|
4011
|
+
switch (format$1) {
|
|
4012
|
+
case void 0:
|
|
4013
|
+
case "es":
|
|
4014
|
+
case "esm":
|
|
4015
|
+
case "module": return "es";
|
|
4016
|
+
case "cjs":
|
|
4017
|
+
case "commonjs": return "cjs";
|
|
4018
|
+
case "iife": return "iife";
|
|
4019
|
+
case "umd": return "umd";
|
|
4020
|
+
default: unimplemented(`output.format: ${format$1}`);
|
|
4021
|
+
}
|
|
4022
|
+
}
|
|
4023
|
+
function bindingifySourcemap(sourcemap) {
|
|
4024
|
+
switch (sourcemap) {
|
|
4025
|
+
case true: return "file";
|
|
4026
|
+
case "inline": return "inline";
|
|
4027
|
+
case false:
|
|
4028
|
+
case void 0: return void 0;
|
|
4029
|
+
case "hidden": return "hidden";
|
|
4030
|
+
default: throw new Error(`unknown sourcemap: ${sourcemap}`);
|
|
4031
|
+
}
|
|
4032
|
+
}
|
|
4033
|
+
function bindingifySourcemapIgnoreList(sourcemapIgnoreList) {
|
|
4034
|
+
return typeof sourcemapIgnoreList === "function" ? sourcemapIgnoreList : sourcemapIgnoreList === false ? () => false : (relativeSourcePath, _sourcemapPath) => relativeSourcePath.includes("node_modules");
|
|
4035
|
+
}
|
|
4036
|
+
function bindingifyAssetFilenames(assetFileNames) {
|
|
4037
|
+
if (typeof assetFileNames === "function") return (asset) => {
|
|
4038
|
+
return assetFileNames({
|
|
4039
|
+
names: asset.names,
|
|
4040
|
+
originalFileNames: asset.originalFileNames,
|
|
4041
|
+
source: transformAssetSource(asset.source),
|
|
4042
|
+
type: "asset"
|
|
4043
|
+
});
|
|
4044
|
+
};
|
|
4045
|
+
return assetFileNames;
|
|
4046
|
+
}
|
|
4047
|
+
function bindingifyAdvancedChunks(advancedChunks, manualChunks) {
|
|
4048
|
+
if (manualChunks != null && advancedChunks != null) console.warn("`manualChunks` option is ignored due to `advancedChunks` option is specified.");
|
|
4049
|
+
else if (manualChunks != null) advancedChunks = { groups: [{ name(moduleId, ctx) {
|
|
4050
|
+
return manualChunks(moduleId, { getModuleInfo: (id$1) => ctx.getModuleInfo(id$1) });
|
|
4051
|
+
} }] };
|
|
4052
|
+
if (advancedChunks == null) return void 0;
|
|
4053
|
+
const { groups,...restAdvancedChunks } = advancedChunks;
|
|
4054
|
+
return {
|
|
4055
|
+
...restAdvancedChunks,
|
|
4056
|
+
groups: groups?.map((group) => {
|
|
4057
|
+
const { name,...restGroup } = group;
|
|
4058
|
+
return {
|
|
4059
|
+
...restGroup,
|
|
4060
|
+
name: typeof name === "function" ? (id$1, ctx) => name(id$1, new ChunkingContextImpl(ctx)) : name
|
|
4061
|
+
};
|
|
4062
|
+
})
|
|
4063
|
+
};
|
|
4064
|
+
}
|
|
4065
|
+
|
|
4066
|
+
//#endregion
|
|
4067
|
+
//#region src/options/normalized-output-options.ts
|
|
4068
|
+
var NormalizedOutputOptionsImpl = class {
|
|
4069
|
+
constructor(inner, outputOptions, normalizedOutputPlugins) {
|
|
4070
|
+
this.inner = inner;
|
|
4071
|
+
this.outputOptions = outputOptions;
|
|
4072
|
+
this.normalizedOutputPlugins = normalizedOutputPlugins;
|
|
4073
|
+
}
|
|
4074
|
+
get dir() {
|
|
4075
|
+
return this.inner.dir ?? void 0;
|
|
4076
|
+
}
|
|
4077
|
+
get entryFileNames() {
|
|
4078
|
+
return this.inner.entryFilenames || this.outputOptions.entryFileNames;
|
|
4079
|
+
}
|
|
4080
|
+
get chunkFileNames() {
|
|
4081
|
+
return this.inner.chunkFilenames || this.outputOptions.chunkFileNames;
|
|
4082
|
+
}
|
|
4083
|
+
get assetFileNames() {
|
|
4084
|
+
return this.inner.assetFilenames || this.outputOptions.assetFileNames;
|
|
4085
|
+
}
|
|
4086
|
+
get format() {
|
|
4087
|
+
return this.inner.format;
|
|
4088
|
+
}
|
|
4089
|
+
get exports() {
|
|
4090
|
+
return this.inner.exports;
|
|
4091
|
+
}
|
|
4092
|
+
get sourcemap() {
|
|
4093
|
+
return this.inner.sourcemap;
|
|
4094
|
+
}
|
|
4095
|
+
get cssEntryFileNames() {
|
|
4096
|
+
return this.inner.cssEntryFilenames || this.outputOptions.cssEntryFileNames;
|
|
4097
|
+
}
|
|
4098
|
+
get cssChunkFileNames() {
|
|
4099
|
+
return this.inner.cssChunkFilenames || this.outputOptions.cssChunkFileNames;
|
|
4100
|
+
}
|
|
4101
|
+
get shimMissingExports() {
|
|
4102
|
+
return this.inner.shimMissingExports;
|
|
4103
|
+
}
|
|
4104
|
+
get name() {
|
|
4105
|
+
return this.inner.name ?? void 0;
|
|
4106
|
+
}
|
|
4107
|
+
get file() {
|
|
4108
|
+
return this.inner.file ?? void 0;
|
|
4109
|
+
}
|
|
4110
|
+
get inlineDynamicImports() {
|
|
4111
|
+
return this.inner.inlineDynamicImports;
|
|
4112
|
+
}
|
|
4113
|
+
get externalLiveBindings() {
|
|
4114
|
+
return this.inner.externalLiveBindings;
|
|
4115
|
+
}
|
|
4116
|
+
get banner() {
|
|
4117
|
+
return normalizeAddon(this.outputOptions.banner);
|
|
4118
|
+
}
|
|
4119
|
+
get footer() {
|
|
4120
|
+
return normalizeAddon(this.outputOptions.footer);
|
|
4121
|
+
}
|
|
4122
|
+
get intro() {
|
|
4123
|
+
return normalizeAddon(this.outputOptions.intro);
|
|
4124
|
+
}
|
|
4125
|
+
get outro() {
|
|
4126
|
+
return normalizeAddon(this.outputOptions.outro);
|
|
4127
|
+
}
|
|
4128
|
+
get esModule() {
|
|
4129
|
+
return this.inner.esModule;
|
|
4130
|
+
}
|
|
4131
|
+
get extend() {
|
|
4132
|
+
return this.inner.extend;
|
|
4133
|
+
}
|
|
4134
|
+
get globals() {
|
|
4135
|
+
return this.inner.globals || this.outputOptions.globals;
|
|
4136
|
+
}
|
|
4137
|
+
get hashCharacters() {
|
|
4138
|
+
return this.inner.hashCharacters;
|
|
4139
|
+
}
|
|
4140
|
+
get sourcemapDebugIds() {
|
|
4141
|
+
return this.inner.sourcemapDebugIds;
|
|
4142
|
+
}
|
|
4143
|
+
get sourcemapIgnoreList() {
|
|
4144
|
+
return bindingifySourcemapIgnoreList(this.outputOptions.sourcemapIgnoreList);
|
|
4145
|
+
}
|
|
4146
|
+
get sourcemapPathTransform() {
|
|
4147
|
+
return this.outputOptions.sourcemapPathTransform;
|
|
4148
|
+
}
|
|
4149
|
+
get minify() {
|
|
4150
|
+
return this.inner.minify;
|
|
4151
|
+
}
|
|
4152
|
+
get legalComments() {
|
|
4153
|
+
return this.inner.legalComments;
|
|
4154
|
+
}
|
|
4155
|
+
get polyfillRequire() {
|
|
4156
|
+
return this.inner.polyfillRequire;
|
|
4157
|
+
}
|
|
4158
|
+
get plugins() {
|
|
4159
|
+
return this.normalizedOutputPlugins;
|
|
4160
|
+
}
|
|
4161
|
+
get preserveModules() {
|
|
4162
|
+
return this.inner.preserveModules;
|
|
4163
|
+
}
|
|
4164
|
+
get preserveModulesRoot() {
|
|
4165
|
+
return this.inner.preserveModulesRoot;
|
|
4166
|
+
}
|
|
4167
|
+
get virtualDirname() {
|
|
4168
|
+
return this.inner.virtualDirname;
|
|
4169
|
+
}
|
|
4170
|
+
};
|
|
4171
|
+
function normalizeAddon(value) {
|
|
4172
|
+
if (typeof value === "function") return value;
|
|
4173
|
+
return () => value || "";
|
|
4174
|
+
}
|
|
4175
|
+
|
|
4176
|
+
//#endregion
|
|
4177
|
+
//#region src/plugin/plugin-context-data.ts
|
|
4178
|
+
var PluginContextData = class {
|
|
4179
|
+
moduleOptionMap = /* @__PURE__ */ new Map();
|
|
4180
|
+
resolveOptionsMap = /* @__PURE__ */ new Map();
|
|
4181
|
+
loadModulePromiseMap = /* @__PURE__ */ new Map();
|
|
4182
|
+
loadModulePromiseResolveFnMap = /* @__PURE__ */ new Map();
|
|
4183
|
+
renderedChunkMeta = null;
|
|
4184
|
+
normalizedInputOptions = null;
|
|
4185
|
+
normalizedOutputOptions = null;
|
|
4186
|
+
constructor(onLog, outputOptions, normalizedOutputPlugins) {
|
|
4187
|
+
this.onLog = onLog;
|
|
4188
|
+
this.outputOptions = outputOptions;
|
|
4189
|
+
this.normalizedOutputPlugins = normalizedOutputPlugins;
|
|
4190
|
+
}
|
|
4191
|
+
updateModuleOption(id$1, option) {
|
|
4192
|
+
const existing = this.moduleOptionMap.get(id$1);
|
|
4193
|
+
if (existing) {
|
|
4194
|
+
if (option.moduleSideEffects != null) existing.moduleSideEffects = option.moduleSideEffects;
|
|
4195
|
+
if (option.meta != null) Object.assign(existing.meta, option.meta);
|
|
4196
|
+
if (option.invalidate != null) existing.invalidate = option.invalidate;
|
|
4188
4197
|
} else {
|
|
4189
4198
|
this.moduleOptionMap.set(id$1, option);
|
|
4190
4199
|
return option;
|
|
@@ -4249,6 +4258,14 @@ var PluginContextData = class {
|
|
|
4249
4258
|
getRenderChunkMeta() {
|
|
4250
4259
|
return this.renderedChunkMeta;
|
|
4251
4260
|
}
|
|
4261
|
+
getInputOptions(opts) {
|
|
4262
|
+
this.normalizedInputOptions ??= new NormalizedInputOptionsImpl(opts, this.onLog);
|
|
4263
|
+
return this.normalizedInputOptions;
|
|
4264
|
+
}
|
|
4265
|
+
getOutputOptions(opts) {
|
|
4266
|
+
this.normalizedOutputOptions ??= new NormalizedOutputOptionsImpl(opts, this.outputOptions, this.normalizedOutputPlugins);
|
|
4267
|
+
return this.normalizedOutputOptions;
|
|
4268
|
+
}
|
|
4252
4269
|
markModuleLoaded(id$1, _success) {
|
|
4253
4270
|
const resolve$1 = this.loadModulePromiseResolveFnMap.get(id$1);
|
|
4254
4271
|
if (resolve$1) resolve$1();
|
|
@@ -4260,28 +4277,16 @@ var PluginContextData = class {
|
|
|
4260
4277
|
}
|
|
4261
4278
|
};
|
|
4262
4279
|
|
|
4263
|
-
//#endregion
|
|
4264
|
-
//#region src/utils/normalize-string-or-regex.ts
|
|
4265
|
-
function normalizedStringOrRegex(pattern) {
|
|
4266
|
-
if (!pattern) return void 0;
|
|
4267
|
-
if (!isReadonlyArray(pattern)) return [pattern];
|
|
4268
|
-
return pattern;
|
|
4269
|
-
}
|
|
4270
|
-
function isReadonlyArray(input) {
|
|
4271
|
-
return Array.isArray(input);
|
|
4272
|
-
}
|
|
4273
|
-
|
|
4274
4280
|
//#endregion
|
|
4275
4281
|
//#region src/utils/bindingify-input-options.ts
|
|
4276
4282
|
function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode) {
|
|
4277
|
-
const pluginContextData = new PluginContextData();
|
|
4283
|
+
const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedOutputPlugins);
|
|
4278
4284
|
const plugins = rawPlugins.map((plugin) => {
|
|
4279
4285
|
if ("_parallel" in plugin) return void 0;
|
|
4280
4286
|
if (plugin instanceof BuiltinPlugin) return bindingifyBuiltInPlugin(plugin);
|
|
4281
4287
|
return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode);
|
|
4282
4288
|
});
|
|
4283
|
-
const { jsx,
|
|
4284
|
-
const transform = inputOptions.transform || jsxTransform;
|
|
4289
|
+
const { jsx, transform } = bindingifyJsx(onLog, inputOptions.jsx, inputOptions.transform);
|
|
4285
4290
|
return {
|
|
4286
4291
|
input: bindingifyInput(inputOptions.input),
|
|
4287
4292
|
plugins,
|
|
@@ -4325,7 +4330,8 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
4325
4330
|
debug: inputOptions.debug,
|
|
4326
4331
|
invalidateJsSideCache: pluginContextData.clear.bind(pluginContextData),
|
|
4327
4332
|
markModuleLoaded: pluginContextData.markModuleLoaded.bind(pluginContextData),
|
|
4328
|
-
preserveEntrySignatures: bindingifyPreserveEntrySignatures(inputOptions.preserveEntrySignatures)
|
|
4333
|
+
preserveEntrySignatures: bindingifyPreserveEntrySignatures(inputOptions.preserveEntrySignatures),
|
|
4334
|
+
optimization: inputOptions.optimization
|
|
4329
4335
|
};
|
|
4330
4336
|
}
|
|
4331
4337
|
function bindingifyHmr(hmr) {
|
|
@@ -4415,24 +4421,45 @@ function bindingifyInput(input) {
|
|
|
4415
4421
|
};
|
|
4416
4422
|
});
|
|
4417
4423
|
}
|
|
4418
|
-
function bindingifyJsx(input) {
|
|
4424
|
+
function bindingifyJsx(onLog, input, transform) {
|
|
4425
|
+
if (transform?.jsx) {
|
|
4426
|
+
if (input !== void 0) onLog(LOG_LEVEL_WARN, logDuplicateJsxConfig());
|
|
4427
|
+
return { transform };
|
|
4428
|
+
}
|
|
4419
4429
|
if (typeof input === "object") {
|
|
4420
|
-
if (input.mode === "preserve") return {
|
|
4430
|
+
if (input.mode === "preserve") return {
|
|
4431
|
+
jsx: BindingJsx.Preserve,
|
|
4432
|
+
transform
|
|
4433
|
+
};
|
|
4421
4434
|
const mode = input.mode ?? "automatic";
|
|
4422
|
-
|
|
4435
|
+
transform ??= {};
|
|
4436
|
+
transform.jsx = {
|
|
4423
4437
|
runtime: mode,
|
|
4424
4438
|
pragma: input.factory,
|
|
4425
4439
|
pragmaFrag: input.fragment,
|
|
4426
4440
|
importSource: mode === "classic" ? input.importSource : mode === "automatic" ? input.jsxImportSource : void 0
|
|
4427
|
-
}
|
|
4441
|
+
};
|
|
4442
|
+
return { transform };
|
|
4428
4443
|
}
|
|
4444
|
+
let jsx;
|
|
4429
4445
|
switch (input) {
|
|
4430
|
-
case false:
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
case "
|
|
4434
|
-
|
|
4446
|
+
case false:
|
|
4447
|
+
jsx = BindingJsx.Disable;
|
|
4448
|
+
break;
|
|
4449
|
+
case "react":
|
|
4450
|
+
jsx = BindingJsx.React;
|
|
4451
|
+
break;
|
|
4452
|
+
case "react-jsx":
|
|
4453
|
+
jsx = BindingJsx.ReactJsx;
|
|
4454
|
+
break;
|
|
4455
|
+
case "preserve":
|
|
4456
|
+
jsx = BindingJsx.Preserve;
|
|
4457
|
+
break;
|
|
4435
4458
|
}
|
|
4459
|
+
return {
|
|
4460
|
+
jsx,
|
|
4461
|
+
transform
|
|
4462
|
+
};
|
|
4436
4463
|
}
|
|
4437
4464
|
function bindingifyWatch(watch$1) {
|
|
4438
4465
|
if (watch$1) return {
|
|
@@ -4482,323 +4509,6 @@ function bindingifyPreserveEntrySignatures(preserveEntrySignatures) {
|
|
|
4482
4509
|
};
|
|
4483
4510
|
}
|
|
4484
4511
|
|
|
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
4512
|
//#endregion
|
|
4803
4513
|
//#region src/utils/create-bundler-option.ts
|
|
4804
4514
|
async function createBundlerOptions(inputOptions, outputOptions, watchMode, isClose) {
|
|
@@ -4813,7 +4523,6 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode, isCl
|
|
|
4813
4523
|
...normalizePlugins(inputPlugins, ANONYMOUS_PLUGIN_PREFIX),
|
|
4814
4524
|
...checkOutputPluginOption(normalizePlugins(normalizedOutputPlugins, ANONYMOUS_OUTPUT_PLUGIN_PREFIX), onLog)
|
|
4815
4525
|
];
|
|
4816
|
-
if (inputOptions.experimental?.enableComposingJsPlugins ?? false) plugins = composeJsPlugins(plugins);
|
|
4817
4526
|
const parallelPluginInitResult = void 0;
|
|
4818
4527
|
try {
|
|
4819
4528
|
const bindingInputOptions = bindingifyInputOptions(plugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode);
|
|
@@ -5083,4 +4792,4 @@ function defineConfig(config) {
|
|
|
5083
4792
|
const VERSION = version;
|
|
5084
4793
|
|
|
5085
4794
|
//#endregion
|
|
5086
|
-
export { BuiltinPlugin, PluginDriver, VERSION, assetPlugin, build, buildImportAnalysisPlugin,
|
|
4795
|
+
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 };
|