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

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 +705 -1101
  2. package/dist/config.d.mts +9 -4
  3. package/dist/config.mjs +4 -13
  4. package/dist/{shared/constructors-BTW-c3jX.mjs → constructors-LtcP0f-6.js} +14 -7
  5. package/dist/error-nyELQq9T.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 +6 -12
  16. package/dist/{normalize-string-or-regex-CL-PJZI7.js → normalize-string-or-regex-Db8ibFkp.js} +25 -23
  17. package/dist/parallel-plugin-worker.mjs +3 -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-CkWJwi9L.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-BPQtF2AA.js} +1063 -745
  30. package/dist/shared/{bindingify-input-options-Bp2kpiI8.mjs → bindingify-input-options-CSSx7s5e.mjs} +124 -165
  31. package/dist/shared/{composable-filters-CIxSuZSM.mjs → composable-filters-B2ByPP8y.mjs} +1 -4
  32. package/dist/{constructors-B8gqcrFr.js → shared/constructors-BGLoUvKR.mjs} +14 -7
  33. package/dist/shared/{constructors-5bt5oBhE.d.mts → constructors-BVnf_fH1.d.mts} +13 -4
  34. package/dist/shared/define-config-Cr6054d_.d.mts +3869 -0
  35. package/dist/shared/{define-config-Dlptvz3X.mjs → define-config-DJOr6Iwt.mjs} +1 -2
  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-CXtSVabV.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-D0o84ejN.mjs} +21 -16
  42. package/dist/shared/parse-B_jvq8dU.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-D-bh1N9N.mjs} +2 -4
  46. package/dist/shared/rolldown-build-Bysdmf-9.mjs +3320 -0
  47. package/dist/shared/transform-DEgNAQOQ.d.mts +149 -0
  48. package/dist/shared/{types-CIYK49jr.d.mts → types-K2r0mx6Y.d.mts} +11 -9
  49. package/dist/shared/{watch-eIop0yN6.mjs → watch-V9eI6ua1.mjs} +71 -76
  50. package/dist/utils-index.browser.mjs +2414 -0
  51. package/dist/utils-index.d.mts +1673 -0
  52. package/dist/utils-index.mjs +2414 -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-D0o84ejN.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.11";
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.121.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,37 @@ 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
+ const nativeReplace = BindingMagicString.prototype.replace;
569
+ const nativeReplaceAll = BindingMagicString.prototype.replaceAll;
570
+ BindingMagicString.prototype.replace = function(searchValue, replacement) {
571
+ if (typeof searchValue === "string") return nativeReplace.call(this, searchValue, replacement);
572
+ if (searchValue.global) searchValue.lastIndex = 0;
573
+ const lastMatchEnd = this.replaceRegex(searchValue, replacement);
574
+ if (searchValue.global) searchValue.lastIndex = 0;
575
+ else if (searchValue.sticky) searchValue.lastIndex = lastMatchEnd === -1 ? 0 : lastMatchEnd;
576
+ return this;
577
+ };
578
+ BindingMagicString.prototype.replaceAll = function(searchValue, replacement) {
579
+ if (typeof searchValue === "string") return nativeReplaceAll.call(this, searchValue, replacement);
580
+ if (!searchValue.global) throw new TypeError("MagicString.prototype.replaceAll called with a non-global RegExp argument");
581
+ searchValue.lastIndex = 0;
582
+ this.replaceRegex(searchValue, replacement);
583
+ searchValue.lastIndex = 0;
584
+ return this;
585
+ };
586
+ /**
587
+ * A native MagicString implementation powered by Rust.
588
+ *
589
+ * @experimental
590
+ */
591
+ const RolldownMagicString = BindingMagicString;
656
592
  //#endregion
657
593
  //#region src/utils/transform-module-info.ts
658
594
  function transformModuleInfo(info, option) {
@@ -670,10 +606,10 @@ function transformModuleInfo(info, option) {
670
606
  dynamicallyImportedIds: info.dynamicallyImportedIds,
671
607
  exports: info.exports,
672
608
  isEntry: info.isEntry,
609
+ inputFormat: info.inputFormat,
673
610
  ...option
674
611
  };
675
612
  }
676
-
677
613
  //#endregion
678
614
  //#region src/utils/transform-sourcemap.ts
679
615
  function isEmptySourcemapFiled(array) {
@@ -688,9 +624,8 @@ function normalizeTransformHookSourcemap(id, originalCode, rawMap) {
688
624
  if (isEmptySourcemapFiled(map.sources) || map.sources && map.sources.length === 1 && map.sources[0] !== id) map.sources = [id];
689
625
  return map;
690
626
  }
691
-
692
627
  //#endregion
693
- //#region ../../node_modules/.pnpm/remeda@2.33.4/node_modules/remeda/dist/lazyDataLastImpl-DtF3cihj.js
628
+ //#region ../../node_modules/.pnpm/remeda@2.33.6/node_modules/remeda/dist/lazyDataLastImpl-DtF3cihj.js
694
629
  function e(e, t, n) {
695
630
  let r = (n) => e(n, ...t);
696
631
  return n === void 0 ? r : Object.assign(r, {
@@ -698,18 +633,16 @@ function e(e, t, n) {
698
633
  lazyArgs: t
699
634
  });
700
635
  }
701
-
702
636
  //#endregion
703
- //#region ../../node_modules/.pnpm/remeda@2.33.4/node_modules/remeda/dist/purry-GjwKKIlp.js
637
+ //#region ../../node_modules/.pnpm/remeda@2.33.6/node_modules/remeda/dist/purry.js
704
638
  function t$1(t, n, r) {
705
639
  let i = t.length - n.length;
706
640
  if (i === 0) return t(...n);
707
641
  if (i === 1) return e(t, n, r);
708
642
  throw Error(`Wrong number of arguments`);
709
643
  }
710
-
711
644
  //#endregion
712
- //#region ../../node_modules/.pnpm/remeda@2.33.4/node_modules/remeda/dist/partition.js
645
+ //#region ../../node_modules/.pnpm/remeda@2.33.6/node_modules/remeda/dist/partition.js
713
646
  function t(...t) {
714
647
  return t$1(n, t);
715
648
  }
@@ -718,7 +651,6 @@ const n = (e, t) => {
718
651
  for (let [r, i] of e.entries()) t(i, r, e) ? n[0].push(i) : n[1].push(i);
719
652
  return n;
720
653
  };
721
-
722
654
  //#endregion
723
655
  //#region src/plugin/bindingify-hook-filter.ts
724
656
  function generalHookFilterMatcherToFilterExprs(matcher, stringKind) {
@@ -880,7 +812,6 @@ function bindingifyRenderChunkFilter(filterOption) {
880
812
  }
881
813
  return filterOption.code ? bindingifyGeneralHookFilter("code", filterOption.code) : void 0;
882
814
  }
883
-
884
815
  //#endregion
885
816
  //#region src/plugin/bindingify-plugin-hook-meta.ts
886
817
  function bindingifyPluginHookMeta(options) {
@@ -895,7 +826,6 @@ function bindingPluginOrder(order) {
895
826
  default: throw new Error(`Unknown plugin order: ${order}`);
896
827
  }
897
828
  }
898
-
899
829
  //#endregion
900
830
  //#region src/plugin/fs.ts
901
831
  const fsModule = {
@@ -913,7 +843,6 @@ const fsModule = {
913
843
  unlink: fsp.unlink,
914
844
  writeFile: fsp.writeFile
915
845
  };
916
-
917
846
  //#endregion
918
847
  //#region src/plugin/plugin-context.ts
919
848
  var PluginContextImpl = class extends MinimalPluginContextImpl {
@@ -977,10 +906,14 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
977
906
  emitFile = (file) => {
978
907
  if (file.type === "prebuilt-chunk") return this.context.emitPrebuiltChunk({
979
908
  fileName: file.fileName,
909
+ name: file.name,
980
910
  code: file.code,
981
911
  exports: file.exports,
982
912
  map: bindingifySourcemap(file.map),
983
- sourcemapFileName: file.sourcemapFileName
913
+ sourcemapFileName: file.sourcemapFileName,
914
+ facadeModuleId: file.facadeModuleId,
915
+ isEntry: file.isEntry,
916
+ isDynamicEntry: file.isDynamicEntry
984
917
  });
985
918
  if (file.type === "chunk") return this.context.emitChunk({
986
919
  preserveEntrySignatures: bindingifyPreserveEntrySignatures(file.preserveSignature),
@@ -1017,7 +950,17 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
1017
950
  return parseAst(input, options);
1018
951
  }
1019
952
  };
1020
-
953
+ //#endregion
954
+ //#region src/plugin/load-plugin-context.ts
955
+ var LoadPluginContextImpl = class extends PluginContextImpl {
956
+ constructor(outputOptions, context, plugin, data, inner, moduleId, onLog, logLevelOption, watchMode) {
957
+ super(outputOptions, context, plugin, data, onLog, logLevelOption, watchMode, moduleId);
958
+ this.inner = inner;
959
+ }
960
+ addWatchFile(id) {
961
+ this.inner.addWatchFile(id);
962
+ }
963
+ };
1021
964
  //#endregion
1022
965
  //#region src/plugin/transform-plugin-context.ts
1023
966
  var TransformPluginContextImpl = class extends PluginContextImpl {
@@ -1054,16 +997,18 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
1054
997
  this.inner.sendMagicString(s);
1055
998
  }
1056
999
  };
1057
-
1058
1000
  //#endregion
1059
1001
  //#region src/plugin/bindingify-build-hooks.ts
1002
+ function createPluginContext(args, ctx) {
1003
+ return new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode);
1004
+ }
1060
1005
  function bindingifyBuildStart(args) {
1061
1006
  const hook = args.plugin.buildStart;
1062
1007
  if (!hook) return {};
1063
1008
  const { handler, meta } = normalizeHook(hook);
1064
1009
  return {
1065
1010
  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));
1011
+ await handler.call(createPluginContext(args, ctx), args.pluginContextData.getInputOptions(opts));
1067
1012
  },
1068
1013
  meta: bindingifyPluginHookMeta(meta)
1069
1014
  };
@@ -1074,7 +1019,7 @@ function bindingifyBuildEnd(args) {
1074
1019
  const { handler, meta } = normalizeHook(hook);
1075
1020
  return {
1076
1021
  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);
1022
+ await handler.call(createPluginContext(args, ctx), err ? aggregateBindingErrorsIntoJsError(err) : void 0);
1078
1023
  },
1079
1024
  meta: bindingifyPluginHookMeta(meta)
1080
1025
  };
@@ -1086,7 +1031,7 @@ function bindingifyResolveId(args) {
1086
1031
  return {
1087
1032
  plugin: async (ctx, specifier, importer, extraOptions) => {
1088
1033
  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, {
1034
+ const ret = await handler.call(createPluginContext(args, ctx), specifier, importer ?? void 0, {
1090
1035
  ...extraOptions,
1091
1036
  custom: contextResolveOptions?.custom
1092
1037
  });
@@ -1123,7 +1068,7 @@ function bindingifyResolveDynamicImport(args) {
1123
1068
  const { handler, meta } = normalizeHook(hook);
1124
1069
  return {
1125
1070
  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);
1071
+ const ret = await handler.call(createPluginContext(args, ctx), specifier, importer ?? void 0);
1127
1072
  if (ret == null) return;
1128
1073
  if (ret === false) return {
1129
1074
  id: specifier,
@@ -1156,7 +1101,7 @@ function bindingifyTransform(args) {
1156
1101
  Object.defineProperties(meta, {
1157
1102
  magicString: { get() {
1158
1103
  if (magicStringInstance) return magicStringInstance;
1159
- magicStringInstance = new BindingMagicString(code);
1104
+ magicStringInstance = new RolldownMagicString(code);
1160
1105
  return magicStringInstance;
1161
1106
  } },
1162
1107
  ast: { get() {
@@ -1190,7 +1135,7 @@ function bindingifyTransform(args) {
1190
1135
  let normalizedCode = void 0;
1191
1136
  let map = ret.map;
1192
1137
  if (typeof ret.code === "string") normalizedCode = ret.code;
1193
- else if (ret.code instanceof BindingMagicString) {
1138
+ else if (ret.code instanceof RolldownMagicString) {
1194
1139
  let magicString = ret.code;
1195
1140
  normalizedCode = magicString.toString();
1196
1141
  let fallbackSourcemap = ctx.sendMagicString(magicString);
@@ -1213,7 +1158,7 @@ function bindingifyLoad(args) {
1213
1158
  const { handler, meta, options } = normalizeHook(hook);
1214
1159
  return {
1215
1160
  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);
1161
+ 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
1162
  if (ret == null) return;
1218
1163
  if (typeof ret === "string") return { code: ret };
1219
1164
  let moduleOption = args.pluginContextData.updateModuleOption(id, {
@@ -1249,12 +1194,11 @@ function bindingifyModuleParsed(args) {
1249
1194
  const { handler, meta } = normalizeHook(hook);
1250
1195
  return {
1251
1196
  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)));
1197
+ await handler.call(createPluginContext(args, ctx), transformModuleInfo(moduleInfo, args.pluginContextData.getModuleOption(moduleInfo.id)));
1253
1198
  },
1254
1199
  meta: bindingifyPluginHookMeta(meta)
1255
1200
  };
1256
1201
  }
1257
-
1258
1202
  //#endregion
1259
1203
  //#region src/plugin/bindingify-output-hooks.ts
1260
1204
  function bindingifyRenderStart(args) {
@@ -1280,14 +1224,14 @@ function bindingifyRenderChunk(args) {
1280
1224
  if (args.options.experimental?.nativeMagicString) Object.defineProperty(renderChunkMeta, "magicString", {
1281
1225
  get() {
1282
1226
  if (magicStringInstance) return magicStringInstance;
1283
- magicStringInstance = new BindingMagicString(code);
1227
+ magicStringInstance = new RolldownMagicString(code);
1284
1228
  return magicStringInstance;
1285
1229
  },
1286
1230
  configurable: true
1287
1231
  });
1288
1232
  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
1233
  if (ret == null) return;
1290
- if (ret instanceof BindingMagicString) {
1234
+ if (ret instanceof RolldownMagicString) {
1291
1235
  const normalizedCode = ret.toString();
1292
1236
  const generatedMap = ret.generateMap();
1293
1237
  return {
@@ -1302,7 +1246,7 @@ function bindingifyRenderChunk(args) {
1302
1246
  };
1303
1247
  }
1304
1248
  if (typeof ret === "string") return { code: ret };
1305
- if (ret.code instanceof BindingMagicString) {
1249
+ if (ret.code instanceof RolldownMagicString) {
1306
1250
  const magicString = ret.code;
1307
1251
  const normalizedCode = magicString.toString();
1308
1252
  if (ret.map === null) return { code: normalizedCode };
@@ -1451,7 +1395,6 @@ function bindingifyOutro(args) {
1451
1395
  meta: bindingifyPluginHookMeta(meta)
1452
1396
  };
1453
1397
  }
1454
-
1455
1398
  //#endregion
1456
1399
  //#region src/plugin/bindingify-watch-hooks.ts
1457
1400
  function bindingifyWatchChange(args) {
@@ -1476,7 +1419,6 @@ function bindingifyCloseWatcher(args) {
1476
1419
  meta: bindingifyPluginHookMeta(meta)
1477
1420
  };
1478
1421
  }
1479
-
1480
1422
  //#endregion
1481
1423
  //#region src/plugin/generated/hook-usage.ts
1482
1424
  let HookUsageKind = /* @__PURE__ */ function(HookUsageKind) {
@@ -1537,7 +1479,6 @@ function extractHookUsage(plugin) {
1537
1479
  if (plugin.outro) hookUsage.union(HookUsageKind.outro);
1538
1480
  return hookUsage;
1539
1481
  }
1540
-
1541
1482
  //#endregion
1542
1483
  //#region src/plugin/bindingify-plugin.ts
1543
1484
  function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode) {
@@ -1658,14 +1599,14 @@ function wrapHandlers(plugin) {
1658
1599
  }
1659
1600
  return plugin;
1660
1601
  }
1661
-
1662
1602
  //#endregion
1663
1603
  //#region src/options/normalized-input-options.ts
1664
1604
  var NormalizedInputOptionsImpl = class extends PlainObjectLike {
1665
1605
  inner;
1666
- constructor(inner, onLog) {
1606
+ constructor(inner, onLog, inputPlugins) {
1667
1607
  super();
1668
1608
  this.onLog = onLog;
1609
+ this.inputPlugins = inputPlugins;
1669
1610
  this.inner = inner;
1670
1611
  }
1671
1612
  get shimMissingExports() {
@@ -1683,13 +1624,15 @@ var NormalizedInputOptionsImpl = class extends PlainObjectLike {
1683
1624
  get context() {
1684
1625
  return this.inner.context;
1685
1626
  }
1627
+ get plugins() {
1628
+ return this.inputPlugins;
1629
+ }
1686
1630
  };
1687
1631
  __decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "shimMissingExports", null);
1688
1632
  __decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "input", null);
1689
1633
  __decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "cwd", null);
1690
1634
  __decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "platform", null);
1691
1635
  __decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "context", null);
1692
-
1693
1636
  //#endregion
1694
1637
  //#region src/options/normalized-output-options.ts
1695
1638
  var NormalizedOutputOptionsImpl = class extends PlainObjectLike {
@@ -1723,12 +1666,6 @@ var NormalizedOutputOptionsImpl = class extends PlainObjectLike {
1723
1666
  get sourcemapBaseUrl() {
1724
1667
  return this.inner.sourcemapBaseUrl ?? void 0;
1725
1668
  }
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
1669
  get shimMissingExports() {
1733
1670
  return this.inner.shimMissingExports;
1734
1671
  }
@@ -1789,6 +1726,9 @@ var NormalizedOutputOptionsImpl = class extends PlainObjectLike {
1789
1726
  get sourcemapDebugIds() {
1790
1727
  return this.inner.sourcemapDebugIds;
1791
1728
  }
1729
+ get sourcemapExcludeSources() {
1730
+ return this.inner.sourcemapExcludeSources;
1731
+ }
1792
1732
  get sourcemapIgnoreList() {
1793
1733
  return this.outputOptions.sourcemapIgnoreList;
1794
1734
  }
@@ -1807,6 +1747,14 @@ var NormalizedOutputOptionsImpl = class extends PlainObjectLike {
1807
1747
  get legalComments() {
1808
1748
  return this.inner.legalComments;
1809
1749
  }
1750
+ get comments() {
1751
+ const c = this.inner.comments;
1752
+ return {
1753
+ legal: c.legal ?? true,
1754
+ annotation: c.annotation ?? true,
1755
+ jsdoc: c.jsdoc ?? true
1756
+ };
1757
+ }
1810
1758
  get polyfillRequire() {
1811
1759
  return this.inner.polyfillRequire;
1812
1760
  }
@@ -1837,8 +1785,6 @@ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "format", null);
1837
1785
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "exports", null);
1838
1786
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemap", null);
1839
1787
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapBaseUrl", null);
1840
- __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "cssEntryFileNames", null);
1841
- __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "cssChunkFileNames", null);
1842
1788
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "shimMissingExports", null);
1843
1789
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "name", null);
1844
1790
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "file", null);
@@ -1858,10 +1804,12 @@ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "globals", null);
1858
1804
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "paths", null);
1859
1805
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "hashCharacters", null);
1860
1806
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapDebugIds", null);
1807
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapExcludeSources", null);
1861
1808
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapIgnoreList", null);
1862
1809
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapPathTransform", null);
1863
1810
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "minify", null);
1864
1811
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "legalComments", null);
1812
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "comments", null);
1865
1813
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "polyfillRequire", null);
1866
1814
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "plugins", null);
1867
1815
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "preserveModules", null);
@@ -1873,7 +1821,6 @@ function normalizeAddon(value) {
1873
1821
  if (typeof value === "function") return value;
1874
1822
  return () => value || "";
1875
1823
  }
1876
-
1877
1824
  //#endregion
1878
1825
  //#region src/plugin/plugin-context-data.ts
1879
1826
  var PluginContextData = class {
@@ -1883,9 +1830,10 @@ var PluginContextData = class {
1883
1830
  renderedChunkMeta = null;
1884
1831
  normalizedInputOptions = null;
1885
1832
  normalizedOutputOptions = null;
1886
- constructor(onLog, outputOptions, normalizedOutputPlugins) {
1833
+ constructor(onLog, outputOptions, normalizedInputPlugins, normalizedOutputPlugins) {
1887
1834
  this.onLog = onLog;
1888
1835
  this.outputOptions = outputOptions;
1836
+ this.normalizedInputPlugins = normalizedInputPlugins;
1889
1837
  this.normalizedOutputPlugins = normalizedOutputPlugins;
1890
1838
  }
1891
1839
  updateModuleOption(id, option) {
@@ -1958,7 +1906,7 @@ var PluginContextData = class {
1958
1906
  return this.renderedChunkMeta;
1959
1907
  }
1960
1908
  getInputOptions(opts) {
1961
- this.normalizedInputOptions ??= new NormalizedInputOptionsImpl(opts, this.onLog);
1909
+ this.normalizedInputOptions ??= new NormalizedInputOptionsImpl(opts, this.onLog, this.normalizedInputPlugins);
1962
1910
  return this.normalizedInputOptions;
1963
1911
  }
1964
1912
  getOutputOptions(opts) {
@@ -1970,7 +1918,6 @@ var PluginContextData = class {
1970
1918
  this.loadModulePromiseMap.clear();
1971
1919
  }
1972
1920
  };
1973
-
1974
1921
  //#endregion
1975
1922
  //#region src/utils/normalize-transform-options.ts
1976
1923
  /**
@@ -1998,11 +1945,10 @@ function normalizeTransformOptions(inputOptions) {
1998
1945
  oxcTransformOptions
1999
1946
  };
2000
1947
  }
2001
-
2002
1948
  //#endregion
2003
1949
  //#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);
1950
+ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedInputPlugins, normalizedOutputPlugins, onLog, logLevel, watchMode) {
1951
+ const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedInputPlugins, normalizedOutputPlugins);
2006
1952
  const plugins = rawPlugins.map((plugin) => {
2007
1953
  if ("_parallel" in plugin) return;
2008
1954
  if (plugin instanceof BuiltinPlugin) switch (plugin.name) {
@@ -2096,7 +2042,8 @@ function bindingifyExperimental(experimental) {
2096
2042
  onDemandWrapping: experimental?.onDemandWrapping,
2097
2043
  incrementalBuild: experimental?.incrementalBuild,
2098
2044
  nativeMagicString: experimental?.nativeMagicString,
2099
- chunkOptimization: experimental?.chunkOptimization
2045
+ chunkOptimization: experimental?.chunkOptimization,
2046
+ lazyBarrel: experimental?.lazyBarrel
2100
2047
  };
2101
2048
  }
2102
2049
  function bindingifyResolve(resolve) {
@@ -2160,13 +2107,26 @@ function bindingifyInput(input) {
2160
2107
  });
2161
2108
  }
2162
2109
  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
- };
2110
+ if (watch) {
2111
+ if (watch.notify) console.warn("The \"watch.notify\" option is deprecated. Please use \"watch.watcher\" instead.");
2112
+ const watcher = {
2113
+ ...watch.notify,
2114
+ ...watch.watcher
2115
+ };
2116
+ return {
2117
+ buildDelay: watch.buildDelay,
2118
+ skipWrite: watch.skipWrite,
2119
+ usePolling: watcher.usePolling,
2120
+ pollInterval: watcher.pollInterval,
2121
+ compareContentsForPolling: watcher.compareContentsForPolling,
2122
+ useDebounce: watcher.useDebounce,
2123
+ debounceDelay: watcher.debounceDelay,
2124
+ debounceTickRate: watcher.debounceTickRate,
2125
+ include: normalizedStringOrRegex(watch.include),
2126
+ exclude: normalizedStringOrRegex(watch.exclude),
2127
+ onInvalidate: (...args) => watch.onInvalidate?.(...args)
2128
+ };
2129
+ }
2170
2130
  }
2171
2131
  function bindingifyTreeshakeOptions(config) {
2172
2132
  if (config === false) return;
@@ -2226,6 +2186,5 @@ function bindingifyPreserveEntrySignatures(preserveEntrySignatures) {
2226
2186
  field0: preserveEntrySignatures
2227
2187
  };
2228
2188
  }
2229
-
2230
2189
  //#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 };
2190
+ 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 };