@rollipop/rolldown 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 (50) hide show
  1. package/bin/cli.mjs +0 -1
  2. package/dist/cli.mjs +705 -1102
  3. package/dist/config.d.mts +9 -5
  4. package/dist/config.mjs +4 -14
  5. package/dist/experimental-index.d.mts +189 -54
  6. package/dist/experimental-index.mjs +106 -22
  7. package/dist/experimental-runtime-types.d.ts +0 -5
  8. package/dist/filter-index.d.mts +1 -2
  9. package/dist/filter-index.mjs +25 -8
  10. package/dist/get-log-filter.d.mts +3 -7
  11. package/dist/get-log-filter.mjs +23 -3
  12. package/dist/index.d.mts +4 -4
  13. package/dist/index.mjs +6 -13
  14. package/dist/parallel-plugin-worker.mjs +4 -8
  15. package/dist/parallel-plugin.d.mts +3 -4
  16. package/dist/parallel-plugin.mjs +1 -2
  17. package/dist/parse-ast-index.d.mts +26 -2
  18. package/dist/parse-ast-index.mjs +60 -4
  19. package/dist/plugins-index.d.mts +8 -5
  20. package/dist/plugins-index.mjs +8 -8
  21. package/dist/shared/{binding-tNJoEqAa.mjs → binding-MvMgR80I.mjs} +41 -43
  22. package/dist/shared/binding-hSQGgsUz.d.mts +1877 -0
  23. package/dist/shared/{bindingify-input-options-CfhrNd_y.mjs → bindingify-input-options-DhxvofsC.mjs} +127 -167
  24. package/dist/shared/{constructors-414MPkgB.mjs → constructors-BEqS3i54.mjs} +14 -7
  25. package/dist/shared/{constructors--k1uxZrh.d.mts → constructors-DMl58KN5.d.mts} +13 -4
  26. package/dist/shared/define-config-BSxBeCq6.d.mts +3810 -0
  27. package/dist/shared/{define-config-BVG4QvnP.mjs → define-config-DJOr6Iwt.mjs} +1 -2
  28. package/dist/shared/error-DcChL8nQ.mjs +85 -0
  29. package/dist/shared/get-log-filter-semyr3Lj.d.mts +35 -0
  30. package/dist/shared/{load-config-Qtd9pHJ5.mjs → load-config-tB5qAWuR.mjs} +11 -5
  31. package/dist/shared/{logging-wIy4zY9I.d.mts → logging-C6h4g8dA.d.mts} +6 -6
  32. package/dist/shared/{logs-NH298mHo.mjs → logs-D80CXhvg.mjs} +6 -9
  33. package/dist/shared/{misc-CCZIsXVO.mjs → misc-DJYbNKZX.mjs} +1 -2
  34. package/dist/shared/{normalize-string-or-regex-DeB7vQ75.mjs → normalize-string-or-regex-Dq9aIZE5.mjs} +22 -17
  35. package/dist/shared/parse-Cn5AzDgI.mjs +74 -0
  36. package/dist/shared/{prompt-tlfjalEt.mjs → prompt-BYQIwEjg.mjs} +4 -6
  37. package/dist/shared/resolve-tsconfig-QSpuHPL1.mjs +113 -0
  38. package/dist/shared/{rolldown-BMzJcmQ7.mjs → rolldown-6yZY58Dc.mjs} +2 -4
  39. package/dist/shared/rolldown-build-C10b1v8L.mjs +3326 -0
  40. package/dist/shared/transform-DY2pi3Qm.d.mts +149 -0
  41. package/dist/shared/{watch-HmN4U4B9.mjs → watch-D9PzJrio.mjs} +73 -78
  42. package/dist/utils-index.d.mts +376 -0
  43. package/dist/utils-index.mjs +2414 -0
  44. package/package.json +23 -21
  45. package/dist/cli-setup.d.mts +0 -1
  46. package/dist/cli-setup.mjs +0 -17
  47. package/dist/shared/binding-B92Lq__Q.d.mts +0 -1687
  48. package/dist/shared/define-config-D8xP5iyL.d.mts +0 -3463
  49. package/dist/shared/parse-ast-index-BcP4Ts_P.mjs +0 -99
  50. package/dist/shared/rolldown-build-DWeKtJOy.mjs +0 -2371
@@ -1,18 +1,17 @@
1
- import { n as __toESM, t as require_binding } from "./binding-tNJoEqAa.mjs";
2
- import { a as logInvalidLogPosition, c as logPluginError, n as error, r as logCycleLoading, t as augmentCodeLocation } from "./logs-NH298mHo.mjs";
3
- import { i as bindingifyManifestPlugin, n as BuiltinPlugin, r as bindingifyBuiltInPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-DeB7vQ75.mjs";
4
- import { a as unreachable, o as unsupported, r as noop, t as arraify } from "./misc-CCZIsXVO.mjs";
5
- import { t as parseAst } from "./parse-ast-index-BcP4Ts_P.mjs";
1
+ import { n as __toESM, t as require_binding } from "./binding-MvMgR80I.mjs";
2
+ import { a as logInvalidLogPosition, c as logPluginError, n as error, r as logCycleLoading, t as augmentCodeLocation } from "./logs-D80CXhvg.mjs";
3
+ import { i as bindingifyManifestPlugin, n as BuiltinPlugin, r as bindingifyBuiltInPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-Dq9aIZE5.mjs";
4
+ import { a as unreachable, o as unsupported, r as noop, t as arraify } from "./misc-DJYbNKZX.mjs";
5
+ import { a as bindingifySourcemap, i as unwrapBindingResult, t as aggregateBindingErrorsIntoJsError } from "./error-DcChL8nQ.mjs";
6
+ import { parseAst } from "../parse-ast-index.mjs";
6
7
  import path from "node:path";
7
8
  import * as filter from "@rollipop/rolldown-pluginutils";
8
9
  import fsp from "node:fs/promises";
9
-
10
10
  //#region package.json
11
- var version = "1.0.0-rc.1";
11
+ var version = "1.0.0-rc.11";
12
12
  var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
13
-
14
13
  //#endregion
15
- //#region src/version.ts
14
+ //#region src/constants/version.ts
16
15
  /**
17
16
  * The version of Rolldown.
18
17
  * @example `'1.0.0'`
@@ -20,7 +19,12 @@ var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compat
20
19
  * @category Plugin APIs
21
20
  */
22
21
  const VERSION = version;
23
-
22
+ //#endregion
23
+ //#region src/constants/index.ts
24
+ /**
25
+ * Runtime helper module ID
26
+ */
27
+ const RUNTIME_MODULE_ID = "\0rolldown/runtime.js";
24
28
  //#endregion
25
29
  //#region src/log/logging.ts
26
30
  const LOG_LEVEL_SILENT = "silent";
@@ -34,7 +38,6 @@ const logLevelPriority = {
34
38
  [LOG_LEVEL_WARN]: 2,
35
39
  [LOG_LEVEL_SILENT]: 3
36
40
  };
37
-
38
41
  //#endregion
39
42
  //#region src/log/log-handler.ts
40
43
  const normalizeLog = (log) => typeof log === "string" ? { message: log } : typeof log === "function" ? normalizeLog(log()) : log;
@@ -49,7 +52,6 @@ function getLogHandler(level, code, logger, pluginName, logLevel) {
49
52
  logger(level, log);
50
53
  };
51
54
  }
52
-
53
55
  //#endregion
54
56
  //#region src/utils/normalize-hook.ts
55
57
  function normalizeHook(hook) {
@@ -68,7 +70,6 @@ function normalizeHook(hook) {
68
70
  }
69
71
  unreachable("Invalid hook type");
70
72
  }
71
-
72
73
  //#endregion
73
74
  //#region src/plugin/minimal-plugin-context.ts
74
75
  var MinimalPluginContextImpl = class {
@@ -92,7 +93,6 @@ var MinimalPluginContextImpl = class {
92
93
  return error(logPluginError(normalizeLog(e), this.pluginName, { hook: this.hookName }));
93
94
  }
94
95
  };
95
-
96
96
  //#endregion
97
97
  //#region src/types/plain-object-like.ts
98
98
  const LAZY_FIELDS_KEY = Symbol("__lazy_fields__");
@@ -171,7 +171,6 @@ function getLazyFields(instance) {
171
171
  const lazyFields = instance.constructor[LAZY_FIELDS_KEY];
172
172
  return lazyFields ? new Set(lazyFields.keys()) : /* @__PURE__ */ new Set();
173
173
  }
174
-
175
174
  //#endregion
176
175
  //#region src/decorators/lazy.ts
177
176
  /**
@@ -209,7 +208,6 @@ function lazyProp(target, propertyKey, descriptor) {
209
208
  configurable: true
210
209
  };
211
210
  }
212
-
213
211
  //#endregion
214
212
  //#region src/utils/asset-source.ts
215
213
  function transformAssetSource(bindingAssetSource) {
@@ -218,16 +216,14 @@ function transformAssetSource(bindingAssetSource) {
218
216
  function bindingAssetSource(source) {
219
217
  return { inner: source };
220
218
  }
221
-
222
219
  //#endregion
223
- //#region \0@oxc-project+runtime@0.110.0/helpers/decorate.js
220
+ //#region \0@oxc-project+runtime@0.121.0/helpers/decorate.js
224
221
  function __decorate(decorators, target, key, desc) {
225
222
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
226
223
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
227
224
  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;
228
225
  return c > 3 && r && Object.defineProperty(target, key, r), r;
229
226
  }
230
-
231
227
  //#endregion
232
228
  //#region src/types/output-asset-impl.ts
233
229
  var OutputAssetImpl = class extends PlainObjectLike {
@@ -268,7 +264,6 @@ __decorate([lazyProp], OutputAssetImpl.prototype, "originalFileNames", null);
268
264
  __decorate([lazyProp], OutputAssetImpl.prototype, "name", null);
269
265
  __decorate([lazyProp], OutputAssetImpl.prototype, "names", null);
270
266
  __decorate([lazyProp], OutputAssetImpl.prototype, "source", null);
271
-
272
267
  //#endregion
273
268
  //#region src/utils/transform-rendered-module.ts
274
269
  function transformToRenderedModule(bindingRenderedModule) {
@@ -284,7 +279,6 @@ function transformToRenderedModule(bindingRenderedModule) {
284
279
  }
285
280
  };
286
281
  }
287
-
288
282
  //#endregion
289
283
  //#region src/utils/transform-rendered-chunk.ts
290
284
  function transformRenderedChunk(chunk) {
@@ -333,7 +327,6 @@ function transformChunkModules(modules) {
333
327
  }
334
328
  return result;
335
329
  }
336
-
337
330
  //#endregion
338
331
  //#region src/types/output-chunk-impl.ts
339
332
  var OutputChunkImpl = class extends PlainObjectLike {
@@ -407,23 +400,6 @@ __decorate([lazyProp], OutputChunkImpl.prototype, "imports", null);
407
400
  __decorate([lazyProp], OutputChunkImpl.prototype, "dynamicImports", null);
408
401
  __decorate([lazyProp], OutputChunkImpl.prototype, "moduleIds", null);
409
402
  __decorate([lazyProp], OutputChunkImpl.prototype, "map", null);
410
-
411
- //#endregion
412
- //#region src/types/sourcemap.ts
413
- function bindingifySourcemap(map) {
414
- if (map == null) return;
415
- return { inner: typeof map === "string" ? map : {
416
- file: map.file ?? void 0,
417
- mappings: map.mappings,
418
- sourceRoot: "sourceRoot" in map ? map.sourceRoot ?? void 0 : void 0,
419
- sources: map.sources?.map((s) => s ?? void 0),
420
- sourcesContent: map.sourcesContent?.map((s) => s ?? void 0),
421
- names: map.names,
422
- x_google_ignoreList: map.x_google_ignoreList,
423
- debugId: "debugId" in map ? map.debugId : void 0
424
- } };
425
- }
426
-
427
403
  //#endregion
428
404
  //#region src/utils/transform-to-rollup-output.ts
429
405
  function transformToRollupSourceMap(map) {
@@ -583,78 +559,38 @@ function collectChangedBundle(changed, bundle) {
583
559
  deleted: changed.deleted
584
560
  };
585
561
  }
586
-
587
562
  //#endregion
588
- //#region src/utils/error.ts
563
+ //#region src/binding-magic-string.ts
589
564
  var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
590
- function unwrapBindingResult(container) {
591
- if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) throw aggregateBindingErrorsIntoJsError(container.errors);
592
- return container;
593
- }
594
- function normalizeBindingResult(container) {
595
- if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) return aggregateBindingErrorsIntoJsError(container.errors);
596
- return container;
597
- }
598
- function normalizeBindingError(e) {
599
- return e.type === "JsError" ? e.field0 : Object.assign(/* @__PURE__ */ new Error(), {
600
- code: e.field0.kind,
601
- kind: e.field0.kind,
602
- message: e.field0.message,
603
- id: e.field0.id,
604
- exporter: e.field0.exporter,
605
- loc: e.field0.loc,
606
- pos: e.field0.pos,
607
- stack: void 0
608
- });
609
- }
610
- function aggregateBindingErrorsIntoJsError(rawErrors) {
611
- const errors = rawErrors.map(normalizeBindingError);
612
- let summary = `Build failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
613
- for (let i = 0; i < errors.length; i++) {
614
- summary += "\n";
615
- if (i >= 5) {
616
- summary += "...";
617
- break;
618
- }
619
- summary += getErrorMessage(errors[i]);
620
- }
621
- const wrapper = new Error(summary);
622
- Object.defineProperty(wrapper, "errors", {
623
- configurable: true,
624
- enumerable: true,
625
- get: () => errors,
626
- set: (value) => Object.defineProperty(wrapper, "errors", {
627
- configurable: true,
628
- enumerable: true,
629
- value
630
- })
631
- });
632
- return wrapper;
633
- }
634
- function getErrorMessage(e) {
635
- if (Object.hasOwn(e, "kind")) return e.message;
636
- let s = "";
637
- if (e.plugin) s += `[plugin ${e.plugin}]`;
638
- const id = e.id ?? e.loc?.file;
639
- if (id) {
640
- s += " " + id;
641
- if (e.loc) s += `:${e.loc.line}:${e.loc.column}`;
642
- }
643
- if (s) s += "\n";
644
- const message = `${e.name ?? "Error"}: ${e.message}`;
645
- s += message;
646
- if (e.frame) s = joinNewLine(s, e.frame);
647
- if (e.stack) s = joinNewLine(s, e.stack.replace(message, ""));
648
- if (e.cause) {
649
- s = joinNewLine(s, "Caused by:");
650
- s = joinNewLine(s, getErrorMessage(e.cause).split("\n").map((line) => " " + line).join("\n"));
651
- }
652
- return s;
653
- }
654
- function joinNewLine(s1, s2) {
655
- return s1.replace(/\n+$/, "") + "\n" + s2.replace(/^\n+/, "");
656
- }
657
-
565
+ Object.defineProperty(import_binding.BindingMagicString.prototype, "isRolldownMagicString", {
566
+ value: true,
567
+ writable: false,
568
+ configurable: false
569
+ });
570
+ const nativeReplace = import_binding.BindingMagicString.prototype.replace;
571
+ const nativeReplaceAll = import_binding.BindingMagicString.prototype.replaceAll;
572
+ import_binding.BindingMagicString.prototype.replace = function(searchValue, replacement) {
573
+ if (typeof searchValue === "string") return nativeReplace.call(this, searchValue, replacement);
574
+ if (searchValue.global) searchValue.lastIndex = 0;
575
+ const lastMatchEnd = this.replaceRegex(searchValue, replacement);
576
+ if (searchValue.global) searchValue.lastIndex = 0;
577
+ else if (searchValue.sticky) searchValue.lastIndex = lastMatchEnd === -1 ? 0 : lastMatchEnd;
578
+ return this;
579
+ };
580
+ import_binding.BindingMagicString.prototype.replaceAll = function(searchValue, replacement) {
581
+ if (typeof searchValue === "string") return nativeReplaceAll.call(this, searchValue, replacement);
582
+ if (!searchValue.global) throw new TypeError("MagicString.prototype.replaceAll called with a non-global RegExp argument");
583
+ searchValue.lastIndex = 0;
584
+ this.replaceRegex(searchValue, replacement);
585
+ searchValue.lastIndex = 0;
586
+ return this;
587
+ };
588
+ /**
589
+ * A native MagicString implementation powered by Rust.
590
+ *
591
+ * @experimental
592
+ */
593
+ const RolldownMagicString = import_binding.BindingMagicString;
658
594
  //#endregion
659
595
  //#region src/utils/transform-module-info.ts
660
596
  function transformModuleInfo(info, option) {
@@ -672,10 +608,10 @@ function transformModuleInfo(info, option) {
672
608
  dynamicallyImportedIds: info.dynamicallyImportedIds,
673
609
  exports: info.exports,
674
610
  isEntry: info.isEntry,
611
+ inputFormat: info.inputFormat,
675
612
  ...option
676
613
  };
677
614
  }
678
-
679
615
  //#endregion
680
616
  //#region src/utils/transform-sourcemap.ts
681
617
  function isEmptySourcemapFiled(array) {
@@ -690,9 +626,8 @@ function normalizeTransformHookSourcemap(id, originalCode, rawMap) {
690
626
  if (isEmptySourcemapFiled(map.sources) || map.sources && map.sources.length === 1 && map.sources[0] !== id) map.sources = [id];
691
627
  return map;
692
628
  }
693
-
694
629
  //#endregion
695
- //#region ../../node_modules/.pnpm/remeda@2.33.4/node_modules/remeda/dist/lazyDataLastImpl-DtF3cihj.js
630
+ //#region ../../node_modules/.pnpm/remeda@2.33.6/node_modules/remeda/dist/lazyDataLastImpl-DtF3cihj.js
696
631
  function e(e, t, n) {
697
632
  let r = (n) => e(n, ...t);
698
633
  return n === void 0 ? r : Object.assign(r, {
@@ -700,18 +635,16 @@ function e(e, t, n) {
700
635
  lazyArgs: t
701
636
  });
702
637
  }
703
-
704
638
  //#endregion
705
- //#region ../../node_modules/.pnpm/remeda@2.33.4/node_modules/remeda/dist/purry-GjwKKIlp.js
639
+ //#region ../../node_modules/.pnpm/remeda@2.33.6/node_modules/remeda/dist/purry.js
706
640
  function t$1(t, n, r) {
707
641
  let i = t.length - n.length;
708
642
  if (i === 0) return t(...n);
709
643
  if (i === 1) return e(t, n, r);
710
644
  throw Error(`Wrong number of arguments`);
711
645
  }
712
-
713
646
  //#endregion
714
- //#region ../../node_modules/.pnpm/remeda@2.33.4/node_modules/remeda/dist/partition.js
647
+ //#region ../../node_modules/.pnpm/remeda@2.33.6/node_modules/remeda/dist/partition.js
715
648
  function t(...t) {
716
649
  return t$1(n, t);
717
650
  }
@@ -720,7 +653,6 @@ const n = (e, t) => {
720
653
  for (let [r, i] of e.entries()) t(i, r, e) ? n[0].push(i) : n[1].push(i);
721
654
  return n;
722
655
  };
723
-
724
656
  //#endregion
725
657
  //#region src/plugin/bindingify-hook-filter.ts
726
658
  function generalHookFilterMatcherToFilterExprs(matcher, stringKind) {
@@ -882,7 +814,6 @@ function bindingifyRenderChunkFilter(filterOption) {
882
814
  }
883
815
  return filterOption.code ? bindingifyGeneralHookFilter("code", filterOption.code) : void 0;
884
816
  }
885
-
886
817
  //#endregion
887
818
  //#region src/plugin/bindingify-plugin-hook-meta.ts
888
819
  function bindingifyPluginHookMeta(options) {
@@ -897,7 +828,6 @@ function bindingPluginOrder(order) {
897
828
  default: throw new Error(`Unknown plugin order: ${order}`);
898
829
  }
899
830
  }
900
-
901
831
  //#endregion
902
832
  //#region src/plugin/fs.ts
903
833
  const fsModule = {
@@ -915,7 +845,6 @@ const fsModule = {
915
845
  unlink: fsp.unlink,
916
846
  writeFile: fsp.writeFile
917
847
  };
918
-
919
848
  //#endregion
920
849
  //#region src/plugin/plugin-context.ts
921
850
  var PluginContextImpl = class extends MinimalPluginContextImpl {
@@ -979,10 +908,14 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
979
908
  emitFile = (file) => {
980
909
  if (file.type === "prebuilt-chunk") return this.context.emitPrebuiltChunk({
981
910
  fileName: file.fileName,
911
+ name: file.name,
982
912
  code: file.code,
983
913
  exports: file.exports,
984
914
  map: bindingifySourcemap(file.map),
985
- sourcemapFileName: file.sourcemapFileName
915
+ sourcemapFileName: file.sourcemapFileName,
916
+ facadeModuleId: file.facadeModuleId,
917
+ isEntry: file.isEntry,
918
+ isDynamicEntry: file.isDynamicEntry
986
919
  });
987
920
  if (file.type === "chunk") return this.context.emitChunk({
988
921
  preserveEntrySignatures: bindingifyPreserveEntrySignatures(file.preserveSignature),
@@ -1019,7 +952,17 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
1019
952
  return parseAst(input, options);
1020
953
  }
1021
954
  };
1022
-
955
+ //#endregion
956
+ //#region src/plugin/load-plugin-context.ts
957
+ var LoadPluginContextImpl = class extends PluginContextImpl {
958
+ constructor(outputOptions, context, plugin, data, inner, moduleId, onLog, logLevelOption, watchMode) {
959
+ super(outputOptions, context, plugin, data, onLog, logLevelOption, watchMode, moduleId);
960
+ this.inner = inner;
961
+ }
962
+ addWatchFile(id) {
963
+ this.inner.addWatchFile(id);
964
+ }
965
+ };
1023
966
  //#endregion
1024
967
  //#region src/plugin/transform-plugin-context.ts
1025
968
  var TransformPluginContextImpl = class extends PluginContextImpl {
@@ -1056,16 +999,18 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
1056
999
  this.inner.sendMagicString(s);
1057
1000
  }
1058
1001
  };
1059
-
1060
1002
  //#endregion
1061
1003
  //#region src/plugin/bindingify-build-hooks.ts
1004
+ function createPluginContext(args, ctx) {
1005
+ return new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode);
1006
+ }
1062
1007
  function bindingifyBuildStart(args) {
1063
1008
  const hook = args.plugin.buildStart;
1064
1009
  if (!hook) return {};
1065
1010
  const { handler, meta } = normalizeHook(hook);
1066
1011
  return {
1067
1012
  plugin: async (ctx, opts) => {
1068
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), args.pluginContextData.getInputOptions(opts));
1013
+ await handler.call(createPluginContext(args, ctx), args.pluginContextData.getInputOptions(opts));
1069
1014
  },
1070
1015
  meta: bindingifyPluginHookMeta(meta)
1071
1016
  };
@@ -1076,7 +1021,7 @@ function bindingifyBuildEnd(args) {
1076
1021
  const { handler, meta } = normalizeHook(hook);
1077
1022
  return {
1078
1023
  plugin: async (ctx, err) => {
1079
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), err ? aggregateBindingErrorsIntoJsError(err) : void 0);
1024
+ await handler.call(createPluginContext(args, ctx), err ? aggregateBindingErrorsIntoJsError(err) : void 0);
1080
1025
  },
1081
1026
  meta: bindingifyPluginHookMeta(meta)
1082
1027
  };
@@ -1088,7 +1033,7 @@ function bindingifyResolveId(args) {
1088
1033
  return {
1089
1034
  plugin: async (ctx, specifier, importer, extraOptions) => {
1090
1035
  const contextResolveOptions = extraOptions.custom != null ? args.pluginContextData.getSavedResolveOptions(extraOptions.custom) : void 0;
1091
- const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), specifier, importer ?? void 0, {
1036
+ const ret = await handler.call(createPluginContext(args, ctx), specifier, importer ?? void 0, {
1092
1037
  ...extraOptions,
1093
1038
  custom: contextResolveOptions?.custom
1094
1039
  });
@@ -1125,7 +1070,7 @@ function bindingifyResolveDynamicImport(args) {
1125
1070
  const { handler, meta } = normalizeHook(hook);
1126
1071
  return {
1127
1072
  plugin: async (ctx, specifier, importer) => {
1128
- const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), specifier, importer ?? void 0);
1073
+ const ret = await handler.call(createPluginContext(args, ctx), specifier, importer ?? void 0);
1129
1074
  if (ret == null) return;
1130
1075
  if (ret === false) return {
1131
1076
  id: specifier,
@@ -1158,7 +1103,7 @@ function bindingifyTransform(args) {
1158
1103
  Object.defineProperties(meta, {
1159
1104
  magicString: { get() {
1160
1105
  if (magicStringInstance) return magicStringInstance;
1161
- magicStringInstance = new import_binding.BindingMagicString(code);
1106
+ magicStringInstance = new RolldownMagicString(code);
1162
1107
  return magicStringInstance;
1163
1108
  } },
1164
1109
  ast: { get() {
@@ -1192,7 +1137,7 @@ function bindingifyTransform(args) {
1192
1137
  let normalizedCode = void 0;
1193
1138
  let map = ret.map;
1194
1139
  if (typeof ret.code === "string") normalizedCode = ret.code;
1195
- else if (ret.code instanceof import_binding.BindingMagicString) {
1140
+ else if (ret.code instanceof RolldownMagicString) {
1196
1141
  let magicString = ret.code;
1197
1142
  normalizedCode = magicString.toString();
1198
1143
  let fallbackSourcemap = ctx.sendMagicString(magicString);
@@ -1215,7 +1160,7 @@ function bindingifyLoad(args) {
1215
1160
  const { handler, meta, options } = normalizeHook(hook);
1216
1161
  return {
1217
1162
  plugin: async (ctx, id) => {
1218
- const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode, id), id);
1163
+ const ret = await handler.call(new LoadPluginContextImpl(args.outputOptions, ctx.inner(), args.plugin, args.pluginContextData, ctx, id, args.onLog, args.logLevel, args.watchMode), id);
1219
1164
  if (ret == null) return;
1220
1165
  if (typeof ret === "string") return { code: ret };
1221
1166
  let moduleOption = args.pluginContextData.updateModuleOption(id, {
@@ -1251,12 +1196,11 @@ function bindingifyModuleParsed(args) {
1251
1196
  const { handler, meta } = normalizeHook(hook);
1252
1197
  return {
1253
1198
  plugin: async (ctx, moduleInfo) => {
1254
- 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)));
1199
+ await handler.call(createPluginContext(args, ctx), transformModuleInfo(moduleInfo, args.pluginContextData.getModuleOption(moduleInfo.id)));
1255
1200
  },
1256
1201
  meta: bindingifyPluginHookMeta(meta)
1257
1202
  };
1258
1203
  }
1259
-
1260
1204
  //#endregion
1261
1205
  //#region src/plugin/bindingify-output-hooks.ts
1262
1206
  function bindingifyRenderStart(args) {
@@ -1282,14 +1226,14 @@ function bindingifyRenderChunk(args) {
1282
1226
  if (args.options.experimental?.nativeMagicString) Object.defineProperty(renderChunkMeta, "magicString", {
1283
1227
  get() {
1284
1228
  if (magicStringInstance) return magicStringInstance;
1285
- magicStringInstance = new import_binding.BindingMagicString(code);
1229
+ magicStringInstance = new RolldownMagicString(code);
1286
1230
  return magicStringInstance;
1287
1231
  },
1288
1232
  configurable: true
1289
1233
  });
1290
1234
  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);
1291
1235
  if (ret == null) return;
1292
- if (ret instanceof import_binding.BindingMagicString) {
1236
+ if (ret instanceof RolldownMagicString) {
1293
1237
  const normalizedCode = ret.toString();
1294
1238
  const generatedMap = ret.generateMap();
1295
1239
  return {
@@ -1304,7 +1248,7 @@ function bindingifyRenderChunk(args) {
1304
1248
  };
1305
1249
  }
1306
1250
  if (typeof ret === "string") return { code: ret };
1307
- if (ret.code instanceof import_binding.BindingMagicString) {
1251
+ if (ret.code instanceof RolldownMagicString) {
1308
1252
  const magicString = ret.code;
1309
1253
  const normalizedCode = magicString.toString();
1310
1254
  if (ret.map === null) return { code: normalizedCode };
@@ -1453,7 +1397,6 @@ function bindingifyOutro(args) {
1453
1397
  meta: bindingifyPluginHookMeta(meta)
1454
1398
  };
1455
1399
  }
1456
-
1457
1400
  //#endregion
1458
1401
  //#region src/plugin/bindingify-watch-hooks.ts
1459
1402
  function bindingifyWatchChange(args) {
@@ -1478,7 +1421,6 @@ function bindingifyCloseWatcher(args) {
1478
1421
  meta: bindingifyPluginHookMeta(meta)
1479
1422
  };
1480
1423
  }
1481
-
1482
1424
  //#endregion
1483
1425
  //#region src/plugin/generated/hook-usage.ts
1484
1426
  let HookUsageKind = /* @__PURE__ */ function(HookUsageKind) {
@@ -1539,7 +1481,6 @@ function extractHookUsage(plugin) {
1539
1481
  if (plugin.outro) hookUsage.union(HookUsageKind.outro);
1540
1482
  return hookUsage;
1541
1483
  }
1542
-
1543
1484
  //#endregion
1544
1485
  //#region src/plugin/bindingify-plugin.ts
1545
1486
  function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode) {
@@ -1660,14 +1601,14 @@ function wrapHandlers(plugin) {
1660
1601
  }
1661
1602
  return plugin;
1662
1603
  }
1663
-
1664
1604
  //#endregion
1665
1605
  //#region src/options/normalized-input-options.ts
1666
1606
  var NormalizedInputOptionsImpl = class extends PlainObjectLike {
1667
1607
  inner;
1668
- constructor(inner, onLog) {
1608
+ constructor(inner, onLog, inputPlugins) {
1669
1609
  super();
1670
1610
  this.onLog = onLog;
1611
+ this.inputPlugins = inputPlugins;
1671
1612
  this.inner = inner;
1672
1613
  }
1673
1614
  get shimMissingExports() {
@@ -1685,13 +1626,15 @@ var NormalizedInputOptionsImpl = class extends PlainObjectLike {
1685
1626
  get context() {
1686
1627
  return this.inner.context;
1687
1628
  }
1629
+ get plugins() {
1630
+ return this.inputPlugins;
1631
+ }
1688
1632
  };
1689
1633
  __decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "shimMissingExports", null);
1690
1634
  __decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "input", null);
1691
1635
  __decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "cwd", null);
1692
1636
  __decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "platform", null);
1693
1637
  __decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "context", null);
1694
-
1695
1638
  //#endregion
1696
1639
  //#region src/options/normalized-output-options.ts
1697
1640
  var NormalizedOutputOptionsImpl = class extends PlainObjectLike {
@@ -1725,12 +1668,6 @@ var NormalizedOutputOptionsImpl = class extends PlainObjectLike {
1725
1668
  get sourcemapBaseUrl() {
1726
1669
  return this.inner.sourcemapBaseUrl ?? void 0;
1727
1670
  }
1728
- get cssEntryFileNames() {
1729
- return this.inner.cssEntryFilenames || this.outputOptions.cssEntryFileNames;
1730
- }
1731
- get cssChunkFileNames() {
1732
- return this.inner.cssChunkFilenames || this.outputOptions.cssChunkFileNames;
1733
- }
1734
1671
  get shimMissingExports() {
1735
1672
  return this.inner.shimMissingExports;
1736
1673
  }
@@ -1791,6 +1728,9 @@ var NormalizedOutputOptionsImpl = class extends PlainObjectLike {
1791
1728
  get sourcemapDebugIds() {
1792
1729
  return this.inner.sourcemapDebugIds;
1793
1730
  }
1731
+ get sourcemapExcludeSources() {
1732
+ return this.inner.sourcemapExcludeSources;
1733
+ }
1794
1734
  get sourcemapIgnoreList() {
1795
1735
  return this.outputOptions.sourcemapIgnoreList;
1796
1736
  }
@@ -1809,6 +1749,14 @@ var NormalizedOutputOptionsImpl = class extends PlainObjectLike {
1809
1749
  get legalComments() {
1810
1750
  return this.inner.legalComments;
1811
1751
  }
1752
+ get comments() {
1753
+ const c = this.inner.comments;
1754
+ return {
1755
+ legal: c.legal ?? true,
1756
+ annotation: c.annotation ?? true,
1757
+ jsdoc: c.jsdoc ?? true
1758
+ };
1759
+ }
1812
1760
  get polyfillRequire() {
1813
1761
  return this.inner.polyfillRequire;
1814
1762
  }
@@ -1839,8 +1787,6 @@ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "format", null);
1839
1787
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "exports", null);
1840
1788
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemap", null);
1841
1789
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapBaseUrl", null);
1842
- __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "cssEntryFileNames", null);
1843
- __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "cssChunkFileNames", null);
1844
1790
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "shimMissingExports", null);
1845
1791
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "name", null);
1846
1792
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "file", null);
@@ -1860,10 +1806,12 @@ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "globals", null);
1860
1806
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "paths", null);
1861
1807
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "hashCharacters", null);
1862
1808
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapDebugIds", null);
1809
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapExcludeSources", null);
1863
1810
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapIgnoreList", null);
1864
1811
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapPathTransform", null);
1865
1812
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "minify", null);
1866
1813
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "legalComments", null);
1814
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "comments", null);
1867
1815
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "polyfillRequire", null);
1868
1816
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "plugins", null);
1869
1817
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "preserveModules", null);
@@ -1875,7 +1823,6 @@ function normalizeAddon(value) {
1875
1823
  if (typeof value === "function") return value;
1876
1824
  return () => value || "";
1877
1825
  }
1878
-
1879
1826
  //#endregion
1880
1827
  //#region src/plugin/plugin-context-data.ts
1881
1828
  var PluginContextData = class {
@@ -1885,9 +1832,10 @@ var PluginContextData = class {
1885
1832
  renderedChunkMeta = null;
1886
1833
  normalizedInputOptions = null;
1887
1834
  normalizedOutputOptions = null;
1888
- constructor(onLog, outputOptions, normalizedOutputPlugins) {
1835
+ constructor(onLog, outputOptions, normalizedInputPlugins, normalizedOutputPlugins) {
1889
1836
  this.onLog = onLog;
1890
1837
  this.outputOptions = outputOptions;
1838
+ this.normalizedInputPlugins = normalizedInputPlugins;
1891
1839
  this.normalizedOutputPlugins = normalizedOutputPlugins;
1892
1840
  }
1893
1841
  updateModuleOption(id, option) {
@@ -1960,7 +1908,7 @@ var PluginContextData = class {
1960
1908
  return this.renderedChunkMeta;
1961
1909
  }
1962
1910
  getInputOptions(opts) {
1963
- this.normalizedInputOptions ??= new NormalizedInputOptionsImpl(opts, this.onLog);
1911
+ this.normalizedInputOptions ??= new NormalizedInputOptionsImpl(opts, this.onLog, this.normalizedInputPlugins);
1964
1912
  return this.normalizedInputOptions;
1965
1913
  }
1966
1914
  getOutputOptions(opts) {
@@ -1972,7 +1920,6 @@ var PluginContextData = class {
1972
1920
  this.loadModulePromiseMap.clear();
1973
1921
  }
1974
1922
  };
1975
-
1976
1923
  //#endregion
1977
1924
  //#region src/utils/normalize-transform-options.ts
1978
1925
  /**
@@ -2000,11 +1947,10 @@ function normalizeTransformOptions(inputOptions) {
2000
1947
  oxcTransformOptions
2001
1948
  };
2002
1949
  }
2003
-
2004
1950
  //#endregion
2005
1951
  //#region src/utils/bindingify-input-options.ts
2006
- function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode) {
2007
- const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedOutputPlugins);
1952
+ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedInputPlugins, normalizedOutputPlugins, onLog, logLevel, watchMode) {
1953
+ const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedInputPlugins, normalizedOutputPlugins);
2008
1954
  const plugins = rawPlugins.map((plugin) => {
2009
1955
  if ("_parallel" in plugin) return;
2010
1956
  if (plugin instanceof BuiltinPlugin) switch (plugin.name) {
@@ -2051,7 +1997,8 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
2051
1997
  preserveEntrySignatures: bindingifyPreserveEntrySignatures(inputOptions.preserveEntrySignatures),
2052
1998
  optimization: inputOptions.optimization,
2053
1999
  context: inputOptions.context,
2054
- tsconfig: inputOptions.resolve?.tsconfigFilename ?? inputOptions.tsconfig
2000
+ tsconfig: inputOptions.resolve?.tsconfigFilename ?? inputOptions.tsconfig,
2001
+ id: inputOptions.id
2055
2002
  };
2056
2003
  }
2057
2004
  function bindingifyDevMode(devMode) {
@@ -2098,7 +2045,8 @@ function bindingifyExperimental(experimental) {
2098
2045
  onDemandWrapping: experimental?.onDemandWrapping,
2099
2046
  incrementalBuild: experimental?.incrementalBuild,
2100
2047
  nativeMagicString: experimental?.nativeMagicString,
2101
- chunkOptimization: experimental?.chunkOptimization
2048
+ chunkOptimization: experimental?.chunkOptimization,
2049
+ lazyBarrel: experimental?.lazyBarrel
2102
2050
  };
2103
2051
  }
2104
2052
  function bindingifyResolve(resolve) {
@@ -2162,13 +2110,26 @@ function bindingifyInput(input) {
2162
2110
  });
2163
2111
  }
2164
2112
  function bindingifyWatch(watch) {
2165
- if (watch) return {
2166
- buildDelay: watch.buildDelay,
2167
- skipWrite: watch.skipWrite,
2168
- include: normalizedStringOrRegex(watch.include),
2169
- exclude: normalizedStringOrRegex(watch.exclude),
2170
- onInvalidate: (...args) => watch.onInvalidate?.(...args)
2171
- };
2113
+ if (watch) {
2114
+ if (watch.notify) console.warn("The \"watch.notify\" option is deprecated. Please use \"watch.watcher\" instead.");
2115
+ const watcher = {
2116
+ ...watch.notify,
2117
+ ...watch.watcher
2118
+ };
2119
+ return {
2120
+ buildDelay: watch.buildDelay,
2121
+ skipWrite: watch.skipWrite,
2122
+ usePolling: watcher.usePolling,
2123
+ pollInterval: watcher.pollInterval,
2124
+ compareContentsForPolling: watcher.compareContentsForPolling,
2125
+ useDebounce: watcher.useDebounce,
2126
+ debounceDelay: watcher.debounceDelay,
2127
+ debounceTickRate: watcher.debounceTickRate,
2128
+ include: normalizedStringOrRegex(watch.include),
2129
+ exclude: normalizedStringOrRegex(watch.exclude),
2130
+ onInvalidate: (...args) => watch.onInvalidate?.(...args)
2131
+ };
2132
+ }
2172
2133
  }
2173
2134
  function bindingifyTreeshakeOptions(config) {
2174
2135
  if (config === false) return;
@@ -2228,6 +2189,5 @@ function bindingifyPreserveEntrySignatures(preserveEntrySignatures) {
2228
2189
  field0: preserveEntrySignatures
2229
2190
  };
2230
2191
  }
2231
-
2232
2192
  //#endregion
2233
- 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 };
2193
+ 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 };