@rollup/browser 3.0.0-3

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.
@@ -0,0 +1,917 @@
1
+ export const VERSION: string;
2
+
3
+ export interface RollupError extends RollupLog {
4
+ name?: string;
5
+ stack?: string;
6
+ watchFiles?: string[];
7
+ }
8
+
9
+ export type RollupWarning = RollupLog;
10
+
11
+ export interface RollupLog {
12
+ binding?: string;
13
+ cause?: Error;
14
+ code?: string;
15
+ exporter?: string;
16
+ frame?: string;
17
+ hook?: string;
18
+ id?: string;
19
+ ids?: string[];
20
+ loc?: {
21
+ column: number;
22
+ file?: string;
23
+ line: number;
24
+ };
25
+ message: string;
26
+ names?: string[];
27
+ plugin?: string;
28
+ pluginCode?: string;
29
+ pos?: number;
30
+ reexporter?: string;
31
+ url?: string;
32
+ }
33
+
34
+ export type SourceMapSegment =
35
+ | [number]
36
+ | [number, number, number, number]
37
+ | [number, number, number, number, number];
38
+
39
+ export interface ExistingDecodedSourceMap {
40
+ file?: string;
41
+ mappings: SourceMapSegment[][];
42
+ names: string[];
43
+ sourceRoot?: string;
44
+ sources: string[];
45
+ sourcesContent?: string[];
46
+ version: number;
47
+ }
48
+
49
+ export interface ExistingRawSourceMap {
50
+ file?: string;
51
+ mappings: string;
52
+ names: string[];
53
+ sourceRoot?: string;
54
+ sources: string[];
55
+ sourcesContent?: string[];
56
+ version: number;
57
+ }
58
+
59
+ export type DecodedSourceMapOrMissing =
60
+ | {
61
+ mappings?: never;
62
+ missing: true;
63
+ plugin: string;
64
+ }
65
+ | ExistingDecodedSourceMap;
66
+
67
+ export interface SourceMap {
68
+ file: string;
69
+ mappings: string;
70
+ names: string[];
71
+ sources: string[];
72
+ sourcesContent: string[];
73
+ version: number;
74
+ toString(): string;
75
+ toUrl(): string;
76
+ }
77
+
78
+ export type SourceMapInput = ExistingRawSourceMap | string | null | { mappings: '' };
79
+
80
+ type PartialNull<T> = {
81
+ [P in keyof T]: T[P] | null;
82
+ };
83
+
84
+ interface ModuleOptions {
85
+ meta: CustomPluginOptions;
86
+ moduleSideEffects: boolean | 'no-treeshake';
87
+ syntheticNamedExports: boolean | string;
88
+ }
89
+
90
+ export interface SourceDescription extends Partial<PartialNull<ModuleOptions>> {
91
+ ast?: AcornNode;
92
+ code: string;
93
+ map?: SourceMapInput;
94
+ }
95
+
96
+ export interface TransformModuleJSON {
97
+ ast?: AcornNode;
98
+ code: string;
99
+ // note if plugins use new this.cache to opt-out auto transform cache
100
+ customTransformCache: boolean;
101
+ originalCode: string;
102
+ originalSourcemap: ExistingDecodedSourceMap | null;
103
+ sourcemapChain: DecodedSourceMapOrMissing[];
104
+ transformDependencies: string[];
105
+ }
106
+
107
+ export interface ModuleJSON extends TransformModuleJSON, ModuleOptions {
108
+ ast: AcornNode;
109
+ dependencies: string[];
110
+ id: string;
111
+ resolvedIds: ResolvedIdMap;
112
+ transformFiles: EmittedFile[] | undefined;
113
+ }
114
+
115
+ export interface PluginCache {
116
+ delete(id: string): boolean;
117
+ get<T = any>(id: string): T;
118
+ has(id: string): boolean;
119
+ set<T = any>(id: string, value: T): void;
120
+ }
121
+
122
+ export interface MinimalPluginContext {
123
+ meta: PluginContextMeta;
124
+ }
125
+
126
+ export interface EmittedAsset {
127
+ fileName?: string;
128
+ name?: string;
129
+ source?: string | Uint8Array;
130
+ type: 'asset';
131
+ }
132
+
133
+ export interface EmittedChunk {
134
+ fileName?: string;
135
+ id: string;
136
+ implicitlyLoadedAfterOneOf?: string[];
137
+ importer?: string;
138
+ name?: string;
139
+ preserveSignature?: PreserveEntrySignaturesOption;
140
+ type: 'chunk';
141
+ }
142
+
143
+ export type EmittedFile = EmittedAsset | EmittedChunk;
144
+
145
+ export type EmitFile = (emittedFile: EmittedFile) => string;
146
+
147
+ interface ModuleInfo extends ModuleOptions {
148
+ ast: AcornNode | null;
149
+ code: string | null;
150
+ dynamicImporters: readonly string[];
151
+ dynamicallyImportedIdResolutions: readonly ResolvedId[];
152
+ dynamicallyImportedIds: readonly string[];
153
+ hasDefaultExport: boolean | null;
154
+ /** @deprecated Use `moduleSideEffects` instead */
155
+ hasModuleSideEffects: boolean | 'no-treeshake';
156
+ id: string;
157
+ implicitlyLoadedAfterOneOf: readonly string[];
158
+ implicitlyLoadedBefore: readonly string[];
159
+ importedIdResolutions: readonly ResolvedId[];
160
+ importedIds: readonly string[];
161
+ importers: readonly string[];
162
+ isEntry: boolean;
163
+ isExternal: boolean;
164
+ isIncluded: boolean | null;
165
+ }
166
+
167
+ export type GetModuleInfo = (moduleId: string) => ModuleInfo | null;
168
+
169
+ export interface CustomPluginOptions {
170
+ [plugin: string]: any;
171
+ }
172
+
173
+ export interface PluginContext extends MinimalPluginContext {
174
+ addWatchFile: (id: string) => void;
175
+ cache: PluginCache;
176
+ emitFile: EmitFile;
177
+ error: (err: RollupError | string, pos?: number | { column: number; line: number }) => never;
178
+ getFileName: (fileReferenceId: string) => string;
179
+ getModuleIds: () => IterableIterator<string>;
180
+ getModuleInfo: GetModuleInfo;
181
+ getWatchFiles: () => string[];
182
+ load: (
183
+ options: { id: string; resolveDependencies?: boolean } & Partial<PartialNull<ModuleOptions>>
184
+ ) => Promise<ModuleInfo>;
185
+ /** @deprecated Use `this.getModuleIds` instead */
186
+ moduleIds: IterableIterator<string>;
187
+ parse: (input: string, options?: any) => AcornNode;
188
+ resolve: (
189
+ source: string,
190
+ importer?: string,
191
+ options?: { custom?: CustomPluginOptions; isEntry?: boolean; skipSelf?: boolean }
192
+ ) => Promise<ResolvedId | null>;
193
+ setAssetSource: (assetReferenceId: string, source: string | Uint8Array) => void;
194
+ warn: (warning: RollupWarning | string, pos?: number | { column: number; line: number }) => void;
195
+ }
196
+
197
+ export interface PluginContextMeta {
198
+ rollupVersion: string;
199
+ watchMode: boolean;
200
+ }
201
+
202
+ export interface ResolvedId extends ModuleOptions {
203
+ external: boolean | 'absolute';
204
+ id: string;
205
+ }
206
+
207
+ export interface ResolvedIdMap {
208
+ [key: string]: ResolvedId;
209
+ }
210
+
211
+ interface PartialResolvedId extends Partial<PartialNull<ModuleOptions>> {
212
+ external?: boolean | 'absolute' | 'relative';
213
+ id: string;
214
+ }
215
+
216
+ export type ResolveIdResult = string | false | null | void | PartialResolvedId;
217
+
218
+ export type ResolveIdHook = (
219
+ this: PluginContext,
220
+ source: string,
221
+ importer: string | undefined,
222
+ options: { custom?: CustomPluginOptions; isEntry: boolean }
223
+ ) => Promise<ResolveIdResult> | ResolveIdResult;
224
+
225
+ export type ShouldTransformCachedModuleHook = (
226
+ this: PluginContext,
227
+ options: {
228
+ ast: AcornNode;
229
+ code: string;
230
+ id: string;
231
+ meta: CustomPluginOptions;
232
+ moduleSideEffects: boolean | 'no-treeshake';
233
+ resolvedSources: ResolvedIdMap;
234
+ syntheticNamedExports: boolean | string;
235
+ }
236
+ ) => Promise<boolean> | boolean;
237
+
238
+ export type IsExternal = (
239
+ source: string,
240
+ importer: string | undefined,
241
+ isResolved: boolean
242
+ ) => boolean;
243
+
244
+ export type IsPureModule = (id: string) => boolean | null | void;
245
+
246
+ export type HasModuleSideEffects = (id: string, external: boolean) => boolean;
247
+
248
+ type LoadResult = SourceDescription | string | null | void;
249
+
250
+ export type LoadHook = (this: PluginContext, id: string) => Promise<LoadResult> | LoadResult;
251
+
252
+ export interface TransformPluginContext extends PluginContext {
253
+ getCombinedSourcemap: () => SourceMap;
254
+ }
255
+
256
+ export type TransformResult = string | null | void | Partial<SourceDescription>;
257
+
258
+ export type TransformHook = (
259
+ this: TransformPluginContext,
260
+ code: string,
261
+ id: string
262
+ ) => Promise<TransformResult> | TransformResult;
263
+
264
+ export type ModuleParsedHook = (this: PluginContext, info: ModuleInfo) => Promise<void> | void;
265
+
266
+ export type RenderChunkHook = (
267
+ this: PluginContext,
268
+ code: string,
269
+ chunk: RenderedChunk,
270
+ options: NormalizedOutputOptions,
271
+ meta: { chunks: Record<string, RenderedChunk> }
272
+ ) =>
273
+ | Promise<{ code: string; map?: SourceMapInput } | null>
274
+ | { code: string; map?: SourceMapInput }
275
+ | string
276
+ | null
277
+ | undefined;
278
+
279
+ export type ResolveDynamicImportHook = (
280
+ this: PluginContext,
281
+ specifier: string | AcornNode,
282
+ importer: string
283
+ ) => Promise<ResolveIdResult> | ResolveIdResult;
284
+
285
+ export type ResolveImportMetaHook = (
286
+ this: PluginContext,
287
+ prop: string | null,
288
+ options: { chunkId: string; format: InternalModuleFormat; moduleId: string }
289
+ ) => string | null | void;
290
+
291
+ export type ResolveFileUrlHook = (
292
+ this: PluginContext,
293
+ options: {
294
+ chunkId: string;
295
+ fileName: string;
296
+ format: InternalModuleFormat;
297
+ moduleId: string;
298
+ referenceId: string;
299
+ relativePath: string;
300
+ }
301
+ ) => string | null | void;
302
+
303
+ export type AddonHookFunction = (
304
+ this: PluginContext,
305
+ chunk: RenderedChunk
306
+ ) => string | Promise<string>;
307
+ export type AddonHook = string | AddonHookFunction;
308
+
309
+ export type ChangeEvent = 'create' | 'update' | 'delete';
310
+ export type WatchChangeHook = (
311
+ this: PluginContext,
312
+ id: string,
313
+ change: { event: ChangeEvent }
314
+ ) => Promise<void> | void;
315
+
316
+ /**
317
+ * use this type for plugin annotation
318
+ * @example
319
+ * ```ts
320
+ * interface Options {
321
+ * ...
322
+ * }
323
+ * const myPlugin: PluginImpl<Options> = (options = {}) => { ... }
324
+ * ```
325
+ */
326
+ // eslint-disable-next-line @typescript-eslint/ban-types
327
+ export type PluginImpl<O extends object = object> = (options?: O) => Plugin;
328
+
329
+ export interface OutputBundle {
330
+ [fileName: string]: OutputAsset | OutputChunk;
331
+ }
332
+
333
+ export interface FilePlaceholder {
334
+ type: 'placeholder';
335
+ }
336
+
337
+ export interface OutputBundleWithPlaceholders {
338
+ [fileName: string]: OutputAsset | OutputChunk | FilePlaceholder;
339
+ }
340
+
341
+ export interface PluginHooks extends OutputPluginHooks {
342
+ buildEnd: (this: PluginContext, err?: Error) => Promise<void> | void;
343
+ buildStart: (this: PluginContext, options: NormalizedInputOptions) => Promise<void> | void;
344
+ closeBundle: (this: PluginContext) => Promise<void> | void;
345
+ closeWatcher: (this: PluginContext) => Promise<void> | void;
346
+ load: LoadHook;
347
+ moduleParsed: ModuleParsedHook;
348
+ options: (
349
+ this: MinimalPluginContext,
350
+ options: InputOptions
351
+ ) => Promise<InputOptions | null | void> | InputOptions | null | void;
352
+ resolveDynamicImport: ResolveDynamicImportHook;
353
+ resolveId: ResolveIdHook;
354
+ shouldTransformCachedModule: ShouldTransformCachedModuleHook;
355
+ transform: TransformHook;
356
+ watchChange: WatchChangeHook;
357
+ }
358
+
359
+ interface OutputPluginHooks {
360
+ augmentChunkHash: (this: PluginContext, chunk: RenderedChunk) => string | void;
361
+ generateBundle: (
362
+ this: PluginContext,
363
+ options: NormalizedOutputOptions,
364
+ bundle: OutputBundle,
365
+ isWrite: boolean
366
+ ) => void | Promise<void>;
367
+ outputOptions: (this: PluginContext, options: OutputOptions) => OutputOptions | null | void;
368
+ renderChunk: RenderChunkHook;
369
+ renderDynamicImport: (
370
+ this: PluginContext,
371
+ options: {
372
+ customResolution: string | null;
373
+ format: InternalModuleFormat;
374
+ moduleId: string;
375
+ targetModuleId: string | null;
376
+ }
377
+ ) => { left: string; right: string } | null | void;
378
+ renderError: (this: PluginContext, err?: Error) => Promise<void> | void;
379
+ renderStart: (
380
+ this: PluginContext,
381
+ outputOptions: NormalizedOutputOptions,
382
+ inputOptions: NormalizedInputOptions
383
+ ) => Promise<void> | void;
384
+ resolveFileUrl: ResolveFileUrlHook;
385
+ resolveImportMeta: ResolveImportMetaHook;
386
+ writeBundle: (
387
+ this: PluginContext,
388
+ options: NormalizedOutputOptions,
389
+ bundle: OutputBundle
390
+ ) => void | Promise<void>;
391
+ }
392
+
393
+ export type AsyncPluginHooks =
394
+ | 'options'
395
+ | 'buildEnd'
396
+ | 'buildStart'
397
+ | 'generateBundle'
398
+ | 'load'
399
+ | 'moduleParsed'
400
+ | 'renderChunk'
401
+ | 'renderError'
402
+ | 'renderStart'
403
+ | 'resolveDynamicImport'
404
+ | 'resolveId'
405
+ | 'shouldTransformCachedModule'
406
+ | 'transform'
407
+ | 'writeBundle'
408
+ | 'closeBundle'
409
+ | 'closeWatcher'
410
+ | 'watchChange';
411
+
412
+ export type PluginValueHooks = 'banner' | 'footer' | 'intro' | 'outro';
413
+
414
+ export type SyncPluginHooks = Exclude<keyof PluginHooks, AsyncPluginHooks>;
415
+
416
+ export type FirstPluginHooks =
417
+ | 'load'
418
+ | 'renderDynamicImport'
419
+ | 'resolveDynamicImport'
420
+ | 'resolveFileUrl'
421
+ | 'resolveId'
422
+ | 'resolveImportMeta'
423
+ | 'shouldTransformCachedModule';
424
+
425
+ export type SequentialPluginHooks =
426
+ | 'augmentChunkHash'
427
+ | 'generateBundle'
428
+ | 'options'
429
+ | 'outputOptions'
430
+ | 'renderChunk'
431
+ | 'transform';
432
+
433
+ export type ParallelPluginHooks =
434
+ | 'banner'
435
+ | 'buildEnd'
436
+ | 'buildStart'
437
+ | 'footer'
438
+ | 'intro'
439
+ | 'moduleParsed'
440
+ | 'outro'
441
+ | 'renderError'
442
+ | 'renderStart'
443
+ | 'writeBundle'
444
+ | 'closeBundle'
445
+ | 'closeWatcher'
446
+ | 'watchChange';
447
+
448
+ interface OutputPluginValueHooks {
449
+ banner: AddonHook;
450
+ cacheKey: string;
451
+ footer: AddonHook;
452
+ intro: AddonHook;
453
+ outro: AddonHook;
454
+ }
455
+
456
+ export interface Plugin extends Partial<PluginHooks>, Partial<OutputPluginValueHooks> {
457
+ // for inter-plugin communication
458
+ api?: any;
459
+ name: string;
460
+ }
461
+
462
+ export interface OutputPlugin extends Partial<OutputPluginHooks>, Partial<OutputPluginValueHooks> {
463
+ name: string;
464
+ }
465
+
466
+ type TreeshakingPreset = 'smallest' | 'safest' | 'recommended';
467
+
468
+ export interface NormalizedTreeshakingOptions {
469
+ annotations: boolean;
470
+ correctVarValueBeforeDeclaration: boolean;
471
+ moduleSideEffects: HasModuleSideEffects;
472
+ propertyReadSideEffects: boolean | 'always';
473
+ tryCatchDeoptimization: boolean;
474
+ unknownGlobalSideEffects: boolean;
475
+ }
476
+
477
+ export interface TreeshakingOptions
478
+ extends Partial<Omit<NormalizedTreeshakingOptions, 'moduleSideEffects'>> {
479
+ moduleSideEffects?: ModuleSideEffectsOption;
480
+ preset?: TreeshakingPreset;
481
+ }
482
+
483
+ interface ManualChunkMeta {
484
+ getModuleIds: () => IterableIterator<string>;
485
+ getModuleInfo: GetModuleInfo;
486
+ }
487
+ export type GetManualChunk = (id: string, meta: ManualChunkMeta) => string | null | void;
488
+
489
+ export type ExternalOption =
490
+ | (string | RegExp)[]
491
+ | string
492
+ | RegExp
493
+ | ((source: string, importer: string | undefined, isResolved: boolean) => boolean | null | void);
494
+ export type PureModulesOption = boolean | string[] | IsPureModule;
495
+ export type GlobalsOption = { [name: string]: string } | ((name: string) => string);
496
+ export type InputOption = string | string[] | { [entryAlias: string]: string };
497
+ export type ManualChunksOption = { [chunkAlias: string]: string[] } | GetManualChunk;
498
+ export type ModuleSideEffectsOption = boolean | 'no-external' | string[] | HasModuleSideEffects;
499
+ export type PreserveEntrySignaturesOption = false | 'strict' | 'allow-extension' | 'exports-only';
500
+ export type SourcemapPathTransformOption = (
501
+ relativeSourcePath: string,
502
+ sourcemapPath: string
503
+ ) => string;
504
+
505
+ export interface InputOptions {
506
+ acorn?: Record<string, unknown>;
507
+ acornInjectPlugins?: (() => unknown)[] | (() => unknown);
508
+ cache?: false | RollupCache;
509
+ context?: string;
510
+ experimentalCacheExpiry?: number;
511
+ external?: ExternalOption;
512
+ /** @deprecated Use the "inlineDynamicImports" output option instead. */
513
+ inlineDynamicImports?: boolean;
514
+ input?: InputOption;
515
+ makeAbsoluteExternalsRelative?: boolean | 'ifRelativeSource';
516
+ /** @deprecated Use the "manualChunks" output option instead. */
517
+ manualChunks?: ManualChunksOption;
518
+ maxParallelFileOps?: number;
519
+ /** @deprecated Use the "maxParallelFileOps" option instead. */
520
+ maxParallelFileReads?: number;
521
+ moduleContext?: ((id: string) => string | null | void) | { [id: string]: string };
522
+ onwarn?: WarningHandlerWithDefault;
523
+ perf?: boolean;
524
+ plugins?: (Plugin | null | false | undefined)[];
525
+ preserveEntrySignatures?: PreserveEntrySignaturesOption;
526
+ /** @deprecated Use the "preserveModules" output option instead. */
527
+ preserveModules?: boolean;
528
+ preserveSymlinks?: boolean;
529
+ shimMissingExports?: boolean;
530
+ strictDeprecations?: boolean;
531
+ treeshake?: boolean | TreeshakingPreset | TreeshakingOptions;
532
+ watch?: WatcherOptions | false;
533
+ }
534
+
535
+ export interface NormalizedInputOptions {
536
+ acorn: Record<string, unknown>;
537
+ acornInjectPlugins: (() => unknown)[];
538
+ cache: false | undefined | RollupCache;
539
+ context: string;
540
+ experimentalCacheExpiry: number;
541
+ external: IsExternal;
542
+ /** @deprecated Use the "inlineDynamicImports" output option instead. */
543
+ inlineDynamicImports: boolean | undefined;
544
+ input: string[] | { [entryAlias: string]: string };
545
+ makeAbsoluteExternalsRelative: boolean | 'ifRelativeSource';
546
+ /** @deprecated Use the "manualChunks" output option instead. */
547
+ manualChunks: ManualChunksOption | undefined;
548
+ maxParallelFileOps: number;
549
+ /** @deprecated Use the "maxParallelFileOps" option instead. */
550
+ maxParallelFileReads: number;
551
+ moduleContext: (id: string) => string;
552
+ onwarn: WarningHandler;
553
+ perf: boolean;
554
+ plugins: Plugin[];
555
+ preserveEntrySignatures: PreserveEntrySignaturesOption;
556
+ /** @deprecated Use the "preserveModules" output option instead. */
557
+ preserveModules: boolean | undefined;
558
+ preserveSymlinks: boolean;
559
+ shimMissingExports: boolean;
560
+ strictDeprecations: boolean;
561
+ treeshake: false | NormalizedTreeshakingOptions;
562
+ }
563
+
564
+ export type InternalModuleFormat = 'amd' | 'cjs' | 'es' | 'iife' | 'system' | 'umd';
565
+
566
+ export type ModuleFormat = InternalModuleFormat | 'commonjs' | 'esm' | 'module' | 'systemjs';
567
+
568
+ type GeneratedCodePreset = 'es5' | 'es2015';
569
+
570
+ interface NormalizedGeneratedCodeOptions {
571
+ arrowFunctions: boolean;
572
+ constBindings: boolean;
573
+ objectShorthand: boolean;
574
+ reservedNamesAsProps: boolean;
575
+ symbols: boolean;
576
+ }
577
+
578
+ interface GeneratedCodeOptions extends Partial<NormalizedGeneratedCodeOptions> {
579
+ preset?: GeneratedCodePreset;
580
+ }
581
+
582
+ export type OptionsPaths = Record<string, string> | ((id: string) => string);
583
+
584
+ export type InteropType = boolean | 'auto' | 'esModule' | 'default' | 'defaultOnly';
585
+
586
+ export type GetInterop = (id: string | null) => InteropType;
587
+
588
+ export type AmdOptions = (
589
+ | {
590
+ autoId?: false;
591
+ id: string;
592
+ }
593
+ | {
594
+ autoId: true;
595
+ basePath?: string;
596
+ id?: undefined;
597
+ }
598
+ | {
599
+ autoId?: false;
600
+ id?: undefined;
601
+ }
602
+ ) & {
603
+ define?: string;
604
+ };
605
+
606
+ export type NormalizedAmdOptions = (
607
+ | {
608
+ autoId: false;
609
+ id?: string;
610
+ }
611
+ | {
612
+ autoId: true;
613
+ basePath: string;
614
+ }
615
+ ) & {
616
+ define: string;
617
+ };
618
+
619
+ type AddonFunction = (chunk: RenderedChunk) => string | Promise<string>;
620
+
621
+ export interface OutputOptions {
622
+ amd?: AmdOptions;
623
+ assetFileNames?: string | ((chunkInfo: PreRenderedAsset) => string);
624
+ banner?: string | AddonFunction;
625
+ chunkFileNames?: string | ((chunkInfo: PreRenderedChunk) => string);
626
+ compact?: boolean;
627
+ // only required for bundle.write
628
+ dir?: string;
629
+ /** @deprecated Use the "renderDynamicImport" plugin hook instead. */
630
+ dynamicImportFunction?: string;
631
+ entryFileNames?: string | ((chunkInfo: PreRenderedChunk) => string);
632
+ esModule?: boolean;
633
+ exports?: 'default' | 'named' | 'none' | 'auto';
634
+ extend?: boolean;
635
+ externalLiveBindings?: boolean;
636
+ // only required for bundle.write
637
+ file?: string;
638
+ footer?: string | AddonFunction;
639
+ format?: ModuleFormat;
640
+ freeze?: boolean;
641
+ generatedCode?: GeneratedCodePreset | GeneratedCodeOptions;
642
+ globals?: GlobalsOption;
643
+ hoistTransitiveImports?: boolean;
644
+ indent?: string | boolean;
645
+ inlineDynamicImports?: boolean;
646
+ interop?: InteropType | GetInterop;
647
+ intro?: string | AddonFunction;
648
+ manualChunks?: ManualChunksOption;
649
+ minifyInternalExports?: boolean;
650
+ name?: string;
651
+ /** @deprecated Use "generatedCode.symbols" instead. */
652
+ namespaceToStringTag?: boolean;
653
+ noConflict?: boolean;
654
+ outro?: string | AddonFunction;
655
+ paths?: OptionsPaths;
656
+ plugins?: (OutputPlugin | null | false | undefined)[];
657
+ /** @deprecated Use "generatedCode.constBindings" instead. */
658
+ preferConst?: boolean;
659
+ preserveModules?: boolean;
660
+ preserveModulesRoot?: string;
661
+ sanitizeFileName?: boolean | ((fileName: string) => string);
662
+ sourcemap?: boolean | 'inline' | 'hidden';
663
+ sourcemapBaseUrl?: string;
664
+ sourcemapExcludeSources?: boolean;
665
+ sourcemapFile?: string;
666
+ sourcemapPathTransform?: SourcemapPathTransformOption;
667
+ strict?: boolean;
668
+ systemNullSetters?: boolean;
669
+ validate?: boolean;
670
+ }
671
+
672
+ export interface NormalizedOutputOptions {
673
+ amd: NormalizedAmdOptions;
674
+ assetFileNames: string | ((chunkInfo: PreRenderedAsset) => string);
675
+ banner: AddonFunction;
676
+ chunkFileNames: string | ((chunkInfo: PreRenderedChunk) => string);
677
+ compact: boolean;
678
+ dir: string | undefined;
679
+ /** @deprecated Use the "renderDynamicImport" plugin hook instead. */
680
+ dynamicImportFunction: string | undefined;
681
+ entryFileNames: string | ((chunkInfo: PreRenderedChunk) => string);
682
+ esModule: boolean;
683
+ exports: 'default' | 'named' | 'none' | 'auto';
684
+ extend: boolean;
685
+ externalLiveBindings: boolean;
686
+ file: string | undefined;
687
+ footer: AddonFunction;
688
+ format: InternalModuleFormat;
689
+ freeze: boolean;
690
+ generatedCode: NormalizedGeneratedCodeOptions;
691
+ globals: GlobalsOption;
692
+ hoistTransitiveImports: boolean;
693
+ indent: true | string;
694
+ inlineDynamicImports: boolean;
695
+ interop: GetInterop;
696
+ intro: AddonFunction;
697
+ manualChunks: ManualChunksOption;
698
+ minifyInternalExports: boolean;
699
+ name: string | undefined;
700
+ /** @deprecated Use "generatedCode.symbols" instead. */
701
+ namespaceToStringTag: boolean;
702
+ noConflict: boolean;
703
+ outro: AddonFunction;
704
+ paths: OptionsPaths;
705
+ plugins: OutputPlugin[];
706
+ /** @deprecated Use "generatedCode.constBindings" instead. */
707
+ preferConst: boolean;
708
+ preserveModules: boolean;
709
+ preserveModulesRoot: string | undefined;
710
+ sanitizeFileName: (fileName: string) => string;
711
+ sourcemap: boolean | 'inline' | 'hidden';
712
+ sourcemapBaseUrl: string | undefined;
713
+ sourcemapExcludeSources: boolean;
714
+ sourcemapFile: string | undefined;
715
+ sourcemapPathTransform: SourcemapPathTransformOption | undefined;
716
+ strict: boolean;
717
+ systemNullSetters: boolean;
718
+ validate: boolean;
719
+ }
720
+
721
+ export type WarningHandlerWithDefault = (
722
+ warning: RollupWarning,
723
+ defaultHandler: WarningHandler
724
+ ) => void;
725
+ export type WarningHandler = (warning: RollupWarning) => void;
726
+
727
+ export interface SerializedTimings {
728
+ [label: string]: [number, number, number];
729
+ }
730
+
731
+ export interface PreRenderedAsset {
732
+ name: string | undefined;
733
+ source: string | Uint8Array;
734
+ type: 'asset';
735
+ }
736
+
737
+ export interface OutputAsset extends PreRenderedAsset {
738
+ fileName: string;
739
+ }
740
+
741
+ export interface RenderedModule {
742
+ code: string | null;
743
+ originalLength: number;
744
+ removedExports: string[];
745
+ renderedExports: string[];
746
+ renderedLength: number;
747
+ }
748
+
749
+ export interface PreRenderedChunk {
750
+ exports: string[];
751
+ facadeModuleId: string | null;
752
+ isDynamicEntry: boolean;
753
+ isEntry: boolean;
754
+ isImplicitEntry: boolean;
755
+ moduleIds: string[];
756
+ name: string;
757
+ type: 'chunk';
758
+ }
759
+
760
+ export interface RenderedChunk extends PreRenderedChunk {
761
+ dynamicImports: string[];
762
+ fileName: string;
763
+ implicitlyLoadedBefore: string[];
764
+ importedBindings: {
765
+ [imported: string]: string[];
766
+ };
767
+ imports: string[];
768
+ modules: {
769
+ [id: string]: RenderedModule;
770
+ };
771
+ referencedFiles: string[];
772
+ }
773
+
774
+ export interface OutputChunk extends RenderedChunk {
775
+ code: string;
776
+ map: SourceMap | null;
777
+ }
778
+
779
+ export interface SerializablePluginCache {
780
+ [key: string]: [number, any];
781
+ }
782
+
783
+ export interface RollupCache {
784
+ modules: ModuleJSON[];
785
+ plugins?: Record<string, SerializablePluginCache>;
786
+ }
787
+
788
+ export interface RollupOutput {
789
+ output: [OutputChunk, ...(OutputChunk | OutputAsset)[]];
790
+ }
791
+
792
+ export interface RollupBuild {
793
+ cache: RollupCache | undefined;
794
+ close: () => Promise<void>;
795
+ closed: boolean;
796
+ generate: (outputOptions: OutputOptions) => Promise<RollupOutput>;
797
+ getTimings?: () => SerializedTimings;
798
+ watchFiles: string[];
799
+ write: (options: OutputOptions) => Promise<RollupOutput>;
800
+ }
801
+
802
+ export interface RollupOptions extends InputOptions {
803
+ // This is included for compatibility with config files but ignored by rollup.rollup
804
+ output?: OutputOptions | OutputOptions[];
805
+ }
806
+
807
+ export interface MergedRollupOptions extends InputOptions {
808
+ output: OutputOptions[];
809
+ }
810
+
811
+ export function rollup(options: RollupOptions): Promise<RollupBuild>;
812
+
813
+ export interface ChokidarOptions {
814
+ alwaysStat?: boolean;
815
+ atomic?: boolean | number;
816
+ awaitWriteFinish?:
817
+ | {
818
+ pollInterval?: number;
819
+ stabilityThreshold?: number;
820
+ }
821
+ | boolean;
822
+ binaryInterval?: number;
823
+ cwd?: string;
824
+ depth?: number;
825
+ disableGlobbing?: boolean;
826
+ followSymlinks?: boolean;
827
+ ignoreInitial?: boolean;
828
+ ignorePermissionErrors?: boolean;
829
+ ignored?: any;
830
+ interval?: number;
831
+ persistent?: boolean;
832
+ useFsEvents?: boolean;
833
+ usePolling?: boolean;
834
+ }
835
+
836
+ export type RollupWatchHooks = 'onError' | 'onStart' | 'onBundleStart' | 'onBundleEnd' | 'onEnd';
837
+
838
+ export interface WatcherOptions {
839
+ buildDelay?: number;
840
+ chokidar?: ChokidarOptions;
841
+ clearScreen?: boolean;
842
+ exclude?: string | RegExp | (string | RegExp)[];
843
+ include?: string | RegExp | (string | RegExp)[];
844
+ skipWrite?: boolean;
845
+ }
846
+
847
+ export interface RollupWatchOptions extends InputOptions {
848
+ output?: OutputOptions | OutputOptions[];
849
+ watch?: WatcherOptions | false;
850
+ }
851
+
852
+ interface TypedEventEmitter<T extends { [event: string]: (...args: any) => any }> {
853
+ addListener<K extends keyof T>(event: K, listener: T[K]): this;
854
+ emit<K extends keyof T>(event: K, ...args: Parameters<T[K]>): boolean;
855
+ eventNames(): Array<keyof T>;
856
+ getMaxListeners(): number;
857
+ listenerCount(type: keyof T): number;
858
+ listeners<K extends keyof T>(event: K): Array<T[K]>;
859
+ off<K extends keyof T>(event: K, listener: T[K]): this;
860
+ on<K extends keyof T>(event: K, listener: T[K]): this;
861
+ once<K extends keyof T>(event: K, listener: T[K]): this;
862
+ prependListener<K extends keyof T>(event: K, listener: T[K]): this;
863
+ prependOnceListener<K extends keyof T>(event: K, listener: T[K]): this;
864
+ rawListeners<K extends keyof T>(event: K): Array<T[K]>;
865
+ removeAllListeners<K extends keyof T>(event?: K): this;
866
+ removeListener<K extends keyof T>(event: K, listener: T[K]): this;
867
+ setMaxListeners(n: number): this;
868
+ }
869
+
870
+ export interface RollupAwaitingEmitter<T extends { [event: string]: (...args: any) => any }>
871
+ extends TypedEventEmitter<T> {
872
+ close(): Promise<void>;
873
+ emitAndAwait<K extends keyof T>(event: K, ...args: Parameters<T[K]>): Promise<ReturnType<T[K]>[]>;
874
+ /**
875
+ * Registers an event listener that will be awaited before Rollup continues
876
+ * for events emitted via emitAndAwait. All listeners will be awaited in
877
+ * parallel while rejections are tracked via Promise.all.
878
+ * Listeners are removed automatically when removeAwaited is called, which
879
+ * happens automatically after each run.
880
+ */
881
+ onCurrentAwaited<K extends keyof T>(
882
+ event: K,
883
+ listener: (...args: Parameters<T[K]>) => Promise<ReturnType<T[K]>>
884
+ ): this;
885
+ removeAwaited(): this;
886
+ }
887
+
888
+ export type RollupWatcherEvent =
889
+ | { code: 'START' }
890
+ | { code: 'BUNDLE_START'; input?: InputOption; output: readonly string[] }
891
+ | {
892
+ code: 'BUNDLE_END';
893
+ duration: number;
894
+ input?: InputOption;
895
+ output: readonly string[];
896
+ result: RollupBuild;
897
+ }
898
+ | { code: 'END' }
899
+ | { code: 'ERROR'; error: RollupError; result: RollupBuild | null };
900
+
901
+ export type RollupWatcher = RollupAwaitingEmitter<{
902
+ change: (id: string, change: { event: ChangeEvent }) => void;
903
+ close: () => void;
904
+ event: (event: RollupWatcherEvent) => void;
905
+ restart: () => void;
906
+ }>;
907
+
908
+ export function watch(config: RollupWatchOptions | RollupWatchOptions[]): RollupWatcher;
909
+
910
+ interface AcornNode {
911
+ end: number;
912
+ start: number;
913
+ type: string;
914
+ }
915
+
916
+ export function defineConfig(options: RollupOptions): RollupOptions;
917
+ export function defineConfig(options: RollupOptions[]): RollupOptions[];