rolldown 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 (33) hide show
  1. package/README.md +11 -0
  2. package/dist/cli-setup.mjs +1 -1
  3. package/dist/cli.mjs +9 -9
  4. package/dist/config.d.mts +2 -2
  5. package/dist/config.mjs +7 -7
  6. package/dist/experimental-index.d.mts +3 -3
  7. package/dist/experimental-index.mjs +22 -23
  8. package/dist/experimental-runtime-types.d.ts +1 -1
  9. package/dist/filter-index.d.mts +4 -4
  10. package/dist/filter-index.mjs +327 -2
  11. package/dist/get-log-filter.d.mts +1 -1
  12. package/dist/index.d.mts +4 -4
  13. package/dist/index.mjs +7 -7
  14. package/dist/parallel-plugin-worker.mjs +4 -4
  15. package/dist/parallel-plugin.d.mts +2 -2
  16. package/dist/parse-ast-index.d.mts +1 -1
  17. package/dist/parse-ast-index.mjs +2 -2
  18. package/dist/plugins-index.d.mts +3 -3
  19. package/dist/plugins-index.mjs +3 -3
  20. package/dist/shared/{binding-CtWITWm-.mjs → binding-B_TbiTj8.mjs} +29 -28
  21. package/dist/shared/{binding-CDyF6W3D.d.mts → binding-MAEzB4KA.d.mts} +10 -0
  22. package/dist/shared/{bindingify-input-options-CO3Vzzk3.mjs → bindingify-input-options-DA2ZhV0B.mjs} +8 -4
  23. package/dist/shared/{constructors-Jt3eRoTg.mjs → constructors-BpxCdJYi.mjs} +1 -1
  24. package/dist/shared/{constructors-Dw-B6Be3.d.mts → constructors-i-dnHlhG.d.mts} +2 -2
  25. package/dist/shared/{define-config-izclUEbx.d.mts → define-config-twT5HTur.d.mts} +470 -124
  26. package/dist/shared/{load-config-BpSXYU8O.mjs → load-config-ORm33WR7.mjs} +1 -1
  27. package/dist/shared/{logging-BpAvp7KV.d.mts → logging-B4x9qar8.d.mts} +1 -0
  28. package/dist/shared/{normalize-string-or-regex-DFzBrq1v.mjs → normalize-string-or-regex-DD62Rjxi.mjs} +4 -3
  29. package/dist/shared/{parse-ast-index-BQgRrweO.mjs → parse-ast-index-CgUIFKC1.mjs} +2 -2
  30. package/dist/shared/{rolldown-DA3tdfJk.mjs → rolldown-B-IUR2m3.mjs} +2 -1
  31. package/dist/shared/{rolldown-build-CUD1BA8L.mjs → rolldown-build-DADnIB07.mjs} +8 -4
  32. package/dist/shared/{watch-XY1CZgsw.mjs → watch-BxrDbQPl.mjs} +5 -4
  33. package/package.json +58 -58
@@ -1,5 +1,5 @@
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, t as BindingBuiltinPluginName } from "./binding-CDyF6W3D.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, t as BindingBuiltinPluginName } from "./binding-MAEzB4KA.mjs";
3
3
  import { TopLevelFilterExpression } from "@rolldown/pluginutils";
4
4
  import { Program } from "@oxc-project/types";
5
5
 
@@ -8,6 +8,7 @@ type SourcemapPathTransformOption = (relativeSourcePath: string, sourcemapPath:
8
8
  type SourcemapIgnoreListOption = (relativeSourcePath: string, sourcemapPath: string) => boolean;
9
9
  //#endregion
10
10
  //#region src/types/module-info.d.ts
11
+ /** @category Plugin APIs */
11
12
  interface ModuleInfo extends ModuleOptions {
12
13
  /**
13
14
  * Unsupported at rolldown
@@ -78,6 +79,7 @@ interface ExternalMemoryHandle {
78
79
  declare function freeExternalMemory(handle: ExternalMemoryHandle, keepDataAlive?: boolean): ExternalMemoryStatus;
79
80
  //#endregion
80
81
  //#region src/types/rolldown-output.d.ts
82
+ /** @category Plugin APIs */
81
83
  interface OutputAsset extends ExternalMemoryHandle {
82
84
  type: "asset";
83
85
  fileName: string;
@@ -89,6 +91,7 @@ interface OutputAsset extends ExternalMemoryHandle {
89
91
  name: string | undefined;
90
92
  names: string[];
91
93
  }
94
+ /** @category Plugin APIs */
92
95
  interface SourceMap {
93
96
  file: string;
94
97
  mappings: string;
@@ -101,11 +104,13 @@ interface SourceMap {
101
104
  toString(): string;
102
105
  toUrl(): string;
103
106
  }
107
+ /** @category Plugin APIs */
104
108
  interface RenderedModule {
105
109
  readonly code: string | null;
106
110
  renderedLength: number;
107
111
  renderedExports: string[];
108
112
  }
113
+ /** @category Plugin APIs */
109
114
  interface RenderedChunk extends Omit<BindingRenderedChunk, "modules"> {
110
115
  type: "chunk";
111
116
  modules: {
@@ -121,6 +126,7 @@ interface RenderedChunk extends Omit<BindingRenderedChunk, "modules"> {
121
126
  imports: Array<string>;
122
127
  dynamicImports: Array<string>;
123
128
  }
129
+ /** @category Plugin APIs */
124
130
  interface OutputChunk extends ExternalMemoryHandle {
125
131
  type: "chunk";
126
132
  code: string;
@@ -140,6 +146,7 @@ interface OutputChunk extends ExternalMemoryHandle {
140
146
  sourcemapFileName: string | null;
141
147
  preliminaryFileName: string;
142
148
  }
149
+ /** @category Programmatic APIs */
143
150
  interface RolldownOutput extends ExternalMemoryHandle {
144
151
  output: [OutputChunk, ...(OutputChunk | OutputAsset)[]];
145
152
  }
@@ -191,6 +198,7 @@ type ModuleFormat = "es" | "cjs" | "esm" | "module" | "commonjs" | "iife" | "umd
191
198
  type AddonFunction = (chunk: RenderedChunk) => string | Promise<string>;
192
199
  type ChunkFileNamesFunction = (chunkInfo: PreRenderedChunk) => string;
193
200
  type SanitizeFileNameFunction = (name: string) => string;
201
+ /** @category Plugin APIs */
194
202
  interface PreRenderedAsset {
195
203
  type: "asset";
196
204
  name?: string;
@@ -329,6 +337,7 @@ interface OutputOptions {
329
337
  generatedCode?: Partial<GeneratedCodeOptions>;
330
338
  externalLiveBindings?: boolean;
331
339
  inlineDynamicImports?: boolean;
340
+ dynamicImportInCjs?: boolean;
332
341
  /**
333
342
  * - Type: `((moduleId: string, meta: { getModuleInfo: (moduleId: string) => ModuleInfo | null }) => string | NullValue)`
334
343
  * - Object form is not supported.
@@ -613,6 +622,7 @@ interface BuildOptions extends InputOptions {
613
622
  write?: boolean;
614
623
  output?: OutputOptions;
615
624
  }
625
+ /** @category Programmatic APIs */
616
626
  declare function build(options: BuildOptions): Promise<RolldownOutput>;
617
627
  /**
618
628
  * Build multiple outputs __sequentially__.
@@ -620,6 +630,7 @@ declare function build(options: BuildOptions): Promise<RolldownOutput>;
620
630
  declare function build(options: BuildOptions[]): Promise<RolldownOutput[]>;
621
631
  //#endregion
622
632
  //#region src/api/rolldown/rolldown-build.d.ts
633
+ /** @category Programmatic APIs */
623
634
  declare class RolldownBuild {
624
635
  #private;
625
636
  static asyncRuntimeShutdown: boolean;
@@ -636,9 +647,11 @@ declare class RolldownBuild {
636
647
  }
637
648
  //#endregion
638
649
  //#region src/api/rolldown/index.d.ts
650
+ /** @category Programmatic APIs */
639
651
  declare const rolldown: (input: InputOptions) => Promise<RolldownBuild>;
640
652
  //#endregion
641
653
  //#region src/options/watch-options.d.ts
654
+ /** @category Programmatic APIs */
642
655
  interface WatchOptions extends InputOptions {
643
656
  output?: OutputOptions | OutputOptions[];
644
657
  }
@@ -647,6 +660,7 @@ interface WatchOptions extends InputOptions {
647
660
  type WatcherEvent = "close" | "event" | "restart" | "change";
648
661
  type ChangeEvent$1 = "create" | "update" | "delete";
649
662
  type RolldownWatchBuild = BindingWatcherBundler;
663
+ /** @category Programmatic APIs */
650
664
  type RolldownWatcherEvent = {
651
665
  code: "START";
652
666
  } | {
@@ -677,9 +691,11 @@ declare class WatcherEmitter {
677
691
  onEvent(event: BindingWatcherEvent): Promise<void>;
678
692
  close(): Promise<void>;
679
693
  }
694
+ /** @category Programmatic APIs */
680
695
  type RolldownWatcher = WatcherEmitter;
681
696
  //#endregion
682
697
  //#region src/api/watch/index.d.ts
698
+ /** @category Programmatic APIs */
683
699
  declare const watch: (input: WatchOptions | WatchOptions[]) => RolldownWatcher;
684
700
  //#endregion
685
701
  //#region src/log/log-handler.d.ts
@@ -690,7 +706,92 @@ type LoggingFunctionWithPosition = (log: RollupLog | string | (() => RollupLog |
690
706
  }) => void;
691
707
  type WarningHandlerWithDefault = (warning: RollupLog, defaultHandler: LoggingFunction) => void;
692
708
  //#endregion
709
+ //#region src/options/generated/checks-options.d.ts
710
+ interface ChecksOptions {
711
+ /**
712
+ * Whether to emit warning when detecting circular dependency
713
+ * @default false
714
+ * */
715
+ circularDependency?: boolean;
716
+ /**
717
+ * Whether to emit warning when detecting eval
718
+ * @default true
719
+ * */
720
+ eval?: boolean;
721
+ /**
722
+ * Whether to emit warning when detecting missing global name
723
+ * @default true
724
+ * */
725
+ missingGlobalName?: boolean;
726
+ /**
727
+ * Whether to emit warning when detecting missing name option for iife export
728
+ * @default true
729
+ * */
730
+ missingNameOptionForIifeExport?: boolean;
731
+ /**
732
+ * Whether to emit warning when detecting mixed exports
733
+ * @default true
734
+ * */
735
+ mixedExports?: boolean;
736
+ /**
737
+ * Whether to emit warning when detecting unresolved entry
738
+ * @default true
739
+ * */
740
+ unresolvedEntry?: boolean;
741
+ /**
742
+ * Whether to emit warning when detecting unresolved import
743
+ * @default true
744
+ * */
745
+ unresolvedImport?: boolean;
746
+ /**
747
+ * Whether to emit warning when detecting filename conflict
748
+ * @default true
749
+ * */
750
+ filenameConflict?: boolean;
751
+ /**
752
+ * Whether to emit warning when detecting common js variable in esm
753
+ * @default true
754
+ * */
755
+ commonJsVariableInEsm?: boolean;
756
+ /**
757
+ * Whether to emit warning when detecting import is undefined
758
+ * @default true
759
+ * */
760
+ importIsUndefined?: boolean;
761
+ /**
762
+ * Whether to emit warning when detecting empty import meta
763
+ * @default true
764
+ * */
765
+ emptyImportMeta?: boolean;
766
+ /**
767
+ * Whether to emit warning when detecting cannot call namespace
768
+ * @default true
769
+ * */
770
+ cannotCallNamespace?: boolean;
771
+ /**
772
+ * Whether to emit warning when detecting configuration field conflict
773
+ * @default true
774
+ * */
775
+ configurationFieldConflict?: boolean;
776
+ /**
777
+ * Whether to emit warning when detecting prefer builtin feature
778
+ * @default true
779
+ * */
780
+ preferBuiltinFeature?: boolean;
781
+ /**
782
+ * Whether to emit warning when detecting could not clean directory
783
+ * @default true
784
+ * */
785
+ couldNotCleanDirectory?: boolean;
786
+ /**
787
+ * Whether to emit warning when detecting plugin timings
788
+ * @default true
789
+ * */
790
+ pluginTimings?: boolean;
791
+ }
792
+ //#endregion
693
793
  //#region src/options/normalized-input-options.d.ts
794
+ /** @category Plugin APIs */
694
795
  interface NormalizedInputOptions {
695
796
  input: string[] | Record<string, string>;
696
797
  cwd: string;
@@ -701,7 +802,9 @@ interface NormalizedInputOptions {
701
802
  //#endregion
702
803
  //#region src/options/normalized-output-options.d.ts
703
804
  type PathsFunction = (id: string) => string;
805
+ /** @category Plugin APIs */
704
806
  type InternalModuleFormat = "es" | "cjs" | "iife" | "umd";
807
+ /** @category Plugin APIs */
705
808
  interface NormalizedOutputOptions {
706
809
  name: string | undefined;
707
810
  file: string | undefined;
@@ -716,6 +819,7 @@ interface NormalizedOutputOptions {
716
819
  cssEntryFileNames: string | ChunkFileNamesFunction;
717
820
  cssChunkFileNames: string | ChunkFileNamesFunction;
718
821
  inlineDynamicImports: boolean;
822
+ dynamicImportInCjs: boolean;
719
823
  externalLiveBindings: boolean;
720
824
  banner: AddonFunction;
721
825
  footer: AddonFunction;
@@ -743,6 +847,7 @@ interface NormalizedOutputOptions {
743
847
  }
744
848
  //#endregion
745
849
  //#region src/plugin/fs.d.ts
850
+ /** @category Plugin APIs */
746
851
  interface RolldownFsModule {
747
852
  appendFile(path: string, data: string | Uint8Array, options?: {
748
853
  encoding?: BufferEncoding | null;
@@ -785,13 +890,16 @@ interface RolldownFsModule {
785
890
  flag?: string | number;
786
891
  }): Promise<void>;
787
892
  }
893
+ /** @category Plugin APIs */
788
894
  type BufferEncoding = "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "base64url" | "latin1" | "binary" | "hex";
895
+ /** @category Plugin APIs */
789
896
  interface RolldownDirectoryEntry {
790
897
  isFile(): boolean;
791
898
  isDirectory(): boolean;
792
899
  isSymbolicLink(): boolean;
793
900
  name: string;
794
901
  }
902
+ /** @category Plugin APIs */
795
903
  interface RolldownFileStats {
796
904
  isFile(): boolean;
797
905
  isDirectory(): boolean;
@@ -804,6 +912,7 @@ interface RolldownFileStats {
804
912
  }
805
913
  //#endregion
806
914
  //#region src/plugin/hook-filter.d.ts
915
+ /** @category Plugin APIs */
807
916
  type GeneralHookFilter<Value = StringOrRegExp> = MaybeArray<Value> | {
808
917
  include?: MaybeArray<Value>;
809
918
  exclude?: MaybeArray<Value>;
@@ -811,7 +920,9 @@ type GeneralHookFilter<Value = StringOrRegExp> = MaybeArray<Value> | {
811
920
  interface FormalModuleTypeFilter {
812
921
  include?: ModuleType[];
813
922
  }
923
+ /** @category Plugin APIs */
814
924
  type ModuleTypeFilter = ModuleType[] | FormalModuleTypeFilter;
925
+ /** @category Plugin APIs */
815
926
  interface HookFilter {
816
927
  /**
817
928
  * This filter is used to do a pre-test to determine whether the hook should be called.
@@ -852,11 +963,13 @@ interface HookFilter {
852
963
  type TUnionWithTopLevelFilterExpressionArray<T> = T | TopLevelFilterExpression[];
853
964
  //#endregion
854
965
  //#region src/plugin/minimal-plugin-context.d.ts
966
+ /** @category Plugin APIs */
855
967
  interface PluginContextMeta {
856
968
  rollupVersion: string;
857
969
  rolldownVersion: string;
858
970
  watchMode: boolean;
859
971
  }
972
+ /** @category Plugin APIs */
860
973
  interface MinimalPluginContext {
861
974
  readonly pluginName: string;
862
975
  error: (e: RollupError | string) => never;
@@ -868,16 +981,17 @@ interface MinimalPluginContext {
868
981
  //#endregion
869
982
  //#region src/plugin/parallel-plugin.d.ts
870
983
  type ParallelPlugin = {
871
- /** @internal */
872
984
  _parallel: {
873
985
  fileUrl: string;
874
986
  options: unknown;
875
987
  };
876
988
  };
989
+ /** @internal */
877
990
  type DefineParallelPluginResult<Options> = (options: Options) => ParallelPlugin;
878
991
  declare function defineParallelPlugin<Options>(pluginPath: string): DefineParallelPluginResult<Options>;
879
992
  //#endregion
880
993
  //#region src/plugin/plugin-context.d.ts
994
+ /** @category Plugin APIs */
881
995
  interface EmittedAsset {
882
996
  type: "asset";
883
997
  name?: string;
@@ -901,13 +1015,16 @@ interface EmittedPrebuiltChunk {
901
1015
  map?: SourceMap;
902
1016
  sourcemapFileName?: string;
903
1017
  }
1018
+ /** @category Plugin APIs */
904
1019
  type EmittedFile = EmittedAsset | EmittedChunk | EmittedPrebuiltChunk;
905
1020
  interface PluginContextResolveOptions {
906
1021
  isEntry?: boolean;
907
1022
  skipSelf?: boolean;
908
1023
  custom?: CustomPluginOptions;
909
1024
  }
1025
+ /** @category Plugin APIs */
910
1026
  type GetModuleInfo = (moduleId: string) => ModuleInfo | null;
1027
+ /** @category Plugin APIs */
911
1028
  interface PluginContext extends MinimalPluginContext {
912
1029
  fs: RolldownFsModule;
913
1030
  emitFile(file: EmittedFile): string;
@@ -924,6 +1041,7 @@ interface PluginContext extends MinimalPluginContext {
924
1041
  }
925
1042
  //#endregion
926
1043
  //#region src/plugin/transform-plugin-context.d.ts
1044
+ /** @category Plugin APIs */
927
1045
  interface TransformPluginContext extends PluginContext {
928
1046
  debug: LoggingFunctionWithPosition;
929
1047
  info: LoggingFunctionWithPosition;
@@ -942,17 +1060,132 @@ interface ModuleSideEffectsRule {
942
1060
  sideEffects: boolean;
943
1061
  }
944
1062
  type ModuleSideEffectsOption = boolean | readonly string[] | ModuleSideEffectsRule[] | ((id: string, external: boolean) => boolean | undefined) | "no-external";
1063
+ /**
1064
+ * When passing an object, you can fine-tune the tree-shaking behavior.
1065
+ */
945
1066
  type TreeshakingOptions = {
1067
+ /**
1068
+ * **Values:**
1069
+ *
1070
+ * - **`true`**: All modules are assumed to have side effects and will be included in the bundle even if none of their exports are used.
1071
+ * - **`false`**: No modules have side effects. This enables aggressive tree-shaking, removing any modules whose exports are not used.
1072
+ * - **`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.
1073
+ * - **`'no-external'`**: Assumes no external modules have side effects while preserving the default behavior for local modules.
1074
+ * - **`ModuleSideEffectsRule[]`**: Array of rules with `test`, `external`, and `sideEffects` properties for fine-grained control.
1075
+ * - **`function`**: Function that receives `(id, external)` and returns whether the module has side effects.
1076
+ *
1077
+ * **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.
1078
+ *
1079
+ * > [!NOTE]
1080
+ * > **Performance: Prefer `ModuleSideEffectsRule[]` over functions**
1081
+ * >
1082
+ * > 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.
1083
+ * >
1084
+ * > **Functions should be a last resort**: Only use the function signature when your logic cannot be expressed with patterns or simple string matching.
1085
+ * >
1086
+ * > **Rule advantages**: `ModuleSideEffectsRule[]` provides better performance by avoiding Rust-JavaScript runtime calls, clearer intent, and easier maintenance.
1087
+ *
1088
+ * @example
1089
+ * ```js
1090
+ * // Assume no modules have side effects (aggressive tree-shaking)
1091
+ * treeshake: {
1092
+ * moduleSideEffects: false
1093
+ * }
1094
+ *
1095
+ * // Only specific modules have side effects (string array)
1096
+ * treeshake: {
1097
+ * moduleSideEffects: [
1098
+ * 'lodash',
1099
+ * 'react-dom',
1100
+ * ]
1101
+ * }
1102
+ *
1103
+ * // Use rules for pattern matching and granular control
1104
+ * treeshake: {
1105
+ * moduleSideEffects: [
1106
+ * { test: /^node:/, sideEffects: true },
1107
+ * { test: /\.css$/, sideEffects: true },
1108
+ * { test: /some-package/, sideEffects: false, external: false },
1109
+ * ]
1110
+ * }
1111
+ *
1112
+ * // Custom function to determine side effects
1113
+ * treeshake: {
1114
+ * moduleSideEffects: (id, external) => {
1115
+ * if (external) return false; // external modules have no side effects
1116
+ * return id.includes('/side-effects/') || id.endsWith('.css');
1117
+ * }
1118
+ * }
1119
+ *
1120
+ * // Assume no external modules have side effects
1121
+ * treeshake: {
1122
+ * moduleSideEffects: 'no-external',
1123
+ * }
1124
+ * ```
1125
+ *
1126
+ * **Common Use Cases:**
1127
+ * - **CSS files**: `{ test: /\.css$/, sideEffects: true }` - preserve CSS imports
1128
+ * - **Polyfills**: Add specific polyfill modules to the array
1129
+ * - **Plugins**: Modules that register themselves globally on import
1130
+ * - **Library development**: Set to `false` for libraries where unused exports should be removed
1131
+ * @default true
1132
+ */
946
1133
  moduleSideEffects?: ModuleSideEffectsOption;
1134
+ /**
1135
+ * Whether to respect `/*@__PURE__*\/` annotations and other tree-shaking hints in the code.
1136
+ * @default true
1137
+ */
947
1138
  annotations?: boolean;
1139
+ /**
1140
+ * Array of function names that should be considered pure (no side effects) even if they can't be automatically detected as pure
1141
+ *
1142
+ * @example
1143
+ * ```js
1144
+ * treeshake: {
1145
+ * manualPureFunctions: ['console.log', 'debug.trace']
1146
+ * }
1147
+ * ```
1148
+ * @default []
1149
+ */
948
1150
  manualPureFunctions?: readonly string[];
1151
+ /**
1152
+ * Whether to assume that accessing unknown global properties might have side effects.
1153
+ * @default true
1154
+ */
949
1155
  unknownGlobalSideEffects?: boolean;
1156
+ /**
1157
+ * 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.
1158
+ *
1159
+ * This option allows rolldown to analyze `exports.property` assignments in CommonJS modules and remove unused exports while preserving the module's side effects.
1160
+ *
1161
+ * @example
1162
+ * ```js
1163
+ * // source.js (CommonJS)
1164
+ * exports.used = 'This will be kept';
1165
+ * exports.unused = 'This will be tree-shaken away';
1166
+ *
1167
+ * // main.js
1168
+ * import { used } from './source.js';
1169
+ * // With commonjs: true, only the 'used' export is included in the bundle
1170
+ * // With commonjs: false, both exports are included
1171
+ * ```
1172
+ * @default true
1173
+ */
950
1174
  commonjs?: boolean;
1175
+ /**
1176
+ * Controls whether reading properties from objects is considered to have side effects. Set to `always` for more conservative behavior.
1177
+ * @default false
1178
+ */
951
1179
  propertyReadSideEffects?: false | "always";
1180
+ /**
1181
+ * Controls whether writing properties to objects is considered to have side effects. Set to `always` for conservative behavior.
1182
+ * @default 'always'
1183
+ */
952
1184
  propertyWriteSideEffects?: false | "always";
953
1185
  };
954
1186
  //#endregion
955
1187
  //#region src/types/output-bundle.d.ts
1188
+ /** @category Plugin APIs */
956
1189
  interface OutputBundle {
957
1190
  [fileName: string]: OutputAsset | OutputChunk;
958
1191
  }
@@ -961,6 +1194,7 @@ interface OutputBundle {
961
1194
  type RolldownOptionsFunction = (commandLineArguments: Record<string, any>) => MaybePromise<RolldownOptions | RolldownOptions[]>;
962
1195
  //#endregion
963
1196
  //#region src/types/sourcemap.d.ts
1197
+ /** @category Plugin APIs */
964
1198
  interface ExistingRawSourceMap {
965
1199
  file?: string | null;
966
1200
  mappings: string;
@@ -974,6 +1208,7 @@ interface ExistingRawSourceMap {
974
1208
  type SourceMapInput = ExistingRawSourceMap | string | null;
975
1209
  //#endregion
976
1210
  //#region src/version.d.ts
1211
+ /** @category Plugin APIs */
977
1212
  declare const VERSION: string;
978
1213
  //#endregion
979
1214
  //#region src/builtin-plugin/utils.d.ts
@@ -999,7 +1234,7 @@ declare const ENUMERATED_PLUGIN_HOOK_NAMES: [...typeof ENUMERATED_INPUT_PLUGIN_H
999
1234
  * }
1000
1235
  * ```
1001
1236
  */
1002
- type DefinedHookNames = { readonly [K in typeof ENUMERATED_PLUGIN_HOOK_NAMES[number]]: K };
1237
+ type DefinedHookNames = { readonly [K in (typeof ENUMERATED_PLUGIN_HOOK_NAMES)[number]]: K };
1003
1238
  /**
1004
1239
  * Names of all defined hooks. It's like
1005
1240
  * ```js
@@ -1023,43 +1258,55 @@ declare function withFilter<A, T extends RolldownPluginOption<A>>(pluginOption:
1023
1258
  //#endregion
1024
1259
  //#region src/plugin/index.d.ts
1025
1260
  type ModuleSideEffects = boolean | "no-treeshake" | null;
1261
+ /** @category Plugin APIs */
1026
1262
  type ModuleType = "js" | "jsx" | "ts" | "tsx" | "json" | "text" | "base64" | "dataurl" | "binary" | "empty" | (string & {});
1263
+ /** @category Plugin APIs */
1027
1264
  type ImportKind = BindingHookResolveIdExtraArgs["kind"];
1265
+ /** @category Plugin APIs */
1028
1266
  interface CustomPluginOptions {
1029
1267
  [plugin: string]: any;
1030
1268
  }
1269
+ /** @category Plugin APIs */
1031
1270
  interface ModuleOptions {
1032
1271
  moduleSideEffects: ModuleSideEffects;
1033
1272
  meta: CustomPluginOptions;
1034
1273
  invalidate?: boolean;
1035
1274
  packageJsonPath?: string;
1036
1275
  }
1276
+ /** @category Plugin APIs */
1037
1277
  interface ResolvedId extends ModuleOptions {
1038
1278
  external: boolean | "absolute";
1039
1279
  id: string;
1040
1280
  }
1281
+ /** @category Plugin APIs */
1041
1282
  interface PartialResolvedId extends Partial<PartialNull<ModuleOptions>> {
1042
1283
  external?: boolean | "absolute" | "relative";
1043
1284
  id: string;
1044
1285
  }
1286
+ /** @category Plugin APIs */
1045
1287
  interface SourceDescription extends Partial<PartialNull<ModuleOptions>> {
1046
1288
  code: string;
1047
1289
  map?: SourceMapInput;
1048
1290
  moduleType?: ModuleType;
1049
1291
  }
1292
+ /** @category Plugin APIs */
1050
1293
  interface ResolveIdExtraOptions {
1051
1294
  custom?: CustomPluginOptions;
1052
1295
  isEntry: boolean;
1053
1296
  kind: BindingHookResolveIdExtraArgs["kind"];
1054
1297
  }
1298
+ /** @category Plugin APIs */
1055
1299
  type ResolveIdResult = string | NullValue | false | PartialResolvedId;
1300
+ /** @category Plugin APIs */
1056
1301
  type LoadResult = NullValue | string | SourceDescription;
1302
+ /** @category Plugin APIs */
1057
1303
  type TransformResult = NullValue | string | (Omit<SourceDescription, "code"> & {
1058
1304
  code?: string | BindingMagicString;
1059
1305
  });
1060
1306
  type RenderedChunkMeta = {
1061
1307
  chunks: Record<string, RenderedChunk>;
1062
1308
  };
1309
+ /** @category Plugin APIs */
1063
1310
  interface FunctionPluginHooks {
1064
1311
  [DEFINED_HOOK_NAMES.onLog]: (this: MinimalPluginContext, level: LogLevel, log: RollupLog) => NullValue | boolean;
1065
1312
  [DEFINED_HOOK_NAMES.options]: (this: MinimalPluginContext, options: InputOptions) => NullValue | InputOptions;
@@ -1099,16 +1346,20 @@ type PluginOrder = "pre" | "post" | null;
1099
1346
  type ObjectHookMeta = {
1100
1347
  order?: PluginOrder;
1101
1348
  };
1349
+ /** @category Plugin APIs */
1102
1350
  type ObjectHook<T, O = {}> = T | ({
1103
1351
  handler: T;
1104
1352
  } & ObjectHookMeta & O);
1105
1353
  type SyncPluginHooks = DefinedHookNames["augmentChunkHash" | "onLog" | "outputOptions"];
1354
+ /** @category Plugin APIs */
1106
1355
  type AsyncPluginHooks = Exclude<keyof FunctionPluginHooks, SyncPluginHooks>;
1107
1356
  type FirstPluginHooks = DefinedHookNames["load" | "resolveDynamicImport" | "resolveId"];
1108
1357
  type SequentialPluginHooks = DefinedHookNames["augmentChunkHash" | "generateBundle" | "onLog" | "options" | "outputOptions" | "renderChunk" | "transform"];
1109
1358
  type AddonHooks = DefinedHookNames["banner" | "footer" | "intro" | "outro"];
1110
1359
  type OutputPluginHooks = DefinedHookNames["augmentChunkHash" | "generateBundle" | "outputOptions" | "renderChunk" | "renderError" | "renderStart" | "writeBundle"];
1360
+ /** @internal */
1111
1361
  type ParallelPluginHooks = Exclude<keyof FunctionPluginHooks | AddonHooks, FirstPluginHooks | SequentialPluginHooks>;
1362
+ /** @category Plugin APIs */
1112
1363
  type HookFilterExtension<K$1 extends keyof FunctionPluginHooks> = K$1 extends "transform" ? {
1113
1364
  filter?: TUnionWithTopLevelFilterExpressionArray<HookFilter>;
1114
1365
  } : K$1 extends "load" ? {
@@ -1133,6 +1384,7 @@ type AddonHook = string | AddonHookFunction;
1133
1384
  interface OutputPlugin extends Partial<{ [K in keyof PluginHooks as K & OutputPluginHooks]: PluginHooks[K] }>, Partial<{ [K in AddonHooks]: ObjectHook<AddonHook> }> {
1134
1385
  name: string;
1135
1386
  }
1387
+ /** @category Plugin APIs */
1136
1388
  interface Plugin<A = any> extends OutputPlugin, Partial<PluginHooks> {
1137
1389
  api?: A;
1138
1390
  }
@@ -1145,85 +1397,6 @@ type RolldownOutputPluginOption = MaybePromise<NullValue<RolldownOutputPlugin> |
1145
1397
  name: string;
1146
1398
  } | false | RolldownOutputPluginOption[]>;
1147
1399
  //#endregion
1148
- //#region src/options/generated/checks-options.d.ts
1149
- interface ChecksOptions {
1150
- /**
1151
- * Whether to emit warning when detecting circular dependency
1152
- * @default false
1153
- */
1154
- circularDependency?: boolean;
1155
- /**
1156
- * Whether to emit warning when detecting eval
1157
- * @default true
1158
- */
1159
- eval?: boolean;
1160
- /**
1161
- * Whether to emit warning when detecting missing global name
1162
- * @default true
1163
- */
1164
- missingGlobalName?: boolean;
1165
- /**
1166
- * Whether to emit warning when detecting missing name option for iife export
1167
- * @default true
1168
- */
1169
- missingNameOptionForIifeExport?: boolean;
1170
- /**
1171
- * Whether to emit warning when detecting mixed exports
1172
- * @default true
1173
- */
1174
- mixedExports?: boolean;
1175
- /**
1176
- * Whether to emit warning when detecting unresolved entry
1177
- * @default true
1178
- */
1179
- unresolvedEntry?: boolean;
1180
- /**
1181
- * Whether to emit warning when detecting unresolved import
1182
- * @default true
1183
- */
1184
- unresolvedImport?: boolean;
1185
- /**
1186
- * Whether to emit warning when detecting filename conflict
1187
- * @default true
1188
- */
1189
- filenameConflict?: boolean;
1190
- /**
1191
- * Whether to emit warning when detecting common js variable in esm
1192
- * @default true
1193
- */
1194
- commonJsVariableInEsm?: boolean;
1195
- /**
1196
- * Whether to emit warning when detecting import is undefined
1197
- * @default true
1198
- */
1199
- importIsUndefined?: boolean;
1200
- /**
1201
- * Whether to emit warning when detecting empty import meta
1202
- * @default true
1203
- */
1204
- emptyImportMeta?: boolean;
1205
- /**
1206
- * Whether to emit warning when detecting configuration field conflict
1207
- * @default true
1208
- */
1209
- configurationFieldConflict?: boolean;
1210
- /**
1211
- * Whether to emit warning when detecting prefer builtin feature
1212
- * @default true
1213
- */
1214
- preferBuiltinFeature?: boolean;
1215
- /**
1216
- * Whether to emit warning when detecting could not clean directory
1217
- * @default true
1218
- */
1219
- couldNotCleanDirectory?: boolean;
1220
- /**
1221
- * Whether to emit warning when detecting plugin timings
1222
- * @default true
1223
- */
1224
- pluginTimings?: boolean;
1225
- }
1226
- //#endregion
1227
1400
  //#region src/options/transform-options.d.ts
1228
1401
  interface TransformOptions extends Omit<TransformOptions$1, "sourceType" | "lang" | "cwd" | "sourcemap" | "define" | "inject" | "jsx"> {
1229
1402
  /**
@@ -1360,7 +1533,8 @@ type OptimizationOptions = {
1360
1533
  *
1361
1534
  * When enabled, constant values from imported modules will be inlined at their usage sites,
1362
1535
  * potentially reducing bundle size and improving runtime performance by eliminating variable lookups.
1363
- * **options**:
1536
+ *
1537
+ * **Options:**
1364
1538
  * - `true`: equivalent to `{ mode: 'all', pass: 1 }`, enabling constant inlining for all eligible constants with a single pass.
1365
1539
  * - `false`: Disable constant inlining
1366
1540
  * - `{ mode: 'smart' | 'all', pass?: number }`:
@@ -1374,7 +1548,7 @@ type OptimizationOptions = {
1374
1548
  * - `mode: 'all'`: Inline all imported constants wherever they are used.
1375
1549
  * - `pass`: Number of passes to perform for inlining constants.
1376
1550
  *
1377
- * **example**
1551
+ * @example
1378
1552
  * ```js
1379
1553
  * // Input files:
1380
1554
  * // constants.js
@@ -1408,18 +1582,44 @@ type ChunkModulesOrder = "exec-order" | "module-id";
1408
1582
  type OnLogFunction = (level: LogLevel, log: RollupLog, defaultHandler: LogOrStringHandler) => void;
1409
1583
  type OnwarnFunction = (warning: RollupLog, defaultHandler: (warning: RollupLogWithString | (() => RollupLogWithString)) => void) => void;
1410
1584
  interface InputOptions {
1585
+ /**
1586
+ * Defines entries and location(s) of entry modules for the bundle. Relative paths are resolved based on the `cwd` option.
1587
+ * {@include ./docs/input.md}
1588
+ */
1411
1589
  input?: InputOption;
1412
1590
  plugins?: RolldownPluginOption;
1591
+ /**
1592
+ * Specifies which modules should be treated as external and not bundled. External modules will be left as import statements in the output.
1593
+ * {@include ./docs/external.md}
1594
+ */
1413
1595
  external?: ExternalOption;
1414
1596
  resolve?: {
1415
1597
  /**
1598
+ * @example
1599
+ * ```js
1600
+ * resolve: {
1601
+ * alias: {
1602
+ * '@': '/src',
1603
+ * 'utils': './src/utils',
1604
+ * }
1605
+ * }
1606
+ * ```
1416
1607
  * > [!WARNING]
1417
1608
  * > `resolve.alias` will not call `resolveId` hooks of other plugin.
1418
1609
  * > If you want to call `resolveId` hooks of other plugin, use `viteAliasPlugin` from `rolldown/experimental` instead.
1419
1610
  * > You could find more discussion in [this issue](https://github.com/rolldown/rolldown/issues/3615)
1420
1611
  */
1421
1612
  alias?: Record<string, string[] | string | false>;
1613
+ /**
1614
+ * Fields in package.json to check for aliased paths.
1615
+ */
1422
1616
  aliasFields?: string[][];
1617
+ /**
1618
+ * Condition names to use when resolving exports in package.json. Defaults based on platform and import kind:
1619
+ * - **Browser platform**: `["import", "browser", "default"]` for import statements, `["require", "browser", "default"]` for require() calls
1620
+ * - **Node platform**: `["import", "node", "default"]` for import statements, `["require", "node", "default"]` for require() calls
1621
+ * - **Neutral platform**: `["import", "default"]` for import statements, `["require", "default"]` for require() calls
1622
+ */
1423
1623
  conditionNames?: string[];
1424
1624
  /**
1425
1625
  * Map of extensions to alternative extensions.
@@ -1428,17 +1628,46 @@ interface InputOptions {
1428
1628
  * You can achieve this by setting: `extensionAlias: { '.js': ['.ts', '.js'] }`.
1429
1629
  */
1430
1630
  extensionAlias?: Record<string, string[]>;
1631
+ /**
1632
+ * Fields in package.json to check for exports.
1633
+ */
1431
1634
  exportsFields?: string[][];
1635
+ /**
1636
+ * Extensions to try when resolving files. These are tried in order from first to last.
1637
+ * @default ['.tsx', '.ts', '.jsx', '.js', '.json']
1638
+ */
1432
1639
  extensions?: string[];
1640
+ /**
1641
+ * Fields in package.json to check for entry points. Defaults based on platform:
1642
+ * - **Node**: `['main', 'module']`
1643
+ * - **Browser**: `['browser', 'module', 'main']`
1644
+ * - **Neutral**: `[]` (relies on exports field)
1645
+ */
1433
1646
  mainFields?: string[];
1647
+ /**
1648
+ * Filenames to try when resolving directories.
1649
+ * @default ['index']
1650
+ */
1434
1651
  mainFiles?: string[];
1652
+ /**
1653
+ * Directories to search for modules.
1654
+ * @default ['node_modules']
1655
+ */
1435
1656
  modules?: string[];
1657
+ /**
1658
+ * Whether to follow symlinks when resolving modules.
1659
+ * @default true
1660
+ */
1436
1661
  symlinks?: boolean;
1437
1662
  /**
1438
1663
  * @deprecated Use the top-level `tsconfig` option instead.
1439
1664
  */
1440
1665
  tsconfigFilename?: string;
1441
1666
  };
1667
+ /**
1668
+ * The working directory to use when resolving relative paths in the configuration.
1669
+ * @default process.cwd()
1670
+ */
1442
1671
  cwd?: string;
1443
1672
  /**
1444
1673
  * Expected platform where the code run.
@@ -1451,55 +1680,147 @@ interface InputOptions {
1451
1680
  * @default
1452
1681
  * - 'node' if the format is 'cjs'
1453
1682
  * - 'browser' for other formats
1683
+ * {@include ./docs/platform.md}
1454
1684
  */
1455
1685
  platform?: "node" | "browser" | "neutral";
1686
+ /**
1687
+ * When `true`, creates shim variables for missing exports instead of throwing an error.
1688
+ * @default false
1689
+ * {@include ./docs/shim-missing-exports.md}
1690
+ */
1456
1691
  shimMissingExports?: boolean;
1692
+ /**
1693
+ * Controls tree-shaking (dead code elimination). When `true`, unused code will be removed from the bundle to reduce bundle size.
1694
+ * @default true
1695
+ */
1457
1696
  treeshake?: boolean | TreeshakingOptions;
1697
+ /**
1698
+ * Controls the verbosity of console logging during the build.
1699
+ * @default 'info'
1700
+ */
1458
1701
  logLevel?: LogLevelOption;
1702
+ /**
1703
+ * Custom handler for logs. Called for each log message before it's written to the console.
1704
+ */
1459
1705
  onLog?: OnLogFunction;
1706
+ /**
1707
+ * Custom handler for warnings during the build process.
1708
+ * @deprecated
1709
+ * :::: warning Deprecated
1710
+ * This is a legacy API. Consider using `onLog` instead for better control over all log types.
1711
+ * ::: details Migration to `onLog`
1712
+ * To migrate from `onwarn` to `onLog`, check the `level` parameter to filter for
1713
+ * warnings:
1714
+ * ```js
1715
+ * // Before: Using `onwarn`
1716
+ * export default {
1717
+ * onwarn(warning, defaultHandler) {
1718
+ * // Suppress certain warnings
1719
+ * if (warning.code === 'CIRCULAR_DEPENDENCY') return;
1720
+ * // Handle other warnings with default behavior
1721
+ * defaultHandler(warning);
1722
+ * },
1723
+ * };
1724
+ * ```
1725
+ * ```js
1726
+ * // After: Using `onLog`
1727
+ * export default {
1728
+ * onLog(level, log, defaultHandler) {
1729
+ * // Handle only warnings (same behavior as `onwarn`)
1730
+ * if (level === 'warn') {
1731
+ * // Suppress certain warnings
1732
+ * if (log.code === 'CIRCULAR_DEPENDENCY') return;
1733
+ * // Handle other warnings with default behavior
1734
+ * defaultHandler(level, log);
1735
+ * } else {
1736
+ * // Let other log levels pass through
1737
+ * defaultHandler(level, log);
1738
+ * }
1739
+ * },
1740
+ * };
1741
+ * ```
1742
+ * :::
1743
+ * ::::
1744
+ */
1460
1745
  onwarn?: OnwarnFunction;
1746
+ /**
1747
+ * 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.
1748
+ */
1461
1749
  moduleTypes?: ModuleTypes;
1750
+ /**
1751
+ * Experimental features that may change in future releases and can introduce behavior change without a major version bump.
1752
+ */
1462
1753
  experimental?: {
1463
1754
  /**
1464
1755
  * Lets modules be executed in the order they are declared.
1465
1756
  *
1466
- * - Type: `boolean`
1467
- * - Default: `false`
1468
- *
1469
1757
  * 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.
1470
1758
  *
1471
1759
  * > [!WARNING]
1472
1760
  * > Enabling this option may negatively increase bundle size. It is recommended to use this option only when absolutely necessary.
1761
+ * @default false
1473
1762
  */
1474
1763
  strictExecutionOrder?: boolean;
1764
+ /**
1765
+ * Disable live bindings for exported variables.
1766
+ * @default false
1767
+ */
1475
1768
  disableLiveBindings?: boolean;
1769
+ /**
1770
+ * Enable Vite compatible mode.
1771
+ * @default false
1772
+ */
1476
1773
  viteMode?: boolean;
1774
+ /**
1775
+ * When enabled, `new URL()` calls will be transformed to a stable asset URL which includes the updated name and content hash.
1776
+ * It is necessary to pass `import.meta.url` as the second argument to the
1777
+ * `new URL` constructor, otherwise no transform will be applied.
1778
+ * :::warning
1779
+ * 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.
1780
+ *
1781
+ * The expected behavior for JS/TS files is still being discussed and may
1782
+ * change in future releases. See [#7258](https://github.com/rolldown/rolldown/issues/7258) for more context.
1783
+ * :::
1784
+ * @example
1785
+ * ```js
1786
+ * // main.js
1787
+ * const url = new URL('./styles.css', import.meta.url);
1788
+ * console.log(url);
1789
+ *
1790
+ * // Example output after bundling WITHOUT the option (default)
1791
+ * const url = new URL('./styles.css', import.meta.url);
1792
+ * console.log(url);
1793
+ *
1794
+ * // Example output after bundling WITH `experimental.resolveNewUrlToAsset` set to `true`
1795
+ * const url = new URL('assets/styles-CjdrdY7X.css', import.meta.url);
1796
+ * console.log(url);
1797
+ * ```
1798
+ * @default false
1799
+ */
1477
1800
  resolveNewUrlToAsset?: boolean;
1478
1801
  devMode?: DevModeOptions;
1479
1802
  /**
1480
- * Control which order should use when rendering modules in chunk
1481
- *
1482
- * - Type: `'exec-order' | 'module-id'
1483
- * - Default: `'exec-order'`
1803
+ * Control which order should use when rendering modules in chunk.
1484
1804
  *
1805
+ * Available options:
1485
1806
  * - `exec-order`: Almost equivalent to the topological order of the module graph, but specially handling when module graph has cycle.
1486
1807
  * - `module-id`: This is more friendly for gzip compression, especially for some javascript static asset lib (e.g. icon library)
1487
1808
  * > [!NOTE]
1488
1809
  * > 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).
1810
+ * @default 'exec-order'
1489
1811
  */
1490
1812
  chunkModulesOrder?: ChunkModulesOrder;
1491
1813
  /**
1492
1814
  * Attach debug information to the output bundle.
1493
1815
  *
1494
- * - Type: `'none' | 'simple' | 'full'`
1495
- * - Default: `'simple'`
1496
- *
1816
+ * Available modes:
1497
1817
  * - `none`: No debug information is attached.
1498
1818
  * - `simple`: Attach comments indicating which files the bundled code comes from. These comments could be removed by the minifier.
1499
1819
  * - `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.
1500
1820
  *
1501
1821
  * > [!WARNING]
1502
1822
  * > You shouldn't use `full` in the production build.
1823
+ * @default 'simple'
1503
1824
  */
1504
1825
  attachDebugInfo?: AttachDebugOptions;
1505
1826
  /**
@@ -1513,8 +1834,7 @@ interface InputOptions {
1513
1834
  * (default `"/"`) can be applied to all paths. The resulting JSON is a valid import map and can be
1514
1835
  * directly injected into HTML via `<script type="importmap">`.
1515
1836
  *
1516
- * Example configuration snippet:
1517
- *
1837
+ * @example
1518
1838
  * ```js
1519
1839
  * {
1520
1840
  * experimental: {
@@ -1546,31 +1866,38 @@ interface InputOptions {
1546
1866
  * }
1547
1867
  * ```
1548
1868
  *
1549
- * > [!NOTE]
1869
+ * > [!TIP]
1550
1870
  * > 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)
1871
+ * @default false
1551
1872
  */
1552
1873
  chunkImportMap?: boolean | {
1553
1874
  baseUrl?: string;
1554
1875
  fileName?: string;
1555
1876
  };
1877
+ /**
1878
+ * Enable on-demand wrapping of modules.
1879
+ * @default false
1880
+ */
1556
1881
  onDemandWrapping?: boolean;
1557
1882
  /**
1558
- * Required to be used with `watch` mode.
1883
+ * Enable incremental build support. Required to be used with `watch` mode.
1884
+ * @default false
1559
1885
  */
1560
1886
  incrementalBuild?: boolean;
1887
+ /**
1888
+ * Enable high-resolution source maps for transform operations.
1889
+ * @default false
1890
+ */
1561
1891
  transformHiresSourcemap?: boolean | "boundary";
1562
1892
  /**
1563
1893
  * Use native Rust implementation of MagicString for source map generation.
1564
1894
  *
1565
- * - Type: `boolean`
1566
- * - Default: `false`
1567
- *
1568
1895
  * [MagicString](https://github.com/rich-harris/magic-string) is a JavaScript library commonly used by bundlers
1569
1896
  * for string manipulation and source map generation. When enabled, rolldown will use a native Rust
1570
1897
  * implementation of MagicString instead of the JavaScript version, providing significantly better performance
1571
1898
  * during source map generation and code transformation.
1572
1899
  *
1573
- * ## Benefits
1900
+ * **Benefits**
1574
1901
  *
1575
1902
  * - **Improved Performance**: The native Rust implementation is typically faster than the JavaScript version,
1576
1903
  * especially for large codebases with extensive source maps.
@@ -1579,8 +1906,7 @@ interface InputOptions {
1579
1906
  * reduce overall build times when working with JavaScript transform hooks.
1580
1907
  * - **Better Integration**: Seamless integration with rolldown's native Rust architecture.
1581
1908
  *
1582
- * ## Example
1583
- *
1909
+ * @example
1584
1910
  * ```js
1585
1911
  * export default {
1586
1912
  * experimental: {
@@ -1596,6 +1922,7 @@ interface InputOptions {
1596
1922
  * > This is an experimental feature. While it aims to provide identical behavior to the JavaScript
1597
1923
  * > implementation, there may be edge cases. Please report any discrepancies you encounter.
1598
1924
  * > For a complete working example, see [examples/native-magic-string](https://github.com/rolldown/rolldown/tree/main/examples/native-magic-string)
1925
+ * @default false
1599
1926
  */
1600
1927
  nativeMagicString?: boolean;
1601
1928
  };
@@ -1618,33 +1945,52 @@ interface InputOptions {
1618
1945
  */
1619
1946
  transform?: TransformOptions;
1620
1947
  watch?: WatcherOptions | false;
1948
+ /**
1949
+ * Controls which warnings are emitted during the build process. Each option can be set to `true` (emit warning) or `false` (suppress warning).
1950
+ */
1621
1951
  checks?: ChecksOptions;
1622
1952
  makeAbsoluteExternalsRelative?: MakeAbsoluteExternalsRelative;
1623
- debug?: {
1953
+ devtools?: {
1624
1954
  sessionId?: string;
1625
1955
  };
1956
+ /**
1957
+ * 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.
1958
+ * @default 'strict'
1959
+ * {@include ./docs/preserve-entry-signatures.md}
1960
+ */
1626
1961
  preserveEntrySignatures?: false | "strict" | "allow-extension" | "exports-only";
1962
+ /**
1963
+ * Configure optimization features for the bundler.
1964
+ */
1627
1965
  optimization?: OptimizationOptions;
1966
+ /**
1967
+ * 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.
1968
+ * @example
1969
+ * **Set custom context**
1970
+ * ```js
1971
+ * export default {
1972
+ * context: 'globalThis',
1973
+ * output: {
1974
+ * format: 'iife',
1975
+ * },
1976
+ * };
1977
+ * ```
1978
+ * **Use window for browser builds**
1979
+ * ```js
1980
+ * export default {
1981
+ * context: 'window',
1982
+ * platform: 'browser',
1983
+ * output: {
1984
+ * format: 'iife',
1985
+ * },
1986
+ * };
1987
+ * ```
1988
+ * {@include ./docs/context.md}
1989
+ */
1628
1990
  context?: string;
1629
1991
  /**
1630
1992
  * Configures TypeScript configuration file resolution and usage.
1631
- *
1632
- * ## Options
1633
- *
1634
- * - `true`: Auto-discovery mode (similar to Vite). For each module, both resolver and transformer
1635
- * will find the nearest tsconfig.json. If the tsconfig has `references`, the file extension is
1636
- * allowed, and the tsconfig's `include`/`exclude` patterns don't match the file, the referenced
1637
- * tsconfigs will be searched for a match. Falls back to the original tsconfig if no match is found.
1638
- * - `string`: Path to a specific tsconfig.json file (relative to cwd or absolute path).
1639
- *
1640
- * ## What's used from tsconfig
1641
- *
1642
- * - **Resolver**: Uses `compilerOptions.paths` and `compilerOptions.baseUrl` for path mapping
1643
- * - **Transformer**: Uses select compiler options (jsx, decorators, typescript, etc.)
1644
- *
1645
- * > [!NOTE]
1646
- * > Priority: Top-level `transform` options always take precedence over tsconfig settings.
1647
- *
1993
+ * {@include ./docs/tsconfig.md}
1648
1994
  * @default undefined (no tsconfig resolution)
1649
1995
  */
1650
1996
  tsconfig?: true | string;
@@ -1667,4 +2013,4 @@ declare function defineConfig(config: RolldownOptions[]): RolldownOptions[];
1667
2013
  declare function defineConfig(config: RolldownOptionsFunction): RolldownOptionsFunction;
1668
2014
  declare function defineConfig(config: ConfigExport): ConfigExport;
1669
2015
  //#endregion
1670
- export { RolldownFsModule as $, BuiltinPlugin as A, RolldownOutput as At, EmittedPrebuiltChunk as B, ResolveIdResult as C, MaybePromise as Ct, SourceDescription as D, OutputChunk as Dt, RolldownPluginOption as E, OutputAsset as Et, OutputBundle as F, MinimalPluginContext as G, PluginContext as H, TreeshakingOptions as I, HookFilter as J, PluginContextMeta as K, TransformPluginContext as L, ExistingRawSourceMap as M, freeExternalMemory as Mt, SourceMapInput as N, ModuleInfo as Nt, TransformResult as O, RenderedChunk as Ot, RolldownOptionsFunction as P, SourcemapIgnoreListOption as Pt, RolldownFileStats as Q, EmittedAsset as R, ResolveIdExtraOptions as S, PreRenderedAsset as St, RolldownPlugin as T, StringOrRegExp as Tt, DefineParallelPluginResult as U, GetModuleInfo as V, defineParallelPlugin as W, BufferEncoding as X, ModuleTypeFilter as Y, RolldownDirectoryEntry as Z, ModuleType as _, GeneratedCodePreset as _t, InputOption as a, watch as at, PartialResolvedId as b, ModuleFormat as bt, OptimizationOptions as c, WatchOptions as ct, CustomPluginOptions as d, BuildOptions as dt, InternalModuleFormat as et, FunctionPluginHooks as f, build as ft, ModuleOptions as g, GeneratedCodeOptions as gt, LoadResult as h, ChunkingContext as ht, ExternalOption as i, WarningHandlerWithDefault as it, VERSION as j, SourceMap as jt, withFilter as k, RenderedModule as kt, WatcherOptions as l, rolldown as lt, ImportKind as m, ChunkFileNamesFunction as mt, ConfigExport as n, NormalizedInputOptions as nt, InputOptions as o, RolldownWatcher as ot, HookFilterExtension as p, AddonFunction as pt, GeneralHookFilter as q, RolldownOptions as r, LoggingFunction as rt, ModuleTypes as s, RolldownWatcherEvent as st, defineConfig as t, NormalizedOutputOptions as tt, AsyncPluginHooks as u, RolldownBuild as ut, ObjectHook as v, GlobalsFunction as vt, ResolvedId as w, PartialNull as wt, Plugin as x, OutputOptions as xt, ParallelPluginHooks as y, MinifyOptions as yt, EmittedFile as z };
2016
+ export { RolldownFsModule as $, BuiltinPlugin as A, RenderedModule as At, EmittedPrebuiltChunk as B, ResolveIdResult as C, PreRenderedAsset as Ct, SourceDescription as D, OutputAsset as Dt, RolldownPluginOption as E, StringOrRegExp as Et, OutputBundle as F, SourcemapIgnoreListOption as Ft, MinimalPluginContext as G, PluginContext as H, TreeshakingOptions as I, HookFilter as J, PluginContextMeta as K, TransformPluginContext as L, ExistingRawSourceMap as M, SourceMap as Mt, SourceMapInput as N, freeExternalMemory as Nt, TransformResult as O, OutputChunk as Ot, RolldownOptionsFunction as P, ModuleInfo as Pt, RolldownFileStats as Q, EmittedAsset as R, ResolveIdExtraOptions as S, OutputOptions as St, RolldownPlugin as T, PartialNull as Tt, DefineParallelPluginResult as U, GetModuleInfo as V, defineParallelPlugin as W, BufferEncoding as X, ModuleTypeFilter as Y, RolldownDirectoryEntry as Z, ModuleType as _, GeneratedCodeOptions as _t, InputOption as a, WarningHandlerWithDefault as at, PartialResolvedId as b, MinifyOptions as bt, OptimizationOptions as c, RolldownWatcherEvent as ct, CustomPluginOptions as d, RolldownBuild as dt, InternalModuleFormat as et, FunctionPluginHooks as f, BuildOptions as ft, ModuleOptions as g, ChunkingContext as gt, LoadResult as h, ChunkFileNamesFunction as ht, ExternalOption as i, LoggingFunction as it, VERSION as j, RolldownOutput as jt, withFilter as k, RenderedChunk as kt, WatcherOptions as l, WatchOptions as lt, ImportKind as m, AddonFunction as mt, ConfigExport as n, NormalizedInputOptions as nt, InputOptions as o, watch as ot, HookFilterExtension as p, build as pt, GeneralHookFilter as q, RolldownOptions as r, ChecksOptions as rt, ModuleTypes as s, RolldownWatcher as st, defineConfig as t, NormalizedOutputOptions as tt, AsyncPluginHooks as u, rolldown as ut, ObjectHook as v, GeneratedCodePreset as vt, ResolvedId as w, MaybePromise as wt, Plugin as x, ModuleFormat as xt, ParallelPluginHooks as y, GlobalsFunction as yt, EmittedFile as z };