@rolldown/browser 1.0.0-beta.10-commit.81375fe → 1.0.0-beta.10-commit.885ee53

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 (37) hide show
  1. package/dist/cli.cjs +2 -2
  2. package/dist/cli.mjs +2 -2
  3. package/dist/config.cjs +2 -2
  4. package/dist/config.d.cts +2 -3
  5. package/dist/config.d.mts +2 -3
  6. package/dist/config.mjs +2 -2
  7. package/dist/experimental-index.browser.mjs +1 -1
  8. package/dist/experimental-index.cjs +1 -1
  9. package/dist/experimental-index.d.cts +13 -44
  10. package/dist/experimental-index.d.mts +13 -44
  11. package/dist/experimental-index.mjs +1 -1
  12. package/dist/filter-index.d.cts +3 -2
  13. package/dist/filter-index.d.mts +3 -2
  14. package/dist/index.browser.mjs +1 -1
  15. package/dist/index.cjs +1 -1
  16. package/dist/index.d.cts +2 -2
  17. package/dist/index.d.mts +2 -2
  18. package/dist/index.mjs +1 -1
  19. package/dist/parallel-plugin-worker.cjs +1 -1
  20. package/dist/parallel-plugin-worker.mjs +1 -1
  21. package/dist/parallel-plugin.d.cts +6 -6
  22. package/dist/parallel-plugin.d.mts +6 -6
  23. package/dist/parse-ast-index.d.cts +2 -2
  24. package/dist/parse-ast-index.d.mts +2 -2
  25. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  26. package/dist/shared/binding-BYafUgFF.d.cts +1652 -0
  27. package/dist/shared/binding-Dod8fhx9.d.mts +1652 -0
  28. package/dist/shared/define-config-BetvTt9D.d.cts +1048 -0
  29. package/dist/shared/define-config-cqCLLLZ-.d.mts +1048 -0
  30. package/dist/shared/{load-config-Cr472rVH.cjs → load-config-0bnuUeT5.cjs} +1 -1
  31. package/dist/shared/{load-config-a5TDbL5U.mjs → load-config-F7nMcxMb.mjs} +1 -1
  32. package/dist/shared/{src-Mp5z-lgE.mjs → src-6t_bV_L5.mjs} +46 -16
  33. package/dist/shared/{src-Cd6dJVwS.cjs → src-B3FAi7gC.cjs} +46 -16
  34. package/dist/{src--mQWdm3h.js → src-1eaUHc8G.js} +46 -16
  35. package/package.json +1 -1
  36. package/dist/shared/define-config.d-BDJzbjFe.d.mts +0 -1168
  37. package/dist/shared/define-config.d-C0X0fNDk.d.cts +0 -1168
@@ -0,0 +1,1048 @@
1
+ import { BindingAssetPluginConfig, BindingBuildImportAnalysisPluginConfig, BindingBuiltinPluginName, BindingDynamicImportVarsPluginConfig, BindingHmrOutput, BindingHookResolveIdExtraArgs, BindingImportGlobPluginConfig, BindingIsolatedDeclarationPluginConfig, BindingJsonPluginConfig, BindingManifestPluginConfig, BindingMfManifest, BindingMinifyOptions, BindingModuleFederationPluginOption, BindingRemote, BindingRenderedChunk, BindingReporterPluginConfig, BindingTransformHookExtraArgs, BindingViteResolvePluginConfig, BindingWatcherEvent, Bundler, ParserOptions, PreRenderedChunk, TransformOptions } from "./binding-BYafUgFF.cjs";
2
+ import { Program } from "@oxc-project/types";
3
+ import { TopLevelFilterExpression } from "@rolldown/pluginutils";
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/utils/asset-source.d.ts
46
+ type AssetSource = string | Uint8Array;
47
+ //#endregion
48
+ //#region src/types/rolldown-output.d.ts
49
+ interface OutputAsset {
50
+ type: "asset";
51
+ fileName: string;
52
+ /** @deprecated Use "originalFileNames" instead. */
53
+ originalFileName: string | null;
54
+ originalFileNames: string[];
55
+ source: AssetSource;
56
+ /** @deprecated Use "names" instead. */
57
+ name: string | undefined;
58
+ names: string[];
59
+ }
60
+ interface SourceMap {
61
+ file: string;
62
+ mappings: string;
63
+ names: string[];
64
+ sources: string[];
65
+ sourcesContent: string[];
66
+ version: number;
67
+ debugId?: string;
68
+ x_google_ignoreList?: number[];
69
+ toString(): string;
70
+ toUrl(): string;
71
+ }
72
+ interface RenderedModule {
73
+ readonly code: string | null;
74
+ renderedLength: number;
75
+ renderedExports: string[];
76
+ }
77
+ interface RenderedChunk extends Omit<BindingRenderedChunk, "modules"> {
78
+ type: "chunk";
79
+ modules: {
80
+ [id: string]: RenderedModule;
81
+ };
82
+ name: string;
83
+ isEntry: boolean;
84
+ isDynamicEntry: boolean;
85
+ facadeModuleId: string | null;
86
+ moduleIds: Array<string>;
87
+ exports: Array<string>;
88
+ fileName: string;
89
+ imports: Array<string>;
90
+ dynamicImports: Array<string>;
91
+ }
92
+ interface OutputChunk {
93
+ type: "chunk";
94
+ code: string;
95
+ name: string;
96
+ isEntry: boolean;
97
+ exports: string[];
98
+ fileName: string;
99
+ modules: {
100
+ [id: string]: RenderedModule;
101
+ };
102
+ imports: string[];
103
+ dynamicImports: string[];
104
+ facadeModuleId: string | null;
105
+ isDynamicEntry: boolean;
106
+ moduleIds: string[];
107
+ map: SourceMap | null;
108
+ sourcemapFileName: string | null;
109
+ preliminaryFileName: string;
110
+ }
111
+ interface RolldownOutput {
112
+ output: [OutputChunk, ...(OutputChunk | OutputAsset)[]];
113
+ }
114
+ //#endregion
115
+ //#region src/types/utils.d.ts
116
+ type MaybePromise<T> = T | Promise<T>;
117
+ type NullValue<T = void> = T | undefined | null | void;
118
+ type PartialNull<T> = { [P in keyof T]: T[P] | null };
119
+ type MakeAsync<Function_> = Function_ extends ((this: infer This, ...parameters: infer Arguments) => infer Return) ? (this: This, ...parameters: Arguments) => Return | Promise<Return> : never;
120
+ type MaybeArray<T> = T | T[];
121
+ type StringOrRegExp = string | RegExp;
122
+ //#endregion
123
+ //#region src/options/output-options.d.ts
124
+ type ModuleFormat = "es" | "cjs" | "esm" | "module" | "commonjs" | "iife" | "umd" | "experimental-app";
125
+ type AddonFunction = (chunk: RenderedChunk) => string | Promise<string>;
126
+ type ChunkFileNamesFunction = (chunkInfo: PreRenderedChunk) => string;
127
+ interface PreRenderedAsset {
128
+ names: string[];
129
+ originalFileNames: string[];
130
+ source: string | Uint8Array;
131
+ type: "asset";
132
+ }
133
+ type AssetFileNamesFunction = (chunkInfo: PreRenderedAsset) => string;
134
+ type GlobalsFunction = (name: string) => string;
135
+ type MinifyOptions = BindingMinifyOptions;
136
+ interface OutputOptions {
137
+ dir?: string;
138
+ file?: string;
139
+ exports?: "auto" | "named" | "default" | "none";
140
+ hashCharacters?: "base64" | "base36" | "hex";
141
+ /**
142
+ * Expected format of generated code.
143
+ * - `'es'`, `'esm'` and `'module'` are the same format, all stand for ES module.
144
+ * - `'cjs'` and `'commonjs'` are the same format, all stand for CommonJS module.
145
+ * - `'iife'` stands for [Immediately Invoked Function Expression](https://developer.mozilla.org/en-US/docs/Glossary/IIFE).
146
+ * - `'umd'` stands for [Universal Module Definition](https://github.com/umdjs/umd).
147
+ *
148
+ * @default 'esm'
149
+ */
150
+ format?: ModuleFormat;
151
+ sourcemap?: boolean | "inline" | "hidden";
152
+ sourcemapDebugIds?: boolean;
153
+ sourcemapIgnoreList?: boolean | SourcemapIgnoreListOption;
154
+ sourcemapPathTransform?: SourcemapPathTransformOption;
155
+ banner?: string | AddonFunction;
156
+ footer?: string | AddonFunction;
157
+ intro?: string | AddonFunction;
158
+ outro?: string | AddonFunction;
159
+ extend?: boolean;
160
+ esModule?: boolean | "if-default-prop";
161
+ assetFileNames?: string | AssetFileNamesFunction;
162
+ entryFileNames?: string | ChunkFileNamesFunction;
163
+ chunkFileNames?: string | ChunkFileNamesFunction;
164
+ cssEntryFileNames?: string | ChunkFileNamesFunction;
165
+ cssChunkFileNames?: string | ChunkFileNamesFunction;
166
+ sanitizeFileName?: boolean | ((name: string) => string);
167
+ minify?: boolean | "dce-only" | MinifyOptions;
168
+ name?: string;
169
+ globals?: Record<string, string> | GlobalsFunction;
170
+ externalLiveBindings?: boolean;
171
+ inlineDynamicImports?: boolean;
172
+ /**
173
+ * Allows you to do advanced chunking. Use it to reduce the number of common chunks or split out a chunk that hardly changes to obtain better caching.
174
+ */
175
+ advancedChunks?: {
176
+ /**
177
+ * - Type: `number`
178
+ *
179
+ * Global fallback of [`{group}.minSize`](#advancedchunks-groups-minsize), if it's not specified in the group.
180
+ */
181
+ minSize?: number;
182
+ /**
183
+ * - Type: `number`
184
+ *
185
+ * Global fallback of [`{group}.maxSize`](#advancedchunks-groups-maxsize), if it's not specified in the group.
186
+ */
187
+ maxSize?: number;
188
+ /**
189
+ * - Type: `number`
190
+ *
191
+ * Global fallback of [`{group}.maxModuleSize`](#advancedchunks-groups-maxmodulesize), if it's not specified in the group.
192
+ */
193
+ maxModuleSize?: number;
194
+ /**
195
+ * - Type: `number`
196
+ *
197
+ * Global fallback of [`{group}.minModuleSize`](#advancedchunks-groups-minmodulesize), if it's not specified in the group.
198
+ */
199
+ minModuleSize?: number;
200
+ /**
201
+ * - Type: `number`
202
+ *
203
+ * Global fallback of [`{group}.minShareCount`](#advancedchunks-groups-minsharecount), if it's not specified in the group.
204
+ */
205
+ minShareCount?: number;
206
+ /**
207
+ * Groups to be used for advanced chunking.
208
+ */
209
+ groups?: {
210
+ /**
211
+ * - Type: `string`
212
+ *
213
+ * Name of the group. It will be also used as the name of the chunk and replaced the `[name]` placeholder in the `chunkFileNames` option.
214
+ */
215
+ name: string;
216
+ /**
217
+ * - Type: `string | RegExp | ((id: string) => boolean | undefined | void);`
218
+ *
219
+ * Controls which modules are captured in this group.
220
+ *
221
+ * If `test` is a string, the module whose id contains the string will be captured.
222
+ * If `test` is a regular expression, the module whose id matches the regular expression will be captured.
223
+ * If `test` is a function, modules for which `test(id)` returns `true` will be captured.
224
+ * if `test` is empty, any module will be considered as matched.
225
+ */
226
+ test?: StringOrRegExp | ((id: string) => boolean | undefined | void);
227
+ /**
228
+ * - Type: `number`
229
+ *
230
+ * 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.
231
+ *
232
+ * If two groups have the same priority, the group whose index is smaller will be chosen.
233
+ */
234
+ priority?: number;
235
+ /**
236
+ * - Type: `number`
237
+ * - Default: `0`
238
+ *
239
+ * Minimum size of the desired chunk. If accumulated size of captured modules is smaller than this value, this group will be ignored.
240
+ */
241
+ minSize?: number;
242
+ /**
243
+ * - Type: `number`
244
+ * - Default: `1`
245
+ *
246
+ * Controls if a module should be captured based on how many entry chunks reference it.
247
+ */
248
+ minShareCount?: number;
249
+ /**
250
+ * - Type: `number`
251
+ * - Default: `Infinity`
252
+ *
253
+ * If final size of this group is larger than this value, this group will be spit into multiple groups that each has size closed to this value.
254
+ */
255
+ maxSize?: number;
256
+ /**
257
+ * - Type: `number`
258
+ * - Default: `Infinity`
259
+ *
260
+ * Controls a module could only be captured if its size is smaller or equal than this value.
261
+ */
262
+ maxModuleSize?: number;
263
+ /**
264
+ * - Type: `number`
265
+ * - Default: `0`
266
+ *
267
+ * Controls a module could only be captured if its size is larger or equal than this value.
268
+ */
269
+ minModuleSize?: number;
270
+ }[];
271
+ };
272
+ /**
273
+ * Control comments in the output.
274
+ *
275
+ * - `none`: no comments
276
+ * - `inline`: preserve comments that contain `@license`, `@preserve` or starts with `//!` `/*!`
277
+ */
278
+ legalComments?: "none" | "inline";
279
+ plugins?: RolldownOutputPluginOption;
280
+ polyfillRequire?: boolean;
281
+ hoistTransitiveImports?: false;
282
+ preserveModules?: boolean;
283
+ virtualDirname?: string;
284
+ preserveModulesRoot?: string;
285
+ }
286
+ //#endregion
287
+ //#region src/api/build.d.ts
288
+ interface BuildOptions extends InputOptions {
289
+ /**
290
+ * Write the output to the file system
291
+ *
292
+ * @default true
293
+ */
294
+ write?: boolean;
295
+ output?: OutputOptions;
296
+ }
297
+ declare function build(options: BuildOptions): Promise<RolldownOutput>;
298
+ /**
299
+ * Build multiple outputs __sequentially__.
300
+ */
301
+ declare function build(options: BuildOptions[]): Promise<RolldownOutput[]>;
302
+ //#endregion
303
+ //#region src/api/rolldown/rolldown-build.d.ts
304
+ declare class RolldownBuild {
305
+ #private;
306
+ constructor(inputOptions: InputOptions);
307
+ get closed(): boolean;
308
+ generate(outputOptions?: OutputOptions): Promise<RolldownOutput>;
309
+ write(outputOptions?: OutputOptions): Promise<RolldownOutput>;
310
+ close(): Promise<void>;
311
+ [Symbol.asyncDispose](): Promise<void>;
312
+ generateHmrPatch(changedFiles: string[]): Promise<BindingHmrOutput | undefined>;
313
+ hmrInvalidate(file: string, firstInvalidatedBy?: string): Promise<BindingHmrOutput | undefined>;
314
+ // TODO(underfin)
315
+ // The `watchFiles` method returns a promise, but Rollup does not.
316
+ // Converting it to a synchronous API might cause a deadlock if the user calls `write` and `watchFiles` simultaneously.
317
+ get watchFiles(): Promise<string[]>;
318
+ }
319
+ //#endregion
320
+ //#region src/api/rolldown/index.d.ts
321
+ // `async` here is intentional to be compatible with `rollup.rollup`.
322
+ declare const rolldown: (input: InputOptions) => Promise<RolldownBuild>;
323
+ //#endregion
324
+ //#region src/options/watch-options.d.ts
325
+ interface WatchOptions extends InputOptions {
326
+ output?: OutputOptions | OutputOptions[];
327
+ }
328
+ //#endregion
329
+ //#region src/api/watch/watch-emitter.d.ts
330
+ type WatcherEvent = "close" | "event" | "restart" | "change";
331
+ type ChangeEvent$1 = "create" | "update" | "delete";
332
+ // TODO: find a way use `RolldownBuild` instead of `Bundler`.
333
+ type RolldownWatchBuild = Bundler;
334
+ type RolldownWatcherEvent = {
335
+ code: "START";
336
+ } | {
337
+ code: "BUNDLE_START";
338
+ } | {
339
+ code: "BUNDLE_END";
340
+ duration: number;
341
+ // input?: InputOption
342
+ output: readonly string[];
343
+ result: RolldownWatchBuild;
344
+ } | {
345
+ code: "END";
346
+ } | {
347
+ code: "ERROR";
348
+ error: Error;
349
+ result: RolldownWatchBuild;
350
+ };
351
+ declare class WatcherEmitter {
352
+ listeners: Map<WatcherEvent, Array<(...parameters: any[]) => MaybePromise<void>>>;
353
+ timer: any;
354
+ constructor();
355
+ on(event: "change", listener: (id: string, change: {
356
+ event: ChangeEvent$1;
357
+ }) => MaybePromise<void>): this;
358
+ on(event: "event", listener: (data: RolldownWatcherEvent) => MaybePromise<void>): this;
359
+ on(event: "restart" | "close", listener: () => MaybePromise<void>): this;
360
+ off(event: WatcherEvent, listener: (...parameters: any[]) => MaybePromise<void>): this;
361
+ onEvent(event: BindingWatcherEvent): Promise<void>;
362
+ close(): Promise<void>;
363
+ }
364
+ type RolldownWatcher = WatcherEmitter;
365
+ //#endregion
366
+ //#region src/api/watch/index.d.ts
367
+ // Compat to `rollup.watch`
368
+ declare const watch: (input: WatchOptions | WatchOptions[]) => RolldownWatcher;
369
+ //#endregion
370
+ //#region src/log/log-handler.d.ts
371
+ type LoggingFunction = (log: RollupLog | string | (() => RollupLog | string)) => void;
372
+ type LoggingFunctionWithPosition = (log: RollupLog | string | (() => RollupLog | string), pos?: number | {
373
+ column: number;
374
+ line: number;
375
+ }) => void;
376
+ type WarningHandlerWithDefault = (warning: RollupLog, defaultHandler: LoggingFunction) => void;
377
+ //#endregion
378
+ //#region src/options/normalized-input-options.d.ts
379
+ interface NormalizedInputOptions {
380
+ input: string[] | Record<string, string>;
381
+ cwd: string | undefined;
382
+ platform: InputOptions["platform"];
383
+ shimMissingExports: boolean;
384
+ }
385
+ // TODO: I guess we make these getters enumerable so it act more like a plain object
386
+ //#endregion
387
+ //#region src/options/normalized-output-options.d.ts
388
+ type InternalModuleFormat = "es" | "cjs" | "iife" | "umd" | "app";
389
+ interface NormalizedOutputOptions {
390
+ name: string | undefined;
391
+ file: string | undefined;
392
+ dir: string | undefined;
393
+ entryFileNames: string | ChunkFileNamesFunction;
394
+ chunkFileNames: string | ChunkFileNamesFunction;
395
+ assetFileNames: string | AssetFileNamesFunction;
396
+ format: InternalModuleFormat;
397
+ exports: NonNullable<OutputOptions["exports"]>;
398
+ sourcemap: boolean | "inline" | "hidden";
399
+ cssEntryFileNames: string | ChunkFileNamesFunction;
400
+ cssChunkFileNames: string | ChunkFileNamesFunction;
401
+ inlineDynamicImports: boolean;
402
+ externalLiveBindings: boolean;
403
+ banner: AddonFunction;
404
+ footer: AddonFunction;
405
+ intro: AddonFunction;
406
+ outro: AddonFunction;
407
+ esModule: boolean | "if-default-prop";
408
+ extend: boolean;
409
+ globals: Record<string, string> | GlobalsFunction;
410
+ hashCharacters: "base64" | "base36" | "hex";
411
+ sourcemapDebugIds: boolean;
412
+ sourcemapIgnoreList: SourcemapIgnoreListOption;
413
+ sourcemapPathTransform: SourcemapPathTransformOption | undefined;
414
+ minify: false | BindingMinifyOptions;
415
+ legalComments: "none" | "inline";
416
+ polyfillRequire: boolean;
417
+ plugins: RolldownPlugin[];
418
+ preserveModules: boolean;
419
+ virtualDirname: string;
420
+ preserveModulesRoot?: string;
421
+ }
422
+ // TODO: I guess we make these getters enumerable so it act more like a plain object
423
+ //#endregion
424
+ //#region src/plugin/hook-filter.d.ts
425
+ type GeneralHookFilter<Value = StringOrRegExp> = MaybeArray<Value> | {
426
+ include?: MaybeArray<Value>;
427
+ exclude?: MaybeArray<Value>;
428
+ };
429
+ interface FormalModuleTypeFilter {
430
+ include?: ModuleType[];
431
+ }
432
+ type ModuleTypeFilter = ModuleType[] | FormalModuleTypeFilter;
433
+ interface HookFilter {
434
+ /**
435
+ * This filter is used to do a pre-test to determine whether the hook should be called.
436
+ *
437
+ * @example
438
+ * Include all `id`s that contain `node_modules` in the path.
439
+ * ```js
440
+ * { id: '**'+'/node_modules/**' }
441
+ * ```
442
+ * @example
443
+ * Include all `id`s that contain `node_modules` or `src` in the path.
444
+ * ```js
445
+ * { id: ['**'+'/node_modules/**', '**'+'/src/**'] }
446
+ * ```
447
+ * @example
448
+ * Include all `id`s that start with `http`
449
+ * ```js
450
+ * { id: /^http/ }
451
+ * ```
452
+ * @example
453
+ * Exclude all `id`s that contain `node_modules` in the path.
454
+ * ```js
455
+ * { id: { exclude: '**'+'/node_modules/**' } }
456
+ * ```
457
+ * @example
458
+ * Formal pattern to define includes and excludes.
459
+ * ```
460
+ * { id : {
461
+ * include: ['**'+'/foo/**', /bar/],
462
+ * exclude: ['**'+'/baz/**', /qux/]
463
+ * }}
464
+ * ```
465
+ */
466
+ id?: GeneralHookFilter;
467
+ moduleType?: ModuleTypeFilter;
468
+ code?: GeneralHookFilter;
469
+ }
470
+ type TUnionWithTopLevelFilterExpressionArray<T> = T | TopLevelFilterExpression[];
471
+ //#endregion
472
+ //#region src/plugin/minimal-plugin-context.d.ts
473
+ interface PluginContextMeta {
474
+ rollupVersion: string;
475
+ rolldownVersion: string;
476
+ watchMode: boolean;
477
+ }
478
+ interface MinimalPluginContext {
479
+ readonly pluginName: string;
480
+ error: (e: RollupError | string) => never;
481
+ info: LoggingFunction;
482
+ warn: LoggingFunction;
483
+ debug: LoggingFunction;
484
+ meta: PluginContextMeta;
485
+ }
486
+ //#endregion
487
+ //#region src/plugin/parallel-plugin.d.ts
488
+ type ParallelPlugin = {
489
+ /** @internal */
490
+ _parallel: {
491
+ fileUrl: string;
492
+ options: unknown;
493
+ };
494
+ };
495
+ type DefineParallelPluginResult<Options> = (options: Options) => ParallelPlugin;
496
+ declare function defineParallelPlugin<Options>(pluginPath: string): DefineParallelPluginResult<Options>;
497
+ //#endregion
498
+ //#region src/types/module-info.d.ts
499
+ interface ModuleInfo extends ModuleOptions {
500
+ /**
501
+ * Unsupported at rolldown
502
+ */
503
+ ast: any;
504
+ code: string | null;
505
+ id: string;
506
+ importers: string[];
507
+ dynamicImporters: string[];
508
+ importedIds: string[];
509
+ dynamicallyImportedIds: string[];
510
+ exports: string[];
511
+ isEntry: boolean;
512
+ }
513
+ //#endregion
514
+ //#region src/plugin/plugin-context.d.ts
515
+ interface EmittedAsset {
516
+ type: "asset";
517
+ name?: string;
518
+ fileName?: string;
519
+ originalFileName?: string | null;
520
+ source: AssetSource;
521
+ }
522
+ interface EmittedChunk {
523
+ type: "chunk";
524
+ name?: string;
525
+ fileName?: string;
526
+ id: string;
527
+ importer?: string;
528
+ }
529
+ type EmittedFile = EmittedAsset | EmittedChunk;
530
+ interface PluginContextResolveOptions {
531
+ skipSelf?: boolean;
532
+ custom?: CustomPluginOptions;
533
+ }
534
+ type GetModuleInfo = (moduleId: string) => ModuleInfo | null;
535
+ interface PluginContext extends MinimalPluginContext {
536
+ emitFile(file: EmittedFile): string;
537
+ getFileName(referenceId: string): string;
538
+ getModuleIds(): IterableIterator<string>;
539
+ getModuleInfo: GetModuleInfo;
540
+ addWatchFile(id: string): void;
541
+ load(options: {
542
+ id: string;
543
+ resolveDependencies?: boolean;
544
+ } & Partial<PartialNull<ModuleOptions>>): Promise<ModuleInfo>;
545
+ parse(input: string, options?: ParserOptions | undefined | null): Program;
546
+ resolve(source: string, importer?: string, options?: PluginContextResolveOptions): Promise<ResolvedId | null>;
547
+ }
548
+ //#endregion
549
+ //#region src/plugin/transform-plugin-context.d.ts
550
+ interface TransformPluginContext extends PluginContext {
551
+ debug: LoggingFunctionWithPosition;
552
+ info: LoggingFunctionWithPosition;
553
+ warn: LoggingFunctionWithPosition;
554
+ error(e: RollupError | string, pos?: number | {
555
+ column: number;
556
+ line: number;
557
+ }): never;
558
+ getCombinedSourcemap(): SourceMap;
559
+ }
560
+ //#endregion
561
+ //#region src/types/module-side-effects.d.ts
562
+ interface ModuleSideEffectsRule {
563
+ test?: RegExp;
564
+ external?: boolean;
565
+ sideEffects: boolean;
566
+ }
567
+ type ModuleSideEffectsOption = boolean | ModuleSideEffectsRule[] | ((id: string, isResolved: boolean) => boolean | undefined) | "no-external";
568
+ type TreeshakingOptions = {
569
+ moduleSideEffects?: ModuleSideEffectsOption;
570
+ annotations?: boolean;
571
+ manualPureFunctions?: string[];
572
+ unknownGlobalSideEffects?: boolean;
573
+ } | boolean;
574
+ //#endregion
575
+ //#region src/types/output-bundle.d.ts
576
+ interface OutputBundle {
577
+ [fileName: string]: OutputAsset | OutputChunk;
578
+ }
579
+ //#endregion
580
+ //#region src/types/sourcemap.d.ts
581
+ interface ExistingRawSourceMap {
582
+ file?: string | null;
583
+ mappings: string;
584
+ names?: string[];
585
+ sources?: (string | null)[];
586
+ sourcesContent?: (string | null)[];
587
+ sourceRoot?: string;
588
+ version?: number;
589
+ x_google_ignoreList?: number[];
590
+ }
591
+ type SourceMapInput = ExistingRawSourceMap | string | null;
592
+ //#endregion
593
+ //#region src/index.d.ts
594
+ declare const VERSION: string;
595
+ //#endregion
596
+ //#region src/builtin-plugin/constructors.d.ts
597
+ declare class BuiltinPlugin {
598
+ name: BindingBuiltinPluginName;
599
+ // NOTE: has `_` to avoid conflict with `options` hook
600
+ _options?: unknown;
601
+ constructor(name: BindingBuiltinPluginName, _options?: unknown);
602
+ }
603
+ declare function modulePreloadPolyfillPlugin(): BuiltinPlugin;
604
+ declare function dynamicImportVarsPlugin(config?: BindingDynamicImportVarsPluginConfig): BuiltinPlugin;
605
+ declare function importGlobPlugin(config?: BindingImportGlobPluginConfig): BuiltinPlugin;
606
+ declare function reporterPlugin(config?: BindingReporterPluginConfig): BuiltinPlugin;
607
+ declare function manifestPlugin(config?: BindingManifestPluginConfig): BuiltinPlugin;
608
+ declare function wasmHelperPlugin(): BuiltinPlugin;
609
+ declare function wasmFallbackPlugin(): BuiltinPlugin;
610
+ declare function loadFallbackPlugin(): BuiltinPlugin;
611
+ declare function jsonPlugin(config?: BindingJsonPluginConfig): BuiltinPlugin;
612
+ declare function buildImportAnalysisPlugin(config: BindingBuildImportAnalysisPluginConfig): BuiltinPlugin;
613
+ declare function viteResolvePlugin(config: BindingViteResolvePluginConfig): BuiltinPlugin;
614
+ type ModuleFederationPluginOption = Omit<BindingModuleFederationPluginOption, "remotes"> & {
615
+ remotes?: Record<string, string | BindingRemote>;
616
+ manifest?: boolean | BindingMfManifest;
617
+ };
618
+ declare function moduleFederationPlugin(config: ModuleFederationPluginOption): BuiltinPlugin;
619
+ declare function isolatedDeclarationPlugin(config?: BindingIsolatedDeclarationPluginConfig): BuiltinPlugin;
620
+ declare function assetPlugin(config?: BindingAssetPluginConfig): BuiltinPlugin;
621
+ declare function webWorkerPostPlugin(): BuiltinPlugin;
622
+ //#endregion
623
+ //#region src/constants/plugin.d.ts
624
+ declare const ENUMERATED_INPUT_PLUGIN_HOOK_NAMES: readonly ["options", "buildStart", "resolveId", "load", "transform", "moduleParsed", "buildEnd", "onLog", "resolveDynamicImport", "closeBundle", "closeWatcher", "watchChange"];
625
+ declare const ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES: readonly ["augmentChunkHash", "outputOptions", "renderChunk", "renderStart", "renderError", "writeBundle", "generateBundle"];
626
+ declare const ENUMERATED_PLUGIN_HOOK_NAMES: [...typeof ENUMERATED_INPUT_PLUGIN_HOOK_NAMES, ...typeof ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES, "footer", "banner", "intro", "outro"];
627
+ type EnumeratedPluginHookNames = typeof ENUMERATED_PLUGIN_HOOK_NAMES;
628
+ /**
629
+ * Names of all hooks in a `Plugin` object. Does not include `name` and `api`, since they are not hooks.
630
+ */
631
+ type PluginHookNames = EnumeratedPluginHookNames[number];
632
+ /**
633
+ * Names of all defined hooks. It's like
634
+ * ```ts
635
+ * type DefinedHookNames = {
636
+ * options: 'options',
637
+ * buildStart: 'buildStart',
638
+ * ...
639
+ * }
640
+ * ```
641
+ */
642
+ type DefinedHookNames = { readonly [K in PluginHookNames]: K };
643
+ /**
644
+ * Names of all defined hooks. It's like
645
+ * ```js
646
+ * const DEFINED_HOOK_NAMES ={
647
+ * options: 'options',
648
+ * buildStart: 'buildStart',
649
+ * ...
650
+ * }
651
+ * ```
652
+ */
653
+ declare const DEFINED_HOOK_NAMES: DefinedHookNames;
654
+ //#endregion
655
+ //#region src/plugin/with-filter.d.ts
656
+ type OverrideFilterObject = {
657
+ transform?: HookFilterExtension<"transform">["filter"];
658
+ resolveId?: HookFilterExtension<"resolveId">["filter"];
659
+ load?: HookFilterExtension<"load">["filter"];
660
+ pluginNamePattern?: StringOrRegExp[];
661
+ };
662
+ declare function withFilter<A, T extends RolldownPluginOption<A>>(pluginOption: T, filterObject: OverrideFilterObject | OverrideFilterObject[]): T;
663
+ //#endregion
664
+ //#region src/plugin/index.d.ts
665
+ type ModuleSideEffects = boolean | "no-treeshake" | null;
666
+ // ref: https://github.com/microsoft/TypeScript/issues/33471#issuecomment-1376364329
667
+ type ModuleType = "js" | "jsx" | "ts" | "tsx" | "json" | "text" | "base64" | "dataurl" | "binary" | "empty" | (string & {});
668
+ type ImportKind = BindingHookResolveIdExtraArgs["kind"];
669
+ interface CustomPluginOptions {
670
+ [plugin: string]: any;
671
+ }
672
+ interface ModuleOptions {
673
+ moduleSideEffects: ModuleSideEffects;
674
+ meta: CustomPluginOptions;
675
+ // flag used to check if user directly modified the `ModuleInfo`
676
+ // this is used to sync state between rust and js
677
+ invalidate?: boolean;
678
+ }
679
+ interface ResolvedId extends ModuleOptions {
680
+ external: boolean | "absolute";
681
+ id: string;
682
+ }
683
+ interface PartialResolvedId extends Partial<PartialNull<ModuleOptions>> {
684
+ external?: boolean | "absolute" | "relative";
685
+ id: string;
686
+ }
687
+ interface SourceDescription extends Partial<PartialNull<ModuleOptions>> {
688
+ code: string;
689
+ map?: SourceMapInput;
690
+ moduleType?: ModuleType;
691
+ }
692
+ interface ResolveIdExtraOptions {
693
+ custom?: CustomPluginOptions;
694
+ isEntry: boolean;
695
+ kind: BindingHookResolveIdExtraArgs["kind"];
696
+ }
697
+ type ResolveIdResult = string | NullValue | false | PartialResolvedId;
698
+ type LoadResult = NullValue | string | SourceDescription;
699
+ type TransformResult = NullValue | string | Partial<SourceDescription>;
700
+ type RenderedChunkMeta = {
701
+ chunks: Record<string, RenderedChunk>;
702
+ };
703
+ interface FunctionPluginHooks {
704
+ [DEFINED_HOOK_NAMES.onLog]: (this: MinimalPluginContext, level: LogLevel, log: RollupLog) => NullValue | boolean;
705
+ [DEFINED_HOOK_NAMES.options]: (this: MinimalPluginContext, options: InputOptions) => NullValue | InputOptions;
706
+ // TODO find a way to make `this: PluginContext` work.
707
+ [DEFINED_HOOK_NAMES.outputOptions]: (this: MinimalPluginContext, options: OutputOptions) => NullValue | OutputOptions;
708
+ // --- Build hooks ---
709
+ [DEFINED_HOOK_NAMES.buildStart]: (this: PluginContext, options: NormalizedInputOptions) => void;
710
+ [DEFINED_HOOK_NAMES.resolveId]: (this: PluginContext, source: string, importer: string | undefined, extraOptions: ResolveIdExtraOptions) => ResolveIdResult;
711
+ /**
712
+ * @deprecated
713
+ * This hook is only for rollup plugin compatibility. Please use `resolveId` instead.
714
+ */
715
+ [DEFINED_HOOK_NAMES.resolveDynamicImport]: (this: PluginContext, source: string, importer: string | undefined) => ResolveIdResult;
716
+ [DEFINED_HOOK_NAMES.load]: (this: PluginContext, id: string) => MaybePromise<LoadResult>;
717
+ [DEFINED_HOOK_NAMES.transform]: (this: TransformPluginContext, code: string, id: string, meta: BindingTransformHookExtraArgs & {
718
+ moduleType: ModuleType;
719
+ }) => TransformResult;
720
+ [DEFINED_HOOK_NAMES.moduleParsed]: (this: PluginContext, moduleInfo: ModuleInfo) => void;
721
+ [DEFINED_HOOK_NAMES.buildEnd]: (this: PluginContext, err?: Error) => void;
722
+ // --- Generate hooks ---
723
+ [DEFINED_HOOK_NAMES.renderStart]: (this: PluginContext, outputOptions: NormalizedOutputOptions, inputOptions: NormalizedInputOptions) => void;
724
+ [DEFINED_HOOK_NAMES.renderChunk]: (this: PluginContext, code: string, chunk: RenderedChunk, outputOptions: NormalizedOutputOptions, meta: RenderedChunkMeta) => NullValue | string | {
725
+ code: string;
726
+ map?: SourceMapInput;
727
+ };
728
+ [DEFINED_HOOK_NAMES.augmentChunkHash]: (this: PluginContext, chunk: RenderedChunk) => string | void;
729
+ [DEFINED_HOOK_NAMES.renderError]: (this: PluginContext, error: Error) => void;
730
+ [DEFINED_HOOK_NAMES.generateBundle]: (this: PluginContext, outputOptions: NormalizedOutputOptions, bundle: OutputBundle, isWrite: boolean) => void;
731
+ [DEFINED_HOOK_NAMES.writeBundle]: (this: PluginContext, outputOptions: NormalizedOutputOptions, bundle: OutputBundle) => void;
732
+ [DEFINED_HOOK_NAMES.closeBundle]: (this: PluginContext) => void;
733
+ // --- watch hooks ---
734
+ [DEFINED_HOOK_NAMES.watchChange]: (this: PluginContext, id: string, event: {
735
+ event: ChangeEvent;
736
+ }) => void;
737
+ [DEFINED_HOOK_NAMES.closeWatcher]: (this: PluginContext) => void;
738
+ }
739
+ type ChangeEvent = "create" | "update" | "delete";
740
+ type PluginOrder = "pre" | "post" | null;
741
+ type ObjectHookMeta = {
742
+ order?: PluginOrder;
743
+ };
744
+ type ObjectHook<T, O = {}> = T | ({
745
+ handler: T;
746
+ } & ObjectHookMeta & O);
747
+ type SyncPluginHooks = DefinedHookNames["augmentChunkHash" | "onLog" | "outputOptions"];
748
+ // | 'renderDynamicImport'
749
+ // | 'resolveFileUrl'
750
+ // | 'resolveImportMeta'
751
+ type AsyncPluginHooks = Exclude<keyof FunctionPluginHooks, SyncPluginHooks>;
752
+ type FirstPluginHooks = DefinedHookNames["load" | "resolveDynamicImport" | "resolveId"];
753
+ // | 'resolveImportMeta'
754
+ // | 'shouldTransformCachedModule'
755
+ type SequentialPluginHooks = DefinedHookNames["augmentChunkHash" | "generateBundle" | "onLog" | "options" | "outputOptions" | "renderChunk" | "transform"];
756
+ type AddonHooks = DefinedHookNames["banner" | "footer" | "intro" | "outro"];
757
+ type OutputPluginHooks = DefinedHookNames["augmentChunkHash" | "generateBundle" | "outputOptions" | "renderChunk" | "renderError" | "renderStart" | "writeBundle"];
758
+ type ParallelPluginHooks = Exclude<keyof FunctionPluginHooks | AddonHooks, FirstPluginHooks | SequentialPluginHooks>;
759
+ type HookFilterExtension<K extends keyof FunctionPluginHooks> = K extends "transform" ? {
760
+ filter?: TUnionWithTopLevelFilterExpressionArray<HookFilter>;
761
+ } : K extends "load" ? {
762
+ filter?: TUnionWithTopLevelFilterExpressionArray<Pick<HookFilter, "id">>;
763
+ } : K extends "resolveId" ? {
764
+ filter?: TUnionWithTopLevelFilterExpressionArray<{
765
+ id?: GeneralHookFilter<RegExp>;
766
+ }>;
767
+ } : K extends "renderChunk" ? {
768
+ filter?: TUnionWithTopLevelFilterExpressionArray<Pick<HookFilter, "code">>;
769
+ } : {};
770
+ type PluginHooks = { [K in keyof FunctionPluginHooks]: ObjectHook<K extends AsyncPluginHooks ? MakeAsync<FunctionPluginHooks[K]> : FunctionPluginHooks[K], HookFilterExtension<K> & (K extends ParallelPluginHooks ? {
771
+ /**
772
+ * @deprecated
773
+ * this is only for rollup Plugin type compatibility.
774
+ * hooks always work as `sequential: true`.
775
+ */
776
+ sequential?: boolean;
777
+ } : {})> };
778
+ type AddonHookFunction = (this: PluginContext, chunk: RenderedChunk) => string | Promise<string>;
779
+ type AddonHook = string | AddonHookFunction;
780
+ interface OutputPlugin extends Partial<{ [K in OutputPluginHooks]: PluginHooks[K] }>, Partial<{ [K in AddonHooks]: ObjectHook<AddonHook> }> {
781
+ // cacheKey?: string
782
+ name: string;
783
+ }
784
+ interface Plugin<A = any> extends OutputPlugin, Partial<PluginHooks> {
785
+ // for inter-plugin communication
786
+ api?: A;
787
+ }
788
+ type RolldownPlugin<A = any> = Plugin<A> | BuiltinPlugin | ParallelPlugin;
789
+ type RolldownPluginOption<A = any> = MaybePromise<NullValue<RolldownPlugin<A>> | {
790
+ name: string;
791
+ } | false | RolldownPluginOption[]>;
792
+ type RolldownOutputPlugin = OutputPlugin | BuiltinPlugin;
793
+ type RolldownOutputPluginOption = MaybePromise<NullValue<RolldownOutputPlugin> | {
794
+ name: string;
795
+ } | false | RolldownOutputPluginOption[]>;
796
+ //#endregion
797
+ //#region src/options/generated/checks-options.d.ts
798
+ // Auto-generated code, DO NOT EDIT DIRECTLY!
799
+ // To edit this generated file you have to edit `tasks/generator/src/generators/checks.rs`
800
+ interface ChecksOptions {
801
+ /**
802
+ * Whether to emit warning when detecting circular dependency
803
+ * @default false
804
+ */
805
+ circularDependency?: boolean;
806
+ /**
807
+ * Whether to emit warning when detecting eval
808
+ * @default true
809
+ */
810
+ eval?: boolean;
811
+ /**
812
+ * Whether to emit warning when detecting missing global name
813
+ * @default true
814
+ */
815
+ missingGlobalName?: boolean;
816
+ /**
817
+ * Whether to emit warning when detecting missing name option for iife export
818
+ * @default true
819
+ */
820
+ missingNameOptionForIifeExport?: boolean;
821
+ /**
822
+ * Whether to emit warning when detecting mixed export
823
+ * @default true
824
+ */
825
+ mixedExport?: boolean;
826
+ /**
827
+ * Whether to emit warning when detecting unresolved entry
828
+ * @default true
829
+ */
830
+ unresolvedEntry?: boolean;
831
+ /**
832
+ * Whether to emit warning when detecting unresolved import
833
+ * @default true
834
+ */
835
+ unresolvedImport?: boolean;
836
+ /**
837
+ * Whether to emit warning when detecting filename conflict
838
+ * @default true
839
+ */
840
+ filenameConflict?: boolean;
841
+ /**
842
+ * Whether to emit warning when detecting common js variable in esm
843
+ * @default true
844
+ */
845
+ commonJsVariableInEsm?: boolean;
846
+ /**
847
+ * Whether to emit warning when detecting import is undefined
848
+ * @default true
849
+ */
850
+ importIsUndefined?: boolean;
851
+ /**
852
+ * Whether to emit warning when detecting configuration field conflict
853
+ * @default true
854
+ */
855
+ configurationFieldConflict?: boolean;
856
+ }
857
+ //#endregion
858
+ //#region src/options/input-options.d.ts
859
+ type InputOption = string | string[] | Record<string, string>;
860
+ // Omit those key that are part of rolldown option
861
+ type OxcTransformOption = Omit<TransformOptions, "sourceType" | "lang" | "cwd" | "sourcemap" | "define" | "inject">;
862
+ type ExternalOption = StringOrRegExp | StringOrRegExp[] | ((id: string, parentId: string | undefined, isResolved: boolean) => NullValue<boolean>);
863
+ type ModuleTypes = Record<string, "js" | "jsx" | "ts" | "tsx" | "json" | "text" | "base64" | "dataurl" | "binary" | "empty" | "css" | "asset">;
864
+ interface WatcherOptions {
865
+ skipWrite?: boolean;
866
+ buildDelay?: number;
867
+ notify?: {
868
+ pollInterval?: number;
869
+ compareContents?: boolean;
870
+ };
871
+ include?: StringOrRegExp | StringOrRegExp[];
872
+ exclude?: StringOrRegExp | StringOrRegExp[];
873
+ }
874
+ type MakeAbsoluteExternalsRelative = boolean | "ifRelativeSource";
875
+ type HmrOptions = boolean | {
876
+ host?: string;
877
+ port?: number;
878
+ implement?: string;
879
+ };
880
+ interface RollupJsxOptions {
881
+ mode?: "classic" | "automatic" | "preserve";
882
+ factory?: string;
883
+ fragment?: string;
884
+ importSource?: string;
885
+ jsxImportSource?: string;
886
+ }
887
+ interface InputOptions {
888
+ input?: InputOption;
889
+ plugins?: RolldownPluginOption;
890
+ external?: ExternalOption;
891
+ resolve?: {
892
+ /**
893
+ * > [!WARNING]
894
+ * > `resolve.alias` will not call `resolveId` hooks of other plugin.
895
+ * > If you want to call `resolveId` hooks of other plugin, use `aliasPlugin` from `rolldown/experimental` instead.
896
+ * > You could find more discussion in [this issue](https://github.com/rolldown/rolldown/issues/3615)
897
+ */
898
+ alias?: Record<string, string[] | string>;
899
+ aliasFields?: string[][];
900
+ conditionNames?: string[];
901
+ /**
902
+ * Map of extensions to alternative extensions.
903
+ *
904
+ * With writing `import './foo.js'` in a file, you want to resolve it to `foo.ts` instead of `foo.js`.
905
+ * You can achieve this by setting: `extensionAlias: { '.js': ['.ts', '.js'] }`.
906
+ */
907
+ extensionAlias?: Record<string, string[]>;
908
+ exportsFields?: string[][];
909
+ extensions?: string[];
910
+ mainFields?: string[];
911
+ mainFiles?: string[];
912
+ modules?: string[];
913
+ symlinks?: boolean;
914
+ tsconfigFilename?: string;
915
+ };
916
+ cwd?: string;
917
+ /**
918
+ * Expected platform where the code run.
919
+ *
920
+ * @default
921
+ * - 'node' if the format is 'cjs'
922
+ * - 'browser' for other formats
923
+ */
924
+ platform?: "node" | "browser" | "neutral";
925
+ shimMissingExports?: boolean;
926
+ treeshake?: boolean | TreeshakingOptions;
927
+ logLevel?: LogLevelOption;
928
+ onLog?: (level: LogLevel, log: RollupLog, defaultHandler: LogOrStringHandler) => void;
929
+ onwarn?: (warning: RollupLog, defaultHandler: (warning: RollupLogWithString | (() => RollupLogWithString)) => void) => void;
930
+ moduleTypes?: ModuleTypes;
931
+ experimental?: {
932
+ enableComposingJsPlugins?: boolean;
933
+ strictExecutionOrder?: boolean;
934
+ disableLiveBindings?: boolean;
935
+ viteMode?: boolean;
936
+ resolveNewUrlToAsset?: boolean;
937
+ hmr?: HmrOptions;
938
+ attachDebugInfo?: boolean;
939
+ };
940
+ /**
941
+ * Replace global variables or [property accessors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_accessors) with the provided values.
942
+ *
943
+ * # Examples
944
+ *
945
+ * - Replace the global variable `IS_PROD` with `true`
946
+ *
947
+ * ```js rolldown.config.js
948
+ * export default defineConfig({ define: { IS_PROD: 'true' // or JSON.stringify(true) } })
949
+ * ```
950
+ *
951
+ * Result:
952
+ *
953
+ * ```js
954
+ * // Input
955
+ * if (IS_PROD) {
956
+ * console.log('Production mode')
957
+ * }
958
+ *
959
+ * // After bundling
960
+ * if (true) {
961
+ * console.log('Production mode')
962
+ * }
963
+ * ```
964
+ *
965
+ * - Replace the property accessor `process.env.NODE_ENV` with `'production'`
966
+ *
967
+ * ```js rolldown.config.js
968
+ * export default defineConfig({ define: { 'process.env.NODE_ENV': "'production'" } })
969
+ * ```
970
+ *
971
+ * Result:
972
+ *
973
+ * ```js
974
+ * // Input
975
+ * if (process.env.NODE_ENV === 'production') {
976
+ * console.log('Production mode')
977
+ * }
978
+ *
979
+ * // After bundling
980
+ * if ('production' === 'production') {
981
+ * console.log('Production mode')
982
+ * }
983
+ *
984
+ * ```
985
+ */
986
+ define?: Record<string, string>;
987
+ /**
988
+ * Inject import statements on demand.
989
+ *
990
+ * ## Supported patterns
991
+ * ```js
992
+ * {
993
+ * // import { Promise } from 'es6-promise'
994
+ * Promise: ['es6-promise', 'Promise'],
995
+ *
996
+ * // import { Promise as P } from 'es6-promise'
997
+ * P: ['es6-promise', 'Promise'],
998
+ *
999
+ * // import $ from 'jquery'
1000
+ * $: 'jquery',
1001
+ *
1002
+ * // import * as fs from 'node:fs'
1003
+ * fs: ['node:fs', '*'],
1004
+ *
1005
+ * // Inject shims for property access pattern
1006
+ * 'Object.assign': path.resolve( 'src/helpers/object-assign.js' ),
1007
+ * }
1008
+ * ```
1009
+ */
1010
+ inject?: Record<string, string | [string, string]>;
1011
+ profilerNames?: boolean;
1012
+ /**
1013
+ * - `false` disables the JSX parser, resulting in a syntax error if JSX syntax is used.
1014
+ * - `"preserve"` disables the JSX transformer, preserving the original JSX syntax in the output.
1015
+ * - `"react"` enables the `classic` JSX transformer.
1016
+ * - `"react-jsx"` enables the `automatic` JSX transformer.
1017
+ *
1018
+ * @default runtime = "automatic"
1019
+ */
1020
+ jsx?: false | "react" | "react-jsx" | "preserve" | RollupJsxOptions;
1021
+ transform?: OxcTransformOption;
1022
+ watch?: WatcherOptions | false;
1023
+ dropLabels?: string[];
1024
+ keepNames?: boolean;
1025
+ checks?: ChecksOptions;
1026
+ makeAbsoluteExternalsRelative?: MakeAbsoluteExternalsRelative;
1027
+ debug?: {
1028
+ sessionId?: string;
1029
+ };
1030
+ }
1031
+ //#endregion
1032
+ //#region src/types/rolldown-options.d.ts
1033
+ interface RolldownOptions extends InputOptions {
1034
+ output?: OutputOptions | OutputOptions[];
1035
+ }
1036
+ //#endregion
1037
+ //#region src/types/config-export.d.ts
1038
+ /**
1039
+ * Type for `default export` of `rolldown.config.js` file.
1040
+ */
1041
+ type ConfigExport = RolldownOptions | RolldownOptions[];
1042
+ //#endregion
1043
+ //#region src/utils/define-config.d.ts
1044
+ declare function defineConfig(config: RolldownOptions): RolldownOptions;
1045
+ declare function defineConfig(config: RolldownOptions[]): RolldownOptions[];
1046
+ declare function defineConfig(config: ConfigExport): ConfigExport;
1047
+ //#endregion
1048
+ export { AddonFunction, AsyncPluginHooks, BuildOptions, BuiltinPlugin, ChunkFileNamesFunction, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedFile, ExistingRawSourceMap, ExternalOption, FunctionPluginHooks, GeneralHookFilter, GetModuleInfo, GlobalsFunction, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, LoadResult, LogLevel, LogLevelOption, LogOrStringHandler, LoggingFunction, MaybePromise, MinifyOptions, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, ModuleTypes, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PreRenderedAsset, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RolldownWatcherEvent, RollupError, RollupLog, RollupLogWithString, SourceDescription, SourceMap, SourceMapInput, SourcemapIgnoreListOption, TransformPluginContext, TransformResult, TreeshakingOptions, VERSION, WarningHandlerWithDefault, WatchOptions, WatcherOptions, assetPlugin, build, buildImportAnalysisPlugin, defineConfig, defineParallelPlugin, dynamicImportVarsPlugin, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, reporterPlugin, rolldown, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch, webWorkerPostPlugin, withFilter };