@rolldown/browser 1.0.0-beta.40 → 1.0.0-beta.42
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.mjs +17 -9
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +4 -4
- package/dist/experimental-index.browser.mjs +22 -25
- package/dist/experimental-index.d.mts +17 -9
- package/dist/experimental-index.mjs +25 -28
- package/dist/experimental-runtime-types.d.ts +6 -0
- package/dist/filter-index.d.mts +2 -2
- package/dist/filter-index.mjs +1 -1
- package/dist/index.browser.mjs +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +3 -3
- package/dist/parallel-plugin-worker.mjs +5 -6
- package/dist/parallel-plugin.d.mts +2 -2
- package/dist/parse-ast-index.d.mts +1 -1
- package/dist/parse-ast-index.mjs +1 -1
- package/dist/rolldown-binding.wasi-browser.js +2 -1
- package/dist/rolldown-binding.wasi.cjs +2 -1
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/shared/{binding-BVXbXhPv.d.mts → binding-CtbNz6TD.d.mts} +29 -22
- package/dist/shared/{define-config-D9LkukIg.d.mts → define-config-xBdWOg15.d.mts} +27 -6
- package/dist/shared/{dist-CHTC3-kR.mjs → dist-CU0dSkK2.mjs} +2 -3
- package/dist/shared/{load-config-CU4Yss-9.mjs → load-config-B4-CoeU7.mjs} +4 -7
- package/dist/shared/{logger-CiCY7ucm.mjs → logger-B83ocDok.mjs} +6 -9
- package/dist/shared/{parse-ast-index-DuyJNdzo.mjs → parse-ast-index-Gktxd-oi.mjs} +1 -1
- package/dist/shared/{prompt-D2FxOcB5.mjs → prompt-B4e-jZUR.mjs} +28 -30
- package/dist/shared/{src-BfUPNTHw.mjs → src-DbG0hppv.mjs} +115 -125
- package/dist/{src-ChN10Pih.js → src-D_rsgcbb.js} +150 -163
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { augmentCodeLocation, error, logCycleLoading, logDuplicateJsxConfig, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-
|
|
2
|
-
import { and, arraify, code, exclude, id, include, moduleType, noop, or, unimplemented, unreachable, unsupported } from "./dist-
|
|
1
|
+
import { augmentCodeLocation, error, logCycleLoading, logDuplicateJsxConfig, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-Gktxd-oi.mjs";
|
|
2
|
+
import { and, arraify, code, exclude, id, include, moduleType, noop, or, unimplemented, unreachable, unsupported } from "./dist-CU0dSkK2.mjs";
|
|
3
3
|
import { Worker, isMainThread } from "node:worker_threads";
|
|
4
4
|
import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingChunkModuleOrderBy, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingPropertyReadSideEffects, BindingPropertyWriteSideEffects, BindingWatcher, ParallelJsPluginRegistry, initTraceSubscriber, shutdownAsyncRuntime, startAsyncRuntime } from "../rolldown-binding.wasi.cjs";
|
|
5
5
|
import path from "node:path";
|
|
@@ -243,7 +243,7 @@ if (isMainThread) {
|
|
|
243
243
|
|
|
244
244
|
//#endregion
|
|
245
245
|
//#region package.json
|
|
246
|
-
var version = "1.0.0-beta.
|
|
246
|
+
var version = "1.0.0-beta.42";
|
|
247
247
|
var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
248
248
|
|
|
249
249
|
//#endregion
|
|
@@ -590,20 +590,20 @@ function getSortedPlugins(hookName, plugins) {
|
|
|
590
590
|
}
|
|
591
591
|
|
|
592
592
|
//#endregion
|
|
593
|
-
//#region ../../node_modules/.pnpm/ansis@4.
|
|
594
|
-
var require_ansis = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ansis@4.
|
|
595
|
-
let e$1, t$2, r, { defineProperty:
|
|
596
|
-
let t$3 = /([a-f\d]{3,6})/i.exec(e$2)?.[1], r$1 = t$3?.length,
|
|
593
|
+
//#region ../../node_modules/.pnpm/ansis@4.2.0/node_modules/ansis/index.cjs
|
|
594
|
+
var require_ansis = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ansis@4.2.0/node_modules/ansis/index.cjs": ((exports, module) => {
|
|
595
|
+
let e$1, t$2, r, { defineProperty: l, setPrototypeOf: n$1, create: o, keys: s } = Object, i = "", { round: c, max: a$1 } = Math, p = (e$2) => {
|
|
596
|
+
let t$3 = /([a-f\d]{3,6})/i.exec(e$2)?.[1], r$1 = t$3?.length, l$1 = parseInt(6 ^ r$1 ? 3 ^ r$1 ? "0" : t$3[0] + t$3[0] + t$3[1] + t$3[1] + t$3[2] + t$3[2] : t$3, 16);
|
|
597
597
|
return [
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
255 &
|
|
598
|
+
l$1 >> 16 & 255,
|
|
599
|
+
l$1 >> 8 & 255,
|
|
600
|
+
255 & l$1
|
|
601
601
|
];
|
|
602
602
|
}, u = (e$2, t$3, r$1) => e$2 ^ t$3 || t$3 ^ r$1 ? 16 + 36 * c(e$2 / 51) + 6 * c(t$3 / 51) + c(r$1 / 51) : 8 > e$2 ? 16 : e$2 > 248 ? 231 : c(24 * (e$2 - 8) / 247) + 232, d = (e$2) => {
|
|
603
|
-
let t$3, r$1,
|
|
604
|
-
return 8 > e$2 ? 30 + e$2 : 16 > e$2 ? e$2 - 8 + 90 : (232 > e$2 ? (o$1 = (e$2 -= 16) % 36, t$3 = (e$2 / 36 | 0) / 5, r$1 = (o$1 / 6 | 0) / 5,
|
|
605
|
-
},
|
|
606
|
-
let r$1 = (e$2) => o$1.some(((t$3) => e$2.test(t$3))),
|
|
603
|
+
let t$3, r$1, l$1, n$2, o$1;
|
|
604
|
+
return 8 > e$2 ? 30 + e$2 : 16 > e$2 ? e$2 - 8 + 90 : (232 > e$2 ? (o$1 = (e$2 -= 16) % 36, t$3 = (e$2 / 36 | 0) / 5, r$1 = (o$1 / 6 | 0) / 5, l$1 = o$1 % 6 / 5) : t$3 = r$1 = l$1 = (10 * (e$2 - 232) + 8) / 255, n$2 = 2 * a$1(t$3, r$1, l$1), n$2 ? 30 + (c(l$1) << 2 | c(r$1) << 1 | c(t$3)) + (2 ^ n$2 ? 0 : 60) : 30);
|
|
605
|
+
}, f = (() => {
|
|
606
|
+
let r$1 = (e$2) => o$1.some(((t$3) => e$2.test(t$3))), l$1 = globalThis, n$2 = l$1.process ?? {}, o$1 = n$2.argv ?? [], i$1 = n$2.env ?? {}, c$1 = -1;
|
|
607
607
|
try {
|
|
608
608
|
e$1 = "," + s(i$1).join(",");
|
|
609
609
|
} catch (e$2) {
|
|
@@ -616,92 +616,92 @@ var require_ansis = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ansis
|
|
|
616
616
|
2: 2,
|
|
617
617
|
3: 3
|
|
618
618
|
}[i$1[a$2]] ?? -1, u$1 = a$2 in i$1 && p$1 || r$1(/^--color=?(true|always)?$/);
|
|
619
|
-
return u$1 && (c$1 = p$1), ~c$1 || (c$1 = ((r$2,
|
|
619
|
+
return u$1 && (c$1 = p$1), ~c$1 || (c$1 = ((r$2, l$2, n$3) => (t$2 = r$2.TERM, {
|
|
620
620
|
"24bit": 3,
|
|
621
621
|
truecolor: 3,
|
|
622
622
|
ansi256: 2,
|
|
623
623
|
ansi: 1
|
|
624
|
-
}[r$2.COLORTERM] || (r$2.CI ? /,GITHUB/.test(e$1) ? 3 : 1 :
|
|
625
|
-
})(),
|
|
624
|
+
}[r$2.COLORTERM] || (r$2.CI ? /,GITHUB/.test(e$1) ? 3 : 1 : l$2 && "dumb" !== t$2 ? n$3 ? 3 : /-256/.test(t$2) ? 2 : 1 : 0)))(i$1, !!i$1.PM2_HOME || i$1.NEXT_RUNTIME?.includes("edge") || !!n$2.stdout?.isTTY, "win32" === n$2.platform)), !p$1 || i$1.NO_COLOR || r$1(/^--(no-color|color=(false|never))$/) ? 0 : l$1.window?.chrome || u$1 && !c$1 ? 3 : c$1;
|
|
625
|
+
})(), g = {
|
|
626
626
|
open: i,
|
|
627
627
|
close: i
|
|
628
|
-
}, h = 39, b = 49, O = {}, m = ({ p: e$2 }, { open: t$3, close:
|
|
628
|
+
}, h = 39, b = 49, O = {}, m = ({ p: e$2 }, { open: t$3, close: l$1 }) => {
|
|
629
629
|
let o$1 = (e$3, ...r$1) => {
|
|
630
630
|
if (!e$3) {
|
|
631
|
-
if (t$3 && t$3 ===
|
|
631
|
+
if (t$3 && t$3 === l$1) return t$3;
|
|
632
632
|
if ((e$3 ?? i) === i) return i;
|
|
633
633
|
}
|
|
634
|
-
let
|
|
634
|
+
let n$2, s$2 = e$3.raw ? String.raw({ raw: e$3 }, ...r$1) : i + e$3, c$2 = o$1.p, a$2 = c$2.o, p$1 = c$2.c;
|
|
635
635
|
if (s$2.includes("\x1B")) for (; c$2; c$2 = c$2.p) {
|
|
636
|
-
let { open: e$4, close: t$4 } = c$2, r$2 = t$4.length,
|
|
637
|
-
if (r$2) for (; ~(
|
|
638
|
-
s$2 =
|
|
636
|
+
let { open: e$4, close: t$4 } = c$2, r$2 = t$4.length, l$2 = i, o$2 = 0;
|
|
637
|
+
if (r$2) for (; ~(n$2 = s$2.indexOf(t$4, o$2)); o$2 = n$2 + r$2) l$2 += s$2.slice(o$2, n$2) + e$4;
|
|
638
|
+
s$2 = l$2 + s$2.slice(o$2);
|
|
639
639
|
}
|
|
640
640
|
return a$2 + (s$2.includes("\n") ? s$2.replace(/(\r?\n)/g, p$1 + "$1" + a$2) : s$2) + p$1;
|
|
641
|
-
}, s$1 = t$3, c$1 =
|
|
642
|
-
return e$2 && (s$1 = e$2.o + t$3, c$1 =
|
|
641
|
+
}, s$1 = t$3, c$1 = l$1;
|
|
642
|
+
return e$2 && (s$1 = e$2.o + t$3, c$1 = l$1 + e$2.c), n$1(o$1, r), o$1.p = {
|
|
643
643
|
open: t$3,
|
|
644
|
-
close:
|
|
644
|
+
close: l$1,
|
|
645
645
|
o: s$1,
|
|
646
646
|
c: c$1,
|
|
647
647
|
p: e$2
|
|
648
648
|
}, o$1.open = s$1, o$1.close = c$1, o$1;
|
|
649
649
|
};
|
|
650
|
-
const w = function
|
|
651
|
-
let
|
|
652
|
-
Ansis:
|
|
653
|
-
level:
|
|
654
|
-
isSupported: () =>
|
|
650
|
+
const w = new function e$2(t$3 = f) {
|
|
651
|
+
let s$1 = {
|
|
652
|
+
Ansis: e$2,
|
|
653
|
+
level: t$3,
|
|
654
|
+
isSupported: () => a$2,
|
|
655
655
|
strip: (e$3) => e$3.replace(/[][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, i),
|
|
656
656
|
extend(e$3) {
|
|
657
657
|
for (let t$4 in e$3) {
|
|
658
|
-
let r$1 = e$3[t$4], l$1 = (typeof r$1)[0]
|
|
659
|
-
|
|
660
|
-
return (...e$4) => m(this, r$1(...e$4));
|
|
661
|
-
} } : { get() {
|
|
662
|
-
let e$4 = m(this, o$1);
|
|
663
|
-
return n$1(this, t$4, { value: e$4 }), e$4;
|
|
664
|
-
} };
|
|
658
|
+
let r$1 = e$3[t$4], l$1 = (typeof r$1)[0];
|
|
659
|
+
"s" === l$1 ? (c$1(t$4, T(...p(r$1))), c$1(_(t$4), v(...p(r$1)))) : c$1(t$4, r$1, "f" === l$1);
|
|
665
660
|
}
|
|
666
|
-
return r = o({}, O),
|
|
661
|
+
return r = o({}, O), n$1(s$1, r), s$1;
|
|
667
662
|
}
|
|
668
|
-
},
|
|
663
|
+
}, c$1 = (e$3, t$4, r$1) => {
|
|
664
|
+
O[e$3] = { get() {
|
|
665
|
+
let n$2 = r$1 ? (...e$4) => m(this, t$4(...e$4)) : m(this, t$4);
|
|
666
|
+
return l(this, e$3, { value: n$2 }), n$2;
|
|
667
|
+
} };
|
|
668
|
+
}, a$2 = t$3 > 0, w$1 = (e$3, t$4) => a$2 ? {
|
|
669
669
|
open: `[${e$3}m`,
|
|
670
670
|
close: `[${t$4}m`
|
|
671
|
-
} :
|
|
672
|
-
2 ===
|
|
673
|
-
let
|
|
674
|
-
fg:
|
|
675
|
-
bg:
|
|
676
|
-
rgb:
|
|
677
|
-
bgRgb:
|
|
678
|
-
hex:
|
|
679
|
-
bgHex:
|
|
680
|
-
visible:
|
|
681
|
-
reset:
|
|
682
|
-
bold:
|
|
683
|
-
dim:
|
|
684
|
-
italic:
|
|
685
|
-
underline:
|
|
686
|
-
inverse:
|
|
687
|
-
hidden:
|
|
688
|
-
strikethrough:
|
|
689
|
-
},
|
|
671
|
+
} : g, y = (e$3) => (t$4) => e$3(...p(t$4)), R = (e$3, t$4) => (r$1, l$1, n$2) => w$1(`${e$3}8;2;${r$1};${l$1};${n$2}`, t$4), $ = (e$3, t$4) => (r$1, l$1, n$2) => w$1(((e$4, t$5, r$2) => d(u(e$4, t$5, r$2)))(r$1, l$1, n$2) + e$3, t$4), x = (e$3) => (t$4, r$1, l$1) => e$3(u(t$4, r$1, l$1)), T = R(3, h), v = R(4, b), C = (e$3) => w$1("38;5;" + e$3, h), E = (e$3) => w$1("48;5;" + e$3, b);
|
|
672
|
+
2 === t$3 ? (T = x(C), v = x(E)) : 1 === t$3 && (T = $(0, h), v = $(10, b), C = (e$3) => w$1(d(e$3), h), E = (e$3) => w$1(d(e$3) + 10, b));
|
|
673
|
+
let M, I = {
|
|
674
|
+
fg: C,
|
|
675
|
+
bg: E,
|
|
676
|
+
rgb: T,
|
|
677
|
+
bgRgb: v,
|
|
678
|
+
hex: y(T),
|
|
679
|
+
bgHex: y(v),
|
|
680
|
+
visible: g,
|
|
681
|
+
reset: w$1(0, 0),
|
|
682
|
+
bold: w$1(1, 22),
|
|
683
|
+
dim: w$1(2, 22),
|
|
684
|
+
italic: w$1(3, 23),
|
|
685
|
+
underline: w$1(4, 24),
|
|
686
|
+
inverse: w$1(7, 27),
|
|
687
|
+
hidden: w$1(8, 28),
|
|
688
|
+
strikethrough: w$1(9, 29)
|
|
689
|
+
}, _ = (e$3) => "bg" + e$3[0].toUpperCase() + e$3.slice(1), k = "Bright";
|
|
690
690
|
return "black,red,green,yellow,blue,magenta,cyan,white,gray".split(",").map(((e$3, t$4) => {
|
|
691
|
-
|
|
692
|
-
})),
|
|
693
|
-
}
|
|
694
|
-
module.exports =
|
|
691
|
+
M = _(e$3), 8 > t$4 ? (I[e$3 + k] = w$1(90 + t$4, h), I[M + k] = w$1(100 + t$4, b)) : t$4 = 60, I[e$3] = w$1(30 + t$4, h), I[M] = w$1(40 + t$4, b);
|
|
692
|
+
})), s$1.extend(I);
|
|
693
|
+
}();
|
|
694
|
+
module.exports = w, w.default = w;
|
|
695
695
|
}) });
|
|
696
696
|
|
|
697
697
|
//#endregion
|
|
698
|
-
//#region ../../node_modules/.pnpm/ansis@4.
|
|
698
|
+
//#region ../../node_modules/.pnpm/ansis@4.2.0/node_modules/ansis/index.mjs
|
|
699
699
|
var import_ansis = /* @__PURE__ */ __toESM(require_ansis(), 1);
|
|
700
700
|
var ansis_default = import_ansis.default;
|
|
701
701
|
const { Ansis, fg, bg, rgb, bgRgb, hex, bgHex, reset, inverse, hidden, visible, bold, dim, italic, underline, strikethrough, black, red, green, yellow, blue, magenta, cyan, white, gray, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bgGray, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright } = import_ansis.default;
|
|
702
702
|
|
|
703
703
|
//#endregion
|
|
704
|
-
//#region ../../node_modules/.pnpm/valibot@1.1.0_typescript@5.9.
|
|
704
|
+
//#region ../../node_modules/.pnpm/valibot@1.1.0_typescript@5.9.3/node_modules/valibot/dist/index.js
|
|
705
705
|
var store;
|
|
706
706
|
/* @__NO_SIDE_EFFECTS__ */
|
|
707
707
|
function getGlobalConfig(config2) {
|
|
@@ -1638,6 +1638,18 @@ function omit(schema, keys) {
|
|
|
1638
1638
|
};
|
|
1639
1639
|
}
|
|
1640
1640
|
/* @__NO_SIDE_EFFECTS__ */
|
|
1641
|
+
function partial(schema, keys) {
|
|
1642
|
+
const entries2 = {};
|
|
1643
|
+
for (const key in schema.entries) entries2[key] = !keys || keys.includes(key) ? /* @__PURE__ */ optional(schema.entries[key]) : schema.entries[key];
|
|
1644
|
+
return {
|
|
1645
|
+
...schema,
|
|
1646
|
+
entries: entries2,
|
|
1647
|
+
get "~standard"() {
|
|
1648
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
1649
|
+
}
|
|
1650
|
+
};
|
|
1651
|
+
}
|
|
1652
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1641
1653
|
function pipe(...pipe2) {
|
|
1642
1654
|
return {
|
|
1643
1655
|
...pipe2[0],
|
|
@@ -2092,6 +2104,11 @@ const AdvancedChunksSchema = strictObject({
|
|
|
2092
2104
|
maxModuleSize: optional(number())
|
|
2093
2105
|
})))
|
|
2094
2106
|
});
|
|
2107
|
+
const GeneratedCodePresetSchema = union([literal("es5"), literal("es2015")]);
|
|
2108
|
+
const GeneratedCodeOptionsSchema = strictObject({
|
|
2109
|
+
symbols: pipe(optional(boolean()), description("Whether to use Symbol.toStringTag for namespace objects")),
|
|
2110
|
+
preset: GeneratedCodePresetSchema
|
|
2111
|
+
});
|
|
2095
2112
|
const OutputOptionsSchema = strictObject({
|
|
2096
2113
|
dir: pipe(optional(string()), description("Output directory, defaults to `dist` if `file` is not set")),
|
|
2097
2114
|
file: pipe(optional(string()), description("Single output file")),
|
|
@@ -2139,6 +2156,7 @@ const OutputOptionsSchema = strictObject({
|
|
|
2139
2156
|
])), description("Minify the bundled file")),
|
|
2140
2157
|
name: pipe(optional(string()), description("Name for UMD / IIFE format outputs")),
|
|
2141
2158
|
globals: pipe(optional(union([record(string(), string()), GlobalsFunctionSchema])), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2159
|
+
generatedCode: pipe(optional(partial(GeneratedCodeOptionsSchema)), description("Generated code options")),
|
|
2142
2160
|
externalLiveBindings: pipe(optional(boolean()), description("external live bindings")),
|
|
2143
2161
|
inlineDynamicImports: pipe(optional(boolean()), description("Inline dynamic imports")),
|
|
2144
2162
|
manualChunks: optional(pipe(function_(), args(tuple([string(), object({})])), returns(union([string(), nullish(string())])))),
|
|
@@ -2190,6 +2208,7 @@ const OutputCliOptionsSchema = omit(strictObject({
|
|
|
2190
2208
|
const CliOptionsSchema = strictObject({
|
|
2191
2209
|
config: pipe(optional(union([string(), boolean()])), description("Path to the config file (default: `rolldown.config.js`)")),
|
|
2192
2210
|
help: pipe(optional(boolean()), description("Show help")),
|
|
2211
|
+
environment: pipe(optional(union([string(), array(string())])), description("Pass additional settings to the config file via process.ENV.")),
|
|
2193
2212
|
version: pipe(optional(boolean()), description("Show version number")),
|
|
2194
2213
|
watch: pipe(optional(boolean()), description("Watch files in bundle and rebuild on changes")),
|
|
2195
2214
|
...InputCliOptionsSchema.entries,
|
|
@@ -2257,12 +2276,19 @@ function bindingifySourcemap$1(map) {
|
|
|
2257
2276
|
|
|
2258
2277
|
//#endregion
|
|
2259
2278
|
//#region src/utils/error.ts
|
|
2260
|
-
function
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2279
|
+
function unwrapBindingResult(container) {
|
|
2280
|
+
if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) throw aggregateBindingErrorsIntoJsError(container.errors);
|
|
2281
|
+
return container;
|
|
2282
|
+
}
|
|
2283
|
+
function normalizeBindingError(e$2) {
|
|
2284
|
+
return e$2.type === "JsError" ? e$2.field0 : Object.assign(/* @__PURE__ */ new Error(), {
|
|
2285
|
+
kind: e$2.field0.kind,
|
|
2286
|
+
message: e$2.field0.message,
|
|
2264
2287
|
stack: void 0
|
|
2265
|
-
})
|
|
2288
|
+
});
|
|
2289
|
+
}
|
|
2290
|
+
function aggregateBindingErrorsIntoJsError(rawErrors) {
|
|
2291
|
+
const errors = rawErrors.map(normalizeBindingError);
|
|
2266
2292
|
let summary = `Build failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
|
|
2267
2293
|
for (let i$1 = 0; i$1 < errors.length; i$1++) {
|
|
2268
2294
|
summary += "\n";
|
|
@@ -2701,7 +2727,7 @@ function bindingifyBuildEnd(args$1) {
|
|
|
2701
2727
|
const { handler, meta } = normalizeHook(hook);
|
|
2702
2728
|
return {
|
|
2703
2729
|
plugin: async (ctx, err) => {
|
|
2704
|
-
await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), err ?
|
|
2730
|
+
await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), err ? aggregateBindingErrorsIntoJsError(err) : void 0);
|
|
2705
2731
|
},
|
|
2706
2732
|
meta: bindingifyPluginHookMeta(meta)
|
|
2707
2733
|
};
|
|
@@ -2759,7 +2785,8 @@ function bindingifyResolveDynamicImport(args$1) {
|
|
|
2759
2785
|
if (typeof ret === "string") return { id: ret };
|
|
2760
2786
|
const result = {
|
|
2761
2787
|
id: ret.id,
|
|
2762
|
-
external: ret.external
|
|
2788
|
+
external: ret.external,
|
|
2789
|
+
packageJsonPath: ret.packageJsonPath
|
|
2763
2790
|
};
|
|
2764
2791
|
if (ret.moduleSideEffects !== null) result.moduleSideEffects = ret.moduleSideEffects;
|
|
2765
2792
|
args$1.pluginContextData.updateModuleOption(ret.id, {
|
|
@@ -3001,14 +3028,9 @@ function transformToRollupOutputAsset(bindingAsset, changed) {
|
|
|
3001
3028
|
});
|
|
3002
3029
|
}
|
|
3003
3030
|
function transformToRollupOutput(output, changed) {
|
|
3004
|
-
handleOutputErrors(output);
|
|
3005
3031
|
const { chunks, assets } = output;
|
|
3006
3032
|
return { output: [...chunks.map((chunk) => transformToRollupOutputChunk(chunk, changed)), ...assets.map((asset) => transformToRollupOutputAsset(asset, changed))] };
|
|
3007
3033
|
}
|
|
3008
|
-
function handleOutputErrors(output) {
|
|
3009
|
-
const rawErrors = output.errors;
|
|
3010
|
-
if (rawErrors.length > 0) throw normalizeErrors(rawErrors);
|
|
3011
|
-
}
|
|
3012
3034
|
function transformToOutputBundle(context, output, changed) {
|
|
3013
3035
|
const bundle = Object.fromEntries(transformToRollupOutput(output, changed).output.map((item) => [item.fileName, item]));
|
|
3014
3036
|
return new Proxy(bundle, {
|
|
@@ -3114,7 +3136,7 @@ function bindingifyRenderError(args$1) {
|
|
|
3114
3136
|
const { handler, meta } = normalizeHook(hook);
|
|
3115
3137
|
return {
|
|
3116
3138
|
plugin: async (ctx, err) => {
|
|
3117
|
-
handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode),
|
|
3139
|
+
handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), aggregateBindingErrorsIntoJsError(err));
|
|
3118
3140
|
},
|
|
3119
3141
|
meta: bindingifyPluginHookMeta(meta)
|
|
3120
3142
|
};
|
|
@@ -3130,7 +3152,7 @@ function bindingifyGenerateBundle(args$1) {
|
|
|
3130
3152
|
deleted: /* @__PURE__ */ new Set()
|
|
3131
3153
|
};
|
|
3132
3154
|
const context = new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode);
|
|
3133
|
-
const output = transformToOutputBundle(context, bundle, changed);
|
|
3155
|
+
const output = transformToOutputBundle(context, unwrapBindingResult(bundle), changed);
|
|
3134
3156
|
await handler.call(context, args$1.pluginContextData.getOutputOptions(opts), output, isWrite);
|
|
3135
3157
|
return collectChangedBundle(changed, output);
|
|
3136
3158
|
},
|
|
@@ -3148,7 +3170,7 @@ function bindingifyWriteBundle(args$1) {
|
|
|
3148
3170
|
deleted: /* @__PURE__ */ new Set()
|
|
3149
3171
|
};
|
|
3150
3172
|
const context = new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode);
|
|
3151
|
-
const output = transformToOutputBundle(context, bundle, changed);
|
|
3173
|
+
const output = transformToOutputBundle(context, unwrapBindingResult(bundle), changed);
|
|
3152
3174
|
await handler.call(context, args$1.pluginContextData.getOutputOptions(opts), output);
|
|
3153
3175
|
return collectChangedBundle(changed, output);
|
|
3154
3176
|
},
|
|
@@ -3335,7 +3357,7 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
|
|
|
3335
3357
|
const { plugin: watchChange, meta: watchChangeMeta } = bindingifyWatchChange(args$1);
|
|
3336
3358
|
const { plugin: closeWatcher, meta: closeWatcherMeta } = bindingifyCloseWatcher(args$1);
|
|
3337
3359
|
let hookUsage = extractHookUsage(plugin).inner();
|
|
3338
|
-
|
|
3360
|
+
return wrapHandlers({
|
|
3339
3361
|
name: plugin.name,
|
|
3340
3362
|
buildStart,
|
|
3341
3363
|
buildStartMeta,
|
|
@@ -3382,8 +3404,7 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
|
|
|
3382
3404
|
closeWatcher,
|
|
3383
3405
|
closeWatcherMeta,
|
|
3384
3406
|
hookUsage
|
|
3385
|
-
};
|
|
3386
|
-
return wrapHandlers(result);
|
|
3407
|
+
});
|
|
3387
3408
|
}
|
|
3388
3409
|
function wrapHandlers(plugin) {
|
|
3389
3410
|
for (const hookName of [
|
|
@@ -3965,7 +3986,7 @@ var ChunkingContextImpl = class {
|
|
|
3965
3986
|
//#endregion
|
|
3966
3987
|
//#region src/utils/bindingify-output-options.ts
|
|
3967
3988
|
function bindingifyOutputOptions(outputOptions) {
|
|
3968
|
-
const { dir, format, exports, hashCharacters, sourcemap, sourcemapBaseUrl, sourcemapDebugIds, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, cssEntryFileNames, cssChunkFileNames, banner, footer, intro, outro, esModule, globals, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, preserveModulesRoot, manualChunks, topLevelVar } = outputOptions;
|
|
3989
|
+
const { dir, format, exports, hashCharacters, sourcemap, sourcemapBaseUrl, sourcemapDebugIds, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, cssEntryFileNames, cssChunkFileNames, banner, footer, intro, outro, esModule, globals, generatedCode, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, preserveModulesRoot, manualChunks, topLevelVar } = outputOptions;
|
|
3969
3990
|
const advancedChunks = bindingifyAdvancedChunks(outputOptions.advancedChunks, manualChunks);
|
|
3970
3991
|
return {
|
|
3971
3992
|
dir,
|
|
@@ -3984,6 +4005,7 @@ function bindingifyOutputOptions(outputOptions) {
|
|
|
3984
4005
|
outro: bindingifyAddon(outro),
|
|
3985
4006
|
extend: outputOptions.extend,
|
|
3986
4007
|
globals,
|
|
4008
|
+
generatedCode,
|
|
3987
4009
|
esModule,
|
|
3988
4010
|
name,
|
|
3989
4011
|
assetFileNames: bindingifyAssetFilenames(assetFileNames),
|
|
@@ -4141,12 +4163,10 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
|
|
|
4141
4163
|
let plugins = [...normalizePlugins(inputPlugins, ANONYMOUS_PLUGIN_PREFIX), ...checkOutputPluginOption(normalizePlugins(normalizedOutputPlugins, ANONYMOUS_OUTPUT_PLUGIN_PREFIX), onLog)];
|
|
4142
4164
|
const parallelPluginInitResult = await initializeParallelPlugins(plugins);
|
|
4143
4165
|
try {
|
|
4144
|
-
const bindingInputOptions = bindingifyInputOptions(plugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode);
|
|
4145
|
-
const bindingOutputOptions = bindingifyOutputOptions(outputOptions);
|
|
4146
4166
|
return {
|
|
4147
4167
|
bundlerOptions: {
|
|
4148
|
-
inputOptions:
|
|
4149
|
-
outputOptions:
|
|
4168
|
+
inputOptions: bindingifyInputOptions(plugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode),
|
|
4169
|
+
outputOptions: bindingifyOutputOptions(outputOptions),
|
|
4150
4170
|
parallelPluginsRegistry: parallelPluginInitResult?.registry
|
|
4151
4171
|
},
|
|
4152
4172
|
inputOptions,
|
|
@@ -4159,18 +4179,6 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
|
|
|
4159
4179
|
}
|
|
4160
4180
|
}
|
|
4161
4181
|
|
|
4162
|
-
//#endregion
|
|
4163
|
-
//#region src/utils/transform-hmr-patch-output.ts
|
|
4164
|
-
function transformHmrPatchOutput(output) {
|
|
4165
|
-
handleHmrPatchOutputErrors(output);
|
|
4166
|
-
const { patch } = output;
|
|
4167
|
-
return patch ?? void 0;
|
|
4168
|
-
}
|
|
4169
|
-
function handleHmrPatchOutputErrors(output) {
|
|
4170
|
-
const rawErrors = output.errors;
|
|
4171
|
-
if (rawErrors.length > 0) throw normalizeErrors(rawErrors);
|
|
4172
|
-
}
|
|
4173
|
-
|
|
4174
4182
|
//#endregion
|
|
4175
4183
|
//#region src/api/rolldown/rolldown-build.ts
|
|
4176
4184
|
Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
|
|
@@ -4206,20 +4214,17 @@ var RolldownBuild = class RolldownBuild {
|
|
|
4206
4214
|
}
|
|
4207
4215
|
async scan() {
|
|
4208
4216
|
const { impl } = await this.#getBundlerWithStopWorker({});
|
|
4209
|
-
|
|
4210
|
-
return handleOutputErrors(output);
|
|
4217
|
+
unwrapBindingResult(await impl.scan());
|
|
4211
4218
|
}
|
|
4212
4219
|
async generate(outputOptions = {}) {
|
|
4213
4220
|
validateOption("output", outputOptions);
|
|
4214
4221
|
const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
|
|
4215
|
-
|
|
4216
|
-
return transformToRollupOutput(output);
|
|
4222
|
+
return transformToRollupOutput(unwrapBindingResult(await impl.generate()));
|
|
4217
4223
|
}
|
|
4218
4224
|
async write(outputOptions = {}) {
|
|
4219
4225
|
validateOption("output", outputOptions);
|
|
4220
4226
|
const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
|
|
4221
|
-
|
|
4222
|
-
return transformToRollupOutput(output);
|
|
4227
|
+
return transformToRollupOutput(unwrapBindingResult(await impl.write()));
|
|
4223
4228
|
}
|
|
4224
4229
|
async close() {
|
|
4225
4230
|
if (this.#bundlerImpl) {
|
|
@@ -4232,18 +4237,6 @@ var RolldownBuild = class RolldownBuild {
|
|
|
4232
4237
|
async [Symbol.asyncDispose]() {
|
|
4233
4238
|
await this.close();
|
|
4234
4239
|
}
|
|
4235
|
-
async generateHmrPatch(changedFiles) {
|
|
4236
|
-
const ret = await this.#bundlerImpl.impl.generateHmrPatch(changedFiles);
|
|
4237
|
-
switch (ret.type) {
|
|
4238
|
-
case "Ok": return ret.field0;
|
|
4239
|
-
case "Error": throw normalizeErrors(ret.field0);
|
|
4240
|
-
default: throw new Error("Unknown error");
|
|
4241
|
-
}
|
|
4242
|
-
}
|
|
4243
|
-
async hmrInvalidate(file, firstInvalidatedBy) {
|
|
4244
|
-
const output = await this.#bundlerImpl.impl.hmrInvalidate(file, firstInvalidatedBy);
|
|
4245
|
-
return transformHmrPatchOutput(output);
|
|
4246
|
-
}
|
|
4247
4240
|
get watchFiles() {
|
|
4248
4241
|
return this.#bundlerImpl?.impl.getWatchFiles() ?? Promise.resolve([]);
|
|
4249
4242
|
}
|
|
@@ -4253,8 +4246,7 @@ var RolldownBuild = class RolldownBuild {
|
|
|
4253
4246
|
//#region src/api/rolldown/index.ts
|
|
4254
4247
|
const rolldown = async (input) => {
|
|
4255
4248
|
validateOption("input", input);
|
|
4256
|
-
|
|
4257
|
-
return new RolldownBuild(inputOptions);
|
|
4249
|
+
return new RolldownBuild(await PluginDriver.callOptionsHook(input));
|
|
4258
4250
|
};
|
|
4259
4251
|
|
|
4260
4252
|
//#endregion
|
|
@@ -4322,7 +4314,7 @@ var WatcherEmitter = class {
|
|
|
4322
4314
|
const data = event.bundleErrorData();
|
|
4323
4315
|
await listener({
|
|
4324
4316
|
code: "ERROR",
|
|
4325
|
-
error:
|
|
4317
|
+
error: aggregateBindingErrorsIntoJsError(data.error),
|
|
4326
4318
|
result: data.result
|
|
4327
4319
|
});
|
|
4328
4320
|
break;
|
|
@@ -4378,12 +4370,10 @@ var Watcher = class {
|
|
|
4378
4370
|
async function createWatcher(emitter, input) {
|
|
4379
4371
|
const options = arraify(input);
|
|
4380
4372
|
const bundlerOptions = await Promise.all(options.map((option) => arraify(option.output || {}).map(async (output) => {
|
|
4381
|
-
|
|
4382
|
-
return createBundlerOptions(inputOptions, output, true);
|
|
4373
|
+
return createBundlerOptions(await PluginDriver.callOptionsHook(option, true), output, true);
|
|
4383
4374
|
})).flat());
|
|
4384
4375
|
const notifyOptions = getValidNotifyOption(bundlerOptions);
|
|
4385
|
-
|
|
4386
|
-
new Watcher(emitter, bindingWatcher, bundlerOptions.map((option) => option.stopWorkers)).start();
|
|
4376
|
+
new Watcher(emitter, new BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions), bundlerOptions.map((option) => option.stopWorkers)).start();
|
|
4387
4377
|
}
|
|
4388
4378
|
function getValidNotifyOption(bundlerOptions) {
|
|
4389
4379
|
let result;
|