@rolldown/browser 1.0.0-beta.10-commit.87188ed → 1.0.0-beta.10-commit.2c4c2a8

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