@rolldown/browser 1.0.0-beta.9-commit.0ec9e7d → 1.0.0-rc.2

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