rolldown 1.0.0-beta.4-commit.308f68b → 1.0.0-beta.41

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 (133) hide show
  1. package/bin/cli.mjs +2 -0
  2. package/dist/cli.d.mts +1 -0
  3. package/dist/cli.mjs +579 -0
  4. package/dist/config.d.mts +10 -0
  5. package/dist/config.mjs +10 -0
  6. package/dist/experimental-index.d.mts +146 -0
  7. package/dist/experimental-index.mjs +215 -0
  8. package/dist/experimental-runtime-types.d.ts +77 -0
  9. package/dist/filter-index.d.mts +4 -0
  10. package/dist/filter-index.mjs +44 -0
  11. package/dist/index.d.mts +3 -0
  12. package/dist/index.mjs +5 -0
  13. package/dist/parallel-plugin-worker.d.mts +1 -0
  14. package/dist/{esm/parallel-plugin-worker.mjs → parallel-plugin-worker.mjs} +8 -16
  15. package/dist/parallel-plugin.d.mts +14 -0
  16. package/dist/{esm/parallel-plugin.mjs → parallel-plugin.mjs} +0 -1
  17. package/dist/parse-ast-index.d.mts +8 -0
  18. package/dist/parse-ast-index.mjs +3 -0
  19. package/dist/shared/binding-DOpOtI1J.d.mts +1404 -0
  20. package/dist/shared/define-config-BZ_n3PjJ.d.mts +1475 -0
  21. package/dist/shared/load-config-DkgIoWHl.mjs +117 -0
  22. package/dist/{esm/cli.mjs → shared/logger-ClMekpHZ.mjs} +107 -868
  23. package/dist/shared/misc-CQeo-AFx.mjs +22 -0
  24. package/dist/shared/parse-ast-index-D2PcAmXE.mjs +10975 -0
  25. package/dist/shared/{prompt-CxK9euq3.mjs → prompt-R6XhwkxA.mjs} +253 -255
  26. package/dist/shared/src-DkvlJJsC.mjs +4277 -0
  27. package/package.json +63 -77
  28. package/bin/cli.js +0 -2
  29. package/dist/cjs/cli.cjs +0 -1753
  30. package/dist/cjs/experimental-index.cjs +0 -85
  31. package/dist/cjs/index.cjs +0 -8
  32. package/dist/cjs/parallel-plugin-worker.cjs +0 -41
  33. package/dist/cjs/parallel-plugin.cjs +0 -9
  34. package/dist/cjs/parse-ast-index.cjs +0 -4
  35. package/dist/esm/experimental-index.mjs +0 -57
  36. package/dist/esm/index.mjs +0 -4
  37. package/dist/esm/parse-ast-index.mjs +0 -3
  38. package/dist/shared/chunk-qZFfknuJ.cjs +0 -40
  39. package/dist/shared/parse-ast-index-CyX8MVZE.mjs +0 -674
  40. package/dist/shared/parse-ast-index-D7XtMFo4.cjs +0 -719
  41. package/dist/shared/prompt-ZZScCEWI.cjs +0 -854
  42. package/dist/shared/src-DB6mZNTU.mjs +0 -2875
  43. package/dist/shared/src-y8hk77fd.cjs +0 -3056
  44. package/dist/types/api/build.d.ts +0 -18
  45. package/dist/types/api/experimental.d.ts +0 -7
  46. package/dist/types/api/rolldown/index.d.ts +0 -3
  47. package/dist/types/api/rolldown/rolldown-build.d.ts +0 -13
  48. package/dist/types/api/watch/index.d.ts +0 -3
  49. package/dist/types/api/watch/watch-emitter.d.ts +0 -31
  50. package/dist/types/api/watch/watcher.d.ts +0 -13
  51. package/dist/types/binding.d.ts +0 -1456
  52. package/dist/types/builtin-plugin/alias-plugin.d.ts +0 -10
  53. package/dist/types/builtin-plugin/constructors.d.ts +0 -21
  54. package/dist/types/builtin-plugin/replace-plugin.d.ts +0 -28
  55. package/dist/types/builtin-plugin/transform-plugin.d.ts +0 -9
  56. package/dist/types/builtin-plugin/utils.d.ts +0 -8
  57. package/dist/types/cli/arguments/alias.d.ts +0 -16
  58. package/dist/types/cli/arguments/index.d.ts +0 -15
  59. package/dist/types/cli/arguments/normalize.d.ts +0 -12
  60. package/dist/types/cli/arguments/utils.d.ts +0 -8
  61. package/dist/types/cli/colors.d.ts +0 -11
  62. package/dist/types/cli/commands/bundle.d.ts +0 -3
  63. package/dist/types/cli/commands/help.d.ts +0 -1
  64. package/dist/types/cli/index.d.ts +0 -1
  65. package/dist/types/cli/load-config.d.ts +0 -5
  66. package/dist/types/cli/logger.d.ts +0 -5
  67. package/dist/types/constants/plugin-context.d.ts +0 -7
  68. package/dist/types/constants/plugin.d.ts +0 -45
  69. package/dist/types/experimental-index.d.ts +0 -9
  70. package/dist/types/index.d.ts +0 -30
  71. package/dist/types/log/log-handler.d.ts +0 -4
  72. package/dist/types/log/logger.d.ts +0 -6
  73. package/dist/types/log/logging.d.ts +0 -12
  74. package/dist/types/log/logs.d.ts +0 -18
  75. package/dist/types/options/generated/checks-options.d.ts +0 -57
  76. package/dist/types/options/input-options.d.ts +0 -177
  77. package/dist/types/options/normalized-input-options.d.ts +0 -18
  78. package/dist/types/options/normalized-output-options.d.ts +0 -70
  79. package/dist/types/options/output-options.d.ts +0 -182
  80. package/dist/types/options/watch-options.d.ts +0 -5
  81. package/dist/types/parallel-plugin-worker.d.ts +0 -1
  82. package/dist/types/parallel-plugin.d.ts +0 -1
  83. package/dist/types/parse-ast-index.d.ts +0 -5
  84. package/dist/types/plugin/bindingify-build-hooks.d.ts +0 -10
  85. package/dist/types/plugin/bindingify-hook-filter.d.ts +0 -7
  86. package/dist/types/plugin/bindingify-output-hooks.d.ts +0 -14
  87. package/dist/types/plugin/bindingify-plugin-hook-meta.d.ts +0 -8
  88. package/dist/types/plugin/bindingify-plugin.d.ts +0 -16
  89. package/dist/types/plugin/bindingify-watch-hooks.d.ts +0 -5
  90. package/dist/types/plugin/hook-filter.d.ts +0 -48
  91. package/dist/types/plugin/index.d.ts +0 -134
  92. package/dist/types/plugin/minimal-plugin-context.d.ts +0 -23
  93. package/dist/types/plugin/parallel-plugin-implementation.d.ts +0 -10
  94. package/dist/types/plugin/parallel-plugin.d.ts +0 -9
  95. package/dist/types/plugin/plugin-context-data.d.ts +0 -17
  96. package/dist/types/plugin/plugin-context.d.ts +0 -67
  97. package/dist/types/plugin/plugin-driver.d.ts +0 -8
  98. package/dist/types/plugin/transform-plugin-context.d.ts +0 -28
  99. package/dist/types/types/assert.d.ts +0 -14
  100. package/dist/types/types/config-export.d.ts +0 -5
  101. package/dist/types/types/misc.d.ts +0 -40
  102. package/dist/types/types/module-info.d.ts +0 -15
  103. package/dist/types/types/module-side-effects.d.ts +0 -12
  104. package/dist/types/types/output-bundle.d.ts +0 -4
  105. package/dist/types/types/rolldown-options.d.ts +0 -5
  106. package/dist/types/types/rolldown-output.d.ts +0 -66
  107. package/dist/types/types/schema.d.ts +0 -33
  108. package/dist/types/types/sourcemap.d.ts +0 -14
  109. package/dist/types/types/utils.d.ts +0 -13
  110. package/dist/types/utils/asset-source.d.ts +0 -4
  111. package/dist/types/utils/async-flatten.d.ts +0 -1
  112. package/dist/types/utils/bindingify-input-options.d.ts +0 -7
  113. package/dist/types/utils/bindingify-output-options.d.ts +0 -5
  114. package/dist/types/utils/code-frame.d.ts +0 -1
  115. package/dist/types/utils/compose-js-plugins.d.ts +0 -2
  116. package/dist/types/utils/create-bundler-option.d.ts +0 -11
  117. package/dist/types/utils/create-bundler.d.ts +0 -8
  118. package/dist/types/utils/define-config.d.ts +0 -5
  119. package/dist/types/utils/error.d.ts +0 -2
  120. package/dist/types/utils/initialize-parallel-plugins.d.ts +0 -19
  121. package/dist/types/utils/misc.d.ts +0 -6
  122. package/dist/types/utils/normalize-hook.d.ts +0 -7
  123. package/dist/types/utils/normalize-plugin-option.d.ts +0 -13
  124. package/dist/types/utils/normalize-string-or-regex.d.ts +0 -2
  125. package/dist/types/utils/plugin/index.d.ts +0 -2
  126. package/dist/types/utils/resolved-external.d.ts +0 -4
  127. package/dist/types/utils/transform-module-info.d.ts +0 -4
  128. package/dist/types/utils/transform-rendered-chunk.d.ts +0 -4
  129. package/dist/types/utils/transform-rendered-module.d.ts +0 -3
  130. package/dist/types/utils/transform-side-effects.d.ts +0 -3
  131. package/dist/types/utils/transform-sourcemap.d.ts +0 -3
  132. package/dist/types/utils/transform-to-rollup-output.d.ts +0 -11
  133. package/dist/types/utils/validator.d.ts +0 -6
@@ -0,0 +1,1475 @@
1
+ import { BindingBuiltinPluginName, BindingBundlerImpl, BindingHookResolveIdExtraArgs, BindingRenderedChunk, BindingTransformHookExtraArgs, BindingWatcherEvent, MinifyOptions as MinifyOptions$1, ParserOptions, PreRenderedChunk, TransformOptions } from "./binding-DOpOtI1J.mjs";
2
+ import { TopLevelFilterExpression } from "@rolldown/pluginutils";
3
+ import { Program } from "@oxc-project/types";
4
+
5
+ //#region src/log/logging.d.ts
6
+ type LogLevel = "info" | "debug" | "warn";
7
+ type LogLevelOption = LogLevel | "silent";
8
+ type LogLevelWithError = LogLevel | "error";
9
+ interface RollupLog {
10
+ binding?: string;
11
+ cause?: unknown;
12
+ code?: string;
13
+ exporter?: string;
14
+ frame?: string;
15
+ hook?: string;
16
+ id?: string;
17
+ ids?: string[];
18
+ loc?: {
19
+ column: number;
20
+ file?: string;
21
+ line: number;
22
+ };
23
+ message: string;
24
+ meta?: any;
25
+ names?: string[];
26
+ plugin?: string;
27
+ pluginCode?: unknown;
28
+ pos?: number;
29
+ reexporter?: string;
30
+ stack?: string;
31
+ url?: string;
32
+ }
33
+ type RollupLogWithString = RollupLog | string;
34
+ interface RollupError extends RollupLog {
35
+ name?: string;
36
+ stack?: string;
37
+ watchFiles?: string[];
38
+ }
39
+ type LogOrStringHandler = (level: LogLevelWithError, log: RollupLogWithString) => void;
40
+ //#endregion
41
+ //#region src/types/misc.d.ts
42
+ type SourcemapPathTransformOption = (relativeSourcePath: string, sourcemapPath: string) => string;
43
+ type SourcemapIgnoreListOption = (relativeSourcePath: string, sourcemapPath: string) => boolean;
44
+ //#endregion
45
+ //#region src/types/module-info.d.ts
46
+ interface ModuleInfo extends ModuleOptions {
47
+ /**
48
+ * Unsupported at rolldown
49
+ */
50
+ ast: any;
51
+ code: string | null;
52
+ id: string;
53
+ importers: string[];
54
+ dynamicImporters: string[];
55
+ importedIds: string[];
56
+ dynamicallyImportedIds: string[];
57
+ exports: string[];
58
+ isEntry: boolean;
59
+ }
60
+ //#endregion
61
+ //#region src/utils/asset-source.d.ts
62
+ type AssetSource = string | Uint8Array;
63
+ //#endregion
64
+ //#region src/types/rolldown-output.d.ts
65
+ interface OutputAsset {
66
+ type: "asset";
67
+ fileName: string;
68
+ /** @deprecated Use "originalFileNames" instead. */
69
+ originalFileName: string | null;
70
+ originalFileNames: string[];
71
+ source: AssetSource;
72
+ /** @deprecated Use "names" instead. */
73
+ name: string | undefined;
74
+ names: string[];
75
+ }
76
+ interface SourceMap {
77
+ file: string;
78
+ mappings: string;
79
+ names: string[];
80
+ sources: string[];
81
+ sourcesContent: string[];
82
+ version: number;
83
+ debugId?: string;
84
+ x_google_ignoreList?: number[];
85
+ toString(): string;
86
+ toUrl(): string;
87
+ }
88
+ interface RenderedModule {
89
+ readonly code: string | null;
90
+ renderedLength: number;
91
+ renderedExports: string[];
92
+ }
93
+ interface RenderedChunk extends Omit<BindingRenderedChunk, "modules"> {
94
+ type: "chunk";
95
+ modules: {
96
+ [id: string]: RenderedModule;
97
+ };
98
+ name: string;
99
+ isEntry: boolean;
100
+ isDynamicEntry: boolean;
101
+ facadeModuleId: string | null;
102
+ moduleIds: Array<string>;
103
+ exports: Array<string>;
104
+ fileName: string;
105
+ imports: Array<string>;
106
+ dynamicImports: Array<string>;
107
+ }
108
+ interface OutputChunk {
109
+ type: "chunk";
110
+ code: string;
111
+ name: string;
112
+ isEntry: boolean;
113
+ exports: string[];
114
+ fileName: string;
115
+ modules: {
116
+ [id: string]: RenderedModule;
117
+ };
118
+ imports: string[];
119
+ dynamicImports: string[];
120
+ facadeModuleId: string | null;
121
+ isDynamicEntry: boolean;
122
+ moduleIds: string[];
123
+ map: SourceMap | null;
124
+ sourcemapFileName: string | null;
125
+ preliminaryFileName: string;
126
+ }
127
+ interface RolldownOutput {
128
+ output: [OutputChunk, ...(OutputChunk | OutputAsset)[]];
129
+ }
130
+ //#endregion
131
+ //#region src/types/utils.d.ts
132
+ type MaybePromise<T> = T | Promise<T>;
133
+ type NullValue<T = void> = T | undefined | null | void;
134
+ type PartialNull<T> = { [P in keyof T]: T[P] | null };
135
+ type MakeAsync<Function_> = Function_ extends ((this: infer This, ...parameters: infer Arguments) => infer Return) ? (this: This, ...parameters: Arguments) => Return | Promise<Return> : never;
136
+ type MaybeArray<T> = T | T[];
137
+ type StringOrRegExp = string | RegExp;
138
+ //#endregion
139
+ //#region src/options/output-options.d.ts
140
+ type GeneratedCodePreset = "es5" | "es2015";
141
+ interface GeneratedCodeOptions {
142
+ /**
143
+ * Whether to use Symbol.toStringTag for namespace objects.
144
+ * @default false
145
+ */
146
+ symbols?: boolean;
147
+ /**
148
+ * Allows choosing one of the presets listed above while overriding some options.
149
+ *
150
+ * ```js
151
+ * export default {
152
+ * output: {
153
+ * generatedCode: {
154
+ * preset: 'es2015',
155
+ * symbols: false
156
+ * }
157
+ * }
158
+ * };
159
+ * ```
160
+ */
161
+ preset?: GeneratedCodePreset;
162
+ }
163
+ type ModuleFormat = "es" | "cjs" | "esm" | "module" | "commonjs" | "iife" | "umd";
164
+ type AddonFunction = (chunk: RenderedChunk) => string | Promise<string>;
165
+ type ChunkFileNamesFunction = (chunkInfo: PreRenderedChunk) => string;
166
+ interface PreRenderedAsset {
167
+ type: "asset";
168
+ name?: string;
169
+ names: string[];
170
+ originalFileName?: string;
171
+ originalFileNames: string[];
172
+ source: string | Uint8Array;
173
+ }
174
+ type AssetFileNamesFunction = (chunkInfo: PreRenderedAsset) => string;
175
+ type GlobalsFunction = (name: string) => string;
176
+ type MinifyOptions = Omit<MinifyOptions$1, "module" | "sourcemap">;
177
+ interface ChunkingContext {
178
+ getModuleInfo(moduleId: string): ModuleInfo | null;
179
+ }
180
+ interface OutputOptions {
181
+ dir?: string;
182
+ file?: string;
183
+ exports?: "auto" | "named" | "default" | "none";
184
+ hashCharacters?: "base64" | "base36" | "hex";
185
+ /**
186
+ * Expected format of generated code.
187
+ * - `'es'`, `'esm'` and `'module'` are the same format, all stand for ES module.
188
+ * - `'cjs'` and `'commonjs'` are the same format, all stand for CommonJS module.
189
+ * - `'iife'` stands for [Immediately Invoked Function Expression](https://developer.mozilla.org/en-US/docs/Glossary/IIFE).
190
+ * - `'umd'` stands for [Universal Module Definition](https://github.com/umdjs/umd).
191
+ *
192
+ * @default 'esm'
193
+ */
194
+ format?: ModuleFormat;
195
+ sourcemap?: boolean | "inline" | "hidden";
196
+ sourcemapBaseUrl?: string;
197
+ sourcemapDebugIds?: boolean;
198
+ /**
199
+ * Control which source files are included in the sourcemap ignore list.
200
+ * Files in the ignore list are excluded from debugger stepping and error stack traces.
201
+ *
202
+ * - `false`: Include all source files in the ignore list
203
+ * - `true`: Include no source files in the ignore list
204
+ * - `string`: Files containing this string in their path will be included in the ignore list
205
+ * - `RegExp`: Files matching this regular expression will be included in the ignore list
206
+ * - `function`: Custom function `(source: string, sourcemapPath: string) => boolean` to determine if a source should be ignored
207
+ *
208
+ * :::tip Performance
209
+ * Using static values (`boolean`, `string`, or `RegExp`) is significantly more performant than functions.
210
+ * Calling JavaScript functions from Rust has extremely high overhead, so prefer static patterns when possible.
211
+ * :::
212
+ *
213
+ * ## Examples
214
+ * ```js
215
+ * // ✅ Preferred: Use RegExp for better performance
216
+ * sourcemapIgnoreList: /node_modules/
217
+ *
218
+ * // ✅ Preferred: Use string pattern for better performance
219
+ * sourcemapIgnoreList: "vendor"
220
+ *
221
+ * // ! Use sparingly: Function calls have high overhead
222
+ * sourcemapIgnoreList: (source, sourcemapPath) => {
223
+ * return source.includes('node_modules') || source.includes('.min.');
224
+ * }
225
+ * ```
226
+ *
227
+ * **default**: /node_modules/
228
+ */
229
+ sourcemapIgnoreList?: boolean | SourcemapIgnoreListOption | StringOrRegExp;
230
+ sourcemapPathTransform?: SourcemapPathTransformOption;
231
+ banner?: string | AddonFunction;
232
+ footer?: string | AddonFunction;
233
+ intro?: string | AddonFunction;
234
+ outro?: string | AddonFunction;
235
+ extend?: boolean;
236
+ esModule?: boolean | "if-default-prop";
237
+ assetFileNames?: string | AssetFileNamesFunction;
238
+ entryFileNames?: string | ChunkFileNamesFunction;
239
+ chunkFileNames?: string | ChunkFileNamesFunction;
240
+ cssEntryFileNames?: string | ChunkFileNamesFunction;
241
+ cssChunkFileNames?: string | ChunkFileNamesFunction;
242
+ sanitizeFileName?: boolean | ((name: string) => string);
243
+ /**
244
+ * Control code minification.
245
+ *
246
+ * - `true`: Enable full minification including code compression and dead code elimination
247
+ * - `false`: Disable minification (default)
248
+ * - `'dce-only'`: Only perform dead code elimination without code compression
249
+ * - `MinifyOptions`: Fine-grained control over minification settings
250
+ *
251
+ * @default false
252
+ */
253
+ minify?: boolean | "dce-only" | MinifyOptions;
254
+ name?: string;
255
+ globals?: Record<string, string> | GlobalsFunction;
256
+ generatedCode?: Partial<GeneratedCodeOptions>;
257
+ externalLiveBindings?: boolean;
258
+ inlineDynamicImports?: boolean;
259
+ /**
260
+ * - Type: `((moduleId: string, meta: { getModuleInfo: (moduleId: string) => ModuleInfo | null }) => string | NullValue)`
261
+ * - Object form is not supported.
262
+ *
263
+ * :::warning
264
+ * - This option is deprecated. Please use `advancedChunks` instead.
265
+ * - If `manualChunks` and `advancedChunks` are both specified, `manualChunks` option will be ignored.
266
+ * :::
267
+ *
268
+ * You could use this option for migration purpose. Under the hood,
269
+ *
270
+ * ```js
271
+ * {
272
+ * manualChunks: (moduleId, meta) => {
273
+ * if (moduleId.includes('node_modules')) {
274
+ * return 'vendor';
275
+ * }
276
+ * return null;
277
+ * }
278
+ * }
279
+ * ```
280
+ *
281
+ * will be transformed to
282
+ *
283
+ * ```js
284
+ * {
285
+ * advancedChunks: {
286
+ * groups: [
287
+ * {
288
+ * name(moduleId) {
289
+ * if (moduleId.includes('node_modules')) {
290
+ * return 'vendor';
291
+ * }
292
+ * return null;
293
+ * },
294
+ * },
295
+ * ],
296
+ * }
297
+ * }
298
+ *
299
+ * ```
300
+ *
301
+ * @deprecated Please use `advancedChunks` instead.
302
+ */
303
+ manualChunks?: (moduleId: string, meta: {
304
+ getModuleInfo: (moduleId: string) => ModuleInfo | null;
305
+ }) => string | NullValue;
306
+ /**
307
+ * Allows you to do manual chunking. For deeper understanding, please refer to the in-depth [documentation](https://rolldown.rs/guide/in-depth/advanced-chunks).
308
+ */
309
+ advancedChunks?: {
310
+ /**
311
+ * - Type: `boolean`
312
+ * - Default: `true`
313
+ *
314
+ * By default, each group will also include captured modules' dependencies. This reduces the chance of generating circular chunks.
315
+ *
316
+ * If you want to disable this behavior, it's recommended to both set
317
+ * - `preserveEntrySignatures: false`
318
+ * - `strictExecutionOrder: true`
319
+ *
320
+ * to avoid generating invalid chunks.
321
+ */
322
+ includeDependenciesRecursively?: boolean;
323
+ /**
324
+ * - Type: `number`
325
+ *
326
+ * Global fallback of [`{group}.minSize`](#advancedchunks-groups-minsize), if it's not specified in the group.
327
+ */
328
+ minSize?: number;
329
+ /**
330
+ * - Type: `number`
331
+ *
332
+ * Global fallback of [`{group}.maxSize`](#advancedchunks-groups-maxsize), if it's not specified in the group.
333
+ */
334
+ maxSize?: number;
335
+ /**
336
+ * - Type: `number`
337
+ *
338
+ * Global fallback of [`{group}.maxModuleSize`](#advancedchunks-groups-maxmodulesize), if it's not specified in the group.
339
+ */
340
+ maxModuleSize?: number;
341
+ /**
342
+ * - Type: `number`
343
+ *
344
+ * Global fallback of [`{group}.minModuleSize`](#advancedchunks-groups-minmodulesize), if it's not specified in the group.
345
+ */
346
+ minModuleSize?: number;
347
+ /**
348
+ * - Type: `number`
349
+ *
350
+ * Global fallback of [`{group}.minShareCount`](#advancedchunks-groups-minsharecount), if it's not specified in the group.
351
+ */
352
+ minShareCount?: number;
353
+ /**
354
+ * Groups to be used for advanced chunking.
355
+ */
356
+ groups?: {
357
+ /**
358
+ * - Type: `string | ((moduleId: string, ctx: { getModuleInfo: (moduleId: string) => ModuleInfo | null }) => string | NullValue)`
359
+ *
360
+ * Name of the group. It will be also used as the name of the chunk and replaced the `[name]` placeholder in the `chunkFileNames` option.
361
+ *
362
+ * For example,
363
+ *
364
+ * ```js
365
+ * import { defineConfig } from 'rolldown';
366
+ *
367
+ * export default defineConfig({
368
+ * advancedChunks: {
369
+ * groups: [
370
+ * {
371
+ * name: 'libs',
372
+ * test: /node_modules/,
373
+ * },
374
+ * ],
375
+ * },
376
+ * });
377
+ * ```
378
+ * will create a chunk named `libs-[hash].js` in the end.
379
+ *
380
+ * It's ok to have the same name for different groups. Rolldown will deduplicate the chunk names if necessary.
381
+ *
382
+ * # Dynamic `name()`
383
+ *
384
+ * If `name` is a function, it will be called with the module id as the argument. The function should return a string or `null`. If it returns `null`, the module will be ignored by this group.
385
+ *
386
+ * Notice, each returned new name will be treated as a separate group.
387
+ *
388
+ * For example,
389
+ *
390
+ * ```js
391
+ * import { defineConfig } from 'rolldown';
392
+ *
393
+ * export default defineConfig({
394
+ * advancedChunks: {
395
+ * groups: [
396
+ * {
397
+ * name: (moduleId) => moduleId.includes('node_modules') ? 'libs' : 'app',
398
+ * minSize: 100 * 1024,
399
+ * },
400
+ * ],
401
+ * },
402
+ * });
403
+ * ```
404
+ *
405
+ * :::warning
406
+ * Constraints like `minSize`, `maxSize`, etc. are applied separately for different names returned by the function.
407
+ * :::
408
+ */
409
+ name: string | ((moduleId: string, ctx: ChunkingContext) => string | NullValue);
410
+ /**
411
+ * - Type: `string | RegExp | ((id: string) => boolean | undefined | void);`
412
+ *
413
+ * Controls which modules are captured in this group.
414
+ *
415
+ * - If `test` is a string, the module whose id contains the string will be captured.
416
+ * - If `test` is a regular expression, the module whose id matches the regular expression will be captured.
417
+ * - If `test` is a function, modules for which `test(id)` returns `true` will be captured.
418
+ * - If `test` is empty, any module will be considered as matched.
419
+ *
420
+ * :::warning
421
+ * When using regular expression, it's recommended to use `[\\/]` to match the path separator instead of `/` to avoid potential issues on Windows.
422
+ * - ✅ Recommended: `/node_modules[\\/]react/`
423
+ * - ❌ Not recommended: `/node_modules/react/`
424
+ * :::
425
+ */
426
+ test?: StringOrRegExp | ((id: string) => boolean | undefined | void);
427
+ /**
428
+ * - Type: `number`
429
+ * - Default: `0`
430
+ *
431
+ * Priority of the group. Group with higher priority will be chosen first to match modules and create chunks. When converting the group to a chunk, modules of that group will be removed from other groups.
432
+ *
433
+ * If two groups have the same priority, the group whose index is smaller will be chosen.
434
+ *
435
+ * For example,
436
+ *
437
+ * ```js
438
+ * import { defineConfig } from 'rolldown';
439
+ *
440
+ * export default defineConfig({
441
+ * advancedChunks: {
442
+ * groups: [
443
+ * {
444
+ * name: 'react',
445
+ * test: /node_modules[\\/]react/,
446
+ * priority: 1,
447
+ * },
448
+ * {
449
+ * name: 'other-libs',
450
+ * test: /node_modules/,
451
+ * priority: 2,
452
+ * },
453
+ * ],
454
+ * });
455
+ * ```
456
+ *
457
+ * This is a clearly __incorrect__ example. Though `react` group is defined before `other-libs`, it has a lower priority, so the modules in `react` group will be captured in `other-libs` group.
458
+ */
459
+ priority?: number;
460
+ /**
461
+ * - Type: `number`
462
+ * - Default: `0`
463
+ *
464
+ * Minimum size in bytes of the desired chunk. If the accumulated size of the captured modules by this group is smaller than this value, it will be ignored. Modules in this group will fall back to the `automatic chunking` if they are not captured by any other group.
465
+ */
466
+ minSize?: number;
467
+ /**
468
+ * - Type: `number`
469
+ * - Default: `1`
470
+ *
471
+ * Controls if a module should be captured based on how many entry chunks reference it.
472
+ */
473
+ minShareCount?: number;
474
+ /**
475
+ * - Type: `number`
476
+ * - Default: `Infinity`
477
+ *
478
+ * If the accumulated size in bytes of the captured modules by this group is larger than this value, this group will be split into multiple groups that each has size close to this value.
479
+ */
480
+ maxSize?: number;
481
+ /**
482
+ * - Type: `number`
483
+ * - Default: `Infinity`
484
+ *
485
+ * Controls a module could only be captured if its size in bytes is smaller or equal than this value.
486
+ */
487
+ maxModuleSize?: number;
488
+ /**
489
+ * - Type: `number`
490
+ * - Default: `0`
491
+ *
492
+ * Controls a module could only be captured if its size in bytes is larger or equal than this value.
493
+ */
494
+ minModuleSize?: number;
495
+ }[];
496
+ };
497
+ /**
498
+ * Control comments in the output.
499
+ *
500
+ * - `none`: no comments
501
+ * - `inline`: preserve comments that contain `@license`, `@preserve` or starts with `//!` `/*!`
502
+ */
503
+ legalComments?: "none" | "inline";
504
+ plugins?: RolldownOutputPluginOption;
505
+ polyfillRequire?: boolean;
506
+ hoistTransitiveImports?: false;
507
+ preserveModules?: boolean;
508
+ virtualDirname?: string;
509
+ preserveModulesRoot?: string;
510
+ topLevelVar?: boolean;
511
+ /**
512
+ * - Type: `boolean`
513
+ * - Default: `false`
514
+ *
515
+ * Whether to minify internal exports.
516
+ */
517
+ minifyInternalExports?: boolean;
518
+ }
519
+ //#endregion
520
+ //#region src/api/build.d.ts
521
+ interface BuildOptions extends InputOptions {
522
+ /**
523
+ * Write the output to the file system
524
+ *
525
+ * @default true
526
+ */
527
+ write?: boolean;
528
+ output?: OutputOptions;
529
+ }
530
+ declare function build(options: BuildOptions): Promise<RolldownOutput>;
531
+ /**
532
+ * Build multiple outputs __sequentially__.
533
+ */
534
+ declare function build(options: BuildOptions[]): Promise<RolldownOutput[]>;
535
+ //#endregion
536
+ //#region src/api/rolldown/rolldown-build.d.ts
537
+ declare class RolldownBuild {
538
+ #private;
539
+ static asyncRuntimeShutdown: boolean;
540
+ constructor(inputOptions: InputOptions);
541
+ get closed(): boolean;
542
+ scan(): Promise<void>;
543
+ generate(outputOptions?: OutputOptions): Promise<RolldownOutput>;
544
+ write(outputOptions?: OutputOptions): Promise<RolldownOutput>;
545
+ close(): Promise<void>;
546
+ [Symbol.asyncDispose](): Promise<void>;
547
+ get watchFiles(): Promise<string[]>;
548
+ }
549
+ //#endregion
550
+ //#region src/api/rolldown/index.d.ts
551
+ declare const rolldown: (input: InputOptions) => Promise<RolldownBuild>;
552
+ //#endregion
553
+ //#region src/options/watch-options.d.ts
554
+ interface WatchOptions extends InputOptions {
555
+ output?: OutputOptions | OutputOptions[];
556
+ }
557
+ //#endregion
558
+ //#region src/api/watch/watch-emitter.d.ts
559
+ type WatcherEvent = "close" | "event" | "restart" | "change";
560
+ type ChangeEvent$1 = "create" | "update" | "delete";
561
+ type RolldownWatchBuild = BindingBundlerImpl;
562
+ type RolldownWatcherEvent = {
563
+ code: "START";
564
+ } | {
565
+ code: "BUNDLE_START";
566
+ } | {
567
+ code: "BUNDLE_END";
568
+ duration: number;
569
+ output: readonly string[];
570
+ result: RolldownWatchBuild;
571
+ } | {
572
+ code: "END";
573
+ } | {
574
+ code: "ERROR";
575
+ error: Error;
576
+ result: RolldownWatchBuild;
577
+ };
578
+ declare class WatcherEmitter {
579
+ listeners: Map<WatcherEvent, Array<(...parameters: any[]) => MaybePromise<void>>>;
580
+ timer: any;
581
+ constructor();
582
+ on(event: "change", listener: (id: string, change: {
583
+ event: ChangeEvent$1;
584
+ }) => MaybePromise<void>): this;
585
+ on(event: "event", listener: (data: RolldownWatcherEvent) => MaybePromise<void>): this;
586
+ on(event: "restart" | "close", listener: () => MaybePromise<void>): this;
587
+ off(event: WatcherEvent, listener: (...parameters: any[]) => MaybePromise<void>): this;
588
+ clear(event: WatcherEvent): void;
589
+ onEvent(event: BindingWatcherEvent): Promise<void>;
590
+ close(): Promise<void>;
591
+ }
592
+ type RolldownWatcher = WatcherEmitter;
593
+ //#endregion
594
+ //#region src/api/watch/index.d.ts
595
+ declare const watch: (input: WatchOptions | WatchOptions[]) => RolldownWatcher;
596
+ //#endregion
597
+ //#region src/log/log-handler.d.ts
598
+ type LoggingFunction = (log: RollupLog | string | (() => RollupLog | string)) => void;
599
+ type LoggingFunctionWithPosition = (log: RollupLog | string | (() => RollupLog | string), pos?: number | {
600
+ column: number;
601
+ line: number;
602
+ }) => void;
603
+ type WarningHandlerWithDefault = (warning: RollupLog, defaultHandler: LoggingFunction) => void;
604
+ //#endregion
605
+ //#region src/options/normalized-input-options.d.ts
606
+ interface NormalizedInputOptions {
607
+ input: string[] | Record<string, string>;
608
+ cwd: string | undefined;
609
+ platform: InputOptions["platform"];
610
+ shimMissingExports: boolean;
611
+ context: string;
612
+ }
613
+ //#endregion
614
+ //#region src/options/normalized-output-options.d.ts
615
+ type InternalModuleFormat = "es" | "cjs" | "iife" | "umd";
616
+ interface NormalizedOutputOptions {
617
+ name: string | undefined;
618
+ file: string | undefined;
619
+ dir: string | undefined;
620
+ entryFileNames: string | ChunkFileNamesFunction;
621
+ chunkFileNames: string | ChunkFileNamesFunction;
622
+ assetFileNames: string | AssetFileNamesFunction;
623
+ format: InternalModuleFormat;
624
+ exports: NonNullable<OutputOptions["exports"]>;
625
+ sourcemap: boolean | "inline" | "hidden";
626
+ sourcemapBaseUrl: string | undefined;
627
+ cssEntryFileNames: string | ChunkFileNamesFunction;
628
+ cssChunkFileNames: string | ChunkFileNamesFunction;
629
+ inlineDynamicImports: boolean;
630
+ externalLiveBindings: boolean;
631
+ banner: AddonFunction;
632
+ footer: AddonFunction;
633
+ intro: AddonFunction;
634
+ outro: AddonFunction;
635
+ esModule: boolean | "if-default-prop";
636
+ extend: boolean;
637
+ globals: Record<string, string> | GlobalsFunction;
638
+ hashCharacters: "base64" | "base36" | "hex";
639
+ sourcemapDebugIds: boolean;
640
+ sourcemapIgnoreList: boolean | SourcemapIgnoreListOption | StringOrRegExp | undefined;
641
+ sourcemapPathTransform: SourcemapPathTransformOption | undefined;
642
+ minify: false | MinifyOptions | "dce-only";
643
+ legalComments: "none" | "inline";
644
+ polyfillRequire: boolean;
645
+ plugins: RolldownPlugin[];
646
+ preserveModules: boolean;
647
+ virtualDirname: string;
648
+ preserveModulesRoot?: string;
649
+ topLevelVar?: boolean;
650
+ minifyInternalExports?: boolean;
651
+ }
652
+ //#endregion
653
+ //#region src/plugin/fs.d.ts
654
+ interface RolldownFsModule {
655
+ appendFile(path: string, data: string | Uint8Array, options?: {
656
+ encoding?: BufferEncoding | null;
657
+ mode?: string | number;
658
+ flag?: string | number;
659
+ }): Promise<void>;
660
+ copyFile(source: string, destination: string, mode?: string | number): Promise<void>;
661
+ mkdir(path: string, options?: {
662
+ recursive?: boolean;
663
+ mode?: string | number;
664
+ }): Promise<void>;
665
+ mkdtemp(prefix: string): Promise<string>;
666
+ readdir(path: string, options?: {
667
+ withFileTypes?: false;
668
+ }): Promise<string[]>;
669
+ readdir(path: string, options?: {
670
+ withFileTypes: true;
671
+ }): Promise<RolldownDirectoryEntry[]>;
672
+ readFile(path: string, options?: {
673
+ encoding?: null;
674
+ flag?: string | number;
675
+ signal?: AbortSignal;
676
+ }): Promise<Uint8Array>;
677
+ readFile(path: string, options?: {
678
+ encoding: BufferEncoding;
679
+ flag?: string | number;
680
+ signal?: AbortSignal;
681
+ }): Promise<string>;
682
+ realpath(path: string): Promise<string>;
683
+ rename(oldPath: string, newPath: string): Promise<void>;
684
+ rmdir(path: string, options?: {
685
+ recursive?: boolean;
686
+ }): Promise<void>;
687
+ stat(path: string): Promise<RolldownFileStats>;
688
+ lstat(path: string): Promise<RolldownFileStats>;
689
+ unlink(path: string): Promise<void>;
690
+ writeFile(path: string, data: string | Uint8Array, options?: {
691
+ encoding?: BufferEncoding | null;
692
+ mode?: string | number;
693
+ flag?: string | number;
694
+ }): Promise<void>;
695
+ }
696
+ type BufferEncoding = "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "base64url" | "latin1" | "binary" | "hex";
697
+ interface RolldownDirectoryEntry {
698
+ isFile(): boolean;
699
+ isDirectory(): boolean;
700
+ isSymbolicLink(): boolean;
701
+ name: string;
702
+ }
703
+ interface RolldownFileStats {
704
+ isFile(): boolean;
705
+ isDirectory(): boolean;
706
+ isSymbolicLink(): boolean;
707
+ size: number;
708
+ mtime: Date;
709
+ ctime: Date;
710
+ atime: Date;
711
+ birthtime: Date;
712
+ }
713
+ //#endregion
714
+ //#region src/plugin/hook-filter.d.ts
715
+ type GeneralHookFilter<Value = StringOrRegExp> = MaybeArray<Value> | {
716
+ include?: MaybeArray<Value>;
717
+ exclude?: MaybeArray<Value>;
718
+ };
719
+ interface FormalModuleTypeFilter {
720
+ include?: ModuleType[];
721
+ }
722
+ type ModuleTypeFilter = ModuleType[] | FormalModuleTypeFilter;
723
+ interface HookFilter {
724
+ /**
725
+ * This filter is used to do a pre-test to determine whether the hook should be called.
726
+ *
727
+ * @example
728
+ * Include all `id`s that contain `node_modules` in the path.
729
+ * ```js
730
+ * { id: '**'+'/node_modules/**' }
731
+ * ```
732
+ * @example
733
+ * Include all `id`s that contain `node_modules` or `src` in the path.
734
+ * ```js
735
+ * { id: ['**'+'/node_modules/**', '**'+'/src/**'] }
736
+ * ```
737
+ * @example
738
+ * Include all `id`s that start with `http`
739
+ * ```js
740
+ * { id: /^http/ }
741
+ * ```
742
+ * @example
743
+ * Exclude all `id`s that contain `node_modules` in the path.
744
+ * ```js
745
+ * { id: { exclude: '**'+'/node_modules/**' } }
746
+ * ```
747
+ * @example
748
+ * Formal pattern to define includes and excludes.
749
+ * ```
750
+ * { id : {
751
+ * include: ['**'+'/foo/**', /bar/],
752
+ * exclude: ['**'+'/baz/**', /qux/]
753
+ * }}
754
+ * ```
755
+ */
756
+ id?: GeneralHookFilter;
757
+ moduleType?: ModuleTypeFilter;
758
+ code?: GeneralHookFilter;
759
+ }
760
+ type TUnionWithTopLevelFilterExpressionArray<T> = T | TopLevelFilterExpression[];
761
+ //#endregion
762
+ //#region src/plugin/minimal-plugin-context.d.ts
763
+ interface PluginContextMeta {
764
+ rollupVersion: string;
765
+ rolldownVersion: string;
766
+ watchMode: boolean;
767
+ }
768
+ interface MinimalPluginContext {
769
+ readonly pluginName: string;
770
+ error: (e: RollupError | string) => never;
771
+ info: LoggingFunction;
772
+ warn: LoggingFunction;
773
+ debug: LoggingFunction;
774
+ meta: PluginContextMeta;
775
+ }
776
+ //#endregion
777
+ //#region src/plugin/parallel-plugin.d.ts
778
+ type ParallelPlugin = {
779
+ /** @internal */
780
+ _parallel: {
781
+ fileUrl: string;
782
+ options: unknown;
783
+ };
784
+ };
785
+ type DefineParallelPluginResult<Options> = (options: Options) => ParallelPlugin;
786
+ declare function defineParallelPlugin<Options>(pluginPath: string): DefineParallelPluginResult<Options>;
787
+ //#endregion
788
+ //#region src/plugin/plugin-context.d.ts
789
+ interface EmittedAsset {
790
+ type: "asset";
791
+ name?: string;
792
+ fileName?: string;
793
+ originalFileName?: string;
794
+ source: AssetSource;
795
+ }
796
+ interface EmittedChunk {
797
+ type: "chunk";
798
+ name?: string;
799
+ fileName?: string;
800
+ preserveSignature?: "strict" | "allow-extension" | "exports-only" | false;
801
+ id: string;
802
+ importer?: string;
803
+ }
804
+ type EmittedFile = EmittedAsset | EmittedChunk;
805
+ interface PluginContextResolveOptions {
806
+ isEntry?: boolean;
807
+ skipSelf?: boolean;
808
+ custom?: CustomPluginOptions;
809
+ }
810
+ type GetModuleInfo = (moduleId: string) => ModuleInfo | null;
811
+ interface PluginContext extends MinimalPluginContext {
812
+ fs: RolldownFsModule;
813
+ emitFile(file: EmittedFile): string;
814
+ getFileName(referenceId: string): string;
815
+ getModuleIds(): IterableIterator<string>;
816
+ getModuleInfo: GetModuleInfo;
817
+ addWatchFile(id: string): void;
818
+ load(options: {
819
+ id: string;
820
+ resolveDependencies?: boolean;
821
+ } & Partial<PartialNull<ModuleOptions>>): Promise<ModuleInfo>;
822
+ parse(input: string, options?: ParserOptions | undefined | null): Program;
823
+ resolve(source: string, importer?: string, options?: PluginContextResolveOptions): Promise<ResolvedId | null>;
824
+ }
825
+ //#endregion
826
+ //#region src/plugin/transform-plugin-context.d.ts
827
+ interface TransformPluginContext extends PluginContext {
828
+ debug: LoggingFunctionWithPosition;
829
+ info: LoggingFunctionWithPosition;
830
+ warn: LoggingFunctionWithPosition;
831
+ error(e: RollupError | string, pos?: number | {
832
+ column: number;
833
+ line: number;
834
+ }): never;
835
+ getCombinedSourcemap(): SourceMap;
836
+ }
837
+ //#endregion
838
+ //#region src/types/module-side-effects.d.ts
839
+ interface ModuleSideEffectsRule {
840
+ test?: RegExp;
841
+ external?: boolean;
842
+ sideEffects: boolean;
843
+ }
844
+ type ModuleSideEffectsOption = boolean | readonly string[] | ModuleSideEffectsRule[] | ((id: string, external: boolean) => boolean | undefined) | "no-external";
845
+ type TreeshakingOptions = {
846
+ moduleSideEffects?: ModuleSideEffectsOption;
847
+ annotations?: boolean;
848
+ manualPureFunctions?: readonly string[];
849
+ unknownGlobalSideEffects?: boolean;
850
+ commonjs?: boolean;
851
+ propertyReadSideEffects?: false | "always";
852
+ propertyWriteSideEffects?: false | "always";
853
+ };
854
+ //#endregion
855
+ //#region src/types/output-bundle.d.ts
856
+ interface OutputBundle {
857
+ [fileName: string]: OutputAsset | OutputChunk;
858
+ }
859
+ //#endregion
860
+ //#region src/types/rolldown-options-function.d.ts
861
+ type RolldownOptionsFunction = (commandLineArguments: Record<string, any>) => MaybePromise<RolldownOptions | RolldownOptions[]>;
862
+ //#endregion
863
+ //#region src/types/sourcemap.d.ts
864
+ interface ExistingRawSourceMap {
865
+ file?: string | null;
866
+ mappings: string;
867
+ names?: string[];
868
+ sources?: (string | null)[];
869
+ sourcesContent?: (string | null)[];
870
+ sourceRoot?: string;
871
+ version?: number;
872
+ x_google_ignoreList?: number[];
873
+ }
874
+ type SourceMapInput = ExistingRawSourceMap | string | null;
875
+ //#endregion
876
+ //#region src/index.d.ts
877
+ declare const VERSION: string;
878
+ //#endregion
879
+ //#region src/builtin-plugin/utils.d.ts
880
+ declare class BuiltinPlugin {
881
+ name: BindingBuiltinPluginName;
882
+ _options?: unknown;
883
+ constructor(name: BindingBuiltinPluginName, _options?: unknown);
884
+ }
885
+ //#endregion
886
+ //#region src/constants/plugin.d.ts
887
+ declare const ENUMERATED_INPUT_PLUGIN_HOOK_NAMES: readonly ["options", "buildStart", "resolveId", "load", "transform", "moduleParsed", "buildEnd", "onLog", "resolveDynamicImport", "closeBundle", "closeWatcher", "watchChange"];
888
+ declare const ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES: readonly ["augmentChunkHash", "outputOptions", "renderChunk", "renderStart", "renderError", "writeBundle", "generateBundle"];
889
+ declare const ENUMERATED_PLUGIN_HOOK_NAMES: [...typeof ENUMERATED_INPUT_PLUGIN_HOOK_NAMES, ...typeof ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES, "footer", "banner", "intro", "outro"];
890
+ /**
891
+ * Names of all defined hooks. It's like
892
+ * ```ts
893
+ * type DefinedHookNames = {
894
+ * options: 'options',
895
+ * buildStart: 'buildStart',
896
+ * ...
897
+ * }
898
+ * ```
899
+ */
900
+ type DefinedHookNames = { readonly [K in typeof ENUMERATED_PLUGIN_HOOK_NAMES[number]]: K };
901
+ /**
902
+ * Names of all defined hooks. It's like
903
+ * ```js
904
+ * const DEFINED_HOOK_NAMES ={
905
+ * options: 'options',
906
+ * buildStart: 'buildStart',
907
+ * ...
908
+ * }
909
+ * ```
910
+ */
911
+ declare const DEFINED_HOOK_NAMES: DefinedHookNames;
912
+ //#endregion
913
+ //#region src/plugin/with-filter.d.ts
914
+ type OverrideFilterObject = {
915
+ transform?: HookFilterExtension<"transform">["filter"];
916
+ resolveId?: HookFilterExtension<"resolveId">["filter"];
917
+ load?: HookFilterExtension<"load">["filter"];
918
+ pluginNamePattern?: StringOrRegExp[];
919
+ };
920
+ declare function withFilter<A, T extends RolldownPluginOption<A>>(pluginOption: T, filterObject: OverrideFilterObject | OverrideFilterObject[]): T;
921
+ //#endregion
922
+ //#region src/plugin/index.d.ts
923
+ type ModuleSideEffects = boolean | "no-treeshake" | null;
924
+ type ModuleType = "js" | "jsx" | "ts" | "tsx" | "json" | "text" | "base64" | "dataurl" | "binary" | "empty" | (string & {});
925
+ type ImportKind = BindingHookResolveIdExtraArgs["kind"];
926
+ interface CustomPluginOptions {
927
+ [plugin: string]: any;
928
+ }
929
+ interface ModuleOptions {
930
+ moduleSideEffects: ModuleSideEffects;
931
+ meta: CustomPluginOptions;
932
+ invalidate?: boolean;
933
+ packageJsonPath?: string;
934
+ }
935
+ interface ResolvedId extends ModuleOptions {
936
+ external: boolean | "absolute";
937
+ id: string;
938
+ }
939
+ interface PartialResolvedId extends Partial<PartialNull<ModuleOptions>> {
940
+ external?: boolean | "absolute" | "relative";
941
+ id: string;
942
+ }
943
+ interface SourceDescription extends Partial<PartialNull<ModuleOptions>> {
944
+ code: string;
945
+ map?: SourceMapInput;
946
+ moduleType?: ModuleType;
947
+ }
948
+ interface ResolveIdExtraOptions {
949
+ custom?: CustomPluginOptions;
950
+ isEntry: boolean;
951
+ kind: BindingHookResolveIdExtraArgs["kind"];
952
+ }
953
+ type ResolveIdResult = string | NullValue | false | PartialResolvedId;
954
+ type LoadResult = NullValue | string | SourceDescription;
955
+ type TransformResult = NullValue | string | Partial<SourceDescription>;
956
+ type RenderedChunkMeta = {
957
+ chunks: Record<string, RenderedChunk>;
958
+ };
959
+ interface FunctionPluginHooks {
960
+ [DEFINED_HOOK_NAMES.onLog]: (this: MinimalPluginContext, level: LogLevel, log: RollupLog) => NullValue | boolean;
961
+ [DEFINED_HOOK_NAMES.options]: (this: MinimalPluginContext, options: InputOptions) => NullValue | InputOptions;
962
+ [DEFINED_HOOK_NAMES.outputOptions]: (this: MinimalPluginContext, options: OutputOptions) => NullValue | OutputOptions;
963
+ [DEFINED_HOOK_NAMES.buildStart]: (this: PluginContext, options: NormalizedInputOptions) => void;
964
+ [DEFINED_HOOK_NAMES.resolveId]: (this: PluginContext, source: string, importer: string | undefined, extraOptions: ResolveIdExtraOptions) => ResolveIdResult;
965
+ /**
966
+ * @deprecated
967
+ * This hook is only for rollup plugin compatibility. Please use `resolveId` instead.
968
+ */
969
+ [DEFINED_HOOK_NAMES.resolveDynamicImport]: (this: PluginContext, source: string, importer: string | undefined) => ResolveIdResult;
970
+ [DEFINED_HOOK_NAMES.load]: (this: PluginContext, id: string) => MaybePromise<LoadResult>;
971
+ [DEFINED_HOOK_NAMES.transform]: (this: TransformPluginContext, code: string, id: string, meta: BindingTransformHookExtraArgs & {
972
+ moduleType: ModuleType;
973
+ }) => TransformResult;
974
+ [DEFINED_HOOK_NAMES.moduleParsed]: (this: PluginContext, moduleInfo: ModuleInfo) => void;
975
+ [DEFINED_HOOK_NAMES.buildEnd]: (this: PluginContext, err?: Error) => void;
976
+ [DEFINED_HOOK_NAMES.renderStart]: (this: PluginContext, outputOptions: NormalizedOutputOptions, inputOptions: NormalizedInputOptions) => void;
977
+ [DEFINED_HOOK_NAMES.renderChunk]: (this: PluginContext, code: string, chunk: RenderedChunk, outputOptions: NormalizedOutputOptions, meta: RenderedChunkMeta) => NullValue | string | {
978
+ code: string;
979
+ map?: SourceMapInput;
980
+ };
981
+ [DEFINED_HOOK_NAMES.augmentChunkHash]: (this: PluginContext, chunk: RenderedChunk) => string | void;
982
+ [DEFINED_HOOK_NAMES.renderError]: (this: PluginContext, error: Error) => void;
983
+ [DEFINED_HOOK_NAMES.generateBundle]: (this: PluginContext, outputOptions: NormalizedOutputOptions, bundle: OutputBundle, isWrite: boolean) => void;
984
+ [DEFINED_HOOK_NAMES.writeBundle]: (this: PluginContext, outputOptions: NormalizedOutputOptions, bundle: OutputBundle) => void;
985
+ [DEFINED_HOOK_NAMES.closeBundle]: (this: PluginContext) => void;
986
+ [DEFINED_HOOK_NAMES.watchChange]: (this: PluginContext, id: string, event: {
987
+ event: ChangeEvent;
988
+ }) => void;
989
+ [DEFINED_HOOK_NAMES.closeWatcher]: (this: PluginContext) => void;
990
+ }
991
+ type ChangeEvent = "create" | "update" | "delete";
992
+ type PluginOrder = "pre" | "post" | null;
993
+ type ObjectHookMeta = {
994
+ order?: PluginOrder;
995
+ };
996
+ type ObjectHook<T, O = {}> = T | ({
997
+ handler: T;
998
+ } & ObjectHookMeta & O);
999
+ type SyncPluginHooks = DefinedHookNames["augmentChunkHash" | "onLog" | "outputOptions"];
1000
+ type AsyncPluginHooks = Exclude<keyof FunctionPluginHooks, SyncPluginHooks>;
1001
+ type FirstPluginHooks = DefinedHookNames["load" | "resolveDynamicImport" | "resolveId"];
1002
+ type SequentialPluginHooks = DefinedHookNames["augmentChunkHash" | "generateBundle" | "onLog" | "options" | "outputOptions" | "renderChunk" | "transform"];
1003
+ type AddonHooks = DefinedHookNames["banner" | "footer" | "intro" | "outro"];
1004
+ type OutputPluginHooks = DefinedHookNames["augmentChunkHash" | "generateBundle" | "outputOptions" | "renderChunk" | "renderError" | "renderStart" | "writeBundle"];
1005
+ type ParallelPluginHooks = Exclude<keyof FunctionPluginHooks | AddonHooks, FirstPluginHooks | SequentialPluginHooks>;
1006
+ type HookFilterExtension<K extends keyof FunctionPluginHooks> = K extends "transform" ? {
1007
+ filter?: TUnionWithTopLevelFilterExpressionArray<HookFilter>;
1008
+ } : K extends "load" ? {
1009
+ filter?: TUnionWithTopLevelFilterExpressionArray<Pick<HookFilter, "id">>;
1010
+ } : K extends "resolveId" ? {
1011
+ filter?: TUnionWithTopLevelFilterExpressionArray<{
1012
+ id?: GeneralHookFilter<RegExp>;
1013
+ }>;
1014
+ } : K extends "renderChunk" ? {
1015
+ filter?: TUnionWithTopLevelFilterExpressionArray<Pick<HookFilter, "code">>;
1016
+ } : {};
1017
+ type PluginHooks = { [K in keyof FunctionPluginHooks]: ObjectHook<K extends AsyncPluginHooks ? MakeAsync<FunctionPluginHooks[K]> : FunctionPluginHooks[K], HookFilterExtension<K> & (K extends ParallelPluginHooks ? {
1018
+ /**
1019
+ * @deprecated
1020
+ * this is only for rollup Plugin type compatibility.
1021
+ * hooks always work as `sequential: true`.
1022
+ */
1023
+ sequential?: boolean;
1024
+ } : {})> };
1025
+ type AddonHookFunction = (this: PluginContext, chunk: RenderedChunk) => string | Promise<string>;
1026
+ type AddonHook = string | AddonHookFunction;
1027
+ interface OutputPlugin extends Partial<{ [K in OutputPluginHooks]: PluginHooks[K] }>, Partial<{ [K in AddonHooks]: ObjectHook<AddonHook> }> {
1028
+ name: string;
1029
+ }
1030
+ interface Plugin<A = any> extends OutputPlugin, Partial<PluginHooks> {
1031
+ api?: A;
1032
+ }
1033
+ type RolldownPlugin<A = any> = Plugin<A> | BuiltinPlugin | ParallelPlugin;
1034
+ type RolldownPluginOption<A = any> = MaybePromise<NullValue<RolldownPlugin<A>> | {
1035
+ name: string;
1036
+ } | false | RolldownPluginOption[]>;
1037
+ type RolldownOutputPlugin = OutputPlugin | BuiltinPlugin;
1038
+ type RolldownOutputPluginOption = MaybePromise<NullValue<RolldownOutputPlugin> | {
1039
+ name: string;
1040
+ } | false | RolldownOutputPluginOption[]>;
1041
+ //#endregion
1042
+ //#region src/options/generated/checks-options.d.ts
1043
+ interface ChecksOptions {
1044
+ /**
1045
+ * Whether to emit warning when detecting circular dependency
1046
+ * @default false
1047
+ */
1048
+ circularDependency?: boolean;
1049
+ /**
1050
+ * Whether to emit warning when detecting eval
1051
+ * @default true
1052
+ */
1053
+ eval?: boolean;
1054
+ /**
1055
+ * Whether to emit warning when detecting missing global name
1056
+ * @default true
1057
+ */
1058
+ missingGlobalName?: boolean;
1059
+ /**
1060
+ * Whether to emit warning when detecting missing name option for iife export
1061
+ * @default true
1062
+ */
1063
+ missingNameOptionForIifeExport?: boolean;
1064
+ /**
1065
+ * Whether to emit warning when detecting mixed export
1066
+ * @default true
1067
+ */
1068
+ mixedExport?: boolean;
1069
+ /**
1070
+ * Whether to emit warning when detecting unresolved entry
1071
+ * @default true
1072
+ */
1073
+ unresolvedEntry?: boolean;
1074
+ /**
1075
+ * Whether to emit warning when detecting unresolved import
1076
+ * @default true
1077
+ */
1078
+ unresolvedImport?: boolean;
1079
+ /**
1080
+ * Whether to emit warning when detecting filename conflict
1081
+ * @default true
1082
+ */
1083
+ filenameConflict?: boolean;
1084
+ /**
1085
+ * Whether to emit warning when detecting common js variable in esm
1086
+ * @default true
1087
+ */
1088
+ commonJsVariableInEsm?: boolean;
1089
+ /**
1090
+ * Whether to emit warning when detecting import is undefined
1091
+ * @default true
1092
+ */
1093
+ importIsUndefined?: boolean;
1094
+ /**
1095
+ * Whether to emit warning when detecting empty import meta
1096
+ * @default true
1097
+ */
1098
+ emptyImportMeta?: boolean;
1099
+ /**
1100
+ * Whether to emit warning when detecting configuration field conflict
1101
+ * @default true
1102
+ */
1103
+ configurationFieldConflict?: boolean;
1104
+ /**
1105
+ * Whether to emit warning when detecting prefer builtin feature
1106
+ * @default true
1107
+ */
1108
+ preferBuiltinFeature?: boolean;
1109
+ }
1110
+ //#endregion
1111
+ //#region src/options/input-options.d.ts
1112
+ type InputOption = string | string[] | Record<string, string>;
1113
+ type OxcTransformOption = Omit<TransformOptions, "sourceType" | "lang" | "cwd" | "sourcemap" | "define" | "inject">;
1114
+ type ExternalOption = StringOrRegExp | StringOrRegExp[] | ((id: string, parentId: string | undefined, isResolved: boolean) => NullValue<boolean>);
1115
+ type ModuleTypes = Record<string, "js" | "jsx" | "ts" | "tsx" | "json" | "text" | "base64" | "dataurl" | "binary" | "empty" | "css" | "asset">;
1116
+ interface WatcherOptions {
1117
+ skipWrite?: boolean;
1118
+ buildDelay?: number;
1119
+ notify?: {
1120
+ pollInterval?: number;
1121
+ compareContents?: boolean;
1122
+ };
1123
+ include?: StringOrRegExp | StringOrRegExp[];
1124
+ exclude?: StringOrRegExp | StringOrRegExp[];
1125
+ onInvalidate?: (id: string) => void;
1126
+ clearScreen?: boolean;
1127
+ }
1128
+ type MakeAbsoluteExternalsRelative = boolean | "ifRelativeSource";
1129
+ type HmrOptions = boolean | {
1130
+ host?: string;
1131
+ port?: number;
1132
+ implement?: string;
1133
+ };
1134
+ type OptimizationOptions = {
1135
+ /**
1136
+ * Inline imported constant values during bundling instead of preserving variable references.
1137
+ *
1138
+ * When enabled, constant values from imported modules will be inlined at their usage sites,
1139
+ * potentially reducing bundle size and improving runtime performance by eliminating variable lookups.
1140
+ * **options**:
1141
+ * - `true`: equivalent to `{ mode: 'all', pass: 1 }`, enabling constant inlining for all eligible constants with a single pass.
1142
+ * - `false`: Disable constant inlining
1143
+ * - `{ mode: 'smart' | 'all', pass?: number }`:
1144
+ * - `mode: 'smart'`: Only inline constants in specific scenarios where it is likely to reduce bundle size and improve performance.
1145
+ * Smart mode inlines constants in these specific scenarios:
1146
+ * 1. `if (test) {} else {}` - condition expressions in if statements
1147
+ * 2. `test ? a : b` - condition expressions in ternary operators
1148
+ * 3. `test1 || test2` - logical OR expressions
1149
+ * 4. `test1 && test2` - logical AND expressions
1150
+ * 5. `test1 ?? test2` - nullish coalescing expressions
1151
+ * - `mode: 'all'`: Inline all imported constants wherever they are used.
1152
+ * - `pass`: Number of passes to perform for inlining constants.
1153
+ *
1154
+ * **example**
1155
+ * ```js
1156
+ * // Input files:
1157
+ * // constants.js
1158
+ * export const API_URL = 'https://api.example.com';
1159
+ *
1160
+ * // main.js
1161
+ * import { API_URL } from './constants.js';
1162
+ * console.log(API_URL);
1163
+ *
1164
+ * // With inlineConst: true, the bundled output becomes:
1165
+ * console.log('https://api.example.com');
1166
+ *
1167
+ * // Instead of:
1168
+ * const API_URL = 'https://api.example.com';
1169
+ * console.log(API_URL);
1170
+ * ```
1171
+ *
1172
+ * @default false
1173
+ */
1174
+ inlineConst?: boolean | {
1175
+ mode?: "all" | "smart";
1176
+ pass?: number;
1177
+ };
1178
+ };
1179
+ type AttachDebugOptions = "none" | "simple" | "full";
1180
+ type ChunkModulesOrder = "exec-order" | "module-id";
1181
+ interface RollupJsxOptions {
1182
+ mode?: "classic" | "automatic" | "preserve";
1183
+ factory?: string;
1184
+ fragment?: string;
1185
+ importSource?: string;
1186
+ jsxImportSource?: string;
1187
+ }
1188
+ interface InputOptions {
1189
+ input?: InputOption;
1190
+ plugins?: RolldownPluginOption;
1191
+ external?: ExternalOption;
1192
+ resolve?: {
1193
+ /**
1194
+ * > [!WARNING]
1195
+ * > `resolve.alias` will not call `resolveId` hooks of other plugin.
1196
+ * > If you want to call `resolveId` hooks of other plugin, use `aliasPlugin` from `rolldown/experimental` instead.
1197
+ * > You could find more discussion in [this issue](https://github.com/rolldown/rolldown/issues/3615)
1198
+ */
1199
+ alias?: Record<string, string[] | string | false>;
1200
+ aliasFields?: string[][];
1201
+ conditionNames?: string[];
1202
+ /**
1203
+ * Map of extensions to alternative extensions.
1204
+ *
1205
+ * With writing `import './foo.js'` in a file, you want to resolve it to `foo.ts` instead of `foo.js`.
1206
+ * You can achieve this by setting: `extensionAlias: { '.js': ['.ts', '.js'] }`.
1207
+ */
1208
+ extensionAlias?: Record<string, string[]>;
1209
+ exportsFields?: string[][];
1210
+ extensions?: string[];
1211
+ mainFields?: string[];
1212
+ mainFiles?: string[];
1213
+ modules?: string[];
1214
+ symlinks?: boolean;
1215
+ /**
1216
+ * @deprecated Use the top-level `tsconfig` option instead.
1217
+ */
1218
+ tsconfigFilename?: string;
1219
+ };
1220
+ cwd?: string;
1221
+ /**
1222
+ * Expected platform where the code run.
1223
+ *
1224
+ * When the platform is set to neutral:
1225
+ * - When bundling is enabled the default output format is set to esm, which uses the export syntax introduced with ECMAScript 2015 (i.e. ES6). You can change the output format if this default is not appropriate.
1226
+ * - The main fields setting is empty by default. If you want to use npm-style packages, you will likely have to configure this to be something else such as main for the standard main field used by node.
1227
+ * - The conditions setting does not automatically include any platform-specific values.
1228
+ *
1229
+ * @default
1230
+ * - 'node' if the format is 'cjs'
1231
+ * - 'browser' for other formats
1232
+ */
1233
+ platform?: "node" | "browser" | "neutral";
1234
+ shimMissingExports?: boolean;
1235
+ treeshake?: boolean | TreeshakingOptions;
1236
+ logLevel?: LogLevelOption;
1237
+ onLog?: (level: LogLevel, log: RollupLog, defaultHandler: LogOrStringHandler) => void;
1238
+ onwarn?: (warning: RollupLog, defaultHandler: (warning: RollupLogWithString | (() => RollupLogWithString)) => void) => void;
1239
+ moduleTypes?: ModuleTypes;
1240
+ experimental?: {
1241
+ strictExecutionOrder?: boolean;
1242
+ disableLiveBindings?: boolean;
1243
+ viteMode?: boolean;
1244
+ resolveNewUrlToAsset?: boolean;
1245
+ hmr?: HmrOptions;
1246
+ /**
1247
+ * Control which order should use when rendering modules in chunk
1248
+ *
1249
+ * - Type: `'exec-order' | 'module-id'
1250
+ * - Default: `'exec-order'`
1251
+ *
1252
+ * - `exec-order`: Almost equivalent to the topological order of the module graph, but specially handling when module graph has cycle.
1253
+ * - `module-id`: This is more friendly for gzip compression, especially for some javascript static asset lib (e.g. icon library)
1254
+ * > [!NOTE]
1255
+ * > 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).
1256
+ */
1257
+ chunkModulesOrder?: ChunkModulesOrder;
1258
+ /**
1259
+ * Attach debug information to the output bundle.
1260
+ *
1261
+ * - Type: `'none' | 'simple' | 'full'`
1262
+ * - Default: `'simple'`
1263
+ *
1264
+ * - `none`: No debug information is attached.
1265
+ * - `simple`: Attach comments indicating which files the bundled code comes from. These comments could be removed by the minifier.
1266
+ * - `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.
1267
+ *
1268
+ * > [!WARNING]
1269
+ * > You shouldn't use `full` in the production build.
1270
+ */
1271
+ attachDebugInfo?: AttachDebugOptions;
1272
+ /**
1273
+ * Enables automatic generation of a chunk import map asset during build.
1274
+ *
1275
+ * This map only includes chunks with hashed filenames, where keys are derived from the facade module
1276
+ * name or primary chunk name. It produces stable and unique hash-based filenames, effectively preventing
1277
+ * cascading cache invalidation caused by content hashes and maximizing browser cache reuse.
1278
+ *
1279
+ * The output defaults to `importmap.json` unless overridden via `fileName`. A base URL prefix
1280
+ * (default `"/"`) can be applied to all paths. The resulting JSON is a valid import map and can be
1281
+ * directly injected into HTML via `<script type="importmap">`.
1282
+ *
1283
+ * Example configuration snippet:
1284
+ *
1285
+ * ```js
1286
+ * {
1287
+ * experimental: {
1288
+ * chunkImportMap: {
1289
+ * baseUrl: '/',
1290
+ * fileName: 'importmap.json'
1291
+ * }
1292
+ * },
1293
+ * plugins: [
1294
+ * {
1295
+ * name: 'inject-import-map',
1296
+ * generateBundle(_, bundle) {
1297
+ * const chunkImportMap = bundle['importmap.json'];
1298
+ * if (chunkImportMap?.type === 'asset') {
1299
+ * const htmlPath = path.resolve('index.html');
1300
+ * let html = fs.readFileSync(htmlPath, 'utf-8');
1301
+ *
1302
+ * html = html.replace(
1303
+ * /<script\s+type="importmap"[^>]*>[\s\S]*?<\/script>/i,
1304
+ * `<script type="importmap">${chunkImportMap.source}<\/script>`
1305
+ * );
1306
+ *
1307
+ * fs.writeFileSync(htmlPath, html);
1308
+ * delete bundle['importmap.json'];
1309
+ * }
1310
+ * }
1311
+ * }
1312
+ * ]
1313
+ * }
1314
+ * ```
1315
+ *
1316
+ * > [!NOTE]
1317
+ * > 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)
1318
+ */
1319
+ chunkImportMap?: boolean | {
1320
+ baseUrl?: string;
1321
+ fileName?: string;
1322
+ };
1323
+ onDemandWrapping?: boolean;
1324
+ /**
1325
+ * Required to be used with `watch` mode.
1326
+ */
1327
+ incrementalBuild?: boolean;
1328
+ transformHiresSourcemap?: boolean | "boundary";
1329
+ };
1330
+ /**
1331
+ * Replace global variables or [property accessors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_accessors) with the provided values.
1332
+ *
1333
+ * # Examples
1334
+ *
1335
+ * - Replace the global variable `IS_PROD` with `true`
1336
+ *
1337
+ * ```js rolldown.config.js
1338
+ * export default defineConfig({ define: { IS_PROD: 'true' // or JSON.stringify(true) } })
1339
+ * ```
1340
+ *
1341
+ * Result:
1342
+ *
1343
+ * ```js
1344
+ * // Input
1345
+ * if (IS_PROD) {
1346
+ * console.log('Production mode')
1347
+ * }
1348
+ *
1349
+ * // After bundling
1350
+ * if (true) {
1351
+ * console.log('Production mode')
1352
+ * }
1353
+ * ```
1354
+ *
1355
+ * - Replace the property accessor `process.env.NODE_ENV` with `'production'`
1356
+ *
1357
+ * ```js rolldown.config.js
1358
+ * export default defineConfig({ define: { 'process.env.NODE_ENV': "'production'" } })
1359
+ * ```
1360
+ *
1361
+ * Result:
1362
+ *
1363
+ * ```js
1364
+ * // Input
1365
+ * if (process.env.NODE_ENV === 'production') {
1366
+ * console.log('Production mode')
1367
+ * }
1368
+ *
1369
+ * // After bundling
1370
+ * if ('production' === 'production') {
1371
+ * console.log('Production mode')
1372
+ * }
1373
+ *
1374
+ * ```
1375
+ */
1376
+ define?: Record<string, string>;
1377
+ /**
1378
+ * Inject import statements on demand.
1379
+ *
1380
+ * ## Supported patterns
1381
+ * ```js
1382
+ * {
1383
+ * // import { Promise } from 'es6-promise'
1384
+ * Promise: ['es6-promise', 'Promise'],
1385
+ *
1386
+ * // import { Promise as P } from 'es6-promise'
1387
+ * P: ['es6-promise', 'Promise'],
1388
+ *
1389
+ * // import $ from 'jquery'
1390
+ * $: 'jquery',
1391
+ *
1392
+ * // import * as fs from 'node:fs'
1393
+ * fs: ['node:fs', '*'],
1394
+ *
1395
+ * // Inject shims for property access pattern
1396
+ * 'Object.assign': path.resolve( 'src/helpers/object-assign.js' ),
1397
+ * }
1398
+ * ```
1399
+ */
1400
+ inject?: Record<string, string | [string, string]>;
1401
+ profilerNames?: boolean;
1402
+ /**
1403
+ * @deprecated Use `transform.jsx` instead.
1404
+ *
1405
+ * This top-level `jsx` option will be removed in a future release.
1406
+ * It is only kept for backward compatibility and will be mapped internally to `transform.jsx`.
1407
+ *
1408
+ * - `false` disables the JSX parser, resulting in a syntax error if JSX syntax is used.
1409
+ * - `"preserve"` disables the JSX transformer, preserving the original JSX syntax in the output.
1410
+ * - `"react"` enables the `classic` JSX transformer.
1411
+ * - `"react-jsx"` enables the `automatic` JSX transformer.
1412
+ *
1413
+ * @default runtime = "automatic"
1414
+ */
1415
+ jsx?: false | "react" | "react-jsx" | "preserve" | RollupJsxOptions;
1416
+ /**
1417
+ * Configure how the code is transformed. This process happens after the `transform` hook.
1418
+ *
1419
+ * To transpile [legacy decorators](https://github.com/tc39/proposal-decorators/tree/4ac0f4cd31bd0f2e8170cb4c5136e51671e46c8d), you could use
1420
+ *
1421
+ * ```js
1422
+ * export default defineConfig({
1423
+ * transform: {
1424
+ * decorator: {
1425
+ * legacy: true,
1426
+ * },
1427
+ * },
1428
+ * })
1429
+ * ```
1430
+ *
1431
+ * For latest decorators proposal, rolldown is able to bundle them but doesn't support transpiling them yet.
1432
+ */
1433
+ transform?: OxcTransformOption;
1434
+ watch?: WatcherOptions | false;
1435
+ dropLabels?: string[];
1436
+ keepNames?: boolean;
1437
+ checks?: ChecksOptions;
1438
+ makeAbsoluteExternalsRelative?: MakeAbsoluteExternalsRelative;
1439
+ debug?: {
1440
+ sessionId?: string;
1441
+ };
1442
+ preserveEntrySignatures?: false | "strict" | "allow-extension" | "exports-only";
1443
+ optimization?: OptimizationOptions;
1444
+ context?: string;
1445
+ /**
1446
+ * Allows you to specify where to find the TypeScript configuration file.
1447
+ *
1448
+ * You may provide:
1449
+ * - a relative path to the configuration file. It will be resolved relative to cwd.
1450
+ * - an absolute path to the configuration file.
1451
+ *
1452
+ * When a tsconfig path is specified, the module resolver will respect `compilerOptions.paths` from the specified `tsconfig.json`,
1453
+ * and the tsconfig options will be merged with the top-level `transform` options, with the `transform` options taking precedence.
1454
+ */
1455
+ tsconfig?: string;
1456
+ }
1457
+ //#endregion
1458
+ //#region src/types/rolldown-options.d.ts
1459
+ interface RolldownOptions extends InputOptions {
1460
+ output?: OutputOptions | OutputOptions[];
1461
+ }
1462
+ //#endregion
1463
+ //#region src/types/config-export.d.ts
1464
+ /**
1465
+ * Type for `default export` of `rolldown.config.js` file.
1466
+ */
1467
+ type ConfigExport = RolldownOptions | RolldownOptions[] | RolldownOptionsFunction;
1468
+ //#endregion
1469
+ //#region src/utils/define-config.d.ts
1470
+ declare function defineConfig(config: RolldownOptions): RolldownOptions;
1471
+ declare function defineConfig(config: RolldownOptions[]): RolldownOptions[];
1472
+ declare function defineConfig(config: RolldownOptionsFunction): RolldownOptionsFunction;
1473
+ declare function defineConfig(config: ConfigExport): ConfigExport;
1474
+ //#endregion
1475
+ export { type AddonFunction, type AsyncPluginHooks, type BufferEncoding, type BuildOptions, BuiltinPlugin, type ChunkFileNamesFunction, type ChunkingContext, type ConfigExport, type CustomPluginOptions, type DefineParallelPluginResult, type EmittedAsset, type EmittedFile, type ExistingRawSourceMap, type ExternalOption, type FunctionPluginHooks, type GeneralHookFilter, type GeneratedCodeOptions, type GeneratedCodePreset, type GetModuleInfo, type GlobalsFunction, type HookFilter, type HookFilterExtension, type ImportKind, type InputOption, type InputOptions, type InternalModuleFormat, type LoadResult, type LogLevel, type LogLevelOption, type LogOrStringHandler, type LoggingFunction, MaybePromise, type MinifyOptions, type MinimalPluginContext, type ModuleFormat, type ModuleInfo, type ModuleOptions, type ModuleType, type ModuleTypeFilter, type ModuleTypes, type NormalizedInputOptions, type NormalizedOutputOptions, type ObjectHook, type OptimizationOptions, type OutputAsset, type OutputBundle, type OutputChunk, type OutputOptions, type ParallelPluginHooks, type PartialNull, type PartialResolvedId, type Plugin, type PluginContext, type PluginContextMeta, type PreRenderedAsset, type RenderedChunk, type RenderedModule, type ResolveIdExtraOptions, type ResolveIdResult, type ResolvedId, type RolldownBuild, type RolldownDirectoryEntry, type RolldownFileStats, type RolldownFsModule, type RolldownOptions, type RolldownOptionsFunction, type RolldownOutput, type RolldownPlugin, type RolldownPluginOption, type RolldownWatcher, type RolldownWatcherEvent, type RollupError, type RollupLog, type RollupLogWithString, type SourceDescription, type SourceMap, type SourceMapInput, type SourcemapIgnoreListOption, StringOrRegExp, type TransformPluginContext, type TransformResult, type TreeshakingOptions, VERSION, type WarningHandlerWithDefault, type WatchOptions, type WatcherOptions, build, defineConfig, defineParallelPlugin, rolldown, watch, withFilter };