@rolldown/browser 1.0.0-beta.56 → 1.0.0-beta.58

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 (41) hide show
  1. package/dist/cli.mjs +8 -8
  2. package/dist/config.d.mts +1 -1
  3. package/dist/config.mjs +6 -6
  4. package/dist/{constructors-DMeuUDyD.js → constructors-BuqTjXTF.js} +1 -1
  5. package/dist/experimental-index.browser.mjs +3 -3
  6. package/dist/experimental-index.d.mts +4 -4
  7. package/dist/experimental-index.mjs +5 -5
  8. package/dist/experimental-runtime-types.d.ts +1 -1
  9. package/dist/filter-index.d.mts +3 -3
  10. package/dist/filter-index.mjs +123 -2
  11. package/dist/get-log-filter.d.mts +1 -1
  12. package/dist/index.browser.mjs +4 -2
  13. package/dist/index.d.mts +5 -5
  14. package/dist/index.mjs +6 -6
  15. package/dist/{normalize-string-or-regex-B-Y4k0qo.js → normalize-string-or-regex-3ql5-z8-.js} +3 -2
  16. package/dist/parallel-plugin-worker.mjs +3 -3
  17. package/dist/parallel-plugin.d.mts +2 -2
  18. package/dist/parse-ast-index.d.mts +1 -1
  19. package/dist/parse-ast-index.mjs +1 -1
  20. package/dist/plugins-index.browser.mjs +2 -2
  21. package/dist/plugins-index.d.mts +3 -3
  22. package/dist/plugins-index.mjs +2 -2
  23. package/dist/rolldown-binding.wasi.cjs +1 -1
  24. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  25. package/dist/{rolldown-build-BEV6JVIl.js → rolldown-build-CRqas5jO.js} +14 -6
  26. package/dist/shared/{binding-CDyF6W3D.d.mts → binding-MAEzB4KA.d.mts} +10 -0
  27. package/dist/shared/{bindingify-input-options-kzSFdf_-.mjs → bindingify-input-options--qcSYuhh.mjs} +8 -4
  28. package/dist/shared/composable-filters-C5qA4jo-.mjs +206 -0
  29. package/dist/shared/{constructors-B0L_9ar3.d.mts → constructors-CQP6o3cR.d.mts} +2 -2
  30. package/dist/shared/{constructors-Dw9UOO6Z.mjs → constructors-kOch67Sb.mjs} +1 -1
  31. package/dist/shared/{define-config-CrCCK_Ci.d.mts → define-config-yInAJbA1.d.mts} +471 -125
  32. package/dist/shared/{load-config-vlnYfd7q.mjs → load-config-BZhApFJg.mjs} +1 -1
  33. package/dist/shared/{logging-BpAvp7KV.d.mts → logging-B4x9qar8.d.mts} +1 -0
  34. package/dist/shared/{normalize-string-or-regex-CwM9ci6w.mjs → normalize-string-or-regex-CIiT1lMg.mjs} +3 -2
  35. package/dist/shared/{parse-ast-index-DZPue_kI.mjs → parse-ast-index-CgzK6cxG.mjs} +1 -1
  36. package/dist/shared/{rolldown-DtiFL1Ph.mjs → rolldown-Vl5SnJ_J.mjs} +2 -1
  37. package/dist/shared/{rolldown-build-B3XDwemQ.mjs → rolldown-build-7kWB1jqY.mjs} +7 -3
  38. package/dist/shared/{utils-B3dcnHc8.d.mts → utils-BGxZdOXA.d.mts} +2 -2
  39. package/dist/shared/{watch-BHMj7YNj.mjs → watch-CGYro6go.mjs} +4 -3
  40. package/package.json +16 -16
  41. package/dist/shared/composable-filters-G1eqjHFo.mjs +0 -122
@@ -1,6 +1,6 @@
1
- import { a as RollupLog, i as RollupError, n as LogLevelOption, o as RollupLogWithString, r as LogOrStringHandler, t as LogLevel } from "./logging-BpAvp7KV.mjs";
2
- import { A as BindingWatcherBundler, B as ParserOptions, F as JsxOptions, I as MinifyOptions$1, M as ExternalMemoryStatus, V as PreRenderedChunk, W as TransformOptions$1, a as BindingHookResolveIdExtraArgs, d as BindingTransformHookExtraArgs, j as BindingWatcherEvent, l as BindingRenderedChunk, s as BindingMagicString } from "./binding-CDyF6W3D.mjs";
3
- import { a as MakeAsync, c as NullValue, l as PartialNull, n as LoggingFunction, o as MaybeArray, r as LoggingFunctionWithPosition, s as MaybePromise, t as BuiltinPlugin, u as StringOrRegExp } from "./utils-B3dcnHc8.mjs";
1
+ import { a as RollupLog, i as RollupError, n as LogLevelOption, o as RollupLogWithString, r as LogOrStringHandler, t as LogLevel } from "./logging-B4x9qar8.mjs";
2
+ import { A as BindingWatcherBundler, B as ParserOptions, F as JsxOptions, I as MinifyOptions$1, M as ExternalMemoryStatus, V as PreRenderedChunk, W as TransformOptions$1, a as BindingHookResolveIdExtraArgs, d as BindingTransformHookExtraArgs, j as BindingWatcherEvent, l as BindingRenderedChunk, s as BindingMagicString } from "./binding-MAEzB4KA.mjs";
3
+ import { a as MakeAsync, c as NullValue, l as PartialNull, n as LoggingFunction, o as MaybeArray, r as LoggingFunctionWithPosition, s as MaybePromise, t as BuiltinPlugin, u as StringOrRegExp } from "./utils-BGxZdOXA.mjs";
4
4
  import { Program } from "@oxc-project/types";
5
5
  import { TopLevelFilterExpression } from "@rolldown/pluginutils";
6
6
 
@@ -9,6 +9,7 @@ type SourcemapPathTransformOption = (relativeSourcePath: string, sourcemapPath:
9
9
  type SourcemapIgnoreListOption = (relativeSourcePath: string, sourcemapPath: string) => boolean;
10
10
  //#endregion
11
11
  //#region src/types/module-info.d.ts
12
+ /** @category Plugin APIs */
12
13
  interface ModuleInfo extends ModuleOptions {
13
14
  /**
14
15
  * Unsupported at rolldown
@@ -79,6 +80,7 @@ interface ExternalMemoryHandle {
79
80
  declare function freeExternalMemory(handle: ExternalMemoryHandle, keepDataAlive?: boolean): ExternalMemoryStatus;
80
81
  //#endregion
81
82
  //#region src/types/rolldown-output.d.ts
83
+ /** @category Plugin APIs */
82
84
  interface OutputAsset extends ExternalMemoryHandle {
83
85
  type: "asset";
84
86
  fileName: string;
@@ -90,6 +92,7 @@ interface OutputAsset extends ExternalMemoryHandle {
90
92
  name: string | undefined;
91
93
  names: string[];
92
94
  }
95
+ /** @category Plugin APIs */
93
96
  interface SourceMap {
94
97
  file: string;
95
98
  mappings: string;
@@ -102,11 +105,13 @@ interface SourceMap {
102
105
  toString(): string;
103
106
  toUrl(): string;
104
107
  }
108
+ /** @category Plugin APIs */
105
109
  interface RenderedModule {
106
110
  readonly code: string | null;
107
111
  renderedLength: number;
108
112
  renderedExports: string[];
109
113
  }
114
+ /** @category Plugin APIs */
110
115
  interface RenderedChunk extends Omit<BindingRenderedChunk, "modules"> {
111
116
  type: "chunk";
112
117
  modules: {
@@ -122,6 +127,7 @@ interface RenderedChunk extends Omit<BindingRenderedChunk, "modules"> {
122
127
  imports: Array<string>;
123
128
  dynamicImports: Array<string>;
124
129
  }
130
+ /** @category Plugin APIs */
125
131
  interface OutputChunk extends ExternalMemoryHandle {
126
132
  type: "chunk";
127
133
  code: string;
@@ -141,6 +147,7 @@ interface OutputChunk extends ExternalMemoryHandle {
141
147
  sourcemapFileName: string | null;
142
148
  preliminaryFileName: string;
143
149
  }
150
+ /** @category Programmatic APIs */
144
151
  interface RolldownOutput extends ExternalMemoryHandle {
145
152
  output: [OutputChunk, ...(OutputChunk | OutputAsset)[]];
146
153
  }
@@ -184,6 +191,7 @@ type ModuleFormat = "es" | "cjs" | "esm" | "module" | "commonjs" | "iife" | "umd
184
191
  type AddonFunction = (chunk: RenderedChunk) => string | Promise<string>;
185
192
  type ChunkFileNamesFunction = (chunkInfo: PreRenderedChunk) => string;
186
193
  type SanitizeFileNameFunction = (name: string) => string;
194
+ /** @category Plugin APIs */
187
195
  interface PreRenderedAsset {
188
196
  type: "asset";
189
197
  name?: string;
@@ -322,6 +330,7 @@ interface OutputOptions {
322
330
  generatedCode?: Partial<GeneratedCodeOptions>;
323
331
  externalLiveBindings?: boolean;
324
332
  inlineDynamicImports?: boolean;
333
+ dynamicImportInCjs?: boolean;
325
334
  /**
326
335
  * - Type: `((moduleId: string, meta: { getModuleInfo: (moduleId: string) => ModuleInfo | null }) => string | NullValue)`
327
336
  * - Object form is not supported.
@@ -606,6 +615,7 @@ interface BuildOptions extends InputOptions {
606
615
  write?: boolean;
607
616
  output?: OutputOptions;
608
617
  }
618
+ /** @category Programmatic APIs */
609
619
  declare function build(options: BuildOptions): Promise<RolldownOutput>;
610
620
  /**
611
621
  * Build multiple outputs __sequentially__.
@@ -613,6 +623,7 @@ declare function build(options: BuildOptions): Promise<RolldownOutput>;
613
623
  declare function build(options: BuildOptions[]): Promise<RolldownOutput[]>;
614
624
  //#endregion
615
625
  //#region src/api/rolldown/rolldown-build.d.ts
626
+ /** @category Programmatic APIs */
616
627
  declare class RolldownBuild {
617
628
  #private;
618
629
  static asyncRuntimeShutdown: boolean;
@@ -629,9 +640,11 @@ declare class RolldownBuild {
629
640
  }
630
641
  //#endregion
631
642
  //#region src/api/rolldown/index.d.ts
643
+ /** @category Programmatic APIs */
632
644
  declare const rolldown: (input: InputOptions) => Promise<RolldownBuild>;
633
645
  //#endregion
634
646
  //#region src/options/watch-options.d.ts
647
+ /** @category Programmatic APIs */
635
648
  interface WatchOptions extends InputOptions {
636
649
  output?: OutputOptions | OutputOptions[];
637
650
  }
@@ -640,6 +653,7 @@ interface WatchOptions extends InputOptions {
640
653
  type WatcherEvent = "close" | "event" | "restart" | "change";
641
654
  type ChangeEvent$1 = "create" | "update" | "delete";
642
655
  type RolldownWatchBuild = BindingWatcherBundler;
656
+ /** @category Programmatic APIs */
643
657
  type RolldownWatcherEvent = {
644
658
  code: "START";
645
659
  } | {
@@ -670,12 +684,99 @@ declare class WatcherEmitter {
670
684
  onEvent(event: BindingWatcherEvent): Promise<void>;
671
685
  close(): Promise<void>;
672
686
  }
687
+ /** @category Programmatic APIs */
673
688
  type RolldownWatcher = WatcherEmitter;
674
689
  //#endregion
675
690
  //#region src/api/watch/index.d.ts
691
+ /** @category Programmatic APIs */
676
692
  declare const watch: (input: WatchOptions | WatchOptions[]) => RolldownWatcher;
677
693
  //#endregion
694
+ //#region src/options/generated/checks-options.d.ts
695
+ interface ChecksOptions {
696
+ /**
697
+ * Whether to emit warning when detecting circular dependency
698
+ * @default false
699
+ * */
700
+ circularDependency?: boolean;
701
+ /**
702
+ * Whether to emit warning when detecting eval
703
+ * @default true
704
+ * */
705
+ eval?: boolean;
706
+ /**
707
+ * Whether to emit warning when detecting missing global name
708
+ * @default true
709
+ * */
710
+ missingGlobalName?: boolean;
711
+ /**
712
+ * Whether to emit warning when detecting missing name option for iife export
713
+ * @default true
714
+ * */
715
+ missingNameOptionForIifeExport?: boolean;
716
+ /**
717
+ * Whether to emit warning when detecting mixed exports
718
+ * @default true
719
+ * */
720
+ mixedExports?: boolean;
721
+ /**
722
+ * Whether to emit warning when detecting unresolved entry
723
+ * @default true
724
+ * */
725
+ unresolvedEntry?: boolean;
726
+ /**
727
+ * Whether to emit warning when detecting unresolved import
728
+ * @default true
729
+ * */
730
+ unresolvedImport?: boolean;
731
+ /**
732
+ * Whether to emit warning when detecting filename conflict
733
+ * @default true
734
+ * */
735
+ filenameConflict?: boolean;
736
+ /**
737
+ * Whether to emit warning when detecting common js variable in esm
738
+ * @default true
739
+ * */
740
+ commonJsVariableInEsm?: boolean;
741
+ /**
742
+ * Whether to emit warning when detecting import is undefined
743
+ * @default true
744
+ * */
745
+ importIsUndefined?: boolean;
746
+ /**
747
+ * Whether to emit warning when detecting empty import meta
748
+ * @default true
749
+ * */
750
+ emptyImportMeta?: boolean;
751
+ /**
752
+ * Whether to emit warning when detecting cannot call namespace
753
+ * @default true
754
+ * */
755
+ cannotCallNamespace?: boolean;
756
+ /**
757
+ * Whether to emit warning when detecting configuration field conflict
758
+ * @default true
759
+ * */
760
+ configurationFieldConflict?: boolean;
761
+ /**
762
+ * Whether to emit warning when detecting prefer builtin feature
763
+ * @default true
764
+ * */
765
+ preferBuiltinFeature?: boolean;
766
+ /**
767
+ * Whether to emit warning when detecting could not clean directory
768
+ * @default true
769
+ * */
770
+ couldNotCleanDirectory?: boolean;
771
+ /**
772
+ * Whether to emit warning when detecting plugin timings
773
+ * @default true
774
+ * */
775
+ pluginTimings?: boolean;
776
+ }
777
+ //#endregion
678
778
  //#region src/options/normalized-input-options.d.ts
779
+ /** @category Plugin APIs */
679
780
  interface NormalizedInputOptions {
680
781
  input: string[] | Record<string, string>;
681
782
  cwd: string;
@@ -686,7 +787,9 @@ interface NormalizedInputOptions {
686
787
  //#endregion
687
788
  //#region src/options/normalized-output-options.d.ts
688
789
  type PathsFunction = (id: string) => string;
790
+ /** @category Plugin APIs */
689
791
  type InternalModuleFormat = "es" | "cjs" | "iife" | "umd";
792
+ /** @category Plugin APIs */
690
793
  interface NormalizedOutputOptions {
691
794
  name: string | undefined;
692
795
  file: string | undefined;
@@ -701,6 +804,7 @@ interface NormalizedOutputOptions {
701
804
  cssEntryFileNames: string | ChunkFileNamesFunction;
702
805
  cssChunkFileNames: string | ChunkFileNamesFunction;
703
806
  inlineDynamicImports: boolean;
807
+ dynamicImportInCjs: boolean;
704
808
  externalLiveBindings: boolean;
705
809
  banner: AddonFunction;
706
810
  footer: AddonFunction;
@@ -728,6 +832,7 @@ interface NormalizedOutputOptions {
728
832
  }
729
833
  //#endregion
730
834
  //#region src/plugin/fs.d.ts
835
+ /** @category Plugin APIs */
731
836
  interface RolldownFsModule {
732
837
  appendFile(path: string, data: string | Uint8Array, options?: {
733
838
  encoding?: BufferEncoding | null;
@@ -770,13 +875,16 @@ interface RolldownFsModule {
770
875
  flag?: string | number;
771
876
  }): Promise<void>;
772
877
  }
878
+ /** @category Plugin APIs */
773
879
  type BufferEncoding = "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "base64url" | "latin1" | "binary" | "hex";
880
+ /** @category Plugin APIs */
774
881
  interface RolldownDirectoryEntry {
775
882
  isFile(): boolean;
776
883
  isDirectory(): boolean;
777
884
  isSymbolicLink(): boolean;
778
885
  name: string;
779
886
  }
887
+ /** @category Plugin APIs */
780
888
  interface RolldownFileStats {
781
889
  isFile(): boolean;
782
890
  isDirectory(): boolean;
@@ -789,6 +897,7 @@ interface RolldownFileStats {
789
897
  }
790
898
  //#endregion
791
899
  //#region src/plugin/hook-filter.d.ts
900
+ /** @category Plugin APIs */
792
901
  type GeneralHookFilter<Value = StringOrRegExp> = MaybeArray<Value> | {
793
902
  include?: MaybeArray<Value>;
794
903
  exclude?: MaybeArray<Value>;
@@ -796,7 +905,9 @@ type GeneralHookFilter<Value = StringOrRegExp> = MaybeArray<Value> | {
796
905
  interface FormalModuleTypeFilter {
797
906
  include?: ModuleType[];
798
907
  }
908
+ /** @category Plugin APIs */
799
909
  type ModuleTypeFilter = ModuleType[] | FormalModuleTypeFilter;
910
+ /** @category Plugin APIs */
800
911
  interface HookFilter {
801
912
  /**
802
913
  * This filter is used to do a pre-test to determine whether the hook should be called.
@@ -837,11 +948,13 @@ interface HookFilter {
837
948
  type TUnionWithTopLevelFilterExpressionArray<T> = T | TopLevelFilterExpression[];
838
949
  //#endregion
839
950
  //#region src/plugin/minimal-plugin-context.d.ts
951
+ /** @category Plugin APIs */
840
952
  interface PluginContextMeta {
841
953
  rollupVersion: string;
842
954
  rolldownVersion: string;
843
955
  watchMode: boolean;
844
956
  }
957
+ /** @category Plugin APIs */
845
958
  interface MinimalPluginContext {
846
959
  readonly pluginName: string;
847
960
  error: (e: RollupError | string) => never;
@@ -853,16 +966,17 @@ interface MinimalPluginContext {
853
966
  //#endregion
854
967
  //#region src/plugin/parallel-plugin.d.ts
855
968
  type ParallelPlugin = {
856
- /** @internal */
857
969
  _parallel: {
858
970
  fileUrl: string;
859
971
  options: unknown;
860
972
  };
861
973
  };
974
+ /** @internal */
862
975
  type DefineParallelPluginResult<Options> = (options: Options) => ParallelPlugin;
863
976
  declare function defineParallelPlugin<Options>(pluginPath: string): DefineParallelPluginResult<Options>;
864
977
  //#endregion
865
978
  //#region src/plugin/plugin-context.d.ts
979
+ /** @category Plugin APIs */
866
980
  interface EmittedAsset {
867
981
  type: "asset";
868
982
  name?: string;
@@ -886,13 +1000,16 @@ interface EmittedPrebuiltChunk {
886
1000
  map?: SourceMap;
887
1001
  sourcemapFileName?: string;
888
1002
  }
1003
+ /** @category Plugin APIs */
889
1004
  type EmittedFile = EmittedAsset | EmittedChunk | EmittedPrebuiltChunk;
890
1005
  interface PluginContextResolveOptions {
891
1006
  isEntry?: boolean;
892
1007
  skipSelf?: boolean;
893
1008
  custom?: CustomPluginOptions;
894
1009
  }
1010
+ /** @category Plugin APIs */
895
1011
  type GetModuleInfo = (moduleId: string) => ModuleInfo | null;
1012
+ /** @category Plugin APIs */
896
1013
  interface PluginContext extends MinimalPluginContext {
897
1014
  fs: RolldownFsModule;
898
1015
  emitFile(file: EmittedFile): string;
@@ -909,6 +1026,7 @@ interface PluginContext extends MinimalPluginContext {
909
1026
  }
910
1027
  //#endregion
911
1028
  //#region src/plugin/transform-plugin-context.d.ts
1029
+ /** @category Plugin APIs */
912
1030
  interface TransformPluginContext extends PluginContext {
913
1031
  debug: LoggingFunctionWithPosition;
914
1032
  info: LoggingFunctionWithPosition;
@@ -927,17 +1045,132 @@ interface ModuleSideEffectsRule {
927
1045
  sideEffects: boolean;
928
1046
  }
929
1047
  type ModuleSideEffectsOption = boolean | readonly string[] | ModuleSideEffectsRule[] | ((id: string, external: boolean) => boolean | undefined) | "no-external";
1048
+ /**
1049
+ * When passing an object, you can fine-tune the tree-shaking behavior.
1050
+ */
930
1051
  type TreeshakingOptions = {
1052
+ /**
1053
+ * **Values:**
1054
+ *
1055
+ * - **`true`**: All modules are assumed to have side effects and will be included in the bundle even if none of their exports are used.
1056
+ * - **`false`**: No modules have side effects. This enables aggressive tree-shaking, removing any modules whose exports are not used.
1057
+ * - **`string[]`**: Array of module IDs that have side effects. Only modules in this list will be preserved if unused; all others can be tree-shaken when their exports are unused.
1058
+ * - **`'no-external'`**: Assumes no external modules have side effects while preserving the default behavior for local modules.
1059
+ * - **`ModuleSideEffectsRule[]`**: Array of rules with `test`, `external`, and `sideEffects` properties for fine-grained control.
1060
+ * - **`function`**: Function that receives `(id, external)` and returns whether the module has side effects.
1061
+ *
1062
+ * **Important:** Setting this to `false` or using an array/string assumes that your modules and their dependencies have no side effects other than their exports. Only use this if you're certain that removing unused modules won't break your application.
1063
+ *
1064
+ * > [!NOTE]
1065
+ * > **Performance: Prefer `ModuleSideEffectsRule[]` over functions**
1066
+ * >
1067
+ * > When possible, use rule-based configuration instead of functions. Rules are processed entirely in Rust, while JavaScript functions require runtime calls between Rust and JavaScript, which can hurt CPU utilization during builds.
1068
+ * >
1069
+ * > **Functions should be a last resort**: Only use the function signature when your logic cannot be expressed with patterns or simple string matching.
1070
+ * >
1071
+ * > **Rule advantages**: `ModuleSideEffectsRule[]` provides better performance by avoiding Rust-JavaScript runtime calls, clearer intent, and easier maintenance.
1072
+ *
1073
+ * @example
1074
+ * ```js
1075
+ * // Assume no modules have side effects (aggressive tree-shaking)
1076
+ * treeshake: {
1077
+ * moduleSideEffects: false
1078
+ * }
1079
+ *
1080
+ * // Only specific modules have side effects (string array)
1081
+ * treeshake: {
1082
+ * moduleSideEffects: [
1083
+ * 'lodash',
1084
+ * 'react-dom',
1085
+ * ]
1086
+ * }
1087
+ *
1088
+ * // Use rules for pattern matching and granular control
1089
+ * treeshake: {
1090
+ * moduleSideEffects: [
1091
+ * { test: /^node:/, sideEffects: true },
1092
+ * { test: /\.css$/, sideEffects: true },
1093
+ * { test: /some-package/, sideEffects: false, external: false },
1094
+ * ]
1095
+ * }
1096
+ *
1097
+ * // Custom function to determine side effects
1098
+ * treeshake: {
1099
+ * moduleSideEffects: (id, external) => {
1100
+ * if (external) return false; // external modules have no side effects
1101
+ * return id.includes('/side-effects/') || id.endsWith('.css');
1102
+ * }
1103
+ * }
1104
+ *
1105
+ * // Assume no external modules have side effects
1106
+ * treeshake: {
1107
+ * moduleSideEffects: 'no-external',
1108
+ * }
1109
+ * ```
1110
+ *
1111
+ * **Common Use Cases:**
1112
+ * - **CSS files**: `{ test: /\.css$/, sideEffects: true }` - preserve CSS imports
1113
+ * - **Polyfills**: Add specific polyfill modules to the array
1114
+ * - **Plugins**: Modules that register themselves globally on import
1115
+ * - **Library development**: Set to `false` for libraries where unused exports should be removed
1116
+ * @default true
1117
+ */
931
1118
  moduleSideEffects?: ModuleSideEffectsOption;
1119
+ /**
1120
+ * Whether to respect `/*@__PURE__*\/` annotations and other tree-shaking hints in the code.
1121
+ * @default true
1122
+ */
932
1123
  annotations?: boolean;
1124
+ /**
1125
+ * Array of function names that should be considered pure (no side effects) even if they can't be automatically detected as pure
1126
+ *
1127
+ * @example
1128
+ * ```js
1129
+ * treeshake: {
1130
+ * manualPureFunctions: ['console.log', 'debug.trace']
1131
+ * }
1132
+ * ```
1133
+ * @default []
1134
+ */
933
1135
  manualPureFunctions?: readonly string[];
1136
+ /**
1137
+ * Whether to assume that accessing unknown global properties might have side effects.
1138
+ * @default true
1139
+ */
934
1140
  unknownGlobalSideEffects?: boolean;
1141
+ /**
1142
+ * Whether to enable tree-shaking for CommonJS modules. When `true`, unused exports from CommonJS modules can be eliminated from the bundle, similar to ES modules. When disabled, CommonJS modules will always be included in their entirety.
1143
+ *
1144
+ * This option allows rolldown to analyze `exports.property` assignments in CommonJS modules and remove unused exports while preserving the module's side effects.
1145
+ *
1146
+ * @example
1147
+ * ```js
1148
+ * // source.js (CommonJS)
1149
+ * exports.used = 'This will be kept';
1150
+ * exports.unused = 'This will be tree-shaken away';
1151
+ *
1152
+ * // main.js
1153
+ * import { used } from './source.js';
1154
+ * // With commonjs: true, only the 'used' export is included in the bundle
1155
+ * // With commonjs: false, both exports are included
1156
+ * ```
1157
+ * @default true
1158
+ */
935
1159
  commonjs?: boolean;
1160
+ /**
1161
+ * Controls whether reading properties from objects is considered to have side effects. Set to `always` for more conservative behavior.
1162
+ * @default false
1163
+ */
936
1164
  propertyReadSideEffects?: false | "always";
1165
+ /**
1166
+ * Controls whether writing properties to objects is considered to have side effects. Set to `always` for conservative behavior.
1167
+ * @default 'always'
1168
+ */
937
1169
  propertyWriteSideEffects?: false | "always";
938
1170
  };
939
1171
  //#endregion
940
1172
  //#region src/types/output-bundle.d.ts
1173
+ /** @category Plugin APIs */
941
1174
  interface OutputBundle {
942
1175
  [fileName: string]: OutputAsset | OutputChunk;
943
1176
  }
@@ -946,6 +1179,7 @@ interface OutputBundle {
946
1179
  type RolldownOptionsFunction = (commandLineArguments: Record<string, any>) => MaybePromise<RolldownOptions | RolldownOptions[]>;
947
1180
  //#endregion
948
1181
  //#region src/types/sourcemap.d.ts
1182
+ /** @category Plugin APIs */
949
1183
  interface ExistingRawSourceMap {
950
1184
  file?: string | null;
951
1185
  mappings: string;
@@ -959,6 +1193,7 @@ interface ExistingRawSourceMap {
959
1193
  type SourceMapInput = ExistingRawSourceMap | string | null;
960
1194
  //#endregion
961
1195
  //#region src/version.d.ts
1196
+ /** @category Plugin APIs */
962
1197
  declare const VERSION: string;
963
1198
  //#endregion
964
1199
  //#region src/constants/plugin.d.ts
@@ -975,7 +1210,7 @@ declare const ENUMERATED_PLUGIN_HOOK_NAMES: [...typeof ENUMERATED_INPUT_PLUGIN_H
975
1210
  * }
976
1211
  * ```
977
1212
  */
978
- type DefinedHookNames = { readonly [K in typeof ENUMERATED_PLUGIN_HOOK_NAMES[number]]: K };
1213
+ type DefinedHookNames = { readonly [K in (typeof ENUMERATED_PLUGIN_HOOK_NAMES)[number]]: K };
979
1214
  /**
980
1215
  * Names of all defined hooks. It's like
981
1216
  * ```js
@@ -999,43 +1234,55 @@ declare function withFilter<A, T extends RolldownPluginOption<A>>(pluginOption:
999
1234
  //#endregion
1000
1235
  //#region src/plugin/index.d.ts
1001
1236
  type ModuleSideEffects = boolean | "no-treeshake" | null;
1237
+ /** @category Plugin APIs */
1002
1238
  type ModuleType = "js" | "jsx" | "ts" | "tsx" | "json" | "text" | "base64" | "dataurl" | "binary" | "empty" | (string & {});
1239
+ /** @category Plugin APIs */
1003
1240
  type ImportKind = BindingHookResolveIdExtraArgs["kind"];
1241
+ /** @category Plugin APIs */
1004
1242
  interface CustomPluginOptions {
1005
1243
  [plugin: string]: any;
1006
1244
  }
1245
+ /** @category Plugin APIs */
1007
1246
  interface ModuleOptions {
1008
1247
  moduleSideEffects: ModuleSideEffects;
1009
1248
  meta: CustomPluginOptions;
1010
1249
  invalidate?: boolean;
1011
1250
  packageJsonPath?: string;
1012
1251
  }
1252
+ /** @category Plugin APIs */
1013
1253
  interface ResolvedId extends ModuleOptions {
1014
1254
  external: boolean | "absolute";
1015
1255
  id: string;
1016
1256
  }
1257
+ /** @category Plugin APIs */
1017
1258
  interface PartialResolvedId extends Partial<PartialNull<ModuleOptions>> {
1018
1259
  external?: boolean | "absolute" | "relative";
1019
1260
  id: string;
1020
1261
  }
1262
+ /** @category Plugin APIs */
1021
1263
  interface SourceDescription extends Partial<PartialNull<ModuleOptions>> {
1022
1264
  code: string;
1023
1265
  map?: SourceMapInput;
1024
1266
  moduleType?: ModuleType;
1025
1267
  }
1268
+ /** @category Plugin APIs */
1026
1269
  interface ResolveIdExtraOptions {
1027
1270
  custom?: CustomPluginOptions;
1028
1271
  isEntry: boolean;
1029
1272
  kind: BindingHookResolveIdExtraArgs["kind"];
1030
1273
  }
1274
+ /** @category Plugin APIs */
1031
1275
  type ResolveIdResult = string | NullValue | false | PartialResolvedId;
1276
+ /** @category Plugin APIs */
1032
1277
  type LoadResult = NullValue | string | SourceDescription;
1278
+ /** @category Plugin APIs */
1033
1279
  type TransformResult = NullValue | string | (Omit<SourceDescription, "code"> & {
1034
1280
  code?: string | BindingMagicString;
1035
1281
  });
1036
1282
  type RenderedChunkMeta = {
1037
1283
  chunks: Record<string, RenderedChunk>;
1038
1284
  };
1285
+ /** @category Plugin APIs */
1039
1286
  interface FunctionPluginHooks {
1040
1287
  [DEFINED_HOOK_NAMES.onLog]: (this: MinimalPluginContext, level: LogLevel, log: RollupLog) => NullValue | boolean;
1041
1288
  [DEFINED_HOOK_NAMES.options]: (this: MinimalPluginContext, options: InputOptions) => NullValue | InputOptions;
@@ -1075,16 +1322,20 @@ type PluginOrder = "pre" | "post" | null;
1075
1322
  type ObjectHookMeta = {
1076
1323
  order?: PluginOrder;
1077
1324
  };
1325
+ /** @category Plugin APIs */
1078
1326
  type ObjectHook<T, O = {}> = T | ({
1079
1327
  handler: T;
1080
1328
  } & ObjectHookMeta & O);
1081
1329
  type SyncPluginHooks = DefinedHookNames["augmentChunkHash" | "onLog" | "outputOptions"];
1330
+ /** @category Plugin APIs */
1082
1331
  type AsyncPluginHooks = Exclude<keyof FunctionPluginHooks, SyncPluginHooks>;
1083
1332
  type FirstPluginHooks = DefinedHookNames["load" | "resolveDynamicImport" | "resolveId"];
1084
1333
  type SequentialPluginHooks = DefinedHookNames["augmentChunkHash" | "generateBundle" | "onLog" | "options" | "outputOptions" | "renderChunk" | "transform"];
1085
1334
  type AddonHooks = DefinedHookNames["banner" | "footer" | "intro" | "outro"];
1086
1335
  type OutputPluginHooks = DefinedHookNames["augmentChunkHash" | "generateBundle" | "outputOptions" | "renderChunk" | "renderError" | "renderStart" | "writeBundle"];
1336
+ /** @internal */
1087
1337
  type ParallelPluginHooks = Exclude<keyof FunctionPluginHooks | AddonHooks, FirstPluginHooks | SequentialPluginHooks>;
1338
+ /** @category Plugin APIs */
1088
1339
  type HookFilterExtension<K$1 extends keyof FunctionPluginHooks> = K$1 extends "transform" ? {
1089
1340
  filter?: TUnionWithTopLevelFilterExpressionArray<HookFilter>;
1090
1341
  } : K$1 extends "load" ? {
@@ -1109,6 +1360,7 @@ type AddonHook = string | AddonHookFunction;
1109
1360
  interface OutputPlugin extends Partial<{ [K in keyof PluginHooks as K & OutputPluginHooks]: PluginHooks[K] }>, Partial<{ [K in AddonHooks]: ObjectHook<AddonHook> }> {
1110
1361
  name: string;
1111
1362
  }
1363
+ /** @category Plugin APIs */
1112
1364
  interface Plugin<A = any> extends OutputPlugin, Partial<PluginHooks> {
1113
1365
  api?: A;
1114
1366
  }
@@ -1121,85 +1373,6 @@ type RolldownOutputPluginOption = MaybePromise<NullValue<RolldownOutputPlugin> |
1121
1373
  name: string;
1122
1374
  } | false | RolldownOutputPluginOption[]>;
1123
1375
  //#endregion
1124
- //#region src/options/generated/checks-options.d.ts
1125
- interface ChecksOptions {
1126
- /**
1127
- * Whether to emit warning when detecting circular dependency
1128
- * @default false
1129
- */
1130
- circularDependency?: boolean;
1131
- /**
1132
- * Whether to emit warning when detecting eval
1133
- * @default true
1134
- */
1135
- eval?: boolean;
1136
- /**
1137
- * Whether to emit warning when detecting missing global name
1138
- * @default true
1139
- */
1140
- missingGlobalName?: boolean;
1141
- /**
1142
- * Whether to emit warning when detecting missing name option for iife export
1143
- * @default true
1144
- */
1145
- missingNameOptionForIifeExport?: boolean;
1146
- /**
1147
- * Whether to emit warning when detecting mixed exports
1148
- * @default true
1149
- */
1150
- mixedExports?: boolean;
1151
- /**
1152
- * Whether to emit warning when detecting unresolved entry
1153
- * @default true
1154
- */
1155
- unresolvedEntry?: boolean;
1156
- /**
1157
- * Whether to emit warning when detecting unresolved import
1158
- * @default true
1159
- */
1160
- unresolvedImport?: boolean;
1161
- /**
1162
- * Whether to emit warning when detecting filename conflict
1163
- * @default true
1164
- */
1165
- filenameConflict?: boolean;
1166
- /**
1167
- * Whether to emit warning when detecting common js variable in esm
1168
- * @default true
1169
- */
1170
- commonJsVariableInEsm?: boolean;
1171
- /**
1172
- * Whether to emit warning when detecting import is undefined
1173
- * @default true
1174
- */
1175
- importIsUndefined?: boolean;
1176
- /**
1177
- * Whether to emit warning when detecting empty import meta
1178
- * @default true
1179
- */
1180
- emptyImportMeta?: boolean;
1181
- /**
1182
- * Whether to emit warning when detecting configuration field conflict
1183
- * @default true
1184
- */
1185
- configurationFieldConflict?: boolean;
1186
- /**
1187
- * Whether to emit warning when detecting prefer builtin feature
1188
- * @default true
1189
- */
1190
- preferBuiltinFeature?: boolean;
1191
- /**
1192
- * Whether to emit warning when detecting could not clean directory
1193
- * @default true
1194
- */
1195
- couldNotCleanDirectory?: boolean;
1196
- /**
1197
- * Whether to emit warning when detecting plugin timings
1198
- * @default true
1199
- */
1200
- pluginTimings?: boolean;
1201
- }
1202
- //#endregion
1203
1376
  //#region src/options/transform-options.d.ts
1204
1377
  interface TransformOptions extends Omit<TransformOptions$1, "sourceType" | "lang" | "cwd" | "sourcemap" | "define" | "inject" | "jsx"> {
1205
1378
  /**
@@ -1336,7 +1509,8 @@ type OptimizationOptions = {
1336
1509
  *
1337
1510
  * When enabled, constant values from imported modules will be inlined at their usage sites,
1338
1511
  * potentially reducing bundle size and improving runtime performance by eliminating variable lookups.
1339
- * **options**:
1512
+ *
1513
+ * **Options:**
1340
1514
  * - `true`: equivalent to `{ mode: 'all', pass: 1 }`, enabling constant inlining for all eligible constants with a single pass.
1341
1515
  * - `false`: Disable constant inlining
1342
1516
  * - `{ mode: 'smart' | 'all', pass?: number }`:
@@ -1350,7 +1524,7 @@ type OptimizationOptions = {
1350
1524
  * - `mode: 'all'`: Inline all imported constants wherever they are used.
1351
1525
  * - `pass`: Number of passes to perform for inlining constants.
1352
1526
  *
1353
- * **example**
1527
+ * @example
1354
1528
  * ```js
1355
1529
  * // Input files:
1356
1530
  * // constants.js
@@ -1384,18 +1558,44 @@ type ChunkModulesOrder = "exec-order" | "module-id";
1384
1558
  type OnLogFunction = (level: LogLevel, log: RollupLog, defaultHandler: LogOrStringHandler) => void;
1385
1559
  type OnwarnFunction = (warning: RollupLog, defaultHandler: (warning: RollupLogWithString | (() => RollupLogWithString)) => void) => void;
1386
1560
  interface InputOptions {
1561
+ /**
1562
+ * Defines entries and location(s) of entry modules for the bundle. Relative paths are resolved based on the `cwd` option.
1563
+ * {@include ./docs/input.md}
1564
+ */
1387
1565
  input?: InputOption;
1388
1566
  plugins?: RolldownPluginOption;
1567
+ /**
1568
+ * Specifies which modules should be treated as external and not bundled. External modules will be left as import statements in the output.
1569
+ * {@include ./docs/external.md}
1570
+ */
1389
1571
  external?: ExternalOption;
1390
1572
  resolve?: {
1391
1573
  /**
1574
+ * @example
1575
+ * ```js
1576
+ * resolve: {
1577
+ * alias: {
1578
+ * '@': '/src',
1579
+ * 'utils': './src/utils',
1580
+ * }
1581
+ * }
1582
+ * ```
1392
1583
  * > [!WARNING]
1393
1584
  * > `resolve.alias` will not call `resolveId` hooks of other plugin.
1394
1585
  * > If you want to call `resolveId` hooks of other plugin, use `viteAliasPlugin` from `rolldown/experimental` instead.
1395
1586
  * > You could find more discussion in [this issue](https://github.com/rolldown/rolldown/issues/3615)
1396
1587
  */
1397
1588
  alias?: Record<string, string[] | string | false>;
1589
+ /**
1590
+ * Fields in package.json to check for aliased paths.
1591
+ */
1398
1592
  aliasFields?: string[][];
1593
+ /**
1594
+ * Condition names to use when resolving exports in package.json. Defaults based on platform and import kind:
1595
+ * - **Browser platform**: `["import", "browser", "default"]` for import statements, `["require", "browser", "default"]` for require() calls
1596
+ * - **Node platform**: `["import", "node", "default"]` for import statements, `["require", "node", "default"]` for require() calls
1597
+ * - **Neutral platform**: `["import", "default"]` for import statements, `["require", "default"]` for require() calls
1598
+ */
1399
1599
  conditionNames?: string[];
1400
1600
  /**
1401
1601
  * Map of extensions to alternative extensions.
@@ -1404,17 +1604,46 @@ interface InputOptions {
1404
1604
  * You can achieve this by setting: `extensionAlias: { '.js': ['.ts', '.js'] }`.
1405
1605
  */
1406
1606
  extensionAlias?: Record<string, string[]>;
1607
+ /**
1608
+ * Fields in package.json to check for exports.
1609
+ */
1407
1610
  exportsFields?: string[][];
1611
+ /**
1612
+ * Extensions to try when resolving files. These are tried in order from first to last.
1613
+ * @default ['.tsx', '.ts', '.jsx', '.js', '.json']
1614
+ */
1408
1615
  extensions?: string[];
1616
+ /**
1617
+ * Fields in package.json to check for entry points. Defaults based on platform:
1618
+ * - **Node**: `['main', 'module']`
1619
+ * - **Browser**: `['browser', 'module', 'main']`
1620
+ * - **Neutral**: `[]` (relies on exports field)
1621
+ */
1409
1622
  mainFields?: string[];
1623
+ /**
1624
+ * Filenames to try when resolving directories.
1625
+ * @default ['index']
1626
+ */
1410
1627
  mainFiles?: string[];
1628
+ /**
1629
+ * Directories to search for modules.
1630
+ * @default ['node_modules']
1631
+ */
1411
1632
  modules?: string[];
1633
+ /**
1634
+ * Whether to follow symlinks when resolving modules.
1635
+ * @default true
1636
+ */
1412
1637
  symlinks?: boolean;
1413
1638
  /**
1414
1639
  * @deprecated Use the top-level `tsconfig` option instead.
1415
1640
  */
1416
1641
  tsconfigFilename?: string;
1417
1642
  };
1643
+ /**
1644
+ * The working directory to use when resolving relative paths in the configuration.
1645
+ * @default process.cwd()
1646
+ */
1418
1647
  cwd?: string;
1419
1648
  /**
1420
1649
  * Expected platform where the code run.
@@ -1427,55 +1656,147 @@ interface InputOptions {
1427
1656
  * @default
1428
1657
  * - 'node' if the format is 'cjs'
1429
1658
  * - 'browser' for other formats
1659
+ * {@include ./docs/platform.md}
1430
1660
  */
1431
1661
  platform?: "node" | "browser" | "neutral";
1662
+ /**
1663
+ * When `true`, creates shim variables for missing exports instead of throwing an error.
1664
+ * @default false
1665
+ * {@include ./docs/shim-missing-exports.md}
1666
+ */
1432
1667
  shimMissingExports?: boolean;
1668
+ /**
1669
+ * Controls tree-shaking (dead code elimination). When `true`, unused code will be removed from the bundle to reduce bundle size.
1670
+ * @default true
1671
+ */
1433
1672
  treeshake?: boolean | TreeshakingOptions;
1673
+ /**
1674
+ * Controls the verbosity of console logging during the build.
1675
+ * @default 'info'
1676
+ */
1434
1677
  logLevel?: LogLevelOption;
1678
+ /**
1679
+ * Custom handler for logs. Called for each log message before it's written to the console.
1680
+ */
1435
1681
  onLog?: OnLogFunction;
1682
+ /**
1683
+ * Custom handler for warnings during the build process.
1684
+ * @deprecated
1685
+ * :::: warning Deprecated
1686
+ * This is a legacy API. Consider using `onLog` instead for better control over all log types.
1687
+ * ::: details Migration to `onLog`
1688
+ * To migrate from `onwarn` to `onLog`, check the `level` parameter to filter for
1689
+ * warnings:
1690
+ * ```js
1691
+ * // Before: Using `onwarn`
1692
+ * export default {
1693
+ * onwarn(warning, defaultHandler) {
1694
+ * // Suppress certain warnings
1695
+ * if (warning.code === 'CIRCULAR_DEPENDENCY') return;
1696
+ * // Handle other warnings with default behavior
1697
+ * defaultHandler(warning);
1698
+ * },
1699
+ * };
1700
+ * ```
1701
+ * ```js
1702
+ * // After: Using `onLog`
1703
+ * export default {
1704
+ * onLog(level, log, defaultHandler) {
1705
+ * // Handle only warnings (same behavior as `onwarn`)
1706
+ * if (level === 'warn') {
1707
+ * // Suppress certain warnings
1708
+ * if (log.code === 'CIRCULAR_DEPENDENCY') return;
1709
+ * // Handle other warnings with default behavior
1710
+ * defaultHandler(level, log);
1711
+ * } else {
1712
+ * // Let other log levels pass through
1713
+ * defaultHandler(level, log);
1714
+ * }
1715
+ * },
1716
+ * };
1717
+ * ```
1718
+ * :::
1719
+ * ::::
1720
+ */
1436
1721
  onwarn?: OnwarnFunction;
1722
+ /**
1723
+ * Maps file patterns to module types, controlling how files are processed. This is conceptually similar to esbuild's loader option, allowing you to specify how different file extensions should be handled.
1724
+ */
1437
1725
  moduleTypes?: ModuleTypes;
1726
+ /**
1727
+ * Experimental features that may change in future releases and can introduce behavior change without a major version bump.
1728
+ */
1438
1729
  experimental?: {
1439
1730
  /**
1440
1731
  * Lets modules be executed in the order they are declared.
1441
1732
  *
1442
- * - Type: `boolean`
1443
- * - Default: `false`
1444
- *
1445
1733
  * This is done by injecting runtime helpers to ensure that modules are executed in the order they are imported. External modules won't be affected.
1446
1734
  *
1447
1735
  * > [!WARNING]
1448
1736
  * > Enabling this option may negatively increase bundle size. It is recommended to use this option only when absolutely necessary.
1737
+ * @default false
1449
1738
  */
1450
1739
  strictExecutionOrder?: boolean;
1740
+ /**
1741
+ * Disable live bindings for exported variables.
1742
+ * @default false
1743
+ */
1451
1744
  disableLiveBindings?: boolean;
1745
+ /**
1746
+ * Enable Vite compatible mode.
1747
+ * @default false
1748
+ */
1452
1749
  viteMode?: boolean;
1750
+ /**
1751
+ * When enabled, `new URL()` calls will be transformed to a stable asset URL which includes the updated name and content hash.
1752
+ * It is necessary to pass `import.meta.url` as the second argument to the
1753
+ * `new URL` constructor, otherwise no transform will be applied.
1754
+ * :::warning
1755
+ * JavaScript and TypeScript files referenced via `new URL('./file.js', import.meta.url)` or `new URL('./file.ts', import.meta.url)` will **not** be transformed or bundled. The file will be copied as-is, meaning TypeScript files remain untransformed and dependencies are not resolved.
1756
+ *
1757
+ * The expected behavior for JS/TS files is still being discussed and may
1758
+ * change in future releases. See [#7258](https://github.com/rolldown/rolldown/issues/7258) for more context.
1759
+ * :::
1760
+ * @example
1761
+ * ```js
1762
+ * // main.js
1763
+ * const url = new URL('./styles.css', import.meta.url);
1764
+ * console.log(url);
1765
+ *
1766
+ * // Example output after bundling WITHOUT the option (default)
1767
+ * const url = new URL('./styles.css', import.meta.url);
1768
+ * console.log(url);
1769
+ *
1770
+ * // Example output after bundling WITH `experimental.resolveNewUrlToAsset` set to `true`
1771
+ * const url = new URL('assets/styles-CjdrdY7X.css', import.meta.url);
1772
+ * console.log(url);
1773
+ * ```
1774
+ * @default false
1775
+ */
1453
1776
  resolveNewUrlToAsset?: boolean;
1454
1777
  devMode?: DevModeOptions;
1455
1778
  /**
1456
- * Control which order should use when rendering modules in chunk
1457
- *
1458
- * - Type: `'exec-order' | 'module-id'
1459
- * - Default: `'exec-order'`
1779
+ * Control which order should use when rendering modules in chunk.
1460
1780
  *
1781
+ * Available options:
1461
1782
  * - `exec-order`: Almost equivalent to the topological order of the module graph, but specially handling when module graph has cycle.
1462
1783
  * - `module-id`: This is more friendly for gzip compression, especially for some javascript static asset lib (e.g. icon library)
1463
1784
  * > [!NOTE]
1464
1785
  * > Try to sort the modules by their module id if possible(Since rolldown scope hoist all modules in the chunk, we only try to sort those modules by module id if we could ensure runtime behavior is correct after sorting).
1786
+ * @default 'exec-order'
1465
1787
  */
1466
1788
  chunkModulesOrder?: ChunkModulesOrder;
1467
1789
  /**
1468
1790
  * Attach debug information to the output bundle.
1469
1791
  *
1470
- * - Type: `'none' | 'simple' | 'full'`
1471
- * - Default: `'simple'`
1472
- *
1792
+ * Available modes:
1473
1793
  * - `none`: No debug information is attached.
1474
1794
  * - `simple`: Attach comments indicating which files the bundled code comes from. These comments could be removed by the minifier.
1475
1795
  * - `full`: Attach detailed debug information to the output bundle. These comments are using legal comment syntax, so they won't be removed by the minifier.
1476
1796
  *
1477
1797
  * > [!WARNING]
1478
1798
  * > You shouldn't use `full` in the production build.
1799
+ * @default 'simple'
1479
1800
  */
1480
1801
  attachDebugInfo?: AttachDebugOptions;
1481
1802
  /**
@@ -1489,8 +1810,7 @@ interface InputOptions {
1489
1810
  * (default `"/"`) can be applied to all paths. The resulting JSON is a valid import map and can be
1490
1811
  * directly injected into HTML via `<script type="importmap">`.
1491
1812
  *
1492
- * Example configuration snippet:
1493
- *
1813
+ * @example
1494
1814
  * ```js
1495
1815
  * {
1496
1816
  * experimental: {
@@ -1522,31 +1842,38 @@ interface InputOptions {
1522
1842
  * }
1523
1843
  * ```
1524
1844
  *
1525
- * > [!NOTE]
1845
+ * > [!TIP]
1526
1846
  * > If you want to learn more, you can check out the example here: [examples/chunk-import-map](https://github.com/rolldown/rolldown/tree/main/examples/chunk-import-map)
1847
+ * @default false
1527
1848
  */
1528
1849
  chunkImportMap?: boolean | {
1529
1850
  baseUrl?: string;
1530
1851
  fileName?: string;
1531
1852
  };
1853
+ /**
1854
+ * Enable on-demand wrapping of modules.
1855
+ * @default false
1856
+ */
1532
1857
  onDemandWrapping?: boolean;
1533
1858
  /**
1534
- * Required to be used with `watch` mode.
1859
+ * Enable incremental build support. Required to be used with `watch` mode.
1860
+ * @default false
1535
1861
  */
1536
1862
  incrementalBuild?: boolean;
1863
+ /**
1864
+ * Enable high-resolution source maps for transform operations.
1865
+ * @default false
1866
+ */
1537
1867
  transformHiresSourcemap?: boolean | "boundary";
1538
1868
  /**
1539
1869
  * Use native Rust implementation of MagicString for source map generation.
1540
1870
  *
1541
- * - Type: `boolean`
1542
- * - Default: `false`
1543
- *
1544
1871
  * [MagicString](https://github.com/rich-harris/magic-string) is a JavaScript library commonly used by bundlers
1545
1872
  * for string manipulation and source map generation. When enabled, rolldown will use a native Rust
1546
1873
  * implementation of MagicString instead of the JavaScript version, providing significantly better performance
1547
1874
  * during source map generation and code transformation.
1548
1875
  *
1549
- * ## Benefits
1876
+ * **Benefits**
1550
1877
  *
1551
1878
  * - **Improved Performance**: The native Rust implementation is typically faster than the JavaScript version,
1552
1879
  * especially for large codebases with extensive source maps.
@@ -1555,8 +1882,7 @@ interface InputOptions {
1555
1882
  * reduce overall build times when working with JavaScript transform hooks.
1556
1883
  * - **Better Integration**: Seamless integration with rolldown's native Rust architecture.
1557
1884
  *
1558
- * ## Example
1559
- *
1885
+ * @example
1560
1886
  * ```js
1561
1887
  * export default {
1562
1888
  * experimental: {
@@ -1572,6 +1898,7 @@ interface InputOptions {
1572
1898
  * > This is an experimental feature. While it aims to provide identical behavior to the JavaScript
1573
1899
  * > implementation, there may be edge cases. Please report any discrepancies you encounter.
1574
1900
  * > For a complete working example, see [examples/native-magic-string](https://github.com/rolldown/rolldown/tree/main/examples/native-magic-string)
1901
+ * @default false
1575
1902
  */
1576
1903
  nativeMagicString?: boolean;
1577
1904
  };
@@ -1594,33 +1921,52 @@ interface InputOptions {
1594
1921
  */
1595
1922
  transform?: TransformOptions;
1596
1923
  watch?: WatcherOptions | false;
1924
+ /**
1925
+ * Controls which warnings are emitted during the build process. Each option can be set to `true` (emit warning) or `false` (suppress warning).
1926
+ */
1597
1927
  checks?: ChecksOptions;
1598
1928
  makeAbsoluteExternalsRelative?: MakeAbsoluteExternalsRelative;
1599
- debug?: {
1929
+ devtools?: {
1600
1930
  sessionId?: string;
1601
1931
  };
1932
+ /**
1933
+ * Controls how entry chunk exports are preserved. This determines whether Rolldown needs to create facade chunks (additional wrapper chunks) to maintain the exact export signatures of entry modules, or whether it can combine entry modules with other chunks for optimization.
1934
+ * @default 'strict'
1935
+ * {@include ./docs/preserve-entry-signatures.md}
1936
+ */
1602
1937
  preserveEntrySignatures?: false | "strict" | "allow-extension" | "exports-only";
1938
+ /**
1939
+ * Configure optimization features for the bundler.
1940
+ */
1603
1941
  optimization?: OptimizationOptions;
1942
+ /**
1943
+ * The value of `this` at the top level of each output chunk. For IIFE and UMD formats, this defaults to `'window'` or `'global'` depending on the platform.
1944
+ * @example
1945
+ * **Set custom context**
1946
+ * ```js
1947
+ * export default {
1948
+ * context: 'globalThis',
1949
+ * output: {
1950
+ * format: 'iife',
1951
+ * },
1952
+ * };
1953
+ * ```
1954
+ * **Use window for browser builds**
1955
+ * ```js
1956
+ * export default {
1957
+ * context: 'window',
1958
+ * platform: 'browser',
1959
+ * output: {
1960
+ * format: 'iife',
1961
+ * },
1962
+ * };
1963
+ * ```
1964
+ * {@include ./docs/context.md}
1965
+ */
1604
1966
  context?: string;
1605
1967
  /**
1606
1968
  * Configures TypeScript configuration file resolution and usage.
1607
- *
1608
- * ## Options
1609
- *
1610
- * - `true`: Auto-discovery mode (similar to Vite). For each module, both resolver and transformer
1611
- * will find the nearest tsconfig.json. If the tsconfig has `references`, the file extension is
1612
- * allowed, and the tsconfig's `include`/`exclude` patterns don't match the file, the referenced
1613
- * tsconfigs will be searched for a match. Falls back to the original tsconfig if no match is found.
1614
- * - `string`: Path to a specific tsconfig.json file (relative to cwd or absolute path).
1615
- *
1616
- * ## What's used from tsconfig
1617
- *
1618
- * - **Resolver**: Uses `compilerOptions.paths` and `compilerOptions.baseUrl` for path mapping
1619
- * - **Transformer**: Uses select compiler options (jsx, decorators, typescript, etc.)
1620
- *
1621
- * > [!NOTE]
1622
- * > Priority: Top-level `transform` options always take precedence over tsconfig settings.
1623
- *
1969
+ * {@include ./docs/tsconfig.md}
1624
1970
  * @default undefined (no tsconfig resolution)
1625
1971
  */
1626
1972
  tsconfig?: true | string;
@@ -1643,4 +1989,4 @@ declare function defineConfig(config: RolldownOptions[]): RolldownOptions[];
1643
1989
  declare function defineConfig(config: RolldownOptionsFunction): RolldownOptionsFunction;
1644
1990
  declare function defineConfig(config: ConfigExport): ConfigExport;
1645
1991
  //#endregion
1646
- export { InternalModuleFormat as $, VERSION as A, GetModuleInfo as B, ResolveIdResult as C, RenderedModule as Ct, SourceDescription as D, ModuleInfo as Dt, RolldownPluginOption as E, freeExternalMemory as Et, TreeshakingOptions as F, PluginContextMeta as G, DefineParallelPluginResult as H, TransformPluginContext as I, ModuleTypeFilter as J, GeneralHookFilter as K, EmittedAsset as L, SourceMapInput as M, RolldownOptionsFunction as N, TransformResult as O, SourcemapIgnoreListOption as Ot, OutputBundle as P, RolldownFsModule as Q, EmittedFile as R, ResolveIdExtraOptions as S, RenderedChunk as St, RolldownPlugin as T, SourceMap as Tt, defineParallelPlugin as U, PluginContext as V, MinimalPluginContext as W, RolldownDirectoryEntry as X, BufferEncoding as Y, RolldownFileStats as Z, ModuleType as _, ModuleFormat as _t, InputOption as a, WatchOptions as at, PartialResolvedId as b, OutputAsset as bt, OptimizationOptions as c, BuildOptions as ct, CustomPluginOptions as d, ChunkFileNamesFunction as dt, NormalizedOutputOptions as et, FunctionPluginHooks as f, ChunkingContext as ft, ModuleOptions as g, MinifyOptions as gt, LoadResult as h, GlobalsFunction as ht, ExternalOption as i, RolldownWatcherEvent as it, ExistingRawSourceMap as j, withFilter as k, WatcherOptions as l, build as lt, ImportKind as m, GeneratedCodePreset as mt, ConfigExport as n, watch as nt, InputOptions as o, rolldown as ot, HookFilterExtension as p, GeneratedCodeOptions as pt, HookFilter as q, RolldownOptions as r, RolldownWatcher as rt, ModuleTypes as s, RolldownBuild as st, defineConfig as t, NormalizedInputOptions as tt, AsyncPluginHooks as u, AddonFunction as ut, ObjectHook as v, OutputOptions as vt, ResolvedId as w, RolldownOutput as wt, Plugin as x, OutputChunk as xt, ParallelPluginHooks as y, PreRenderedAsset as yt, EmittedPrebuiltChunk as z };
1992
+ export { InternalModuleFormat as $, VERSION as A, GetModuleInfo as B, ResolveIdResult as C, RenderedChunk as Ct, SourceDescription as D, freeExternalMemory as Dt, RolldownPluginOption as E, SourceMap as Et, TreeshakingOptions as F, PluginContextMeta as G, DefineParallelPluginResult as H, TransformPluginContext as I, ModuleTypeFilter as J, GeneralHookFilter as K, EmittedAsset as L, SourceMapInput as M, RolldownOptionsFunction as N, TransformResult as O, ModuleInfo as Ot, OutputBundle as P, RolldownFsModule as Q, EmittedFile as R, ResolveIdExtraOptions as S, OutputChunk as St, RolldownPlugin as T, RolldownOutput as Tt, defineParallelPlugin as U, PluginContext as V, MinimalPluginContext as W, RolldownDirectoryEntry as X, BufferEncoding as Y, RolldownFileStats as Z, ModuleType as _, MinifyOptions as _t, InputOption as a, RolldownWatcherEvent as at, PartialResolvedId as b, PreRenderedAsset as bt, OptimizationOptions as c, RolldownBuild as ct, CustomPluginOptions as d, AddonFunction as dt, NormalizedOutputOptions as et, FunctionPluginHooks as f, ChunkFileNamesFunction as ft, ModuleOptions as g, GlobalsFunction as gt, LoadResult as h, GeneratedCodePreset as ht, ExternalOption as i, RolldownWatcher as it, ExistingRawSourceMap as j, withFilter as k, SourcemapIgnoreListOption as kt, WatcherOptions as l, BuildOptions as lt, ImportKind as m, GeneratedCodeOptions as mt, ConfigExport as n, ChecksOptions as nt, InputOptions as o, WatchOptions as ot, HookFilterExtension as p, ChunkingContext as pt, HookFilter as q, RolldownOptions as r, watch as rt, ModuleTypes as s, rolldown as st, defineConfig as t, NormalizedInputOptions as tt, AsyncPluginHooks as u, build as ut, ObjectHook as v, ModuleFormat as vt, ResolvedId as w, RenderedModule as wt, Plugin as x, OutputAsset as xt, ParallelPluginHooks as y, OutputOptions as yt, EmittedPrebuiltChunk as z };