@rolldown/browser 1.0.0-rc.1 → 1.0.0-rc.10

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 (59) hide show
  1. package/dist/cli.mjs +708 -1101
  2. package/dist/config.d.mts +9 -4
  3. package/dist/config.mjs +9 -13
  4. package/dist/{shared/constructors-BTW-c3jX.mjs → constructors-DsfxKD6A.js} +14 -7
  5. package/dist/error-BeZaDkS8.js +157 -0
  6. package/dist/experimental-index.browser.mjs +74 -15
  7. package/dist/experimental-index.d.mts +128 -56
  8. package/dist/experimental-index.mjs +76 -17
  9. package/dist/filter-index.d.mts +1 -1
  10. package/dist/filter-index.mjs +25 -6
  11. package/dist/get-log-filter.d.mts +3 -7
  12. package/dist/get-log-filter.mjs +23 -3
  13. package/dist/index.browser.mjs +70 -75
  14. package/dist/index.d.mts +4 -4
  15. package/dist/index.mjs +10 -12
  16. package/dist/{normalize-string-or-regex-CL-PJZI7.js → normalize-string-or-regex-TtAGUp42.js} +6 -12
  17. package/dist/parallel-plugin-worker.mjs +6 -7
  18. package/dist/parallel-plugin.d.mts +4 -4
  19. package/dist/parallel-plugin.mjs +1 -2
  20. package/dist/parse-ast-index.d.mts +27 -3
  21. package/dist/parse-ast-index.mjs +60 -3
  22. package/dist/plugins-index.browser.mjs +8 -7
  23. package/dist/plugins-index.d.mts +7 -4
  24. package/dist/plugins-index.mjs +8 -7
  25. package/dist/resolve-tsconfig-DThkUPSZ.js +112 -0
  26. package/dist/rolldown-binding.wasi-browser.js +6 -1
  27. package/dist/rolldown-binding.wasi.cjs +6 -1
  28. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  29. package/dist/{rolldown-build-C4tDS_XC.js → rolldown-build-Chx5S-TB.js} +1038 -744
  30. package/dist/shared/{bindingify-input-options-Bp2kpiI8.mjs → bindingify-input-options-Czbczr8Z.mjs} +102 -165
  31. package/dist/shared/{composable-filters-CIxSuZSM.mjs → composable-filters-B2ByPP8y.mjs} +1 -4
  32. package/dist/shared/{constructors-5bt5oBhE.d.mts → constructors-BVnf_fH1.d.mts} +13 -4
  33. package/dist/{constructors-B8gqcrFr.js → shared/constructors-CemeNi29.mjs} +14 -7
  34. package/dist/shared/{define-config-Dlptvz3X.mjs → define-config-DJOr6Iwt.mjs} +1 -2
  35. package/dist/shared/define-config-i6TWE2hm.d.mts +3855 -0
  36. package/dist/shared/error-CQ6njWsV.mjs +86 -0
  37. package/dist/shared/get-log-filter-semyr3Lj.d.mts +35 -0
  38. package/dist/shared/{load-config-BBZgIUGN.mjs → load-config-CxvL5JxT.mjs} +11 -5
  39. package/dist/shared/{logging-Nvu645a7.d.mts → logging-C6h4g8dA.d.mts} +6 -6
  40. package/dist/shared/{logs-B2CASPcx.mjs → logs-D80CXhvg.mjs} +6 -9
  41. package/dist/shared/{normalize-string-or-regex-DIwprzLy.mjs → normalize-string-or-regex-CF3Uz6aU.mjs} +2 -5
  42. package/dist/shared/parse-CRhjbrcT.mjs +73 -0
  43. package/dist/shared/{prompt-B6NrDD1-.mjs → prompt-BYQIwEjg.mjs} +4 -6
  44. package/dist/shared/resolve-tsconfig-Cwoo4h_o.mjs +112 -0
  45. package/dist/shared/{rolldown-C0_W0QdY.mjs → rolldown-C3wFxOwq.mjs} +2 -4
  46. package/dist/shared/rolldown-build-ChZOz6BP.mjs +3318 -0
  47. package/dist/shared/transform-DEgNAQOQ.d.mts +149 -0
  48. package/dist/shared/{types-CIYK49jr.d.mts → types-Cx3HYorz.d.mts} +5 -3
  49. package/dist/shared/{watch-eIop0yN6.mjs → watch-C1jC1oFT.mjs} +71 -76
  50. package/dist/utils-index.browser.mjs +2414 -0
  51. package/dist/utils-index.d.mts +374 -0
  52. package/dist/utils-index.mjs +2415 -0
  53. package/package.json +1 -1
  54. package/dist/cli-setup.d.mts +0 -1
  55. package/dist/cli-setup.mjs +0 -16
  56. package/dist/shared/define-config-CDlEOpr1.d.mts +0 -3531
  57. package/dist/shared/parse-ast-index-2ahkCVK6.mjs +0 -98
  58. package/dist/shared/rolldown-build-DLuUhuNw.mjs +0 -2368
  59. /package/dist/shared/{utils-CqMTwlsR.d.mts → utils-6wxe_LMG.d.mts} +0 -0
@@ -1,17 +1,16 @@
1
- import { a as logInvalidLogPosition, c as logPluginError, n as error, r as logCycleLoading, t as augmentCodeLocation } from "./logs-B2CASPcx.mjs";
2
- import { i as bindingifyManifestPlugin, n as BuiltinPlugin, r as bindingifyBuiltInPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-DIwprzLy.mjs";
3
- import { _ as noop, a as id, b as unsupported, f as or, h as arraify, n as code, r as exclude, s as include, t as and, u as moduleType, y as unreachable } from "./composable-filters-CIxSuZSM.mjs";
4
- import { t as parseAst } from "./parse-ast-index-2ahkCVK6.mjs";
1
+ import { a as logInvalidLogPosition, c as logPluginError, n as error, r as logCycleLoading, t as augmentCodeLocation } from "./logs-D80CXhvg.mjs";
2
+ import { i as bindingifyManifestPlugin, n as BuiltinPlugin, r as bindingifyBuiltInPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-CF3Uz6aU.mjs";
3
+ import { _ as noop, a as id, b as unsupported, f as or, h as arraify, n as code, r as exclude, s as include, t as and, u as moduleType, y as unreachable } from "./composable-filters-B2ByPP8y.mjs";
4
+ import { a as bindingifySourcemap, i as unwrapBindingResult, t as aggregateBindingErrorsIntoJsError } from "./error-CQ6njWsV.mjs";
5
+ import { parseAst } from "../parse-ast-index.mjs";
5
6
  import { BindingAttachDebugInfo, BindingChunkModuleOrderBy, BindingLogLevel, BindingMagicString, BindingPluginOrder, BindingPropertyReadSideEffects, BindingPropertyWriteSideEffects } from "../rolldown-binding.wasi.cjs";
6
7
  import path from "node:path";
7
8
  import fsp from "node:fs/promises";
8
-
9
9
  //#region package.json
10
- var version = "1.0.0-rc.1";
10
+ var version = "1.0.0-rc.10";
11
11
  var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
12
-
13
12
  //#endregion
14
- //#region src/version.ts
13
+ //#region src/constants/version.ts
15
14
  /**
16
15
  * The version of Rolldown.
17
16
  * @example `'1.0.0'`
@@ -19,7 +18,12 @@ var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compat
19
18
  * @category Plugin APIs
20
19
  */
21
20
  const VERSION = version;
22
-
21
+ //#endregion
22
+ //#region src/constants/index.ts
23
+ /**
24
+ * Runtime helper module ID
25
+ */
26
+ const RUNTIME_MODULE_ID = "\0rolldown/runtime.js";
23
27
  //#endregion
24
28
  //#region src/log/logging.ts
25
29
  const LOG_LEVEL_SILENT = "silent";
@@ -33,7 +37,6 @@ const logLevelPriority = {
33
37
  [LOG_LEVEL_WARN]: 2,
34
38
  [LOG_LEVEL_SILENT]: 3
35
39
  };
36
-
37
40
  //#endregion
38
41
  //#region src/log/log-handler.ts
39
42
  const normalizeLog = (log) => typeof log === "string" ? { message: log } : typeof log === "function" ? normalizeLog(log()) : log;
@@ -48,7 +51,6 @@ function getLogHandler(level, code, logger, pluginName, logLevel) {
48
51
  logger(level, log);
49
52
  };
50
53
  }
51
-
52
54
  //#endregion
53
55
  //#region src/utils/normalize-hook.ts
54
56
  function normalizeHook(hook) {
@@ -67,7 +69,6 @@ function normalizeHook(hook) {
67
69
  }
68
70
  unreachable("Invalid hook type");
69
71
  }
70
-
71
72
  //#endregion
72
73
  //#region src/plugin/minimal-plugin-context.ts
73
74
  var MinimalPluginContextImpl = class {
@@ -91,7 +92,6 @@ var MinimalPluginContextImpl = class {
91
92
  return error(logPluginError(normalizeLog(e), this.pluginName, { hook: this.hookName }));
92
93
  }
93
94
  };
94
-
95
95
  //#endregion
96
96
  //#region src/types/plain-object-like.ts
97
97
  const LAZY_FIELDS_KEY = Symbol("__lazy_fields__");
@@ -170,7 +170,6 @@ function getLazyFields(instance) {
170
170
  const lazyFields = instance.constructor[LAZY_FIELDS_KEY];
171
171
  return lazyFields ? new Set(lazyFields.keys()) : /* @__PURE__ */ new Set();
172
172
  }
173
-
174
173
  //#endregion
175
174
  //#region src/decorators/lazy.ts
176
175
  /**
@@ -208,7 +207,6 @@ function lazyProp(target, propertyKey, descriptor) {
208
207
  configurable: true
209
208
  };
210
209
  }
211
-
212
210
  //#endregion
213
211
  //#region src/utils/asset-source.ts
214
212
  function transformAssetSource(bindingAssetSource) {
@@ -217,16 +215,14 @@ function transformAssetSource(bindingAssetSource) {
217
215
  function bindingAssetSource(source) {
218
216
  return { inner: source };
219
217
  }
220
-
221
218
  //#endregion
222
- //#region \0@oxc-project+runtime@0.110.0/helpers/decorate.js
219
+ //#region \0@oxc-project+runtime@0.120.0/helpers/decorate.js
223
220
  function __decorate(decorators, target, key, desc) {
224
221
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
225
222
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
226
223
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
227
224
  return c > 3 && r && Object.defineProperty(target, key, r), r;
228
225
  }
229
-
230
226
  //#endregion
231
227
  //#region src/types/output-asset-impl.ts
232
228
  var OutputAssetImpl = class extends PlainObjectLike {
@@ -267,7 +263,6 @@ __decorate([lazyProp], OutputAssetImpl.prototype, "originalFileNames", null);
267
263
  __decorate([lazyProp], OutputAssetImpl.prototype, "name", null);
268
264
  __decorate([lazyProp], OutputAssetImpl.prototype, "names", null);
269
265
  __decorate([lazyProp], OutputAssetImpl.prototype, "source", null);
270
-
271
266
  //#endregion
272
267
  //#region src/utils/transform-rendered-module.ts
273
268
  function transformToRenderedModule(bindingRenderedModule) {
@@ -283,7 +278,6 @@ function transformToRenderedModule(bindingRenderedModule) {
283
278
  }
284
279
  };
285
280
  }
286
-
287
281
  //#endregion
288
282
  //#region src/utils/transform-rendered-chunk.ts
289
283
  function transformRenderedChunk(chunk) {
@@ -332,7 +326,6 @@ function transformChunkModules(modules) {
332
326
  }
333
327
  return result;
334
328
  }
335
-
336
329
  //#endregion
337
330
  //#region src/types/output-chunk-impl.ts
338
331
  var OutputChunkImpl = class extends PlainObjectLike {
@@ -406,23 +399,6 @@ __decorate([lazyProp], OutputChunkImpl.prototype, "imports", null);
406
399
  __decorate([lazyProp], OutputChunkImpl.prototype, "dynamicImports", null);
407
400
  __decorate([lazyProp], OutputChunkImpl.prototype, "moduleIds", null);
408
401
  __decorate([lazyProp], OutputChunkImpl.prototype, "map", null);
409
-
410
- //#endregion
411
- //#region src/types/sourcemap.ts
412
- function bindingifySourcemap(map) {
413
- if (map == null) return;
414
- return { inner: typeof map === "string" ? map : {
415
- file: map.file ?? void 0,
416
- mappings: map.mappings,
417
- sourceRoot: "sourceRoot" in map ? map.sourceRoot ?? void 0 : void 0,
418
- sources: map.sources?.map((s) => s ?? void 0),
419
- sourcesContent: map.sourcesContent?.map((s) => s ?? void 0),
420
- names: map.names,
421
- x_google_ignoreList: map.x_google_ignoreList,
422
- debugId: "debugId" in map ? map.debugId : void 0
423
- } };
424
- }
425
-
426
402
  //#endregion
427
403
  //#region src/utils/transform-to-rollup-output.ts
428
404
  function transformToRollupSourceMap(map) {
@@ -582,77 +558,19 @@ function collectChangedBundle(changed, bundle) {
582
558
  deleted: changed.deleted
583
559
  };
584
560
  }
585
-
586
561
  //#endregion
587
- //#region src/utils/error.ts
588
- function unwrapBindingResult(container) {
589
- if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) throw aggregateBindingErrorsIntoJsError(container.errors);
590
- return container;
591
- }
592
- function normalizeBindingResult(container) {
593
- if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) return aggregateBindingErrorsIntoJsError(container.errors);
594
- return container;
595
- }
596
- function normalizeBindingError(e) {
597
- return e.type === "JsError" ? e.field0 : Object.assign(/* @__PURE__ */ new Error(), {
598
- code: e.field0.kind,
599
- kind: e.field0.kind,
600
- message: e.field0.message,
601
- id: e.field0.id,
602
- exporter: e.field0.exporter,
603
- loc: e.field0.loc,
604
- pos: e.field0.pos,
605
- stack: void 0
606
- });
607
- }
608
- function aggregateBindingErrorsIntoJsError(rawErrors) {
609
- const errors = rawErrors.map(normalizeBindingError);
610
- let summary = `Build failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
611
- for (let i = 0; i < errors.length; i++) {
612
- summary += "\n";
613
- if (i >= 5) {
614
- summary += "...";
615
- break;
616
- }
617
- summary += getErrorMessage(errors[i]);
618
- }
619
- const wrapper = new Error(summary);
620
- Object.defineProperty(wrapper, "errors", {
621
- configurable: true,
622
- enumerable: true,
623
- get: () => errors,
624
- set: (value) => Object.defineProperty(wrapper, "errors", {
625
- configurable: true,
626
- enumerable: true,
627
- value
628
- })
629
- });
630
- return wrapper;
631
- }
632
- function getErrorMessage(e) {
633
- if (Object.hasOwn(e, "kind")) return e.message;
634
- let s = "";
635
- if (e.plugin) s += `[plugin ${e.plugin}]`;
636
- const id = e.id ?? e.loc?.file;
637
- if (id) {
638
- s += " " + id;
639
- if (e.loc) s += `:${e.loc.line}:${e.loc.column}`;
640
- }
641
- if (s) s += "\n";
642
- const message = `${e.name ?? "Error"}: ${e.message}`;
643
- s += message;
644
- if (e.frame) s = joinNewLine(s, e.frame);
645
- if (e.stack) s = joinNewLine(s, e.stack.replace(message, ""));
646
- if (e.cause) {
647
- s = joinNewLine(s, "Caused by:");
648
- s = joinNewLine(s, getErrorMessage(e.cause).split("\n").map((line) => " " + line).join("\n"));
649
- }
650
- return s;
651
- }
652
- function joinNewLine(s1, s2) {
653
- return s1.replace(/\n+$/, "") + "\n" + s2.replace(/^\n+/, "");
654
- }
655
-
562
+ //#region src/binding-magic-string.ts
563
+ Object.defineProperty(BindingMagicString.prototype, "isRolldownMagicString", {
564
+ value: true,
565
+ writable: false,
566
+ configurable: false
567
+ });
568
+ /**
569
+ * A native MagicString implementation powered by Rust.
570
+ *
571
+ * @experimental
572
+ */
573
+ const RolldownMagicString = BindingMagicString;
656
574
  //#endregion
657
575
  //#region src/utils/transform-module-info.ts
658
576
  function transformModuleInfo(info, option) {
@@ -670,10 +588,10 @@ function transformModuleInfo(info, option) {
670
588
  dynamicallyImportedIds: info.dynamicallyImportedIds,
671
589
  exports: info.exports,
672
590
  isEntry: info.isEntry,
591
+ inputFormat: info.inputFormat,
673
592
  ...option
674
593
  };
675
594
  }
676
-
677
595
  //#endregion
678
596
  //#region src/utils/transform-sourcemap.ts
679
597
  function isEmptySourcemapFiled(array) {
@@ -688,9 +606,8 @@ function normalizeTransformHookSourcemap(id, originalCode, rawMap) {
688
606
  if (isEmptySourcemapFiled(map.sources) || map.sources && map.sources.length === 1 && map.sources[0] !== id) map.sources = [id];
689
607
  return map;
690
608
  }
691
-
692
609
  //#endregion
693
- //#region ../../node_modules/.pnpm/remeda@2.33.4/node_modules/remeda/dist/lazyDataLastImpl-DtF3cihj.js
610
+ //#region ../../node_modules/.pnpm/remeda@2.33.6/node_modules/remeda/dist/lazyDataLastImpl-DtF3cihj.js
694
611
  function e(e, t, n) {
695
612
  let r = (n) => e(n, ...t);
696
613
  return n === void 0 ? r : Object.assign(r, {
@@ -698,18 +615,16 @@ function e(e, t, n) {
698
615
  lazyArgs: t
699
616
  });
700
617
  }
701
-
702
618
  //#endregion
703
- //#region ../../node_modules/.pnpm/remeda@2.33.4/node_modules/remeda/dist/purry-GjwKKIlp.js
619
+ //#region ../../node_modules/.pnpm/remeda@2.33.6/node_modules/remeda/dist/purry.js
704
620
  function t$1(t, n, r) {
705
621
  let i = t.length - n.length;
706
622
  if (i === 0) return t(...n);
707
623
  if (i === 1) return e(t, n, r);
708
624
  throw Error(`Wrong number of arguments`);
709
625
  }
710
-
711
626
  //#endregion
712
- //#region ../../node_modules/.pnpm/remeda@2.33.4/node_modules/remeda/dist/partition.js
627
+ //#region ../../node_modules/.pnpm/remeda@2.33.6/node_modules/remeda/dist/partition.js
713
628
  function t(...t) {
714
629
  return t$1(n, t);
715
630
  }
@@ -718,7 +633,6 @@ const n = (e, t) => {
718
633
  for (let [r, i] of e.entries()) t(i, r, e) ? n[0].push(i) : n[1].push(i);
719
634
  return n;
720
635
  };
721
-
722
636
  //#endregion
723
637
  //#region src/plugin/bindingify-hook-filter.ts
724
638
  function generalHookFilterMatcherToFilterExprs(matcher, stringKind) {
@@ -880,7 +794,6 @@ function bindingifyRenderChunkFilter(filterOption) {
880
794
  }
881
795
  return filterOption.code ? bindingifyGeneralHookFilter("code", filterOption.code) : void 0;
882
796
  }
883
-
884
797
  //#endregion
885
798
  //#region src/plugin/bindingify-plugin-hook-meta.ts
886
799
  function bindingifyPluginHookMeta(options) {
@@ -895,7 +808,6 @@ function bindingPluginOrder(order) {
895
808
  default: throw new Error(`Unknown plugin order: ${order}`);
896
809
  }
897
810
  }
898
-
899
811
  //#endregion
900
812
  //#region src/plugin/fs.ts
901
813
  const fsModule = {
@@ -913,7 +825,6 @@ const fsModule = {
913
825
  unlink: fsp.unlink,
914
826
  writeFile: fsp.writeFile
915
827
  };
916
-
917
828
  //#endregion
918
829
  //#region src/plugin/plugin-context.ts
919
830
  var PluginContextImpl = class extends MinimalPluginContextImpl {
@@ -977,10 +888,14 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
977
888
  emitFile = (file) => {
978
889
  if (file.type === "prebuilt-chunk") return this.context.emitPrebuiltChunk({
979
890
  fileName: file.fileName,
891
+ name: file.name,
980
892
  code: file.code,
981
893
  exports: file.exports,
982
894
  map: bindingifySourcemap(file.map),
983
- sourcemapFileName: file.sourcemapFileName
895
+ sourcemapFileName: file.sourcemapFileName,
896
+ facadeModuleId: file.facadeModuleId,
897
+ isEntry: file.isEntry,
898
+ isDynamicEntry: file.isDynamicEntry
984
899
  });
985
900
  if (file.type === "chunk") return this.context.emitChunk({
986
901
  preserveEntrySignatures: bindingifyPreserveEntrySignatures(file.preserveSignature),
@@ -1017,7 +932,17 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
1017
932
  return parseAst(input, options);
1018
933
  }
1019
934
  };
1020
-
935
+ //#endregion
936
+ //#region src/plugin/load-plugin-context.ts
937
+ var LoadPluginContextImpl = class extends PluginContextImpl {
938
+ constructor(outputOptions, context, plugin, data, inner, moduleId, onLog, logLevelOption, watchMode) {
939
+ super(outputOptions, context, plugin, data, onLog, logLevelOption, watchMode, moduleId);
940
+ this.inner = inner;
941
+ }
942
+ addWatchFile(id) {
943
+ this.inner.addWatchFile(id);
944
+ }
945
+ };
1021
946
  //#endregion
1022
947
  //#region src/plugin/transform-plugin-context.ts
1023
948
  var TransformPluginContextImpl = class extends PluginContextImpl {
@@ -1054,16 +979,18 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
1054
979
  this.inner.sendMagicString(s);
1055
980
  }
1056
981
  };
1057
-
1058
982
  //#endregion
1059
983
  //#region src/plugin/bindingify-build-hooks.ts
984
+ function createPluginContext(args, ctx) {
985
+ return new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode);
986
+ }
1060
987
  function bindingifyBuildStart(args) {
1061
988
  const hook = args.plugin.buildStart;
1062
989
  if (!hook) return {};
1063
990
  const { handler, meta } = normalizeHook(hook);
1064
991
  return {
1065
992
  plugin: async (ctx, opts) => {
1066
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), args.pluginContextData.getInputOptions(opts));
993
+ await handler.call(createPluginContext(args, ctx), args.pluginContextData.getInputOptions(opts));
1067
994
  },
1068
995
  meta: bindingifyPluginHookMeta(meta)
1069
996
  };
@@ -1074,7 +1001,7 @@ function bindingifyBuildEnd(args) {
1074
1001
  const { handler, meta } = normalizeHook(hook);
1075
1002
  return {
1076
1003
  plugin: async (ctx, err) => {
1077
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), err ? aggregateBindingErrorsIntoJsError(err) : void 0);
1004
+ await handler.call(createPluginContext(args, ctx), err ? aggregateBindingErrorsIntoJsError(err) : void 0);
1078
1005
  },
1079
1006
  meta: bindingifyPluginHookMeta(meta)
1080
1007
  };
@@ -1086,7 +1013,7 @@ function bindingifyResolveId(args) {
1086
1013
  return {
1087
1014
  plugin: async (ctx, specifier, importer, extraOptions) => {
1088
1015
  const contextResolveOptions = extraOptions.custom != null ? args.pluginContextData.getSavedResolveOptions(extraOptions.custom) : void 0;
1089
- const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), specifier, importer ?? void 0, {
1016
+ const ret = await handler.call(createPluginContext(args, ctx), specifier, importer ?? void 0, {
1090
1017
  ...extraOptions,
1091
1018
  custom: contextResolveOptions?.custom
1092
1019
  });
@@ -1123,7 +1050,7 @@ function bindingifyResolveDynamicImport(args) {
1123
1050
  const { handler, meta } = normalizeHook(hook);
1124
1051
  return {
1125
1052
  plugin: async (ctx, specifier, importer) => {
1126
- const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), specifier, importer ?? void 0);
1053
+ const ret = await handler.call(createPluginContext(args, ctx), specifier, importer ?? void 0);
1127
1054
  if (ret == null) return;
1128
1055
  if (ret === false) return {
1129
1056
  id: specifier,
@@ -1156,7 +1083,7 @@ function bindingifyTransform(args) {
1156
1083
  Object.defineProperties(meta, {
1157
1084
  magicString: { get() {
1158
1085
  if (magicStringInstance) return magicStringInstance;
1159
- magicStringInstance = new BindingMagicString(code);
1086
+ magicStringInstance = new RolldownMagicString(code);
1160
1087
  return magicStringInstance;
1161
1088
  } },
1162
1089
  ast: { get() {
@@ -1190,7 +1117,7 @@ function bindingifyTransform(args) {
1190
1117
  let normalizedCode = void 0;
1191
1118
  let map = ret.map;
1192
1119
  if (typeof ret.code === "string") normalizedCode = ret.code;
1193
- else if (ret.code instanceof BindingMagicString) {
1120
+ else if (ret.code instanceof RolldownMagicString) {
1194
1121
  let magicString = ret.code;
1195
1122
  normalizedCode = magicString.toString();
1196
1123
  let fallbackSourcemap = ctx.sendMagicString(magicString);
@@ -1213,7 +1140,7 @@ function bindingifyLoad(args) {
1213
1140
  const { handler, meta, options } = normalizeHook(hook);
1214
1141
  return {
1215
1142
  plugin: async (ctx, id) => {
1216
- const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode, id), id);
1143
+ const ret = await handler.call(new LoadPluginContextImpl(args.outputOptions, ctx.inner(), args.plugin, args.pluginContextData, ctx, id, args.onLog, args.logLevel, args.watchMode), id);
1217
1144
  if (ret == null) return;
1218
1145
  if (typeof ret === "string") return { code: ret };
1219
1146
  let moduleOption = args.pluginContextData.updateModuleOption(id, {
@@ -1249,12 +1176,11 @@ function bindingifyModuleParsed(args) {
1249
1176
  const { handler, meta } = normalizeHook(hook);
1250
1177
  return {
1251
1178
  plugin: async (ctx, moduleInfo) => {
1252
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformModuleInfo(moduleInfo, args.pluginContextData.getModuleOption(moduleInfo.id)));
1179
+ await handler.call(createPluginContext(args, ctx), transformModuleInfo(moduleInfo, args.pluginContextData.getModuleOption(moduleInfo.id)));
1253
1180
  },
1254
1181
  meta: bindingifyPluginHookMeta(meta)
1255
1182
  };
1256
1183
  }
1257
-
1258
1184
  //#endregion
1259
1185
  //#region src/plugin/bindingify-output-hooks.ts
1260
1186
  function bindingifyRenderStart(args) {
@@ -1280,14 +1206,14 @@ function bindingifyRenderChunk(args) {
1280
1206
  if (args.options.experimental?.nativeMagicString) Object.defineProperty(renderChunkMeta, "magicString", {
1281
1207
  get() {
1282
1208
  if (magicStringInstance) return magicStringInstance;
1283
- magicStringInstance = new BindingMagicString(code);
1209
+ magicStringInstance = new RolldownMagicString(code);
1284
1210
  return magicStringInstance;
1285
1211
  },
1286
1212
  configurable: true
1287
1213
  });
1288
1214
  const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), code, transformRenderedChunk(chunk), args.pluginContextData.getOutputOptions(opts), renderChunkMeta);
1289
1215
  if (ret == null) return;
1290
- if (ret instanceof BindingMagicString) {
1216
+ if (ret instanceof RolldownMagicString) {
1291
1217
  const normalizedCode = ret.toString();
1292
1218
  const generatedMap = ret.generateMap();
1293
1219
  return {
@@ -1302,7 +1228,7 @@ function bindingifyRenderChunk(args) {
1302
1228
  };
1303
1229
  }
1304
1230
  if (typeof ret === "string") return { code: ret };
1305
- if (ret.code instanceof BindingMagicString) {
1231
+ if (ret.code instanceof RolldownMagicString) {
1306
1232
  const magicString = ret.code;
1307
1233
  const normalizedCode = magicString.toString();
1308
1234
  if (ret.map === null) return { code: normalizedCode };
@@ -1451,7 +1377,6 @@ function bindingifyOutro(args) {
1451
1377
  meta: bindingifyPluginHookMeta(meta)
1452
1378
  };
1453
1379
  }
1454
-
1455
1380
  //#endregion
1456
1381
  //#region src/plugin/bindingify-watch-hooks.ts
1457
1382
  function bindingifyWatchChange(args) {
@@ -1476,7 +1401,6 @@ function bindingifyCloseWatcher(args) {
1476
1401
  meta: bindingifyPluginHookMeta(meta)
1477
1402
  };
1478
1403
  }
1479
-
1480
1404
  //#endregion
1481
1405
  //#region src/plugin/generated/hook-usage.ts
1482
1406
  let HookUsageKind = /* @__PURE__ */ function(HookUsageKind) {
@@ -1537,7 +1461,6 @@ function extractHookUsage(plugin) {
1537
1461
  if (plugin.outro) hookUsage.union(HookUsageKind.outro);
1538
1462
  return hookUsage;
1539
1463
  }
1540
-
1541
1464
  //#endregion
1542
1465
  //#region src/plugin/bindingify-plugin.ts
1543
1466
  function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode) {
@@ -1658,14 +1581,14 @@ function wrapHandlers(plugin) {
1658
1581
  }
1659
1582
  return plugin;
1660
1583
  }
1661
-
1662
1584
  //#endregion
1663
1585
  //#region src/options/normalized-input-options.ts
1664
1586
  var NormalizedInputOptionsImpl = class extends PlainObjectLike {
1665
1587
  inner;
1666
- constructor(inner, onLog) {
1588
+ constructor(inner, onLog, inputPlugins) {
1667
1589
  super();
1668
1590
  this.onLog = onLog;
1591
+ this.inputPlugins = inputPlugins;
1669
1592
  this.inner = inner;
1670
1593
  }
1671
1594
  get shimMissingExports() {
@@ -1683,13 +1606,15 @@ var NormalizedInputOptionsImpl = class extends PlainObjectLike {
1683
1606
  get context() {
1684
1607
  return this.inner.context;
1685
1608
  }
1609
+ get plugins() {
1610
+ return this.inputPlugins;
1611
+ }
1686
1612
  };
1687
1613
  __decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "shimMissingExports", null);
1688
1614
  __decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "input", null);
1689
1615
  __decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "cwd", null);
1690
1616
  __decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "platform", null);
1691
1617
  __decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "context", null);
1692
-
1693
1618
  //#endregion
1694
1619
  //#region src/options/normalized-output-options.ts
1695
1620
  var NormalizedOutputOptionsImpl = class extends PlainObjectLike {
@@ -1723,12 +1648,6 @@ var NormalizedOutputOptionsImpl = class extends PlainObjectLike {
1723
1648
  get sourcemapBaseUrl() {
1724
1649
  return this.inner.sourcemapBaseUrl ?? void 0;
1725
1650
  }
1726
- get cssEntryFileNames() {
1727
- return this.inner.cssEntryFilenames || this.outputOptions.cssEntryFileNames;
1728
- }
1729
- get cssChunkFileNames() {
1730
- return this.inner.cssChunkFilenames || this.outputOptions.cssChunkFileNames;
1731
- }
1732
1651
  get shimMissingExports() {
1733
1652
  return this.inner.shimMissingExports;
1734
1653
  }
@@ -1807,6 +1726,14 @@ var NormalizedOutputOptionsImpl = class extends PlainObjectLike {
1807
1726
  get legalComments() {
1808
1727
  return this.inner.legalComments;
1809
1728
  }
1729
+ get comments() {
1730
+ const c = this.inner.comments;
1731
+ return {
1732
+ legal: c.legal ?? true,
1733
+ annotation: c.annotation ?? true,
1734
+ jsdoc: c.jsdoc ?? true
1735
+ };
1736
+ }
1810
1737
  get polyfillRequire() {
1811
1738
  return this.inner.polyfillRequire;
1812
1739
  }
@@ -1837,8 +1764,6 @@ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "format", null);
1837
1764
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "exports", null);
1838
1765
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemap", null);
1839
1766
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapBaseUrl", null);
1840
- __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "cssEntryFileNames", null);
1841
- __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "cssChunkFileNames", null);
1842
1767
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "shimMissingExports", null);
1843
1768
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "name", null);
1844
1769
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "file", null);
@@ -1862,6 +1787,7 @@ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapIgnoreLi
1862
1787
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapPathTransform", null);
1863
1788
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "minify", null);
1864
1789
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "legalComments", null);
1790
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "comments", null);
1865
1791
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "polyfillRequire", null);
1866
1792
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "plugins", null);
1867
1793
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "preserveModules", null);
@@ -1873,7 +1799,6 @@ function normalizeAddon(value) {
1873
1799
  if (typeof value === "function") return value;
1874
1800
  return () => value || "";
1875
1801
  }
1876
-
1877
1802
  //#endregion
1878
1803
  //#region src/plugin/plugin-context-data.ts
1879
1804
  var PluginContextData = class {
@@ -1883,9 +1808,10 @@ var PluginContextData = class {
1883
1808
  renderedChunkMeta = null;
1884
1809
  normalizedInputOptions = null;
1885
1810
  normalizedOutputOptions = null;
1886
- constructor(onLog, outputOptions, normalizedOutputPlugins) {
1811
+ constructor(onLog, outputOptions, normalizedInputPlugins, normalizedOutputPlugins) {
1887
1812
  this.onLog = onLog;
1888
1813
  this.outputOptions = outputOptions;
1814
+ this.normalizedInputPlugins = normalizedInputPlugins;
1889
1815
  this.normalizedOutputPlugins = normalizedOutputPlugins;
1890
1816
  }
1891
1817
  updateModuleOption(id, option) {
@@ -1958,7 +1884,7 @@ var PluginContextData = class {
1958
1884
  return this.renderedChunkMeta;
1959
1885
  }
1960
1886
  getInputOptions(opts) {
1961
- this.normalizedInputOptions ??= new NormalizedInputOptionsImpl(opts, this.onLog);
1887
+ this.normalizedInputOptions ??= new NormalizedInputOptionsImpl(opts, this.onLog, this.normalizedInputPlugins);
1962
1888
  return this.normalizedInputOptions;
1963
1889
  }
1964
1890
  getOutputOptions(opts) {
@@ -1970,7 +1896,6 @@ var PluginContextData = class {
1970
1896
  this.loadModulePromiseMap.clear();
1971
1897
  }
1972
1898
  };
1973
-
1974
1899
  //#endregion
1975
1900
  //#region src/utils/normalize-transform-options.ts
1976
1901
  /**
@@ -1998,11 +1923,10 @@ function normalizeTransformOptions(inputOptions) {
1998
1923
  oxcTransformOptions
1999
1924
  };
2000
1925
  }
2001
-
2002
1926
  //#endregion
2003
1927
  //#region src/utils/bindingify-input-options.ts
2004
- function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode) {
2005
- const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedOutputPlugins);
1928
+ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedInputPlugins, normalizedOutputPlugins, onLog, logLevel, watchMode) {
1929
+ const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedInputPlugins, normalizedOutputPlugins);
2006
1930
  const plugins = rawPlugins.map((plugin) => {
2007
1931
  if ("_parallel" in plugin) return;
2008
1932
  if (plugin instanceof BuiltinPlugin) switch (plugin.name) {
@@ -2096,7 +2020,8 @@ function bindingifyExperimental(experimental) {
2096
2020
  onDemandWrapping: experimental?.onDemandWrapping,
2097
2021
  incrementalBuild: experimental?.incrementalBuild,
2098
2022
  nativeMagicString: experimental?.nativeMagicString,
2099
- chunkOptimization: experimental?.chunkOptimization
2023
+ chunkOptimization: experimental?.chunkOptimization,
2024
+ lazyBarrel: experimental?.lazyBarrel
2100
2025
  };
2101
2026
  }
2102
2027
  function bindingifyResolve(resolve) {
@@ -2160,13 +2085,26 @@ function bindingifyInput(input) {
2160
2085
  });
2161
2086
  }
2162
2087
  function bindingifyWatch(watch) {
2163
- if (watch) return {
2164
- buildDelay: watch.buildDelay,
2165
- skipWrite: watch.skipWrite,
2166
- include: normalizedStringOrRegex(watch.include),
2167
- exclude: normalizedStringOrRegex(watch.exclude),
2168
- onInvalidate: (...args) => watch.onInvalidate?.(...args)
2169
- };
2088
+ if (watch) {
2089
+ if (watch.notify) console.warn("The \"watch.notify\" option is deprecated. Please use \"watch.watcher\" instead.");
2090
+ const watcher = {
2091
+ ...watch.notify,
2092
+ ...watch.watcher
2093
+ };
2094
+ return {
2095
+ buildDelay: watch.buildDelay,
2096
+ skipWrite: watch.skipWrite,
2097
+ usePolling: watcher.usePolling,
2098
+ pollInterval: watcher.pollInterval,
2099
+ compareContentsForPolling: watcher.compareContentsForPolling,
2100
+ useDebounce: watcher.useDebounce,
2101
+ debounceDelay: watcher.debounceDelay,
2102
+ debounceTickRate: watcher.debounceTickRate,
2103
+ include: normalizedStringOrRegex(watch.include),
2104
+ exclude: normalizedStringOrRegex(watch.exclude),
2105
+ onInvalidate: (...args) => watch.onInvalidate?.(...args)
2106
+ };
2107
+ }
2170
2108
  }
2171
2109
  function bindingifyTreeshakeOptions(config) {
2172
2110
  if (config === false) return;
@@ -2226,6 +2164,5 @@ function bindingifyPreserveEntrySignatures(preserveEntrySignatures) {
2226
2164
  field0: preserveEntrySignatures
2227
2165
  };
2228
2166
  }
2229
-
2230
2167
  //#endregion
2231
- export { description as C, VERSION as S, LOG_LEVEL_DEBUG as _, aggregateBindingErrorsIntoJsError as a, LOG_LEVEL_WARN as b, transformToRollupOutput as c, transformAssetSource as d, lazyProp as f, normalizeLog as g, normalizeHook as h, transformModuleInfo as i, transformRenderedChunk as l, MinimalPluginContextImpl as m, PluginContextData as n, normalizeBindingResult as o, PlainObjectLike as p, bindingifyPlugin as r, unwrapBindingResult as s, bindingifyInputOptions as t, __decorate as u, LOG_LEVEL_ERROR as v, version as w, logLevelPriority as x, LOG_LEVEL_INFO as y };
2168
+ export { version as C, description as S, LOG_LEVEL_INFO as _, RolldownMagicString as a, RUNTIME_MODULE_ID as b, __decorate as c, PlainObjectLike as d, MinimalPluginContextImpl as f, LOG_LEVEL_ERROR as g, LOG_LEVEL_DEBUG as h, transformModuleInfo as i, transformAssetSource as l, normalizeLog as m, PluginContextData as n, transformToRollupOutput as o, normalizeHook as p, bindingifyPlugin as r, transformRenderedChunk as s, bindingifyInputOptions as t, lazyProp as u, LOG_LEVEL_WARN as v, VERSION as x, logLevelPriority as y };
@@ -17,7 +17,6 @@ function unsupported(info) {
17
17
  throw new Error(`UNSUPPORTED: ${info}`);
18
18
  }
19
19
  function noop(..._args) {}
20
-
21
20
  //#endregion
22
21
  //#region ../pluginutils/dist/utils.js
23
22
  const postfixRE = /[?#].*$/;
@@ -31,7 +30,6 @@ function extractQueryWithoutFragment(url) {
31
30
  if (fragmentIndex === -1) return url.substring(questionMarkIndex);
32
31
  else return url.substring(questionMarkIndex, fragmentIndex);
33
32
  }
34
-
35
33
  //#endregion
36
34
  //#region ../pluginutils/dist/filter/composable-filters.js
37
35
  var And = class {
@@ -222,6 +220,5 @@ function exprInterpreter(expr, code, id, moduleType, importerId, ctx = {}) {
222
220
  default: throw new Error(`Expression ${JSON.stringify(expr)} is not expected.`);
223
221
  }
224
222
  }
225
-
226
223
  //#endregion
227
- export { noop as _, id as a, unsupported as b, interpreter as c, not as d, or as f, isPromiseLike as g, arraify as h, exprInterpreter as i, interpreterImpl as l, query as m, code as n, importerId as o, queries as p, exclude as r, include as s, and as t, moduleType as u, unimplemented as v, unreachable as y };
224
+ export { noop as _, id as a, unsupported as b, interpreter as c, not as d, or as f, isPromiseLike as g, arraify as h, exprInterpreter as i, interpreterImpl as l, query as m, code as n, importerId as o, queries as p, exclude as r, include as s, and as t, moduleType as u, unimplemented as v, unreachable as y };