@rolldown/browser 1.0.0-beta.31 → 1.0.0-beta.32

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.
Files changed (48) hide show
  1. package/dist/cli.cjs +6 -6
  2. package/dist/cli.d.cts +1 -1
  3. package/dist/cli.d.mts +1 -1
  4. package/dist/cli.mjs +8 -7
  5. package/dist/config.cjs +4 -4
  6. package/dist/config.d.cts +2 -2
  7. package/dist/config.d.mts +2 -2
  8. package/dist/config.mjs +4 -4
  9. package/dist/experimental-index.browser.mjs +1 -1
  10. package/dist/experimental-index.cjs +3 -3
  11. package/dist/experimental-index.d.cts +2 -2
  12. package/dist/experimental-index.d.mts +2 -2
  13. package/dist/experimental-index.mjs +3 -3
  14. package/dist/experimental-runtime-types.d.ts +7 -4
  15. package/dist/filter-index.cjs +1 -1
  16. package/dist/filter-index.d.cts +2 -2
  17. package/dist/filter-index.d.mts +2 -2
  18. package/dist/filter-index.mjs +1 -1
  19. package/dist/index.browser.mjs +1 -1
  20. package/dist/index.cjs +3 -3
  21. package/dist/index.d.cts +2 -2
  22. package/dist/index.d.mts +2 -2
  23. package/dist/index.mjs +3 -3
  24. package/dist/parallel-plugin-worker.cjs +3 -3
  25. package/dist/parallel-plugin-worker.d.cts +1 -1
  26. package/dist/parallel-plugin-worker.d.mts +1 -1
  27. package/dist/parallel-plugin-worker.mjs +5 -4
  28. package/dist/parallel-plugin.d.cts +2 -2
  29. package/dist/parallel-plugin.d.mts +2 -2
  30. package/dist/parse-ast-index.cjs +1 -1
  31. package/dist/parse-ast-index.d.cts +1 -1
  32. package/dist/parse-ast-index.d.mts +1 -1
  33. package/dist/parse-ast-index.mjs +1 -1
  34. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  35. package/dist/shared/{binding-B2f_h9DF.d.mts → binding-BEeJNtY4.d.mts} +2 -0
  36. package/dist/shared/{binding-CCkTRaSB.d.cts → binding-CRMJJtol.d.cts} +2 -0
  37. package/dist/shared/{define-config-BzVT47Bj.d.cts → define-config-Dw9PP95x.d.cts} +18 -4
  38. package/dist/shared/{define-config-xzVj_WrD.d.mts → define-config-rQzrgjTj.d.mts} +18 -4
  39. package/dist/shared/{load-config-9KWiC1Y_.cjs → load-config-Df5heSrD.cjs} +1 -1
  40. package/dist/shared/{load-config-DCz6MK3j.mjs → load-config-Dv1HB87g.mjs} +1 -1
  41. package/dist/shared/{parse-ast-index-r9XO-GhB.mjs → parse-ast-index-CqHkFxPM.mjs} +1 -1
  42. package/dist/shared/{parse-ast-index-DZ5uPSgP.cjs → parse-ast-index-DAsDnaa1.cjs} +1 -1
  43. package/dist/shared/{src-gD0LmYxq.cjs → src-BDMOiU9t.cjs} +130 -119
  44. package/dist/shared/{src-BSeUgDdv.mjs → src-ZwxjvPpL.mjs} +132 -121
  45. package/dist/{src-C8_hb_FH.js → src-ZTshMqyf.js} +427 -416
  46. package/package.json +2 -2
  47. /package/dist/shared/{dist-DvBwroyk.mjs → dist-ByKQkexh.mjs} +0 -0
  48. /package/dist/shared/{dist-BVAp8sOm.cjs → dist-CK0hotcm.cjs} +0 -0
@@ -1,6 +1,6 @@
1
1
  const require_chunk = require('./chunk-DDkG_k5U.cjs');
2
- const require_dist = require('./dist-BVAp8sOm.cjs');
3
- const require_parse_ast_index = require('./parse-ast-index-DZ5uPSgP.cjs');
2
+ const require_parse_ast_index = require('./parse-ast-index-DAsDnaa1.cjs');
3
+ const require_dist = require('./dist-CK0hotcm.cjs');
4
4
  const src_rolldown_binding_wasi_cjs = require_chunk.__toESM(require("../rolldown-binding.wasi.cjs"));
5
5
  const node_path = require_chunk.__toESM(require("node:path"));
6
6
  const node_url = require_chunk.__toESM(require("node:url"));
@@ -9,7 +9,7 @@ const node_os = require_chunk.__toESM(require("node:os"));
9
9
  const node_worker_threads = require_chunk.__toESM(require("node:worker_threads"));
10
10
 
11
11
  //#region package.json
12
- var version = "1.0.0-beta.31";
12
+ var version = "1.0.0-beta.32";
13
13
  var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
14
14
 
15
15
  //#endregion
@@ -28,8 +28,16 @@ function isReadonlyArray(input) {
28
28
  function makeBuiltinPluginCallable(plugin) {
29
29
  let callablePlugin = new src_rolldown_binding_wasi_cjs.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
30
30
  const wrappedPlugin = plugin;
31
- for (const key in callablePlugin) wrappedPlugin[key] = function(...args$1) {
32
- return callablePlugin[key](...args$1);
31
+ for (const key in callablePlugin) wrappedPlugin[key] = async function(...args$1) {
32
+ try {
33
+ return await callablePlugin[key](...args$1);
34
+ } catch (e$2) {
35
+ if (e$2 instanceof Error && !e$2.stack?.includes("at ")) Error.captureStackTrace(e$2, wrappedPlugin[key]);
36
+ return require_parse_ast_index.error(require_parse_ast_index.logPluginError(e$2, plugin.name, {
37
+ hook: key,
38
+ id: key === "transform" ? args$1[2] : void 0
39
+ }));
40
+ }
33
41
  };
34
42
  return wrappedPlugin;
35
43
  }
@@ -344,8 +352,8 @@ var MinimalPluginContextImpl = class {
344
352
  watchMode
345
353
  };
346
354
  }
347
- error(e$1) {
348
- return require_parse_ast_index.error(require_parse_ast_index.logPluginError(normalizeLog(e$1), this.pluginName, { hook: this.hookName }));
355
+ error(e$2) {
356
+ return require_parse_ast_index.error(require_parse_ast_index.logPluginError(normalizeLog(e$2), this.pluginName, { hook: this.hookName }));
349
357
  }
350
358
  };
351
359
 
@@ -1800,22 +1808,22 @@ function toJsonSchema(schema, config) {
1800
1808
  //#endregion
1801
1809
  //#region ../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.cjs
1802
1810
  var require_ansis = /* @__PURE__ */ require_chunk.__commonJS({ "../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.cjs": ((exports, module) => {
1803
- let e, t, r, { defineProperty: n, setPrototypeOf: l, create: o, keys: s } = Object, i$1 = "", { round: c, max: a$1 } = Math, p = (e$1) => {
1804
- 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);
1811
+ let e$1, t$2, r, { defineProperty: n$1, setPrototypeOf: l, create: o, keys: s } = Object, i = "", { round: c, max: a$1 } = Math, p = (e$2) => {
1812
+ let t$3 = /([a-f\d]{3,6})/i.exec(e$2)?.[1], r$1 = t$3?.length, n$2 = 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);
1805
1813
  return [
1806
- n$1 >> 16 & 255,
1807
- n$1 >> 8 & 255,
1808
- 255 & n$1
1814
+ n$2 >> 16 & 255,
1815
+ n$2 >> 8 & 255,
1816
+ 255 & n$2
1809
1817
  ];
1810
- }, 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) => {
1811
- let t$1, r$1, n$1, l$1, o$1;
1812
- 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);
1818
+ }, 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) => {
1819
+ let t$3, r$1, n$2, l$1, o$1;
1820
+ 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, n$2 = o$1 % 6 / 5) : t$3 = r$1 = n$2 = (10 * (e$2 - 232) + 8) / 255, l$1 = 2 * a$1(t$3, r$1, n$2), l$1 ? 30 + (c(n$2) << 2 | c(r$1) << 1 | c(t$3)) + (2 ^ l$1 ? 0 : 60) : 30);
1813
1821
  }, g = (() => {
1814
- 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;
1822
+ let r$1 = (e$2) => o$1.some(((t$3) => e$2.test(t$3))), n$2 = globalThis, l$1 = n$2.process ?? {}, o$1 = l$1.argv ?? [], i$1 = l$1.env ?? {}, c$1 = -1;
1815
1823
  try {
1816
- e = "," + s(i$2).join(",");
1817
- } catch (e$1) {
1818
- i$2 = {}, c$1 = 0;
1824
+ e$1 = "," + s(i$1).join(",");
1825
+ } catch (e$2) {
1826
+ i$1 = {}, c$1 = 0;
1819
1827
  }
1820
1828
  let a$2 = "FORCE_COLOR", p$1 = {
1821
1829
  false: 0,
@@ -1823,61 +1831,61 @@ var require_ansis = /* @__PURE__ */ require_chunk.__commonJS({ "../../node_modul
1823
1831
  1: 1,
1824
1832
  2: 2,
1825
1833
  3: 3
1826
- }[i$2[a$2]] ?? -1, u$3 = a$2 in i$2 && p$1 || r$1(/^--color=?(true|always)?$/);
1827
- return u$3 && (c$1 = p$1), ~c$1 || (c$1 = ((r$2, n$2, l$2) => (t = r$2.TERM, {
1834
+ }[i$1[a$2]] ?? -1, u$1 = a$2 in i$1 && p$1 || r$1(/^--color=?(true|always)?$/);
1835
+ return u$1 && (c$1 = p$1), ~c$1 || (c$1 = ((r$2, n$3, l$2) => (t$2 = r$2.TERM, {
1828
1836
  "24bit": 3,
1829
1837
  truecolor: 3,
1830
1838
  ansi256: 2,
1831
1839
  ansi: 1
1832
- }[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;
1840
+ }[r$2.COLORTERM] || (r$2.CI ? /,GITHUB/.test(e$1) ? 3 : 1 : n$3 && "dumb" !== t$2 ? l$2 ? 3 : /-256/.test(t$2) ? 2 : 1 : 0)))(i$1, !!i$1.PM2_HOME || i$1.NEXT_RUNTIME?.includes("edge") || !!l$1.stdout?.isTTY, "win32" === l$1.platform)), !p$1 || i$1.NO_COLOR || r$1(/^--(no-color|color=(false|never))$/) ? 0 : n$2.window?.chrome || u$1 && !c$1 ? 3 : c$1;
1833
1841
  })(), f = {
1834
- open: i$1,
1835
- close: i$1
1836
- }, h = 39, b = 49, O = {}, m = ({ p: e$1 }, { open: t$1, close: n$1 }) => {
1837
- let o$1 = (e$2, ...r$1) => {
1838
- if (!e$2) {
1839
- if (t$1 && t$1 === n$1) return t$1;
1840
- if ((e$2 ?? i$1) === i$1) return i$1;
1842
+ open: i,
1843
+ close: i
1844
+ }, h = 39, b = 49, O = {}, m = ({ p: e$2 }, { open: t$3, close: n$2 }) => {
1845
+ let o$1 = (e$3, ...r$1) => {
1846
+ if (!e$3) {
1847
+ if (t$3 && t$3 === n$2) return t$3;
1848
+ if ((e$3 ?? i) === i) return i;
1841
1849
  }
1842
- 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;
1850
+ let l$1, 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;
1843
1851
  if (s$2.includes("\x1B")) for (; c$2; c$2 = c$2.p) {
1844
- let { open: e$3, close: t$2 } = c$2, r$2 = t$2.length, n$2 = i$1, o$2 = 0;
1845
- 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;
1846
- s$2 = n$2 + s$2.slice(o$2);
1852
+ let { open: e$4, close: t$4 } = c$2, r$2 = t$4.length, n$3 = i, o$2 = 0;
1853
+ if (r$2) for (; ~(l$1 = s$2.indexOf(t$4, o$2)); o$2 = l$1 + r$2) n$3 += s$2.slice(o$2, l$1) + e$4;
1854
+ s$2 = n$3 + s$2.slice(o$2);
1847
1855
  }
1848
1856
  return a$2 + (s$2.includes("\n") ? s$2.replace(/(\r?\n)/g, p$1 + "$1" + a$2) : s$2) + p$1;
1849
- }, s$1 = t$1, c$1 = n$1;
1850
- return e$1 && (s$1 = e$1.o + t$1, c$1 = n$1 + e$1.c), l(o$1, r), o$1.p = {
1851
- open: t$1,
1852
- close: n$1,
1857
+ }, s$1 = t$3, c$1 = n$2;
1858
+ return e$2 && (s$1 = e$2.o + t$3, c$1 = n$2 + e$2.c), l(o$1, r), o$1.p = {
1859
+ open: t$3,
1860
+ close: n$2,
1853
1861
  o: s$1,
1854
1862
  c: c$1,
1855
- p: e$1
1863
+ p: e$2
1856
1864
  }, o$1.open = s$1, o$1.close = c$1, o$1;
1857
1865
  };
1858
- const w = function(e$1 = g) {
1859
- let t$1 = {
1866
+ const w = function(e$2 = g) {
1867
+ let t$3 = {
1860
1868
  Ansis: w,
1861
- level: e$1,
1869
+ level: e$2,
1862
1870
  isSupported: () => s$1,
1863
- strip: (e$2) => e$2.replace(/[›][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, i$1),
1864
- extend(e$2) {
1865
- for (let t$2 in e$2) {
1866
- let r$1 = e$2[t$2], l$1 = (typeof r$1)[0], o$1 = "s" === l$1 ? x(...p(r$1)) : r$1;
1867
- O[t$2] = "f" === l$1 ? { get() {
1868
- return (...e$3) => m(this, r$1(...e$3));
1871
+ strip: (e$3) => e$3.replace(/[›][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, i),
1872
+ extend(e$3) {
1873
+ for (let t$4 in e$3) {
1874
+ let r$1 = e$3[t$4], l$1 = (typeof r$1)[0], o$1 = "s" === l$1 ? x(...p(r$1)) : r$1;
1875
+ O[t$4] = "f" === l$1 ? { get() {
1876
+ return (...e$4) => m(this, r$1(...e$4));
1869
1877
  } } : { get() {
1870
- let e$3 = m(this, o$1);
1871
- return n(this, t$2, { value: e$3 }), e$3;
1878
+ let e$4 = m(this, o$1);
1879
+ return n$1(this, t$4, { value: e$4 }), e$4;
1872
1880
  } };
1873
1881
  }
1874
- return r = o({}, O), l(t$1, r), t$1;
1882
+ return r = o({}, O), l(t$3, r), t$3;
1875
1883
  }
1876
- }, s$1 = e$1 > 0, c$1 = (e$2, t$2) => s$1 ? {
1877
- open: `[${e$2}m`,
1878
- close: `[${t$2}m`
1879
- } : 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);
1880
- 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));
1884
+ }, s$1 = e$2 > 0, c$1 = (e$3, t$4) => s$1 ? {
1885
+ open: `[${e$3}m`,
1886
+ close: `[${t$4}m`
1887
+ } : f, a$2 = (e$3) => (t$4) => e$3(...p(t$4)), y$1 = (e$3, t$4) => (r$1, n$2, l$1) => c$1(`${e$3}8;2;${r$1};${n$2};${l$1}`, t$4), R = (e$3, t$4) => (r$1, n$2, l$1) => c$1(((e$4, t$5, r$2) => d(u(e$4, t$5, r$2)))(r$1, n$2, l$1) + e$3, t$4), $ = (e$3) => (t$4, r$1, n$2) => e$3(u(t$4, r$1, n$2)), x = y$1(3, h), T = y$1(4, b), v = (e$3) => c$1("38;5;" + e$3, h), C = (e$3) => c$1("48;5;" + e$3, b);
1888
+ 2 === e$2 ? (x = $(v), T = $(C)) : 1 === e$2 && (x = R(0, h), T = R(10, b), v = (e$3) => c$1(d(e$3), h), C = (e$3) => c$1(d(e$3) + 10, b));
1881
1889
  let E, M = {
1882
1890
  fg: v,
1883
1891
  bg: C,
@@ -1895,9 +1903,9 @@ var require_ansis = /* @__PURE__ */ require_chunk.__commonJS({ "../../node_modul
1895
1903
  hidden: c$1(8, 28),
1896
1904
  strikethrough: c$1(9, 29)
1897
1905
  }, I = "Bright";
1898
- return "black,red,green,yellow,blue,magenta,cyan,white,gray".split(",").map(((e$2, t$2) => {
1899
- 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);
1900
- })), t$1.extend(M);
1906
+ return "black,red,green,yellow,blue,magenta,cyan,white,gray".split(",").map(((e$3, t$4) => {
1907
+ E = "bg" + e$3[0].toUpperCase() + e$3.slice(1), 8 > t$4 ? (M[e$3 + I] = c$1(90 + t$4, h), M[E + I] = c$1(100 + t$4, b)) : t$4 = 60, M[e$3] = c$1(30 + t$4, h), M[E] = c$1(40 + t$4, b);
1908
+ })), t$3.extend(M);
1901
1909
  }, y = new w();
1902
1910
  module.exports = y, y.default = y;
1903
1911
  }) });
@@ -2147,7 +2155,8 @@ const InputCliOverrideSchema = strictObject({
2147
2155
  literal("react-jsx"),
2148
2156
  literal("preserve")
2149
2157
  ])), description("Jsx options preset")),
2150
- preserveEntrySignatures: pipe(optional(union([literal(false)])), description("Avoid facade chunks for entry points"))
2158
+ preserveEntrySignatures: pipe(optional(union([literal(false)])), description("Avoid facade chunks for entry points")),
2159
+ context: pipe(optional(string()), description("The entity top-level `this` represents."))
2151
2160
  });
2152
2161
  const InputCliOptionsSchema = omit(strictObject({
2153
2162
  ...InputOptionsSchema.entries,
@@ -2176,6 +2185,7 @@ const AssetFileNamesSchema = union([string(), pipe(function_(), args(tuple([cust
2176
2185
  const SanitizeFileNameSchema = union([boolean(), pipe(function_(), args(tuple([string()])), returns(string()))]);
2177
2186
  const GlobalsFunctionSchema = pipe(function_(), args(tuple([string()])), returns(string()));
2178
2187
  const AdvancedChunksSchema = strictObject({
2188
+ includeDependenciesRecursively: optional(boolean()),
2179
2189
  minSize: optional(number()),
2180
2190
  maxSize: optional(number()),
2181
2191
  minModuleSize: optional(number()),
@@ -2311,7 +2321,7 @@ function validateOption(key, options) {
2311
2321
  const issuePaths = issue.path.map((path$2) => path$2.key);
2312
2322
  let issueMsg = issue.message;
2313
2323
  if (issue.type === "union") {
2314
- const subIssue = issue.issues?.find((i$2) => !(i$2.type !== issue.received && i$2.input === issue.input));
2324
+ const subIssue = issue.issues?.find((i$1) => !(i$1.type !== issue.received && i$1.input === issue.input));
2315
2325
  if (subIssue) {
2316
2326
  if (subIssue.path) issuePaths.push(subIssue.path.map((path$2) => path$2.key));
2317
2327
  issueMsg = subIssue.message;
@@ -2354,19 +2364,19 @@ function bindingifySourcemap$1(map) {
2354
2364
  //#endregion
2355
2365
  //#region src/utils/error.ts
2356
2366
  function normalizeErrors(rawErrors) {
2357
- const errors = rawErrors.map((e$1) => e$1 instanceof Error ? e$1 : Object.assign(/* @__PURE__ */ new Error(), {
2358
- kind: e$1.kind,
2359
- message: e$1.message,
2367
+ const errors = rawErrors.map((e$2) => e$2 instanceof Error ? e$2 : Object.assign(/* @__PURE__ */ new Error(), {
2368
+ kind: e$2.kind,
2369
+ message: e$2.message,
2360
2370
  stack: void 0
2361
2371
  }));
2362
2372
  let summary = `Build failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
2363
- for (let i$2 = 0; i$2 < errors.length; i$2++) {
2373
+ for (let i$1 = 0; i$1 < errors.length; i$1++) {
2364
2374
  summary += "\n";
2365
- if (i$2 >= 5) {
2375
+ if (i$1 >= 5) {
2366
2376
  summary += "...";
2367
2377
  break;
2368
2378
  }
2369
- summary += getErrorMessage(errors[i$2]);
2379
+ summary += getErrorMessage(errors[i$1]);
2370
2380
  }
2371
2381
  const wrapper = new Error(summary);
2372
2382
  Object.defineProperty(wrapper, "errors", {
@@ -2381,20 +2391,20 @@ function normalizeErrors(rawErrors) {
2381
2391
  });
2382
2392
  return wrapper;
2383
2393
  }
2384
- function getErrorMessage(e$1) {
2385
- if (Object.hasOwn(e$1, "kind")) return e$1.message;
2394
+ function getErrorMessage(e$2) {
2395
+ if (Object.hasOwn(e$2, "kind")) return e$2.message;
2386
2396
  let s$1 = "";
2387
- if (e$1.plugin) s$1 += `[plugin ${e$1.plugin}]`;
2388
- const id$1 = e$1.id ?? e$1.loc?.file;
2397
+ if (e$2.plugin) s$1 += `[plugin ${e$2.plugin}]`;
2398
+ const id$1 = e$2.id ?? e$2.loc?.file;
2389
2399
  if (id$1) {
2390
2400
  s$1 += " " + id$1;
2391
- if (e$1.loc) s$1 += `:${e$1.loc.line}:${e$1.loc.column}`;
2401
+ if (e$2.loc) s$1 += `:${e$2.loc.line}:${e$2.loc.column}`;
2392
2402
  }
2393
2403
  if (s$1) s$1 += "\n";
2394
- const message = `${e$1.name ?? "Error"}: ${e$1.message}`;
2404
+ const message = `${e$2.name ?? "Error"}: ${e$2.message}`;
2395
2405
  s$1 += message;
2396
- if (e$1.frame) s$1 = joinNewLine(s$1, e$1.frame);
2397
- if (e$1.stack) s$1 = joinNewLine(s$1, e$1.stack.replace(message, ""));
2406
+ if (e$2.frame) s$1 = joinNewLine(s$1, e$2.frame);
2407
+ if (e$2.stack) s$1 = joinNewLine(s$1, e$2.stack.replace(message, ""));
2398
2408
  return s$1;
2399
2409
  }
2400
2410
  function joinNewLine(s1, s2) {
@@ -2438,33 +2448,33 @@ function normalizeTransformHookSourcemap(id$1, originalCode, rawMap) {
2438
2448
  }
2439
2449
 
2440
2450
  //#endregion
2441
- //#region ../../node_modules/.pnpm/remeda@2.28.0/node_modules/remeda/dist/chunk-D6FCK2GA.js
2442
- function u$1(o$1, n$1, a$2) {
2443
- let t$1 = (r$1) => o$1(r$1, ...n$1);
2444
- return a$2 === void 0 ? t$1 : Object.assign(t$1, {
2445
- lazy: a$2,
2446
- lazyArgs: n$1
2451
+ //#region ../../node_modules/.pnpm/remeda@2.30.0/node_modules/remeda/dist/lazyDataLastImpl-BDhrIOwR.js
2452
+ function e(e$2, t$3, n$2) {
2453
+ let r$1 = (n$3) => e$2(n$3, ...t$3);
2454
+ return n$2 === void 0 ? r$1 : Object.assign(r$1, {
2455
+ lazy: n$2,
2456
+ lazyArgs: t$3
2447
2457
  });
2448
2458
  }
2449
2459
 
2450
2460
  //#endregion
2451
- //#region ../../node_modules/.pnpm/remeda@2.28.0/node_modules/remeda/dist/chunk-WIMGWYZL.js
2452
- function u(r$1, n$1, o$1) {
2453
- let a$2 = r$1.length - n$1.length;
2454
- if (a$2 === 0) return r$1(...n$1);
2455
- if (a$2 === 1) return u$1(r$1, n$1, o$1);
2456
- throw new Error("Wrong number of arguments");
2461
+ //#region ../../node_modules/.pnpm/remeda@2.30.0/node_modules/remeda/dist/purry-DH9cw9sy.js
2462
+ function t(t$3, n$2, r$1) {
2463
+ let i$1 = t$3.length - n$2.length;
2464
+ if (i$1 === 0) return t$3(...n$2);
2465
+ if (i$1 === 1) return e(t$3, n$2, r$1);
2466
+ throw Error(`Wrong number of arguments`);
2457
2467
  }
2458
2468
 
2459
2469
  //#endregion
2460
- //#region ../../node_modules/.pnpm/remeda@2.28.0/node_modules/remeda/dist/chunk-3IFJP4R5.js
2461
- function d(...r$1) {
2462
- return u(i, r$1);
2463
- }
2464
- var i = (r$1, t$1) => {
2465
- let a$2 = [[], []];
2466
- 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);
2467
- return a$2;
2470
+ //#region ../../node_modules/.pnpm/remeda@2.30.0/node_modules/remeda/dist/partition-BJYkp-a7.js
2471
+ function t$1(...t$3) {
2472
+ return t(n, t$3);
2473
+ }
2474
+ const n = (e$2, t$3) => {
2475
+ let n$2 = [[], []];
2476
+ for (let [r$1, i$1] of e$2.entries()) t$3(i$1, r$1, e$2) ? n$2[0].push(i$1) : n$2[1].push(i$1);
2477
+ return n$2;
2468
2478
  };
2469
2479
 
2470
2480
  //#endregion
@@ -2489,8 +2499,8 @@ function transformFilterMatcherToFilterExprs(filterOption) {
2489
2499
  let idExcludes = [];
2490
2500
  let codeIncludes = [];
2491
2501
  let codeExcludes = [];
2492
- if (id$1) [idIncludes, idExcludes] = d(generalHookFilterMatcherToFilterExprs(id$1, "id") ?? [], (m$1) => m$1.kind === "include");
2493
- if (code$1) [codeIncludes, codeExcludes] = d(generalHookFilterMatcherToFilterExprs(code$1, "code") ?? [], (m$1) => m$1.kind === "include");
2502
+ if (id$1) [idIncludes, idExcludes] = t$1(generalHookFilterMatcherToFilterExprs(id$1, "id") ?? [], (m$1) => m$1.kind === "include");
2503
+ if (code$1) [codeIncludes, codeExcludes] = t$1(generalHookFilterMatcherToFilterExprs(code$1, "code") ?? [], (m$1) => m$1.kind === "include");
2494
2504
  ret.push(...idExcludes);
2495
2505
  ret.push(...codeExcludes);
2496
2506
  let andExprList = [];
@@ -2518,7 +2528,7 @@ function bindingifyFilterExprImpl(expr, list) {
2518
2528
  switch (expr.kind) {
2519
2529
  case "and": {
2520
2530
  let args$1 = expr.args;
2521
- for (let i$2 = args$1.length - 1; i$2 >= 0; i$2--) bindingifyFilterExprImpl(args$1[i$2], list);
2531
+ for (let i$1 = args$1.length - 1; i$1 >= 0; i$1--) bindingifyFilterExprImpl(args$1[i$1], list);
2522
2532
  list.push({
2523
2533
  kind: "And",
2524
2534
  payload: args$1.length
@@ -2527,7 +2537,7 @@ function bindingifyFilterExprImpl(expr, list) {
2527
2537
  }
2528
2538
  case "or": {
2529
2539
  let args$1 = expr.args;
2530
- for (let i$2 = args$1.length - 1; i$2 >= 0; i$2--) bindingifyFilterExprImpl(args$1[i$2], list);
2540
+ for (let i$1 = args$1.length - 1; i$1 >= 0; i$1--) bindingifyFilterExprImpl(args$1[i$1], list);
2531
2541
  list.push({
2532
2542
  kind: "Or",
2533
2543
  payload: args$1.length
@@ -2677,10 +2687,10 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
2677
2687
  data.loadModulePromiseMap.set(id$1, promise$1);
2678
2688
  try {
2679
2689
  await context.load(id$1, options.moduleSideEffects ?? void 0);
2680
- } catch (e$1) {
2690
+ } catch (e$2) {
2681
2691
  data.loadModulePromiseMap.delete(id$1);
2682
2692
  data.loadModulePromiseResolveFnMap.delete(id$1);
2683
- throw e$1;
2693
+ throw e$2;
2684
2694
  }
2685
2695
  return promise$1;
2686
2696
  }
@@ -2767,12 +2777,12 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
2767
2777
  this.warn = getLogHandler$1(this.warn);
2768
2778
  this.info = getLogHandler$1(this.info);
2769
2779
  }
2770
- error(e$1, pos) {
2771
- if (typeof e$1 === "string") e$1 = { message: e$1 };
2772
- if (pos) require_parse_ast_index.augmentCodeLocation(e$1, pos, this.moduleSource, this.moduleId);
2773
- e$1.id = this.moduleId;
2774
- e$1.hook = "transform";
2775
- return require_parse_ast_index.error(require_parse_ast_index.logPluginError(normalizeLog(e$1), this.pluginName));
2780
+ error(e$2, pos) {
2781
+ if (typeof e$2 === "string") e$2 = { message: e$2 };
2782
+ if (pos) require_parse_ast_index.augmentCodeLocation(e$2, pos, this.moduleSource, this.moduleId);
2783
+ e$2.id = this.moduleId;
2784
+ e$2.hook = "transform";
2785
+ return require_parse_ast_index.error(require_parse_ast_index.logPluginError(normalizeLog(e$2), this.pluginName));
2776
2786
  }
2777
2787
  getCombinedSourcemap() {
2778
2788
  return JSON.parse(this.inner.getCombinedSourcemap());
@@ -2998,9 +3008,9 @@ function transformRenderedChunk(chunk) {
2998
3008
  }
2999
3009
  function transformChunkModules(modules) {
3000
3010
  const result = {};
3001
- for (let i$2 = 0; i$2 < modules.values.length; i$2++) {
3002
- let key = modules.keys[i$2];
3003
- const mod = modules.values[i$2];
3011
+ for (let i$1 = 0; i$1 < modules.values.length; i$1++) {
3012
+ let key = modules.keys[i$1];
3013
+ const mod = modules.values[i$1];
3004
3014
  result[key] = transformToRenderedModule(mod);
3005
3015
  }
3006
3016
  return result;
@@ -3509,8 +3519,8 @@ function wrapHandlers(plugin) {
3509
3519
  if (handler) plugin[hookName] = async (...args$1) => {
3510
3520
  try {
3511
3521
  return await handler(...args$1);
3512
- } catch (e$1) {
3513
- return require_parse_ast_index.error(require_parse_ast_index.logPluginError(e$1, plugin.name, {
3522
+ } catch (e$2) {
3523
+ return require_parse_ast_index.error(require_parse_ast_index.logPluginError(e$2, plugin.name, {
3514
3524
  hook: hookName,
3515
3525
  id: hookName === "transform" ? args$1[2] : void 0
3516
3526
  }));
@@ -3939,7 +3949,8 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
3939
3949
  invalidateJsSideCache: pluginContextData.clear.bind(pluginContextData),
3940
3950
  markModuleLoaded: pluginContextData.markModuleLoaded.bind(pluginContextData),
3941
3951
  preserveEntrySignatures: bindingifyPreserveEntrySignatures(inputOptions.preserveEntrySignatures),
3942
- optimization: inputOptions.optimization
3952
+ optimization: inputOptions.optimization,
3953
+ context: inputOptions.context
3943
3954
  };
3944
3955
  }
3945
3956
  function bindingifyHmr(hmr) {
@@ -4170,7 +4181,7 @@ async function initializeParallelPlugins(plugins) {
4170
4181
  };
4171
4182
  }
4172
4183
  function initializeWorkers(registryId, count, pluginInfos) {
4173
- return Promise.all(Array.from({ length: count }, (_, i$2) => initializeWorker(registryId, pluginInfos, i$2)));
4184
+ return Promise.all(Array.from({ length: count }, (_, i$1) => initializeWorker(registryId, pluginInfos, i$1)));
4174
4185
  }
4175
4186
  async function initializeWorker(registryId, pluginInfos, threadNumber) {
4176
4187
  const urlString = (void 0)("#parallel-plugin-worker");
@@ -4190,9 +4201,9 @@ async function initializeWorker(registryId, pluginInfos, threadNumber) {
4190
4201
  });
4191
4202
  });
4192
4203
  return worker;
4193
- } catch (e$1) {
4204
+ } catch (e$2) {
4194
4205
  worker?.terminate();
4195
- throw e$1;
4206
+ throw e$2;
4196
4207
  }
4197
4208
  }
4198
4209
  const availableParallelism = () => {
@@ -4234,9 +4245,9 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode, isCl
4234
4245
  onLog,
4235
4246
  stopWorkers: parallelPluginInitResult?.stopWorkers
4236
4247
  };
4237
- } catch (e$1) {
4248
+ } catch (e$2) {
4238
4249
  await parallelPluginInitResult?.stopWorkers();
4239
- throw e$1;
4250
+ throw e$2;
4240
4251
  }
4241
4252
  }
4242
4253
 
@@ -4255,9 +4266,9 @@ async function createBundlerImpl(bundler, inputOptions, outputOptions, isClose)
4255
4266
  asyncRuntimeShutdown = true;
4256
4267
  }
4257
4268
  };
4258
- } catch (e$1) {
4269
+ } catch (e$2) {
4259
4270
  await option.stopWorkers?.();
4260
- throw e$1;
4271
+ throw e$2;
4261
4272
  }
4262
4273
  }
4263
4274