rolldown 1.0.0-beta.7-commit.a7cf9ac → 1.0.0-beta.7-commit.b80d472

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