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

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 (51) hide show
  1. package/dist/cli.mjs +96 -1069
  2. package/dist/config.d.mts +2 -2
  3. package/dist/config.mjs +4 -4
  4. package/dist/experimental-index.browser.mjs +493 -7
  5. package/dist/experimental-index.d.mts +43 -5
  6. package/dist/experimental-index.mjs +32 -9
  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 +3 -3
  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.wasi-browser.js +1 -0
  17. package/dist/rolldown-binding.wasi.cjs +1 -0
  18. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  19. package/dist/shared/{binding-9k0egz6L.d.mts → binding-Cjs27cfu.d.mts} +1 -0
  20. package/dist/shared/{define-config-DhrkZ_o7.d.cts → define-config-DzsPS4fI.d.mts} +8 -8
  21. package/dist/shared/{dist-ByKQkexh.mjs → dist-CHTC3-kR.mjs} +1 -1
  22. package/dist/shared/{load-config-BCjD-AGJ.mjs → load-config-efyGD8HY.mjs} +4 -6
  23. package/dist/{cli.cjs → shared/logger-CiCY7ucm.mjs} +34 -817
  24. package/dist/shared/{parse-ast-index-C_CZT4St.mjs → parse-ast-index-C3TkGcEQ.mjs} +1 -1
  25. package/dist/shared/{prompt-C5jz26Zn.mjs → prompt-D2FxOcB5.mjs} +4 -7
  26. package/dist/shared/{src-B0RCtUy7.mjs → src-kVjGhYdF.mjs} +89 -70
  27. package/dist/{src-C8U06Im1.js → src-C2GHZXDs.js} +88 -70
  28. package/package.json +10 -24
  29. package/dist/cli.d.cts +0 -1
  30. package/dist/config.cjs +0 -12
  31. package/dist/config.d.cts +0 -10
  32. package/dist/experimental-index.cjs +0 -176
  33. package/dist/experimental-index.d.cts +0 -99
  34. package/dist/filter-index.cjs +0 -53
  35. package/dist/filter-index.d.cts +0 -4
  36. package/dist/index.cjs +0 -9
  37. package/dist/index.d.cts +0 -3
  38. package/dist/parallel-plugin-worker.cjs +0 -35
  39. package/dist/parallel-plugin-worker.d.cts +0 -1
  40. package/dist/parallel-plugin.cjs +0 -8
  41. package/dist/parallel-plugin.d.cts +0 -14
  42. package/dist/parse-ast-index.cjs +0 -4
  43. package/dist/parse-ast-index.d.cts +0 -8
  44. package/dist/shared/binding-D13M6Llu.d.cts +0 -1425
  45. package/dist/shared/chunk-DDkG_k5U.cjs +0 -39
  46. package/dist/shared/define-config-DJXaSinS.d.mts +0 -1421
  47. package/dist/shared/dist-CK0hotcm.cjs +0 -240
  48. package/dist/shared/load-config-BJKhRKZL.cjs +0 -130
  49. package/dist/shared/parse-ast-index-J0xVKZRe.cjs +0 -327
  50. package/dist/shared/prompt-Q05EYrFb.cjs +0 -858
  51. package/dist/shared/src-Bd4BGX4v.cjs +0 -4788
@@ -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.37";
31
31
 
32
32
  //#endregion
33
33
  //#region src/utils/code-frame.ts
@@ -223,20 +223,12 @@ function augmentCodeLocation(properties, pos, source, id$1) {
223
223
 
224
224
  //#endregion
225
225
  //#region src/builtin-plugin/utils.ts
226
- const BuiltinClassSymbol = Symbol.for("__RolldownBuiltinPlugin__");
227
226
  var BuiltinPlugin = class {
228
227
  constructor(name, _options) {
229
228
  this.name = name;
230
229
  this._options = _options;
231
- this[BuiltinClassSymbol] = true;
232
230
  }
233
231
  };
234
- function isBuiltinPlugin(obj) {
235
- return obj && obj[BuiltinClassSymbol] === true;
236
- }
237
- function createBuiltinPlugin(name, options) {
238
- return new BuiltinPlugin(name, options);
239
- }
240
232
  function makeBuiltinPluginCallable(plugin) {
241
233
  let callablePlugin = new BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
242
234
  const wrappedPlugin = plugin;
@@ -366,8 +358,7 @@ let _lazyMatch = () => {
366
358
  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
359
  };
368
360
  }, _ = (r$1, e$2) => {
369
- const n$2 = v(r$1);
370
- return n$2;
361
+ return v(r$1);
371
362
  }, g$1 = (() => {
372
363
  let r$1 = 0;
373
364
  return (e$2) => {
@@ -539,8 +530,7 @@ const join = function(...segments) {
539
530
  if (path.length > 0) {
540
531
  const pathTrailing = path[path.length - 1] === "/";
541
532
  const segLeading = seg[0] === "/";
542
- const both = pathTrailing && segLeading;
543
- if (both) path += seg.slice(1);
533
+ if (pathTrailing && segLeading) path += seg.slice(1);
544
534
  else path += pathTrailing || segLeading ? seg : `/${seg}`;
545
535
  } else path += seg;
546
536
  }
@@ -766,8 +756,7 @@ function getLogHandler(level, code$1, logger, pluginName, logLevel) {
766
756
  function getLogger(plugins, onLog, logLevel, watchMode) {
767
757
  const minimalPriority = logLevelPriority[logLevel];
768
758
  const logger = (level, log, skipped = /* @__PURE__ */ new Set()) => {
769
- const logPriority = logLevelPriority[level];
770
- if (logPriority < minimalPriority) return;
759
+ if (logLevelPriority[level] < minimalPriority) return;
771
760
  for (const plugin of getSortedPlugins("onLog", plugins)) {
772
761
  if (skipped.has(plugin)) continue;
773
762
  const { onLog: pluginOnLog } = plugin;
@@ -776,8 +765,7 @@ function getLogger(plugins, onLog, logLevel, watchMode) {
776
765
  if (logLevelPriority[level$1] < minimalPriority) return () => {};
777
766
  return (log$1) => logger(level$1, normalizeLog(log$1), new Set(skipped).add(plugin));
778
767
  };
779
- const handler = "handler" in pluginOnLog ? pluginOnLog.handler : pluginOnLog;
780
- if (handler.call({
768
+ if (("handler" in pluginOnLog ? pluginOnLog.handler : pluginOnLog).call({
781
769
  debug: getLogHandler$1(LOG_LEVEL_DEBUG),
782
770
  error: (log$1) => error(normalizeLog(log$1)),
783
771
  info: getLogHandler$1(LOG_LEVEL_INFO),
@@ -859,7 +847,7 @@ function normalizeHook(hook) {
859
847
  //#endregion
860
848
  //#region src/utils/normalize-string-or-regex.ts
861
849
  function normalizedStringOrRegex(pattern) {
862
- if (!pattern) return void 0;
850
+ if (!pattern) return;
863
851
  if (!isReadonlyArray(pattern)) return [pattern];
864
852
  return pattern;
865
853
  }
@@ -870,56 +858,56 @@ function isReadonlyArray(input) {
870
858
  //#endregion
871
859
  //#region src/builtin-plugin/constructors.ts
872
860
  function modulePreloadPolyfillPlugin(config) {
873
- return createBuiltinPlugin("builtin:module-preload-polyfill", config);
861
+ return new BuiltinPlugin("builtin:module-preload-polyfill", config);
874
862
  }
875
863
  function dynamicImportVarsPlugin(config) {
876
864
  if (config) {
877
865
  config.include = normalizedStringOrRegex(config.include);
878
866
  config.exclude = normalizedStringOrRegex(config.exclude);
879
867
  }
880
- return createBuiltinPlugin("builtin:dynamic-import-vars", config);
868
+ return new BuiltinPlugin("builtin:dynamic-import-vars", config);
881
869
  }
882
870
  function importGlobPlugin(config) {
883
- return createBuiltinPlugin("builtin:import-glob", config);
871
+ return new BuiltinPlugin("builtin:import-glob", config);
884
872
  }
885
873
  function reporterPlugin(config) {
886
- return createBuiltinPlugin("builtin:reporter", config);
874
+ return new BuiltinPlugin("builtin:reporter", config);
887
875
  }
888
876
  function manifestPlugin(config) {
889
- return createBuiltinPlugin("builtin:manifest", config);
877
+ return new BuiltinPlugin("builtin:manifest", config);
890
878
  }
891
879
  function wasmHelperPlugin(config) {
892
- return createBuiltinPlugin("builtin:wasm-helper", config);
880
+ return new BuiltinPlugin("builtin:wasm-helper", config);
893
881
  }
894
882
  function wasmFallbackPlugin() {
895
- const builtinPlugin = createBuiltinPlugin("builtin:wasm-fallback");
883
+ const builtinPlugin = new BuiltinPlugin("builtin:wasm-fallback");
896
884
  return makeBuiltinPluginCallable(builtinPlugin);
897
885
  }
898
886
  function loadFallbackPlugin() {
899
- return createBuiltinPlugin("builtin:load-fallback");
887
+ return new BuiltinPlugin("builtin:load-fallback");
900
888
  }
901
889
  function jsonPlugin(config) {
902
- const builtinPlugin = createBuiltinPlugin("builtin:json", config);
890
+ const builtinPlugin = new BuiltinPlugin("builtin:json", config);
903
891
  return makeBuiltinPluginCallable(builtinPlugin);
904
892
  }
905
893
  function buildImportAnalysisPlugin(config) {
906
- return createBuiltinPlugin("builtin:build-import-analysis", config);
894
+ return new BuiltinPlugin("builtin:build-import-analysis", config);
907
895
  }
908
896
  function viteResolvePlugin(config) {
909
- const builtinPlugin = createBuiltinPlugin("builtin:vite-resolve", config);
897
+ const builtinPlugin = new BuiltinPlugin("builtin:vite-resolve", config);
910
898
  return makeBuiltinPluginCallable(builtinPlugin);
911
899
  }
912
900
  function isolatedDeclarationPlugin(config) {
913
- return createBuiltinPlugin("builtin:isolated-declaration", config);
901
+ return new BuiltinPlugin("builtin:isolated-declaration", config);
914
902
  }
915
903
  function assetPlugin(config) {
916
- return createBuiltinPlugin("builtin:asset", config);
904
+ return new BuiltinPlugin("builtin:asset", config);
917
905
  }
918
906
  function webWorkerPostPlugin() {
919
- return createBuiltinPlugin("builtin:web-worker-post");
907
+ return new BuiltinPlugin("builtin:web-worker-post");
920
908
  }
921
909
  function esmExternalRequirePlugin(config) {
922
- return createBuiltinPlugin("builtin:esm-external-require", config);
910
+ return new BuiltinPlugin("builtin:esm-external-require", config);
923
911
  }
924
912
 
925
913
  //#endregion
@@ -1013,7 +1001,7 @@ function checkOutputPluginOption(plugins, onLog) {
1013
1001
  function normalizePlugins(plugins, anonymousPrefix) {
1014
1002
  for (const [index, plugin] of plugins.entries()) {
1015
1003
  if ("_parallel" in plugin) continue;
1016
- if (isBuiltinPlugin(plugin)) continue;
1004
+ if (plugin instanceof BuiltinPlugin) continue;
1017
1005
  if (!plugin.name) plugin.name = `${anonymousPrefix}${index + 1}`;
1018
1006
  }
1019
1007
  return plugins;
@@ -1080,9 +1068,9 @@ var PluginDriver = class {
1080
1068
  };
1081
1069
  function getObjectPlugins(plugins) {
1082
1070
  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;
1071
+ if (!plugin) return;
1072
+ if ("_parallel" in plugin) return;
1073
+ if (plugin instanceof BuiltinPlugin) return;
1086
1074
  return plugin;
1087
1075
  });
1088
1076
  }
@@ -2315,10 +2303,43 @@ const ChecksOptionsSchema = strictObject({
2315
2303
  configurationFieldConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting configuration field conflict")),
2316
2304
  preferBuiltinFeature: pipe(optional(boolean()), description("Whether to emit warning when detecting prefer builtin feature"))
2317
2305
  });
2306
+ const CompressOptionsKeepNamesSchema = strictObject({
2307
+ function: optional(boolean()),
2308
+ class: optional(boolean())
2309
+ });
2310
+ const CompressOptionsSchema = strictObject({
2311
+ target: optional(union([
2312
+ literal("esnext"),
2313
+ literal("es2015"),
2314
+ literal("es2016"),
2315
+ literal("es2017"),
2316
+ literal("es2018"),
2317
+ literal("es2019"),
2318
+ literal("es2020"),
2319
+ literal("es2021"),
2320
+ literal("es2022"),
2321
+ literal("es2023"),
2322
+ literal("es2024")
2323
+ ])),
2324
+ dropConsole: optional(boolean()),
2325
+ dropDebugger: optional(boolean()),
2326
+ keepNames: optional(CompressOptionsKeepNamesSchema),
2327
+ unused: optional(union([boolean(), literal("keep_assign")]))
2328
+ });
2329
+ const MangleOptionsKeepNamesSchema = strictObject({
2330
+ function: optional(boolean()),
2331
+ class: optional(boolean())
2332
+ });
2333
+ const MangleOptionsSchema = strictObject({
2334
+ toplevel: optional(boolean()),
2335
+ keepNames: optional(union([boolean(), MangleOptionsKeepNamesSchema])),
2336
+ debug: optional(boolean())
2337
+ });
2338
+ const CodegenOptionsSchema = strictObject({ removeWhitespace: optional(boolean()) });
2318
2339
  const MinifyOptionsSchema = strictObject({
2319
- mangle: optional(boolean()),
2320
- compress: optional(boolean()),
2321
- removeWhitespace: optional(boolean())
2340
+ compress: optional(union([boolean(), CompressOptionsSchema])),
2341
+ mangle: optional(union([boolean(), MangleOptionsSchema])),
2342
+ codegen: optional(union([boolean(), CodegenOptionsSchema]))
2322
2343
  });
2323
2344
  const ResolveOptionsSchema = strictObject({
2324
2345
  alias: optional(record(string(), union([string(), array(string())]))),
@@ -2725,7 +2746,7 @@ function normalizeTransformHookSourcemap(id$1, originalCode, rawMap) {
2725
2746
  }
2726
2747
 
2727
2748
  //#endregion
2728
- //#region ../pluginutils/dist/index.js
2749
+ //#region ../pluginutils/dist/index.mjs
2729
2750
  var And = class {
2730
2751
  kind;
2731
2752
  args;
@@ -2852,7 +2873,7 @@ function generateAtomMatcher(kind, matcher) {
2852
2873
  return kind === "code" ? code(matcher) : id(matcher);
2853
2874
  }
2854
2875
  function transformFilterMatcherToFilterExprs(filterOption) {
2855
- if (!filterOption) return void 0;
2876
+ if (!filterOption) return;
2856
2877
  if (Array.isArray(filterOption)) return filterOption;
2857
2878
  const { id: id$1, code: code$1, moduleType: moduleType$1 } = filterOption;
2858
2879
  let ret = [];
@@ -2950,24 +2971,24 @@ function bindingifyFilterExprImpl(expr, list) {
2950
2971
  }
2951
2972
  }
2952
2973
  function bindingifyResolveIdFilter(filterOption) {
2953
- if (!filterOption) return void 0;
2974
+ if (!filterOption) return;
2954
2975
  if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
2955
2976
  return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
2956
2977
  }
2957
2978
  function bindingifyLoadFilter(filterOption) {
2958
- if (!filterOption) return void 0;
2979
+ if (!filterOption) return;
2959
2980
  if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
2960
2981
  return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
2961
2982
  }
2962
2983
  function bindingifyTransformFilter(filterOption) {
2963
- if (!filterOption) return void 0;
2984
+ if (!filterOption) return;
2964
2985
  let filterExprs = transformFilterMatcherToFilterExprs(filterOption);
2965
2986
  let ret = [];
2966
2987
  if (filterExprs) ret = filterExprs.map(bindingifyFilterExpr);
2967
2988
  return { value: ret.length > 0 ? ret : void 0 };
2968
2989
  }
2969
2990
  function bindingifyRenderChunkFilter(filterOption) {
2970
- if (!filterOption) return void 0;
2991
+ if (!filterOption) return;
2971
2992
  if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
2972
2993
  return filterOption.code ? bindingifyGeneralHookFilter("code", filterOption.code) : void 0;
2973
2994
  }
@@ -2982,13 +3003,13 @@ function bindingPluginOrder(order) {
2982
3003
  case "post": return BindingPluginOrder.Post;
2983
3004
  case "pre": return BindingPluginOrder.Pre;
2984
3005
  case null:
2985
- case void 0: return void 0;
3006
+ case void 0: return;
2986
3007
  default: throw new Error(`Unknown plugin order: ${order}`);
2987
3008
  }
2988
3009
  }
2989
3010
 
2990
3011
  //#endregion
2991
- //#region ../../node_modules/.pnpm/oxc-parser@0.82.3/node_modules/oxc-parser/wrap.mjs
3012
+ //#region ../../node_modules/.pnpm/oxc-parser@0.87.0/node_modules/oxc-parser/wrap.mjs
2992
3013
  function wrap$1(result) {
2993
3014
  let program, module$1, comments, errors;
2994
3015
  return {
@@ -3225,6 +3246,9 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
3225
3246
  getCombinedSourcemap() {
3226
3247
  return JSON.parse(this.inner.getCombinedSourcemap());
3227
3248
  }
3249
+ addWatchFile(id$1) {
3250
+ this.inner.addWatchFile(id$1);
3251
+ }
3228
3252
  };
3229
3253
 
3230
3254
  //#endregion
@@ -3324,7 +3348,7 @@ function bindingifyTransform(args$1) {
3324
3348
  return {
3325
3349
  plugin: async (ctx, code$1, id$1, meta$1) => {
3326
3350
  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;
3351
+ if (ret == null) return;
3328
3352
  if (typeof ret === "string") return { code: ret };
3329
3353
  let moduleOption = args$1.pluginContextData.updateModuleOption(id$1, {
3330
3354
  meta: ret.meta ?? {},
@@ -3458,9 +3482,8 @@ function transformChunkModules(modules) {
3458
3482
  //#endregion
3459
3483
  //#region src/utils/transform-to-rollup-output.ts
3460
3484
  function transformToRollupSourceMap(map) {
3461
- const parsed = JSON.parse(map);
3462
3485
  const obj = {
3463
- ...parsed,
3486
+ ...JSON.parse(map),
3464
3487
  toString() {
3465
3488
  return JSON.stringify(obj);
3466
3489
  },
@@ -4002,13 +4025,10 @@ var ChunkingContextImpl = class {
4002
4025
  }
4003
4026
  getModuleInfo(moduleId) {
4004
4027
  const bindingInfo = this.context.getModuleInfo(moduleId);
4005
- if (bindingInfo) {
4006
- const info = transformModuleInfo(bindingInfo, {
4007
- moduleSideEffects: null,
4008
- meta: {}
4009
- });
4010
- return info;
4011
- }
4028
+ if (bindingInfo) return transformModuleInfo(bindingInfo, {
4029
+ moduleSideEffects: null,
4030
+ meta: {}
4031
+ });
4012
4032
  return null;
4013
4033
  }
4014
4034
  };
@@ -4081,7 +4101,7 @@ function bindingifySourcemap(sourcemap) {
4081
4101
  case true: return "file";
4082
4102
  case "inline": return "inline";
4083
4103
  case false:
4084
- case void 0: return void 0;
4104
+ case void 0: return;
4085
4105
  case "hidden": return "hidden";
4086
4106
  default: throw new Error(`unknown sourcemap: ${sourcemap}`);
4087
4107
  }
@@ -4107,7 +4127,7 @@ function bindingifyAdvancedChunks(advancedChunks, manualChunks) {
4107
4127
  else if (manualChunks != null) advancedChunks = { groups: [{ name(moduleId, ctx) {
4108
4128
  return manualChunks(moduleId, { getModuleInfo: (id$1) => ctx.getModuleInfo(id$1) });
4109
4129
  } }] };
4110
- if (advancedChunks == null) return void 0;
4130
+ if (advancedChunks == null) return;
4111
4131
  const { groups,...restAdvancedChunks } = advancedChunks;
4112
4132
  return {
4113
4133
  ...restAdvancedChunks,
@@ -4311,8 +4331,7 @@ var PluginContextData = class {
4311
4331
  return info;
4312
4332
  }
4313
4333
  getModuleIds(context) {
4314
- const moduleIds = context.getModuleIds();
4315
- return moduleIds.values();
4334
+ return context.getModuleIds().values();
4316
4335
  }
4317
4336
  saveResolveOptions(options) {
4318
4337
  const index = this.resolveOptionsMap.size;
@@ -4355,8 +4374,8 @@ var PluginContextData = class {
4355
4374
  function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode) {
4356
4375
  const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedOutputPlugins);
4357
4376
  const plugins = rawPlugins.map((plugin) => {
4358
- if ("_parallel" in plugin) return void 0;
4359
- if (isBuiltinPlugin(plugin)) return bindingifyBuiltInPlugin(plugin);
4377
+ if ("_parallel" in plugin) return;
4378
+ if (plugin instanceof BuiltinPlugin) return bindingifyBuiltInPlugin(plugin);
4360
4379
  return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode);
4361
4380
  });
4362
4381
  const { jsx, transform } = bindingifyJsx(onLog, inputOptions.jsx, inputOptions.transform);
@@ -4410,7 +4429,7 @@ function bindingifyHmr(hmr) {
4410
4429
  }
4411
4430
  function bindingifyAttachDebugInfo(attachDebugInfo) {
4412
4431
  switch (attachDebugInfo) {
4413
- case void 0: return void 0;
4432
+ case void 0: return;
4414
4433
  case "full": return BindingAttachDebugInfo.Full;
4415
4434
  case "simple": return BindingAttachDebugInfo.Simple;
4416
4435
  case "none": return BindingAttachDebugInfo.None;
@@ -4565,7 +4584,7 @@ function bindingifyWatch(watch$1) {
4565
4584
  };
4566
4585
  }
4567
4586
  function bindingifyTreeshakeOptions(config) {
4568
- if (config === false) return void 0;
4587
+ if (config === false) return;
4569
4588
  if (config === true || config === void 0) return { moduleSideEffects: true };
4570
4589
  let normalizedConfig = {
4571
4590
  moduleSideEffects: true,
@@ -4611,7 +4630,7 @@ function bindingifyMakeAbsoluteExternalsRelative(makeAbsoluteExternalsRelative)
4611
4630
  };
4612
4631
  }
4613
4632
  function bindingifyPreserveEntrySignatures(preserveEntrySignatures) {
4614
- if (preserveEntrySignatures == void 0) return void 0;
4633
+ if (preserveEntrySignatures == void 0) return;
4615
4634
  else if (typeof preserveEntrySignatures === "string") return {
4616
4635
  type: "String",
4617
4636
  field0: preserveEntrySignatures
@@ -4881,8 +4900,7 @@ async function createWatcher(emitter, input) {
4881
4900
  })).flat());
4882
4901
  const notifyOptions = getValidNotifyOption(bundlerOptions);
4883
4902
  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();
4903
+ new Watcher(emitter, bindingWatcher, bundlerOptions.map((option) => option.stopWorkers)).start();
4886
4904
  }
4887
4905
  function getValidNotifyOption(bundlerOptions) {
4888
4906
  let result;
@@ -4914,4 +4932,4 @@ function defineConfig(config) {
4914
4932
  const VERSION = version;
4915
4933
 
4916
4934
  //#endregion
4917
- export { PluginDriver, VERSION, assetPlugin, build, buildImportAnalysisPlugin, createBuiltinPlugin, createBundlerImpl, createBundlerOptions, defineConfig, dynamicImportVarsPlugin, esmExternalRequirePlugin, handleOutputErrors, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, reporterPlugin, rolldown, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch, webWorkerPostPlugin };
4935
+ export { BuiltinPlugin, PluginDriver, VERSION, assetPlugin, build, buildImportAnalysisPlugin, createBundlerImpl, createBundlerOptions, defineConfig, dynamicImportVarsPlugin, esmExternalRequirePlugin, handleOutputErrors, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, reporterPlugin, rolldown, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch, webWorkerPostPlugin };
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.37",
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",
package/dist/cli.d.cts DELETED
@@ -1 +0,0 @@
1
- export {};
package/dist/config.cjs DELETED
@@ -1,12 +0,0 @@
1
- const require_src = require('./shared/src-Bd4BGX4v.cjs');
2
- require('./shared/parse-ast-index-J0xVKZRe.cjs');
3
- require('./shared/dist-CK0hotcm.cjs');
4
- const require_load_config = require('./shared/load-config-BJKhRKZL.cjs');
5
-
6
- //#region src/config.ts
7
- const VERSION = require_src.version;
8
-
9
- //#endregion
10
- exports.VERSION = VERSION;
11
- exports.defineConfig = require_src.defineConfig;
12
- exports.loadConfig = require_load_config.loadConfig;
package/dist/config.d.cts DELETED
@@ -1,10 +0,0 @@
1
- import "./shared/binding-D13M6Llu.cjs";
2
- import { ConfigExport, defineConfig } from "./shared/define-config-DhrkZ_o7.cjs";
3
-
4
- //#region src/utils/load-config.d.ts
5
- declare function loadConfig(configPath: string): Promise<ConfigExport>;
6
- //#endregion
7
- //#region src/config.d.ts
8
- declare const VERSION: string;
9
- //#endregion
10
- export { VERSION, defineConfig, loadConfig };
@@ -1,176 +0,0 @@
1
- const require_chunk = require('./shared/chunk-DDkG_k5U.cjs');
2
- const require_src = require('./shared/src-Bd4BGX4v.cjs');
3
- require('./shared/parse-ast-index-J0xVKZRe.cjs');
4
- require('./shared/dist-CK0hotcm.cjs');
5
- let src_rolldown_binding_wasi_cjs = require("./rolldown-binding.wasi.cjs");
6
- src_rolldown_binding_wasi_cjs = require_chunk.__toESM(src_rolldown_binding_wasi_cjs);
7
- let node_url = require("node:url");
8
- node_url = require_chunk.__toESM(node_url);
9
-
10
- //#region src/api/dev/dev-engine.ts
11
- var DevEngine = class DevEngine {
12
- #inner;
13
- #cachedBuildFinishPromise = null;
14
- static async create(inputOptions, outputOptions = {}, devOptions = {}) {
15
- inputOptions = await require_src.PluginDriver.callOptionsHook(inputOptions);
16
- const options = await require_src.createBundlerOptions(inputOptions, outputOptions, false);
17
- const bindingDevOptions = {
18
- onHmrUpdates: devOptions.onHmrUpdates,
19
- usePolling: devOptions.usePolling,
20
- pollInterval: devOptions.pollInterval
21
- };
22
- const inner = new src_rolldown_binding_wasi_cjs.BindingDevEngine(options.bundlerOptions, bindingDevOptions);
23
- return new DevEngine(inner);
24
- }
25
- constructor(inner) {
26
- this.#inner = inner;
27
- }
28
- async run() {
29
- await this.#inner.run();
30
- }
31
- async ensureCurrentBuildFinish() {
32
- if (this.#cachedBuildFinishPromise) return this.#cachedBuildFinishPromise;
33
- const promise = this.#inner.ensureCurrentBuildFinish().then(() => {
34
- this.#cachedBuildFinishPromise = null;
35
- });
36
- this.#cachedBuildFinishPromise = promise;
37
- return promise;
38
- }
39
- async ensureLatestBuild() {
40
- await this.#inner.ensureLatestBuild();
41
- }
42
- async invalidate(file, firstInvalidatedBy) {
43
- return this.#inner.invalidate(file, firstInvalidatedBy);
44
- }
45
- };
46
-
47
- //#endregion
48
- //#region src/api/dev/index.ts
49
- var dev = DevEngine.create;
50
-
51
- //#endregion
52
- //#region src/api/experimental.ts
53
- /**
54
- * This is an experimental API. It's behavior may change in the future.
55
- *
56
- * Calling this API will only execute the scan stage of rolldown.
57
- */
58
- const experimental_scan = async (input) => {
59
- const inputOptions = await require_src.PluginDriver.callOptionsHook(input);
60
- const { impl: bundler, stopWorkers } = await require_src.createBundlerImpl(new src_rolldown_binding_wasi_cjs.BindingBundler(), inputOptions, {});
61
- const output = await bundler.scan();
62
- require_src.handleOutputErrors(output);
63
- await stopWorkers?.();
64
- };
65
-
66
- //#endregion
67
- //#region src/plugin/parallel-plugin.ts
68
- function defineParallelPlugin(pluginPath) {
69
- return (options) => {
70
- return { _parallel: {
71
- fileUrl: (0, node_url.pathToFileURL)(pluginPath).href,
72
- options
73
- } };
74
- };
75
- }
76
-
77
- //#endregion
78
- //#region src/builtin-plugin/alias-plugin.ts
79
- function aliasPlugin(config) {
80
- return require_src.createBuiltinPlugin("builtin:alias", config);
81
- }
82
-
83
- //#endregion
84
- //#region src/builtin-plugin/replace-plugin.ts
85
- /**
86
- * Replaces targeted strings in files while bundling.
87
- *
88
- * @example
89
- * // Basic usage
90
- * ```js
91
- * replacePlugin({
92
- * 'process.env.NODE_ENV': JSON.stringify('production'),
93
- * __buildVersion: 15
94
- * })
95
- * ```
96
- * @example
97
- * // With options
98
- * ```js
99
- * replacePlugin({
100
- * 'process.env.NODE_ENV': JSON.stringify('production'),
101
- * __buildVersion: 15
102
- * }, {
103
- * preventAssignment: false,
104
- * })
105
- * ```
106
- */
107
- function replacePlugin(values = {}, options = {}) {
108
- Object.keys(values).forEach((key) => {
109
- values[key] = values[key].toString();
110
- });
111
- return require_src.createBuiltinPlugin("builtin:replace", {
112
- ...options,
113
- values
114
- });
115
- }
116
-
117
- //#endregion
118
- //#region src/builtin-plugin/transform-plugin.ts
119
- function transformPlugin(config) {
120
- if (config) config = {
121
- ...config,
122
- include: require_src.normalizedStringOrRegex(config.include),
123
- exclude: require_src.normalizedStringOrRegex(config.exclude),
124
- jsxRefreshInclude: require_src.normalizedStringOrRegex(config.jsxRefreshInclude),
125
- jsxRefreshExclude: require_src.normalizedStringOrRegex(config.jsxRefreshExclude)
126
- };
127
- return require_src.createBuiltinPlugin("builtin:transform", config);
128
- }
129
-
130
- //#endregion
131
- exports.DevEngine = DevEngine;
132
- Object.defineProperty(exports, 'ResolverFactory', {
133
- enumerable: true,
134
- get: function () {
135
- return src_rolldown_binding_wasi_cjs.ResolverFactory;
136
- }
137
- });
138
- exports.aliasPlugin = aliasPlugin;
139
- exports.assetPlugin = require_src.assetPlugin;
140
- exports.buildImportAnalysisPlugin = require_src.buildImportAnalysisPlugin;
141
- exports.defineParallelPlugin = defineParallelPlugin;
142
- exports.dev = dev;
143
- exports.dynamicImportVarsPlugin = require_src.dynamicImportVarsPlugin;
144
- exports.esmExternalRequirePlugin = require_src.esmExternalRequirePlugin;
145
- exports.importGlobPlugin = require_src.importGlobPlugin;
146
- Object.defineProperty(exports, 'isolatedDeclaration', {
147
- enumerable: true,
148
- get: function () {
149
- return src_rolldown_binding_wasi_cjs.isolatedDeclaration;
150
- }
151
- });
152
- exports.isolatedDeclarationPlugin = require_src.isolatedDeclarationPlugin;
153
- exports.jsonPlugin = require_src.jsonPlugin;
154
- exports.loadFallbackPlugin = require_src.loadFallbackPlugin;
155
- exports.manifestPlugin = require_src.manifestPlugin;
156
- exports.modulePreloadPolyfillPlugin = require_src.modulePreloadPolyfillPlugin;
157
- Object.defineProperty(exports, 'moduleRunnerTransform', {
158
- enumerable: true,
159
- get: function () {
160
- return src_rolldown_binding_wasi_cjs.moduleRunnerTransform;
161
- }
162
- });
163
- exports.replacePlugin = replacePlugin;
164
- exports.reporterPlugin = require_src.reporterPlugin;
165
- exports.scan = experimental_scan;
166
- Object.defineProperty(exports, 'transform', {
167
- enumerable: true,
168
- get: function () {
169
- return src_rolldown_binding_wasi_cjs.transform;
170
- }
171
- });
172
- exports.transformPlugin = transformPlugin;
173
- exports.viteResolvePlugin = require_src.viteResolvePlugin;
174
- exports.wasmFallbackPlugin = require_src.wasmFallbackPlugin;
175
- exports.wasmHelperPlugin = require_src.wasmHelperPlugin;
176
- exports.webWorkerPostPlugin = require_src.webWorkerPostPlugin;