source: frontend/node_modules/rollup/dist/rollup.d.ts

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago

Fix frontend appearance

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