@rolldown/browser 1.0.0-beta.35 → 1.0.0-beta.36

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 (49) hide show
  1. package/dist/cli.mjs +18 -29
  2. package/dist/config.d.mts +2 -2
  3. package/dist/config.mjs +4 -4
  4. package/dist/experimental-index.browser.mjs +5 -3
  5. package/dist/experimental-index.d.mts +8 -5
  6. package/dist/experimental-index.mjs +7 -5
  7. package/dist/filter-index.d.mts +2 -2
  8. package/dist/filter-index.mjs +1 -1
  9. package/dist/index.browser.mjs +1 -1
  10. package/dist/index.d.mts +2 -2
  11. package/dist/index.mjs +3 -3
  12. package/dist/parallel-plugin-worker.mjs +4 -5
  13. package/dist/parallel-plugin.d.mts +2 -2
  14. package/dist/parse-ast-index.d.mts +1 -1
  15. package/dist/parse-ast-index.mjs +1 -1
  16. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  17. package/dist/shared/{binding-9k0egz6L.d.mts → binding-wK0CRIMb.d.mts} +1 -0
  18. package/dist/shared/{define-config-DhrkZ_o7.d.cts → define-config-BcNhk996.d.mts} +2 -2
  19. package/dist/shared/{dist-ByKQkexh.mjs → dist-CHTC3-kR.mjs} +1 -1
  20. package/dist/shared/{load-config-BCjD-AGJ.mjs → load-config-M8Gvqt1X.mjs} +4 -6
  21. package/dist/shared/{parse-ast-index-C_CZT4St.mjs → parse-ast-index-C3TkGcEQ.mjs} +1 -1
  22. package/dist/shared/{prompt-C5jz26Zn.mjs → prompt-DuG2i9ud.mjs} +4 -7
  23. package/dist/shared/{src-B0RCtUy7.mjs → src-Dc4fRARy.mjs} +70 -43
  24. package/dist/{src-C8U06Im1.js → src-Cl6h35QH.js} +70 -44
  25. package/package.json +10 -24
  26. package/dist/cli.cjs +0 -1771
  27. package/dist/cli.d.cts +0 -1
  28. package/dist/config.cjs +0 -12
  29. package/dist/config.d.cts +0 -10
  30. package/dist/experimental-index.cjs +0 -176
  31. package/dist/experimental-index.d.cts +0 -99
  32. package/dist/filter-index.cjs +0 -53
  33. package/dist/filter-index.d.cts +0 -4
  34. package/dist/index.cjs +0 -9
  35. package/dist/index.d.cts +0 -3
  36. package/dist/parallel-plugin-worker.cjs +0 -35
  37. package/dist/parallel-plugin-worker.d.cts +0 -1
  38. package/dist/parallel-plugin.cjs +0 -8
  39. package/dist/parallel-plugin.d.cts +0 -14
  40. package/dist/parse-ast-index.cjs +0 -4
  41. package/dist/parse-ast-index.d.cts +0 -8
  42. package/dist/shared/binding-D13M6Llu.d.cts +0 -1425
  43. package/dist/shared/chunk-DDkG_k5U.cjs +0 -39
  44. package/dist/shared/define-config-DJXaSinS.d.mts +0 -1421
  45. package/dist/shared/dist-CK0hotcm.cjs +0 -240
  46. package/dist/shared/load-config-BJKhRKZL.cjs +0 -130
  47. package/dist/shared/parse-ast-index-J0xVKZRe.cjs +0 -327
  48. package/dist/shared/prompt-Q05EYrFb.cjs +0 -858
  49. package/dist/shared/src-Bd4BGX4v.cjs +0 -4788
@@ -1,5 +1,5 @@
1
- import { augmentCodeLocation, error, logCycleLoading, logDuplicateJsxConfig, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-C_CZT4St.mjs";
2
- import { and, arraify, code, exclude, id, include, moduleType, noop, or, unimplemented, unreachable, unsupported } from "./dist-ByKQkexh.mjs";
1
+ import { augmentCodeLocation, error, logCycleLoading, logDuplicateJsxConfig, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-C3TkGcEQ.mjs";
2
+ import { and, arraify, code, exclude, id, include, moduleType, noop, or, unimplemented, unreachable, unsupported } from "./dist-CHTC3-kR.mjs";
3
3
  import { Worker } from "node:worker_threads";
4
4
  import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingChunkModuleOrderBy, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingPropertyReadSideEffects, BindingPropertyWriteSideEffects, BindingWatcher, ParallelJsPluginRegistry, shutdownAsyncRuntime, startAsyncRuntime } from "../rolldown-binding.wasi.cjs";
5
5
  import path from "node:path";
@@ -34,7 +34,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
34
34
 
35
35
  //#endregion
36
36
  //#region package.json
37
- var version = "1.0.0-beta.35";
37
+ var version = "1.0.0-beta.36";
38
38
  var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
39
39
 
40
40
  //#endregion
@@ -110,8 +110,7 @@ function getLogHandler(level, code$1, logger, pluginName, logLevel) {
110
110
  function getLogger(plugins, onLog, logLevel, watchMode) {
111
111
  const minimalPriority = logLevelPriority[logLevel];
112
112
  const logger = (level, log, skipped = /* @__PURE__ */ new Set()) => {
113
- const logPriority = logLevelPriority[level];
114
- if (logPriority < minimalPriority) return;
113
+ if (logLevelPriority[level] < minimalPriority) return;
115
114
  for (const plugin of getSortedPlugins("onLog", plugins)) {
116
115
  if (skipped.has(plugin)) continue;
117
116
  const { onLog: pluginOnLog } = plugin;
@@ -120,8 +119,7 @@ function getLogger(plugins, onLog, logLevel, watchMode) {
120
119
  if (logLevelPriority[level$1] < minimalPriority) return () => {};
121
120
  return (log$1) => logger(level$1, normalizeLog(log$1), new Set(skipped).add(plugin));
122
121
  };
123
- const handler = "handler" in pluginOnLog ? pluginOnLog.handler : pluginOnLog;
124
- if (handler.call({
122
+ if (("handler" in pluginOnLog ? pluginOnLog.handler : pluginOnLog).call({
125
123
  debug: getLogHandler$1(LOG_LEVEL_DEBUG),
126
124
  error: (log$1) => error(normalizeLog(log$1)),
127
125
  info: getLogHandler$1(LOG_LEVEL_INFO),
@@ -203,7 +201,7 @@ function normalizeHook(hook) {
203
201
  //#endregion
204
202
  //#region src/utils/normalize-string-or-regex.ts
205
203
  function normalizedStringOrRegex(pattern) {
206
- if (!pattern) return void 0;
204
+ if (!pattern) return;
207
205
  if (!isReadonlyArray(pattern)) return [pattern];
208
206
  return pattern;
209
207
  }
@@ -427,9 +425,9 @@ var PluginDriver = class {
427
425
  };
428
426
  function getObjectPlugins(plugins) {
429
427
  return plugins.filter((plugin) => {
430
- if (!plugin) return void 0;
431
- if ("_parallel" in plugin) return void 0;
432
- if (isBuiltinPlugin(plugin)) return void 0;
428
+ if (!plugin) return;
429
+ if ("_parallel" in plugin) return;
430
+ if (isBuiltinPlugin(plugin)) return;
433
431
  return plugin;
434
432
  });
435
433
  }
@@ -2078,10 +2076,43 @@ const ChecksOptionsSchema = strictObject({
2078
2076
  configurationFieldConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting configuration field conflict")),
2079
2077
  preferBuiltinFeature: pipe(optional(boolean()), description("Whether to emit warning when detecting prefer builtin feature"))
2080
2078
  });
2079
+ const CompressOptionsKeepNamesSchema = strictObject({
2080
+ function: optional(boolean()),
2081
+ class: optional(boolean())
2082
+ });
2083
+ const CompressOptionsSchema = strictObject({
2084
+ target: optional(union([
2085
+ literal("esnext"),
2086
+ literal("es2015"),
2087
+ literal("es2016"),
2088
+ literal("es2017"),
2089
+ literal("es2018"),
2090
+ literal("es2019"),
2091
+ literal("es2020"),
2092
+ literal("es2021"),
2093
+ literal("es2022"),
2094
+ literal("es2023"),
2095
+ literal("es2024")
2096
+ ])),
2097
+ dropConsole: optional(boolean()),
2098
+ dropDebugger: optional(boolean()),
2099
+ keepNames: optional(CompressOptionsKeepNamesSchema),
2100
+ unused: optional(union([boolean(), literal("keep_assign")]))
2101
+ });
2102
+ const MangleOptionsKeepNamesSchema = strictObject({
2103
+ function: optional(boolean()),
2104
+ class: optional(boolean())
2105
+ });
2106
+ const MangleOptionsSchema = strictObject({
2107
+ toplevel: optional(boolean()),
2108
+ keepNames: optional(union([boolean(), MangleOptionsKeepNamesSchema])),
2109
+ debug: optional(boolean())
2110
+ });
2111
+ const CodegenOptionsSchema = strictObject({ removeWhitespace: optional(boolean()) });
2081
2112
  const MinifyOptionsSchema = strictObject({
2082
- mangle: optional(boolean()),
2083
- compress: optional(boolean()),
2084
- removeWhitespace: optional(boolean())
2113
+ compress: optional(union([boolean(), CompressOptionsSchema])),
2114
+ mangle: optional(union([boolean(), MangleOptionsSchema])),
2115
+ codegen: optional(union([boolean(), CodegenOptionsSchema]))
2085
2116
  });
2086
2117
  const ResolveOptionsSchema = strictObject({
2087
2118
  alias: optional(record(string(), union([string(), array(string())]))),
@@ -2355,8 +2386,7 @@ const CliOptionsSchema = strictObject({
2355
2386
  function validateCliOptions(options) {
2356
2387
  let parsed = safeParse(CliOptionsSchema, options);
2357
2388
  return [parsed.output, parsed.issues?.map((issue) => {
2358
- const option = issue.path?.map((pathItem) => pathItem.key).join(" ");
2359
- return `Invalid value for option ${option}: ${issue.message}`;
2389
+ return `Invalid value for option ${issue.path?.map((pathItem) => pathItem.key).join(" ")}: ${issue.message}`;
2360
2390
  })];
2361
2391
  }
2362
2392
  const inputHelperMsgRecord = {
@@ -2547,7 +2577,7 @@ function generateAtomMatcher(kind, matcher) {
2547
2577
  return kind === "code" ? code(matcher) : id(matcher);
2548
2578
  }
2549
2579
  function transformFilterMatcherToFilterExprs(filterOption) {
2550
- if (!filterOption) return void 0;
2580
+ if (!filterOption) return;
2551
2581
  if (Array.isArray(filterOption)) return filterOption;
2552
2582
  const { id: id$1, code: code$1, moduleType: moduleType$1 } = filterOption;
2553
2583
  let ret = [];
@@ -2645,24 +2675,24 @@ function bindingifyFilterExprImpl(expr, list) {
2645
2675
  }
2646
2676
  }
2647
2677
  function bindingifyResolveIdFilter(filterOption) {
2648
- if (!filterOption) return void 0;
2678
+ if (!filterOption) return;
2649
2679
  if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
2650
2680
  return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
2651
2681
  }
2652
2682
  function bindingifyLoadFilter(filterOption) {
2653
- if (!filterOption) return void 0;
2683
+ if (!filterOption) return;
2654
2684
  if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
2655
2685
  return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
2656
2686
  }
2657
2687
  function bindingifyTransformFilter(filterOption) {
2658
- if (!filterOption) return void 0;
2688
+ if (!filterOption) return;
2659
2689
  let filterExprs = transformFilterMatcherToFilterExprs(filterOption);
2660
2690
  let ret = [];
2661
2691
  if (filterExprs) ret = filterExprs.map(bindingifyFilterExpr);
2662
2692
  return { value: ret.length > 0 ? ret : void 0 };
2663
2693
  }
2664
2694
  function bindingifyRenderChunkFilter(filterOption) {
2665
- if (!filterOption) return void 0;
2695
+ if (!filterOption) return;
2666
2696
  if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
2667
2697
  return filterOption.code ? bindingifyGeneralHookFilter("code", filterOption.code) : void 0;
2668
2698
  }
@@ -2677,7 +2707,7 @@ function bindingPluginOrder(order) {
2677
2707
  case "post": return BindingPluginOrder.Post;
2678
2708
  case "pre": return BindingPluginOrder.Pre;
2679
2709
  case null:
2680
- case void 0: return void 0;
2710
+ case void 0: return;
2681
2711
  default: throw new Error(`Unknown plugin order: ${order}`);
2682
2712
  }
2683
2713
  }
@@ -2844,6 +2874,9 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
2844
2874
  getCombinedSourcemap() {
2845
2875
  return JSON.parse(this.inner.getCombinedSourcemap());
2846
2876
  }
2877
+ addWatchFile(id$1) {
2878
+ this.inner.addWatchFile(id$1);
2879
+ }
2847
2880
  };
2848
2881
 
2849
2882
  //#endregion
@@ -2943,7 +2976,7 @@ function bindingifyTransform(args$1) {
2943
2976
  return {
2944
2977
  plugin: async (ctx, code$1, id$1, meta$1) => {
2945
2978
  const ret = await handler.call(new TransformPluginContextImpl(args$1.outputOptions, ctx.inner(), args$1.plugin, args$1.pluginContextData, ctx, id$1, code$1, args$1.onLog, args$1.logLevel, args$1.watchMode), code$1, id$1, meta$1);
2946
- if (ret == null) return void 0;
2979
+ if (ret == null) return;
2947
2980
  if (typeof ret === "string") return { code: ret };
2948
2981
  let moduleOption = args$1.pluginContextData.updateModuleOption(id$1, {
2949
2982
  meta: ret.meta ?? {},
@@ -3077,9 +3110,8 @@ function transformChunkModules(modules) {
3077
3110
  //#endregion
3078
3111
  //#region src/utils/transform-to-rollup-output.ts
3079
3112
  function transformToRollupSourceMap(map) {
3080
- const parsed = JSON.parse(map);
3081
3113
  const obj = {
3082
- ...parsed,
3114
+ ...JSON.parse(map),
3083
3115
  toString() {
3084
3116
  return JSON.stringify(obj);
3085
3117
  },
@@ -3621,13 +3653,10 @@ var ChunkingContextImpl = class {
3621
3653
  }
3622
3654
  getModuleInfo(moduleId) {
3623
3655
  const bindingInfo = this.context.getModuleInfo(moduleId);
3624
- if (bindingInfo) {
3625
- const info = transformModuleInfo(bindingInfo, {
3626
- moduleSideEffects: null,
3627
- meta: {}
3628
- });
3629
- return info;
3630
- }
3656
+ if (bindingInfo) return transformModuleInfo(bindingInfo, {
3657
+ moduleSideEffects: null,
3658
+ meta: {}
3659
+ });
3631
3660
  return null;
3632
3661
  }
3633
3662
  };
@@ -3700,7 +3729,7 @@ function bindingifySourcemap(sourcemap) {
3700
3729
  case true: return "file";
3701
3730
  case "inline": return "inline";
3702
3731
  case false:
3703
- case void 0: return void 0;
3732
+ case void 0: return;
3704
3733
  case "hidden": return "hidden";
3705
3734
  default: throw new Error(`unknown sourcemap: ${sourcemap}`);
3706
3735
  }
@@ -3726,7 +3755,7 @@ function bindingifyAdvancedChunks(advancedChunks, manualChunks) {
3726
3755
  else if (manualChunks != null) advancedChunks = { groups: [{ name(moduleId, ctx) {
3727
3756
  return manualChunks(moduleId, { getModuleInfo: (id$1) => ctx.getModuleInfo(id$1) });
3728
3757
  } }] };
3729
- if (advancedChunks == null) return void 0;
3758
+ if (advancedChunks == null) return;
3730
3759
  const { groups,...restAdvancedChunks } = advancedChunks;
3731
3760
  return {
3732
3761
  ...restAdvancedChunks,
@@ -3930,8 +3959,7 @@ var PluginContextData = class {
3930
3959
  return info;
3931
3960
  }
3932
3961
  getModuleIds(context) {
3933
- const moduleIds = context.getModuleIds();
3934
- return moduleIds.values();
3962
+ return context.getModuleIds().values();
3935
3963
  }
3936
3964
  saveResolveOptions(options) {
3937
3965
  const index = this.resolveOptionsMap.size;
@@ -3974,7 +4002,7 @@ var PluginContextData = class {
3974
4002
  function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode) {
3975
4003
  const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedOutputPlugins);
3976
4004
  const plugins = rawPlugins.map((plugin) => {
3977
- if ("_parallel" in plugin) return void 0;
4005
+ if ("_parallel" in plugin) return;
3978
4006
  if (isBuiltinPlugin(plugin)) return bindingifyBuiltInPlugin(plugin);
3979
4007
  return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode);
3980
4008
  });
@@ -4029,7 +4057,7 @@ function bindingifyHmr(hmr) {
4029
4057
  }
4030
4058
  function bindingifyAttachDebugInfo(attachDebugInfo) {
4031
4059
  switch (attachDebugInfo) {
4032
- case void 0: return void 0;
4060
+ case void 0: return;
4033
4061
  case "full": return BindingAttachDebugInfo.Full;
4034
4062
  case "simple": return BindingAttachDebugInfo.Simple;
4035
4063
  case "none": return BindingAttachDebugInfo.None;
@@ -4184,7 +4212,7 @@ function bindingifyWatch(watch$1) {
4184
4212
  };
4185
4213
  }
4186
4214
  function bindingifyTreeshakeOptions(config) {
4187
- if (config === false) return void 0;
4215
+ if (config === false) return;
4188
4216
  if (config === true || config === void 0) return { moduleSideEffects: true };
4189
4217
  let normalizedConfig = {
4190
4218
  moduleSideEffects: true,
@@ -4230,7 +4258,7 @@ function bindingifyMakeAbsoluteExternalsRelative(makeAbsoluteExternalsRelative)
4230
4258
  };
4231
4259
  }
4232
4260
  function bindingifyPreserveEntrySignatures(preserveEntrySignatures) {
4233
- if (preserveEntrySignatures == void 0) return void 0;
4261
+ if (preserveEntrySignatures == void 0) return;
4234
4262
  else if (typeof preserveEntrySignatures === "string") return {
4235
4263
  type: "String",
4236
4264
  field0: preserveEntrySignatures
@@ -4253,7 +4281,7 @@ async function initializeParallelPlugins(plugins) {
4253
4281
  options
4254
4282
  });
4255
4283
  }
4256
- if (pluginInfos.length <= 0) return void 0;
4284
+ if (pluginInfos.length <= 0) return;
4257
4285
  const count = availableParallelism();
4258
4286
  const parallelJsPluginRegistry = new ParallelJsPluginRegistry(count);
4259
4287
  const registryId = parallelJsPluginRegistry.id;
@@ -4562,8 +4590,7 @@ async function createWatcher(emitter, input) {
4562
4590
  })).flat());
4563
4591
  const notifyOptions = getValidNotifyOption(bundlerOptions);
4564
4592
  const bindingWatcher = new BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions);
4565
- const watcher = new Watcher(emitter, bindingWatcher, bundlerOptions.map((option) => option.stopWorkers));
4566
- watcher.start();
4593
+ new Watcher(emitter, bindingWatcher, bundlerOptions.map((option) => option.stopWorkers)).start();
4567
4594
  }
4568
4595
  function getValidNotifyOption(bundlerOptions) {
4569
4596
  let result;
@@ -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.35";
30
+ var version = "1.0.0-beta.36";
31
31
 
32
32
  //#endregion
33
33
  //#region src/utils/code-frame.ts
@@ -366,8 +366,7 @@ let _lazyMatch = () => {
366
366
  return (!u$1 || e$2) && (a$2.index = t$3, a$2.output.length !== o$1 && (a$2.output.length = o$1)), u$1;
367
367
  };
368
368
  }, _ = (r$1, e$2) => {
369
- const n$2 = v(r$1);
370
- return n$2;
369
+ return v(r$1);
371
370
  }, g$1 = (() => {
372
371
  let r$1 = 0;
373
372
  return (e$2) => {
@@ -539,8 +538,7 @@ const join = function(...segments) {
539
538
  if (path.length > 0) {
540
539
  const pathTrailing = path[path.length - 1] === "/";
541
540
  const segLeading = seg[0] === "/";
542
- const both = pathTrailing && segLeading;
543
- if (both) path += seg.slice(1);
541
+ if (pathTrailing && segLeading) path += seg.slice(1);
544
542
  else path += pathTrailing || segLeading ? seg : `/${seg}`;
545
543
  } else path += seg;
546
544
  }
@@ -766,8 +764,7 @@ function getLogHandler(level, code$1, logger, pluginName, logLevel) {
766
764
  function getLogger(plugins, onLog, logLevel, watchMode) {
767
765
  const minimalPriority = logLevelPriority[logLevel];
768
766
  const logger = (level, log, skipped = /* @__PURE__ */ new Set()) => {
769
- const logPriority = logLevelPriority[level];
770
- if (logPriority < minimalPriority) return;
767
+ if (logLevelPriority[level] < minimalPriority) return;
771
768
  for (const plugin of getSortedPlugins("onLog", plugins)) {
772
769
  if (skipped.has(plugin)) continue;
773
770
  const { onLog: pluginOnLog } = plugin;
@@ -776,8 +773,7 @@ function getLogger(plugins, onLog, logLevel, watchMode) {
776
773
  if (logLevelPriority[level$1] < minimalPriority) return () => {};
777
774
  return (log$1) => logger(level$1, normalizeLog(log$1), new Set(skipped).add(plugin));
778
775
  };
779
- const handler = "handler" in pluginOnLog ? pluginOnLog.handler : pluginOnLog;
780
- if (handler.call({
776
+ if (("handler" in pluginOnLog ? pluginOnLog.handler : pluginOnLog).call({
781
777
  debug: getLogHandler$1(LOG_LEVEL_DEBUG),
782
778
  error: (log$1) => error(normalizeLog(log$1)),
783
779
  info: getLogHandler$1(LOG_LEVEL_INFO),
@@ -859,7 +855,7 @@ function normalizeHook(hook) {
859
855
  //#endregion
860
856
  //#region src/utils/normalize-string-or-regex.ts
861
857
  function normalizedStringOrRegex(pattern) {
862
- if (!pattern) return void 0;
858
+ if (!pattern) return;
863
859
  if (!isReadonlyArray(pattern)) return [pattern];
864
860
  return pattern;
865
861
  }
@@ -1080,9 +1076,9 @@ var PluginDriver = class {
1080
1076
  };
1081
1077
  function getObjectPlugins(plugins) {
1082
1078
  return plugins.filter((plugin) => {
1083
- if (!plugin) return void 0;
1084
- if ("_parallel" in plugin) return void 0;
1085
- if (isBuiltinPlugin(plugin)) return void 0;
1079
+ if (!plugin) return;
1080
+ if ("_parallel" in plugin) return;
1081
+ if (isBuiltinPlugin(plugin)) return;
1086
1082
  return plugin;
1087
1083
  });
1088
1084
  }
@@ -2315,10 +2311,43 @@ const ChecksOptionsSchema = strictObject({
2315
2311
  configurationFieldConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting configuration field conflict")),
2316
2312
  preferBuiltinFeature: pipe(optional(boolean()), description("Whether to emit warning when detecting prefer builtin feature"))
2317
2313
  });
2314
+ const CompressOptionsKeepNamesSchema = strictObject({
2315
+ function: optional(boolean()),
2316
+ class: optional(boolean())
2317
+ });
2318
+ const CompressOptionsSchema = strictObject({
2319
+ target: optional(union([
2320
+ literal("esnext"),
2321
+ literal("es2015"),
2322
+ literal("es2016"),
2323
+ literal("es2017"),
2324
+ literal("es2018"),
2325
+ literal("es2019"),
2326
+ literal("es2020"),
2327
+ literal("es2021"),
2328
+ literal("es2022"),
2329
+ literal("es2023"),
2330
+ literal("es2024")
2331
+ ])),
2332
+ dropConsole: optional(boolean()),
2333
+ dropDebugger: optional(boolean()),
2334
+ keepNames: optional(CompressOptionsKeepNamesSchema),
2335
+ unused: optional(union([boolean(), literal("keep_assign")]))
2336
+ });
2337
+ const MangleOptionsKeepNamesSchema = strictObject({
2338
+ function: optional(boolean()),
2339
+ class: optional(boolean())
2340
+ });
2341
+ const MangleOptionsSchema = strictObject({
2342
+ toplevel: optional(boolean()),
2343
+ keepNames: optional(union([boolean(), MangleOptionsKeepNamesSchema])),
2344
+ debug: optional(boolean())
2345
+ });
2346
+ const CodegenOptionsSchema = strictObject({ removeWhitespace: optional(boolean()) });
2318
2347
  const MinifyOptionsSchema = strictObject({
2319
- mangle: optional(boolean()),
2320
- compress: optional(boolean()),
2321
- removeWhitespace: optional(boolean())
2348
+ compress: optional(union([boolean(), CompressOptionsSchema])),
2349
+ mangle: optional(union([boolean(), MangleOptionsSchema])),
2350
+ codegen: optional(union([boolean(), CodegenOptionsSchema]))
2322
2351
  });
2323
2352
  const ResolveOptionsSchema = strictObject({
2324
2353
  alias: optional(record(string(), union([string(), array(string())]))),
@@ -2725,7 +2754,7 @@ function normalizeTransformHookSourcemap(id$1, originalCode, rawMap) {
2725
2754
  }
2726
2755
 
2727
2756
  //#endregion
2728
- //#region ../pluginutils/dist/index.js
2757
+ //#region ../pluginutils/dist/index.mjs
2729
2758
  var And = class {
2730
2759
  kind;
2731
2760
  args;
@@ -2852,7 +2881,7 @@ function generateAtomMatcher(kind, matcher) {
2852
2881
  return kind === "code" ? code(matcher) : id(matcher);
2853
2882
  }
2854
2883
  function transformFilterMatcherToFilterExprs(filterOption) {
2855
- if (!filterOption) return void 0;
2884
+ if (!filterOption) return;
2856
2885
  if (Array.isArray(filterOption)) return filterOption;
2857
2886
  const { id: id$1, code: code$1, moduleType: moduleType$1 } = filterOption;
2858
2887
  let ret = [];
@@ -2950,24 +2979,24 @@ function bindingifyFilterExprImpl(expr, list) {
2950
2979
  }
2951
2980
  }
2952
2981
  function bindingifyResolveIdFilter(filterOption) {
2953
- if (!filterOption) return void 0;
2982
+ if (!filterOption) return;
2954
2983
  if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
2955
2984
  return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
2956
2985
  }
2957
2986
  function bindingifyLoadFilter(filterOption) {
2958
- if (!filterOption) return void 0;
2987
+ if (!filterOption) return;
2959
2988
  if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
2960
2989
  return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
2961
2990
  }
2962
2991
  function bindingifyTransformFilter(filterOption) {
2963
- if (!filterOption) return void 0;
2992
+ if (!filterOption) return;
2964
2993
  let filterExprs = transformFilterMatcherToFilterExprs(filterOption);
2965
2994
  let ret = [];
2966
2995
  if (filterExprs) ret = filterExprs.map(bindingifyFilterExpr);
2967
2996
  return { value: ret.length > 0 ? ret : void 0 };
2968
2997
  }
2969
2998
  function bindingifyRenderChunkFilter(filterOption) {
2970
- if (!filterOption) return void 0;
2999
+ if (!filterOption) return;
2971
3000
  if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
2972
3001
  return filterOption.code ? bindingifyGeneralHookFilter("code", filterOption.code) : void 0;
2973
3002
  }
@@ -2982,13 +3011,13 @@ function bindingPluginOrder(order) {
2982
3011
  case "post": return BindingPluginOrder.Post;
2983
3012
  case "pre": return BindingPluginOrder.Pre;
2984
3013
  case null:
2985
- case void 0: return void 0;
3014
+ case void 0: return;
2986
3015
  default: throw new Error(`Unknown plugin order: ${order}`);
2987
3016
  }
2988
3017
  }
2989
3018
 
2990
3019
  //#endregion
2991
- //#region ../../node_modules/.pnpm/oxc-parser@0.82.3/node_modules/oxc-parser/wrap.mjs
3020
+ //#region ../../node_modules/.pnpm/oxc-parser@0.87.0/node_modules/oxc-parser/wrap.mjs
2992
3021
  function wrap$1(result) {
2993
3022
  let program, module$1, comments, errors;
2994
3023
  return {
@@ -3225,6 +3254,9 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
3225
3254
  getCombinedSourcemap() {
3226
3255
  return JSON.parse(this.inner.getCombinedSourcemap());
3227
3256
  }
3257
+ addWatchFile(id$1) {
3258
+ this.inner.addWatchFile(id$1);
3259
+ }
3228
3260
  };
3229
3261
 
3230
3262
  //#endregion
@@ -3324,7 +3356,7 @@ function bindingifyTransform(args$1) {
3324
3356
  return {
3325
3357
  plugin: async (ctx, code$1, id$1, meta$1) => {
3326
3358
  const ret = await handler.call(new TransformPluginContextImpl(args$1.outputOptions, ctx.inner(), args$1.plugin, args$1.pluginContextData, ctx, id$1, code$1, args$1.onLog, args$1.logLevel, args$1.watchMode), code$1, id$1, meta$1);
3327
- if (ret == null) return void 0;
3359
+ if (ret == null) return;
3328
3360
  if (typeof ret === "string") return { code: ret };
3329
3361
  let moduleOption = args$1.pluginContextData.updateModuleOption(id$1, {
3330
3362
  meta: ret.meta ?? {},
@@ -3458,9 +3490,8 @@ function transformChunkModules(modules) {
3458
3490
  //#endregion
3459
3491
  //#region src/utils/transform-to-rollup-output.ts
3460
3492
  function transformToRollupSourceMap(map) {
3461
- const parsed = JSON.parse(map);
3462
3493
  const obj = {
3463
- ...parsed,
3494
+ ...JSON.parse(map),
3464
3495
  toString() {
3465
3496
  return JSON.stringify(obj);
3466
3497
  },
@@ -4002,13 +4033,10 @@ var ChunkingContextImpl = class {
4002
4033
  }
4003
4034
  getModuleInfo(moduleId) {
4004
4035
  const bindingInfo = this.context.getModuleInfo(moduleId);
4005
- if (bindingInfo) {
4006
- const info = transformModuleInfo(bindingInfo, {
4007
- moduleSideEffects: null,
4008
- meta: {}
4009
- });
4010
- return info;
4011
- }
4036
+ if (bindingInfo) return transformModuleInfo(bindingInfo, {
4037
+ moduleSideEffects: null,
4038
+ meta: {}
4039
+ });
4012
4040
  return null;
4013
4041
  }
4014
4042
  };
@@ -4081,7 +4109,7 @@ function bindingifySourcemap(sourcemap) {
4081
4109
  case true: return "file";
4082
4110
  case "inline": return "inline";
4083
4111
  case false:
4084
- case void 0: return void 0;
4112
+ case void 0: return;
4085
4113
  case "hidden": return "hidden";
4086
4114
  default: throw new Error(`unknown sourcemap: ${sourcemap}`);
4087
4115
  }
@@ -4107,7 +4135,7 @@ function bindingifyAdvancedChunks(advancedChunks, manualChunks) {
4107
4135
  else if (manualChunks != null) advancedChunks = { groups: [{ name(moduleId, ctx) {
4108
4136
  return manualChunks(moduleId, { getModuleInfo: (id$1) => ctx.getModuleInfo(id$1) });
4109
4137
  } }] };
4110
- if (advancedChunks == null) return void 0;
4138
+ if (advancedChunks == null) return;
4111
4139
  const { groups,...restAdvancedChunks } = advancedChunks;
4112
4140
  return {
4113
4141
  ...restAdvancedChunks,
@@ -4311,8 +4339,7 @@ var PluginContextData = class {
4311
4339
  return info;
4312
4340
  }
4313
4341
  getModuleIds(context) {
4314
- const moduleIds = context.getModuleIds();
4315
- return moduleIds.values();
4342
+ return context.getModuleIds().values();
4316
4343
  }
4317
4344
  saveResolveOptions(options) {
4318
4345
  const index = this.resolveOptionsMap.size;
@@ -4355,7 +4382,7 @@ var PluginContextData = class {
4355
4382
  function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode) {
4356
4383
  const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedOutputPlugins);
4357
4384
  const plugins = rawPlugins.map((plugin) => {
4358
- if ("_parallel" in plugin) return void 0;
4385
+ if ("_parallel" in plugin) return;
4359
4386
  if (isBuiltinPlugin(plugin)) return bindingifyBuiltInPlugin(plugin);
4360
4387
  return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode);
4361
4388
  });
@@ -4410,7 +4437,7 @@ function bindingifyHmr(hmr) {
4410
4437
  }
4411
4438
  function bindingifyAttachDebugInfo(attachDebugInfo) {
4412
4439
  switch (attachDebugInfo) {
4413
- case void 0: return void 0;
4440
+ case void 0: return;
4414
4441
  case "full": return BindingAttachDebugInfo.Full;
4415
4442
  case "simple": return BindingAttachDebugInfo.Simple;
4416
4443
  case "none": return BindingAttachDebugInfo.None;
@@ -4565,7 +4592,7 @@ function bindingifyWatch(watch$1) {
4565
4592
  };
4566
4593
  }
4567
4594
  function bindingifyTreeshakeOptions(config) {
4568
- if (config === false) return void 0;
4595
+ if (config === false) return;
4569
4596
  if (config === true || config === void 0) return { moduleSideEffects: true };
4570
4597
  let normalizedConfig = {
4571
4598
  moduleSideEffects: true,
@@ -4611,7 +4638,7 @@ function bindingifyMakeAbsoluteExternalsRelative(makeAbsoluteExternalsRelative)
4611
4638
  };
4612
4639
  }
4613
4640
  function bindingifyPreserveEntrySignatures(preserveEntrySignatures) {
4614
- if (preserveEntrySignatures == void 0) return void 0;
4641
+ if (preserveEntrySignatures == void 0) return;
4615
4642
  else if (typeof preserveEntrySignatures === "string") return {
4616
4643
  type: "String",
4617
4644
  field0: preserveEntrySignatures
@@ -4881,8 +4908,7 @@ async function createWatcher(emitter, input) {
4881
4908
  })).flat());
4882
4909
  const notifyOptions = getValidNotifyOption(bundlerOptions);
4883
4910
  const bindingWatcher = new BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions);
4884
- const watcher = new Watcher(emitter, bindingWatcher, bundlerOptions.map((option) => option.stopWorkers));
4885
- watcher.start();
4911
+ new Watcher(emitter, bindingWatcher, bundlerOptions.map((option) => option.stopWorkers)).start();
4886
4912
  }
4887
4913
  function getValidNotifyOption(bundlerOptions) {
4888
4914
  let result;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rolldown/browser",
3
- "version": "1.0.0-beta.35",
3
+ "version": "1.0.0-beta.36",
4
4
  "description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
5
5
  "homepage": "https://rolldown.rs/",
6
6
  "type": "module",
@@ -26,36 +26,22 @@
26
26
  "bin": {
27
27
  "rolldown": "./bin/cli.mjs"
28
28
  },
29
- "main": "./dist/index.cjs",
29
+ "main": "./dist/index.mjs",
30
30
  "module": "./dist/index.mjs",
31
- "types": "./dist/index.d.cts",
31
+ "types": "./dist/index.d.mts",
32
32
  "exports": {
33
33
  ".": {
34
34
  "browser": "./dist/index.browser.mjs",
35
- "import": "./dist/index.mjs",
36
- "require": "./dist/index.cjs"
37
- },
38
- "./config": {
39
- "import": "./dist/config.mjs",
40
- "require": "./dist/config.cjs"
35
+ "default": "./dist/index.mjs"
41
36
  },
37
+ "./config": "./dist/config.mjs",
42
38
  "./experimental": {
43
39
  "browser": "./dist/experimental-index.browser.mjs",
44
- "import": "./dist/experimental-index.mjs",
45
- "require": "./dist/experimental-index.cjs"
46
- },
47
- "./filter": {
48
- "import": "./dist/filter-index.mjs",
49
- "require": "./dist/filter-index.cjs"
50
- },
51
- "./parallelPlugin": {
52
- "import": "./dist/parallel-plugin.mjs",
53
- "require": "./dist/parallel-plugin.cjs"
54
- },
55
- "./parseAst": {
56
- "import": "./dist/parse-ast-index.mjs",
57
- "require": "./dist/parse-ast-index.cjs"
40
+ "default": "./dist/experimental-index.mjs"
58
41
  },
42
+ "./filter": "./dist/filter-index.mjs",
43
+ "./parallelPlugin": "./dist/parallel-plugin.mjs",
44
+ "./parseAst": "./dist/parse-ast-index.mjs",
59
45
  "./package.json": "./package.json"
60
46
  },
61
47
  "publishConfig": {
@@ -64,7 +50,7 @@
64
50
  },
65
51
  "dependencies": {
66
52
  "@napi-rs/wasm-runtime": "^1.0.0",
67
- "@oxc-project/runtime": "=0.82.3"
53
+ "@oxc-project/runtime": "=0.87.0"
68
54
  },
69
55
  "scripts": {
70
56
  "build": "pnpm run build:debug",