@rolldown/browser 1.0.0-beta.39 → 1.0.0-beta.41

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.
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
 
28
28
  //#endregion
29
29
  //#region package.json
30
- var version = "1.0.0-beta.39";
30
+ var version = "1.0.0-beta.41";
31
31
 
32
32
  //#endregion
33
33
  //#region src/utils/code-frame.ts
@@ -414,13 +414,13 @@ let _lazyMatch = () => {
414
414
  }, or$1 = (r$1, e$2, n$2) => S(r$1, e$2).map((a$2) => String(a$2).padStart(n$2, "0")), R = (r$1, e$2) => S(O$1(r$1), O$1(e$2)).map(ir), p$1 = (r$1) => r$1, z = (r$1) => ur((e$2) => rr(e$2, r$1, { memoization: false }).join("")), ur = (r$1) => {
415
415
  const e$2 = {};
416
416
  return (n$2) => e$2[n$2] ?? (e$2[n$2] = r$1(n$2));
417
- }, sr = i$1(/^\*\*\/\*$/, ".*"), cr = i$1(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/, (r$1, e$2, n$2) => `.*${e$2 ? "" : "(?:^|/)"}${n$2.replaceAll(".", "\\.")}`), lr = i$1(/^\*\*\/(\*)?([ a-zA-Z0-9._-]*)\{([ a-zA-Z0-9._-]+(?:,[ a-zA-Z0-9._-]+)*)\}$/, (r$1, e$2, n$2, a$2) => `.*${e$2 ? "" : "(?:^|/)"}${n$2.replaceAll(".", "\\.")}(?:${a$2.replaceAll(",", "|").replaceAll(".", "\\.")})`), y$1 = i$1(/\\./, p$1), pr = i$1(/[$.*+?^(){}[\]\|]/, (r$1) => `\\${r$1}`), vr = i$1(/./, p$1), hr = i$1(/^(?:!!)*!(.*)$/, (r$1, e$2) => `(?!^${L(e$2)}$).*?`), dr = i$1(/^(!!)+/, ""), fr = l$1([hr, dr]), xr = i$1(/\/(\*\*\/)+/, "(?:/.+/|/)"), gr = i$1(/^(\*\*\/)+/, "(?:^|.*/)"), mr = i$1(/\/(\*\*)$/, "(?:/.*|$)"), _r = i$1(/\*\*/, ".*"), j = l$1([
417
+ }, sr = i$1(/^\*\*\/\*$/, ".*"), cr = i$1(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/, (r$1, e$2, n$2) => `.*${e$2 ? "" : "(?:^|/)"}${n$2.replaceAll(".", "\\.")}`), lr = i$1(/^\*\*\/(\*)?([ a-zA-Z0-9._-]*)\{([ a-zA-Z0-9._-]+(?:,[ a-zA-Z0-9._-]+)*)\}$/, (r$1, e$2, n$2, a$2) => `.*${e$2 ? "" : "(?:^|/)"}${n$2.replaceAll(".", "\\.")}(?:${a$2.replaceAll(",", "|").replaceAll(".", "\\.")})`), y = i$1(/\\./, p$1), pr = i$1(/[$.*+?^(){}[\]\|]/, (r$1) => `\\${r$1}`), vr = i$1(/./, p$1), hr = i$1(/^(?:!!)*!(.*)$/, (r$1, e$2) => `(?!^${L(e$2)}$).*?`), dr = i$1(/^(!!)+/, ""), fr = l$1([hr, dr]), xr = i$1(/\/(\*\*\/)+/, "(?:/.+/|/)"), gr = i$1(/^(\*\*\/)+/, "(?:^|.*/)"), mr = i$1(/\/(\*\*)$/, "(?:/.*|$)"), _r = i$1(/\*\*/, ".*"), j = l$1([
418
418
  xr,
419
419
  gr,
420
420
  mr,
421
421
  _r
422
422
  ]), Sr = i$1(/\*\/(?!\*\*\/)/, "[^/]*/"), yr = i$1(/\*/, "[^/]*"), N = l$1([Sr, yr]), k = i$1("?", "[^/]"), $r = i$1("[", p$1), wr = i$1("]", p$1), Ar = i$1(/[!^]/, "^/"), br = i$1(/[a-z]-[a-z]|[0-9]-[0-9]/i, p$1), Cr = i$1(/[$.*+?^(){}[\|]/, (r$1) => `\\${r$1}`), Mr = i$1(/[^\]]/, p$1), Er = l$1([
423
- y$1,
423
+ y,
424
424
  Cr,
425
425
  br,
426
426
  Mr
@@ -444,7 +444,7 @@ let _lazyMatch = () => {
444
444
  B,
445
445
  I,
446
446
  Zr,
447
- y$1,
447
+ y,
448
448
  Fr,
449
449
  Ir,
450
450
  Lr
@@ -452,7 +452,7 @@ let _lazyMatch = () => {
452
452
  kr,
453
453
  f$1(Dr),
454
454
  Br
455
- ]), Ur = f$1(l$1([
455
+ ]), Vr = f$1(l$1([
456
456
  sr,
457
457
  cr,
458
458
  lr,
@@ -463,16 +463,16 @@ let _lazyMatch = () => {
463
463
  B,
464
464
  I,
465
465
  F,
466
- y$1,
466
+ y,
467
467
  pr,
468
468
  vr
469
- ])), Vr = Ur, Gr = z(Vr), L = Gr, Tr = i$1(/\\./, p$1), qr = i$1(/./, p$1), Hr = i$1(/\*\*\*+/, "*"), Jr = i$1(/([^/{[(!])\*\*/, (r$1, e$2) => `${e$2}*`), Qr = i$1(/(^|.)\*\*(?=[^*/)\]}])/, (r$1, e$2) => `${e$2}*`), Wr = f$1(l$1([
469
+ ])), L = z(Vr), Tr = i$1(/\\./, p$1), qr = i$1(/./, p$1), Hr = i$1(/\*\*\*+/, "*"), Jr = i$1(/([^/{[(!])\*\*/, (r$1, e$2) => `${e$2}*`), Qr = i$1(/(^|.)\*\*(?=[^*/)\]}])/, (r$1, e$2) => `${e$2}*`), Kr = f$1(l$1([
470
470
  Tr,
471
471
  Hr,
472
472
  Jr,
473
473
  Qr,
474
474
  qr
475
- ])), Kr = Wr, Xr = z(Kr), Yr = Xr, $ = (r$1, e$2) => {
475
+ ])), Yr = z(Kr), $ = (r$1, e$2) => {
476
476
  const n$2 = Array.isArray(r$1) ? r$1 : [r$1];
477
477
  if (!n$2.length) return false;
478
478
  const a$2 = n$2.map($.compile), t$3 = n$2.every((s$1) => /(\/(?:\*\*)?|\[\/\])$/.test(s$1)), o$1 = e$2.replace(/[\\\/]+/g, "/").replace(/\/$/, t$3 ? "/" : "");
@@ -1035,20 +1035,20 @@ function getSortedPlugins(hookName, plugins) {
1035
1035
  }
1036
1036
 
1037
1037
  //#endregion
1038
- //#region ../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.cjs
1039
- var require_ansis = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.cjs": ((exports, module) => {
1040
- 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) => {
1041
- 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);
1038
+ //#region ../../node_modules/.pnpm/ansis@4.2.0/node_modules/ansis/index.cjs
1039
+ var require_ansis = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ansis@4.2.0/node_modules/ansis/index.cjs": ((exports, module) => {
1040
+ 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) => {
1041
+ 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);
1042
1042
  return [
1043
- n$2 >> 16 & 255,
1044
- n$2 >> 8 & 255,
1045
- 255 & n$2
1043
+ l$1 >> 16 & 255,
1044
+ l$1 >> 8 & 255,
1045
+ 255 & l$1
1046
1046
  ];
1047
1047
  }, 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) => {
1048
- let t$3, r$1, n$2, l$1, o$1;
1049
- 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);
1050
- }, g = (() => {
1051
- 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;
1048
+ let t$3, r$1, l$1, n$2, o$1;
1049
+ 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);
1050
+ }, f = (() => {
1051
+ 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;
1052
1052
  try {
1053
1053
  e$1 = "," + s(i$1).join(",");
1054
1054
  } catch (e$2) {
@@ -1061,86 +1061,86 @@ var require_ansis = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ansis
1061
1061
  2: 2,
1062
1062
  3: 3
1063
1063
  }[i$1[a$2]] ?? -1, u$1 = a$2 in i$1 && p$1 || r$1(/^--color=?(true|always)?$/);
1064
- return u$1 && (c$1 = p$1), ~c$1 || (c$1 = ((r$2, n$3, l$2) => (t$2 = r$2.TERM, {
1064
+ return u$1 && (c$1 = p$1), ~c$1 || (c$1 = ((r$2, l$2, n$3) => (t$2 = r$2.TERM, {
1065
1065
  "24bit": 3,
1066
1066
  truecolor: 3,
1067
1067
  ansi256: 2,
1068
1068
  ansi: 1
1069
- }[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;
1070
- })(), f = {
1069
+ }[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;
1070
+ })(), g = {
1071
1071
  open: i,
1072
1072
  close: i
1073
- }, h = 39, b = 49, O = {}, m = ({ p: e$2 }, { open: t$3, close: n$2 }) => {
1073
+ }, h = 39, b = 49, O = {}, m = ({ p: e$2 }, { open: t$3, close: l$1 }) => {
1074
1074
  let o$1 = (e$3, ...r$1) => {
1075
1075
  if (!e$3) {
1076
- if (t$3 && t$3 === n$2) return t$3;
1076
+ if (t$3 && t$3 === l$1) return t$3;
1077
1077
  if ((e$3 ?? i) === i) return i;
1078
1078
  }
1079
- 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;
1079
+ 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;
1080
1080
  if (s$2.includes("\x1B")) for (; c$2; c$2 = c$2.p) {
1081
- let { open: e$4, close: t$4 } = c$2, r$2 = t$4.length, n$3 = i, o$2 = 0;
1082
- 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;
1083
- s$2 = n$3 + s$2.slice(o$2);
1081
+ let { open: e$4, close: t$4 } = c$2, r$2 = t$4.length, l$2 = i, o$2 = 0;
1082
+ 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;
1083
+ s$2 = l$2 + s$2.slice(o$2);
1084
1084
  }
1085
1085
  return a$2 + (s$2.includes("\n") ? s$2.replace(/(\r?\n)/g, p$1 + "$1" + a$2) : s$2) + p$1;
1086
- }, s$1 = t$3, c$1 = n$2;
1087
- return e$2 && (s$1 = e$2.o + t$3, c$1 = n$2 + e$2.c), l(o$1, r), o$1.p = {
1086
+ }, s$1 = t$3, c$1 = l$1;
1087
+ 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 = {
1088
1088
  open: t$3,
1089
- close: n$2,
1089
+ close: l$1,
1090
1090
  o: s$1,
1091
1091
  c: c$1,
1092
1092
  p: e$2
1093
1093
  }, o$1.open = s$1, o$1.close = c$1, o$1;
1094
1094
  };
1095
- const w = function(e$2 = g) {
1096
- let t$3 = {
1097
- Ansis: w,
1098
- level: e$2,
1099
- isSupported: () => s$1,
1095
+ const w = new function e$2(t$3 = f) {
1096
+ let s$1 = {
1097
+ Ansis: e$2,
1098
+ level: t$3,
1099
+ isSupported: () => a$2,
1100
1100
  strip: (e$3) => e$3.replace(/[›][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, i),
1101
1101
  extend(e$3) {
1102
1102
  for (let t$4 in e$3) {
1103
- let r$1 = e$3[t$4], l$1 = (typeof r$1)[0], o$1 = "s" === l$1 ? x(...p(r$1)) : r$1;
1104
- O[t$4] = "f" === l$1 ? { get() {
1105
- return (...e$4) => m(this, r$1(...e$4));
1106
- } } : { get() {
1107
- let e$4 = m(this, o$1);
1108
- return n$1(this, t$4, { value: e$4 }), e$4;
1109
- } };
1103
+ let r$1 = e$3[t$4], l$1 = (typeof r$1)[0];
1104
+ "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);
1110
1105
  }
1111
- return r = o({}, O), l(t$3, r), t$3;
1106
+ return r = o({}, O), n$1(s$1, r), s$1;
1112
1107
  }
1113
- }, s$1 = e$2 > 0, c$1 = (e$3, t$4) => s$1 ? {
1108
+ }, c$1 = (e$3, t$4, r$1) => {
1109
+ O[e$3] = { get() {
1110
+ let n$2 = r$1 ? (...e$4) => m(this, t$4(...e$4)) : m(this, t$4);
1111
+ return l(this, e$3, { value: n$2 }), n$2;
1112
+ } };
1113
+ }, a$2 = t$3 > 0, w$1 = (e$3, t$4) => a$2 ? {
1114
1114
  open: `[${e$3}m`,
1115
1115
  close: `[${t$4}m`
1116
- } : 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);
1117
- 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));
1118
- let E, M = {
1119
- fg: v,
1120
- bg: C,
1121
- rgb: x,
1122
- bgRgb: T,
1123
- hex: a$2(x),
1124
- bgHex: a$2(T),
1125
- visible: f,
1126
- reset: c$1(0, 0),
1127
- bold: c$1(1, 22),
1128
- dim: c$1(2, 22),
1129
- italic: c$1(3, 23),
1130
- underline: c$1(4, 24),
1131
- inverse: c$1(7, 27),
1132
- hidden: c$1(8, 28),
1133
- strikethrough: c$1(9, 29)
1134
- }, I = "Bright";
1116
+ } : 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);
1117
+ 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));
1118
+ let M, I = {
1119
+ fg: C,
1120
+ bg: E,
1121
+ rgb: T,
1122
+ bgRgb: v,
1123
+ hex: y(T),
1124
+ bgHex: y(v),
1125
+ visible: g,
1126
+ reset: w$1(0, 0),
1127
+ bold: w$1(1, 22),
1128
+ dim: w$1(2, 22),
1129
+ italic: w$1(3, 23),
1130
+ underline: w$1(4, 24),
1131
+ inverse: w$1(7, 27),
1132
+ hidden: w$1(8, 28),
1133
+ strikethrough: w$1(9, 29)
1134
+ }, _ = (e$3) => "bg" + e$3[0].toUpperCase() + e$3.slice(1), k = "Bright";
1135
1135
  return "black,red,green,yellow,blue,magenta,cyan,white,gray".split(",").map(((e$3, t$4) => {
1136
- 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);
1137
- })), t$3.extend(M);
1138
- }, y = new w();
1139
- module.exports = y, y.default = y;
1136
+ 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);
1137
+ })), s$1.extend(I);
1138
+ }();
1139
+ module.exports = w, w.default = w;
1140
1140
  }) });
1141
1141
 
1142
1142
  //#endregion
1143
- //#region ../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.mjs
1143
+ //#region ../../node_modules/.pnpm/ansis@4.2.0/node_modules/ansis/index.mjs
1144
1144
  var import_ansis = /* @__PURE__ */ __toESM(require_ansis(), 1);
1145
1145
  var ansis_default = import_ansis.default;
1146
1146
  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;
@@ -2059,6 +2059,18 @@ function omit(schema, keys) {
2059
2059
  };
2060
2060
  }
2061
2061
  /* @__NO_SIDE_EFFECTS__ */
2062
+ function partial(schema, keys) {
2063
+ const entries2 = {};
2064
+ for (const key in schema.entries) entries2[key] = !keys || keys.includes(key) ? /* @__PURE__ */ optional(schema.entries[key]) : schema.entries[key];
2065
+ return {
2066
+ ...schema,
2067
+ entries: entries2,
2068
+ get "~standard"() {
2069
+ return /* @__PURE__ */ _getStandardProps(this);
2070
+ }
2071
+ };
2072
+ }
2073
+ /* @__NO_SIDE_EFFECTS__ */
2062
2074
  function pipe(...pipe2) {
2063
2075
  return {
2064
2076
  ...pipe2[0],
@@ -2448,6 +2460,11 @@ const AdvancedChunksSchema = strictObject({
2448
2460
  maxModuleSize: optional(number())
2449
2461
  })))
2450
2462
  });
2463
+ const GeneratedCodePresetSchema = union([literal("es5"), literal("es2015")]);
2464
+ const GeneratedCodeOptionsSchema = strictObject({
2465
+ symbols: pipe(optional(boolean()), description("Whether to use Symbol.toStringTag for namespace objects")),
2466
+ preset: GeneratedCodePresetSchema
2467
+ });
2451
2468
  const OutputOptionsSchema = strictObject({
2452
2469
  dir: pipe(optional(string()), description("Output directory, defaults to `dist` if `file` is not set")),
2453
2470
  file: pipe(optional(string()), description("Single output file")),
@@ -2470,7 +2487,11 @@ const OutputOptionsSchema = strictObject({
2470
2487
  ])), description(`Generate sourcemap (\`-s inline\` for inline, or ${ansis_default.bold("pass the `-s` on the last argument if you want to generate `.map` file")})`)),
2471
2488
  sourcemapBaseUrl: pipe(optional(string()), description("Base URL used to prefix sourcemap paths")),
2472
2489
  sourcemapDebugIds: pipe(optional(boolean()), description("Inject sourcemap debug IDs")),
2473
- sourcemapIgnoreList: optional(union([boolean(), custom(() => true)])),
2490
+ sourcemapIgnoreList: optional(union([
2491
+ boolean(),
2492
+ custom(() => true),
2493
+ StringOrRegExpSchema
2494
+ ])),
2474
2495
  sourcemapPathTransform: optional(custom(() => true)),
2475
2496
  banner: optional(union([string(), AddonFunctionSchema])),
2476
2497
  footer: optional(union([string(), AddonFunctionSchema])),
@@ -2491,6 +2512,7 @@ const OutputOptionsSchema = strictObject({
2491
2512
  ])), description("Minify the bundled file")),
2492
2513
  name: pipe(optional(string()), description("Name for UMD / IIFE format outputs")),
2493
2514
  globals: pipe(optional(union([record(string(), string()), GlobalsFunctionSchema])), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
2515
+ generatedCode: pipe(optional(partial(GeneratedCodeOptionsSchema)), description("Generated code options")),
2494
2516
  externalLiveBindings: pipe(optional(boolean()), description("external live bindings")),
2495
2517
  inlineDynamicImports: pipe(optional(boolean()), description("Inline dynamic imports")),
2496
2518
  manualChunks: optional(pipe(function_(), args(tuple([string(), object({})])), returns(union([string(), nullish(string())])))),
@@ -2767,7 +2789,7 @@ function exclude(expr) {
2767
2789
  }
2768
2790
 
2769
2791
  //#endregion
2770
- //#region ../../node_modules/.pnpm/remeda@2.31.1/node_modules/remeda/dist/lazyDataLastImpl-BDhrIOwR.js
2792
+ //#region ../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/lazyDataLastImpl-BDhrIOwR.js
2771
2793
  function e(e$2, t$3, n$2) {
2772
2794
  let r$1 = (n$3) => e$2(n$3, ...t$3);
2773
2795
  return n$2 === void 0 ? r$1 : Object.assign(r$1, {
@@ -2777,7 +2799,7 @@ function e(e$2, t$3, n$2) {
2777
2799
  }
2778
2800
 
2779
2801
  //#endregion
2780
- //#region ../../node_modules/.pnpm/remeda@2.31.1/node_modules/remeda/dist/purry-DH9cw9sy.js
2802
+ //#region ../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/purry-DH9cw9sy.js
2781
2803
  function t(t$3, n$2, r$1) {
2782
2804
  let i$1 = t$3.length - n$2.length;
2783
2805
  if (i$1 === 0) return t$3(...n$2);
@@ -2786,7 +2808,7 @@ function t(t$3, n$2, r$1) {
2786
2808
  }
2787
2809
 
2788
2810
  //#endregion
2789
- //#region ../../node_modules/.pnpm/remeda@2.31.1/node_modules/remeda/dist/partition-DAu403JQ.js
2811
+ //#region ../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/partition-DAu403JQ.js
2790
2812
  function t$1(...t$3) {
2791
2813
  return t(n, t$3);
2792
2814
  }
@@ -2946,7 +2968,7 @@ function bindingPluginOrder(order) {
2946
2968
  }
2947
2969
 
2948
2970
  //#endregion
2949
- //#region ../../node_modules/.pnpm/oxc-parser@0.90.0/node_modules/oxc-parser/wrap.mjs
2971
+ //#region ../../node_modules/.pnpm/oxc-parser@0.93.0/node_modules/oxc-parser/src-js/wrap.js
2950
2972
  function wrap$1(result) {
2951
2973
  let program, module$1, comments, errors;
2952
2974
  return {
@@ -3945,130 +3967,6 @@ var NormalizedInputOptionsImpl = class {
3945
3967
  }
3946
3968
  };
3947
3969
 
3948
- //#endregion
3949
- //#region src/types/chunking-context.ts
3950
- var ChunkingContextImpl = class {
3951
- constructor(context) {
3952
- this.context = context;
3953
- }
3954
- getModuleInfo(moduleId) {
3955
- const bindingInfo = this.context.getModuleInfo(moduleId);
3956
- if (bindingInfo) return transformModuleInfo(bindingInfo, {
3957
- moduleSideEffects: null,
3958
- meta: {}
3959
- });
3960
- return null;
3961
- }
3962
- };
3963
-
3964
- //#endregion
3965
- //#region src/utils/bindingify-output-options.ts
3966
- function bindingifyOutputOptions(outputOptions) {
3967
- const { dir, format: format$1, 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;
3968
- const advancedChunks = bindingifyAdvancedChunks(outputOptions.advancedChunks, manualChunks);
3969
- return {
3970
- dir,
3971
- file: file == null ? void 0 : file,
3972
- format: bindingifyFormat(format$1),
3973
- exports,
3974
- hashCharacters,
3975
- sourcemap: bindingifySourcemap(sourcemap),
3976
- sourcemapBaseUrl,
3977
- sourcemapDebugIds,
3978
- sourcemapIgnoreList: bindingifySourcemapIgnoreList(sourcemapIgnoreList),
3979
- sourcemapPathTransform,
3980
- banner: bindingifyAddon(banner),
3981
- footer: bindingifyAddon(footer),
3982
- intro: bindingifyAddon(intro),
3983
- outro: bindingifyAddon(outro),
3984
- extend: outputOptions.extend,
3985
- globals,
3986
- esModule,
3987
- name,
3988
- assetFileNames: bindingifyAssetFilenames(assetFileNames),
3989
- entryFileNames,
3990
- chunkFileNames,
3991
- cssEntryFileNames,
3992
- cssChunkFileNames,
3993
- plugins: [],
3994
- minify: outputOptions.minify,
3995
- externalLiveBindings: outputOptions.externalLiveBindings,
3996
- inlineDynamicImports: outputOptions.inlineDynamicImports,
3997
- advancedChunks,
3998
- polyfillRequire: outputOptions.polyfillRequire,
3999
- sanitizeFileName,
4000
- preserveModules,
4001
- virtualDirname,
4002
- legalComments,
4003
- preserveModulesRoot,
4004
- topLevelVar,
4005
- minifyInternalExports: outputOptions.minifyInternalExports
4006
- };
4007
- }
4008
- function bindingifyAddon(configAddon) {
4009
- return async (chunk) => {
4010
- if (typeof configAddon === "function") return configAddon(transformRenderedChunk(chunk));
4011
- return configAddon || "";
4012
- };
4013
- }
4014
- function bindingifyFormat(format$1) {
4015
- switch (format$1) {
4016
- case void 0:
4017
- case "es":
4018
- case "esm":
4019
- case "module": return "es";
4020
- case "cjs":
4021
- case "commonjs": return "cjs";
4022
- case "iife": return "iife";
4023
- case "umd": return "umd";
4024
- default: unimplemented(`output.format: ${format$1}`);
4025
- }
4026
- }
4027
- function bindingifySourcemap(sourcemap) {
4028
- switch (sourcemap) {
4029
- case true: return "file";
4030
- case "inline": return "inline";
4031
- case false:
4032
- case void 0: return;
4033
- case "hidden": return "hidden";
4034
- default: throw new Error(`unknown sourcemap: ${sourcemap}`);
4035
- }
4036
- }
4037
- function bindingifySourcemapIgnoreList(sourcemapIgnoreList) {
4038
- return typeof sourcemapIgnoreList === "function" ? sourcemapIgnoreList : sourcemapIgnoreList === false ? () => false : (relativeSourcePath, _sourcemapPath) => relativeSourcePath.includes("node_modules");
4039
- }
4040
- function bindingifyAssetFilenames(assetFileNames) {
4041
- if (typeof assetFileNames === "function") return (asset) => {
4042
- return assetFileNames({
4043
- name: asset.name,
4044
- names: asset.names,
4045
- originalFileName: asset.originalFileName,
4046
- originalFileNames: asset.originalFileNames,
4047
- source: transformAssetSource(asset.source),
4048
- type: "asset"
4049
- });
4050
- };
4051
- return assetFileNames;
4052
- }
4053
- function bindingifyAdvancedChunks(advancedChunks, manualChunks) {
4054
- if (manualChunks != null && advancedChunks != null) console.warn("`manualChunks` option is ignored due to `advancedChunks` option is specified.");
4055
- else if (manualChunks != null) advancedChunks = { groups: [{ name(moduleId, ctx) {
4056
- return manualChunks(moduleId, { getModuleInfo: (id$1) => ctx.getModuleInfo(id$1) });
4057
- } }] };
4058
- if (advancedChunks == null) return;
4059
- const { groups,...restAdvancedChunks } = advancedChunks;
4060
- return {
4061
- ...restAdvancedChunks,
4062
- groups: groups?.map((group) => {
4063
- const { name,...restGroup } = group;
4064
- return {
4065
- ...restGroup,
4066
- name: typeof name === "function" ? (id$1, ctx) => name(id$1, new ChunkingContextImpl(ctx)) : name
4067
- };
4068
- })
4069
- };
4070
- }
4071
-
4072
3970
  //#endregion
4073
3971
  //#region src/options/normalized-output-options.ts
4074
3972
  var NormalizedOutputOptionsImpl = class {
@@ -4150,7 +4048,7 @@ var NormalizedOutputOptionsImpl = class {
4150
4048
  return this.inner.sourcemapDebugIds;
4151
4049
  }
4152
4050
  get sourcemapIgnoreList() {
4153
- return bindingifySourcemapIgnoreList(this.outputOptions.sourcemapIgnoreList);
4051
+ return this.outputOptions.sourcemapIgnoreList;
4154
4052
  }
4155
4053
  get sourcemapPathTransform() {
4156
4054
  return this.outputOptions.sourcemapPathTransform;
@@ -4567,6 +4465,128 @@ function bindingifyPreserveEntrySignatures(preserveEntrySignatures) {
4567
4465
  };
4568
4466
  }
4569
4467
 
4468
+ //#endregion
4469
+ //#region src/types/chunking-context.ts
4470
+ var ChunkingContextImpl = class {
4471
+ constructor(context) {
4472
+ this.context = context;
4473
+ }
4474
+ getModuleInfo(moduleId) {
4475
+ const bindingInfo = this.context.getModuleInfo(moduleId);
4476
+ if (bindingInfo) return transformModuleInfo(bindingInfo, {
4477
+ moduleSideEffects: null,
4478
+ meta: {}
4479
+ });
4480
+ return null;
4481
+ }
4482
+ };
4483
+
4484
+ //#endregion
4485
+ //#region src/utils/bindingify-output-options.ts
4486
+ function bindingifyOutputOptions(outputOptions) {
4487
+ const { dir, format: format$1, 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;
4488
+ const advancedChunks = bindingifyAdvancedChunks(outputOptions.advancedChunks, manualChunks);
4489
+ return {
4490
+ dir,
4491
+ file: file == null ? void 0 : file,
4492
+ format: bindingifyFormat(format$1),
4493
+ exports,
4494
+ hashCharacters,
4495
+ sourcemap: bindingifySourcemap(sourcemap),
4496
+ sourcemapBaseUrl,
4497
+ sourcemapDebugIds,
4498
+ sourcemapIgnoreList: sourcemapIgnoreList ?? /node_modules/,
4499
+ sourcemapPathTransform,
4500
+ banner: bindingifyAddon(banner),
4501
+ footer: bindingifyAddon(footer),
4502
+ intro: bindingifyAddon(intro),
4503
+ outro: bindingifyAddon(outro),
4504
+ extend: outputOptions.extend,
4505
+ globals,
4506
+ generatedCode,
4507
+ esModule,
4508
+ name,
4509
+ assetFileNames: bindingifyAssetFilenames(assetFileNames),
4510
+ entryFileNames,
4511
+ chunkFileNames,
4512
+ cssEntryFileNames,
4513
+ cssChunkFileNames,
4514
+ plugins: [],
4515
+ minify: outputOptions.minify,
4516
+ externalLiveBindings: outputOptions.externalLiveBindings,
4517
+ inlineDynamicImports: outputOptions.inlineDynamicImports,
4518
+ advancedChunks,
4519
+ polyfillRequire: outputOptions.polyfillRequire,
4520
+ sanitizeFileName,
4521
+ preserveModules,
4522
+ virtualDirname,
4523
+ legalComments,
4524
+ preserveModulesRoot,
4525
+ topLevelVar,
4526
+ minifyInternalExports: outputOptions.minifyInternalExports
4527
+ };
4528
+ }
4529
+ function bindingifyAddon(configAddon) {
4530
+ return async (chunk) => {
4531
+ if (typeof configAddon === "function") return configAddon(transformRenderedChunk(chunk));
4532
+ return configAddon || "";
4533
+ };
4534
+ }
4535
+ function bindingifyFormat(format$1) {
4536
+ switch (format$1) {
4537
+ case void 0:
4538
+ case "es":
4539
+ case "esm":
4540
+ case "module": return "es";
4541
+ case "cjs":
4542
+ case "commonjs": return "cjs";
4543
+ case "iife": return "iife";
4544
+ case "umd": return "umd";
4545
+ default: unimplemented(`output.format: ${format$1}`);
4546
+ }
4547
+ }
4548
+ function bindingifySourcemap(sourcemap) {
4549
+ switch (sourcemap) {
4550
+ case true: return "file";
4551
+ case "inline": return "inline";
4552
+ case false:
4553
+ case void 0: return;
4554
+ case "hidden": return "hidden";
4555
+ default: throw new Error(`unknown sourcemap: ${sourcemap}`);
4556
+ }
4557
+ }
4558
+ function bindingifyAssetFilenames(assetFileNames) {
4559
+ if (typeof assetFileNames === "function") return (asset) => {
4560
+ return assetFileNames({
4561
+ name: asset.name,
4562
+ names: asset.names,
4563
+ originalFileName: asset.originalFileName,
4564
+ originalFileNames: asset.originalFileNames,
4565
+ source: transformAssetSource(asset.source),
4566
+ type: "asset"
4567
+ });
4568
+ };
4569
+ return assetFileNames;
4570
+ }
4571
+ function bindingifyAdvancedChunks(advancedChunks, manualChunks) {
4572
+ if (manualChunks != null && advancedChunks != null) console.warn("`manualChunks` option is ignored due to `advancedChunks` option is specified.");
4573
+ else if (manualChunks != null) advancedChunks = { groups: [{ name(moduleId, ctx) {
4574
+ return manualChunks(moduleId, { getModuleInfo: (id$1) => ctx.getModuleInfo(id$1) });
4575
+ } }] };
4576
+ if (advancedChunks == null) return;
4577
+ const { groups,...restAdvancedChunks } = advancedChunks;
4578
+ return {
4579
+ ...restAdvancedChunks,
4580
+ groups: groups?.map((group) => {
4581
+ const { name,...restGroup } = group;
4582
+ return {
4583
+ ...restGroup,
4584
+ name: typeof name === "function" ? (id$1, ctx) => name(id$1, new ChunkingContextImpl(ctx)) : name
4585
+ };
4586
+ })
4587
+ };
4588
+ }
4589
+
4570
4590
  //#endregion
4571
4591
  //#region src/utils/create-bundler-option.ts
4572
4592
  async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
@@ -4597,18 +4617,6 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
4597
4617
  }
4598
4618
  }
4599
4619
 
4600
- //#endregion
4601
- //#region src/utils/transform-hmr-patch-output.ts
4602
- function transformHmrPatchOutput(output) {
4603
- handleHmrPatchOutputErrors(output);
4604
- const { patch } = output;
4605
- return patch ?? void 0;
4606
- }
4607
- function handleHmrPatchOutputErrors(output) {
4608
- const rawErrors = output.errors;
4609
- if (rawErrors.length > 0) throw normalizeErrors(rawErrors);
4610
- }
4611
-
4612
4620
  //#endregion
4613
4621
  //#region src/api/rolldown/rolldown-build.ts
4614
4622
  Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
@@ -4670,18 +4678,6 @@ var RolldownBuild = class RolldownBuild {
4670
4678
  async [Symbol.asyncDispose]() {
4671
4679
  await this.close();
4672
4680
  }
4673
- async generateHmrPatch(changedFiles) {
4674
- const ret = await this.#bundlerImpl.impl.generateHmrPatch(changedFiles);
4675
- switch (ret.type) {
4676
- case "Ok": return ret.field0;
4677
- case "Error": throw normalizeErrors(ret.field0);
4678
- default: throw new Error("Unknown error");
4679
- }
4680
- }
4681
- async hmrInvalidate(file, firstInvalidatedBy) {
4682
- const output = await this.#bundlerImpl.impl.hmrInvalidate(file, firstInvalidatedBy);
4683
- return transformHmrPatchOutput(output);
4684
- }
4685
4681
  get watchFiles() {
4686
4682
  return this.#bundlerImpl?.impl.getWatchFiles() ?? Promise.resolve([]);
4687
4683
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rolldown/browser",
3
- "version": "1.0.0-beta.39",
3
+ "version": "1.0.0-beta.41",
4
4
  "description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
5
5
  "homepage": "https://rolldown.rs/",
6
6
  "type": "module",