@rollup/browser 3.0.1 → 3.2.0
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.
package/dist/rollup.browser.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export const VERSION: string;
|
|
2
2
|
|
|
3
|
+
type FalsyValue = false | null | undefined;
|
|
4
|
+
type MaybeArray<T> = T | T[];
|
|
5
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
6
|
+
|
|
3
7
|
export interface RollupError extends RollupLog {
|
|
4
8
|
name?: string;
|
|
5
9
|
stack?: string;
|
|
@@ -176,7 +180,7 @@ export interface PluginContext extends MinimalPluginContext {
|
|
|
176
180
|
addWatchFile: (id: string) => void;
|
|
177
181
|
cache: PluginCache;
|
|
178
182
|
emitFile: EmitFile;
|
|
179
|
-
error: (
|
|
183
|
+
error: (error: RollupError | string, pos?: number | { column: number; line: number }) => never;
|
|
180
184
|
getFileName: (fileReferenceId: string) => string;
|
|
181
185
|
getModuleIds: () => IterableIterator<string>;
|
|
182
186
|
getModuleInfo: GetModuleInfo;
|
|
@@ -287,7 +291,7 @@ export type ResolveDynamicImportHook = (
|
|
|
287
291
|
|
|
288
292
|
export type ResolveImportMetaHook = (
|
|
289
293
|
this: PluginContext,
|
|
290
|
-
|
|
294
|
+
property: string | null,
|
|
291
295
|
options: { chunkId: string; format: InternalModuleFormat; moduleId: string }
|
|
292
296
|
) => string | null | void;
|
|
293
297
|
|
|
@@ -335,7 +339,7 @@ export interface OutputBundle {
|
|
|
335
339
|
|
|
336
340
|
export interface FunctionPluginHooks {
|
|
337
341
|
augmentChunkHash: (this: PluginContext, chunk: RenderedChunk) => string | void;
|
|
338
|
-
buildEnd: (this: PluginContext,
|
|
342
|
+
buildEnd: (this: PluginContext, error?: Error) => void;
|
|
339
343
|
buildStart: (this: PluginContext, options: NormalizedInputOptions) => void;
|
|
340
344
|
closeBundle: (this: PluginContext) => void;
|
|
341
345
|
closeWatcher: (this: PluginContext) => void;
|
|
@@ -359,7 +363,7 @@ export interface FunctionPluginHooks {
|
|
|
359
363
|
targetModuleId: string | null;
|
|
360
364
|
}
|
|
361
365
|
) => { left: string; right: string } | null | void;
|
|
362
|
-
renderError: (this: PluginContext,
|
|
366
|
+
renderError: (this: PluginContext, error?: Error) => void;
|
|
363
367
|
renderStart: (
|
|
364
368
|
this: PluginContext,
|
|
365
369
|
outputOptions: NormalizedOutputOptions,
|
|
@@ -426,8 +430,11 @@ export type ParallelPluginHooks = Exclude<
|
|
|
426
430
|
|
|
427
431
|
export type AddonHooks = 'banner' | 'footer' | 'intro' | 'outro';
|
|
428
432
|
|
|
429
|
-
type MakeAsync<
|
|
430
|
-
|
|
433
|
+
type MakeAsync<Function_> = Function_ extends (
|
|
434
|
+
this: infer This,
|
|
435
|
+
...parameters: infer Arguments
|
|
436
|
+
) => infer Return
|
|
437
|
+
? (this: This, ...parameters: Arguments) => Return | Promise<Return>
|
|
431
438
|
: never;
|
|
432
439
|
|
|
433
440
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
@@ -492,6 +499,8 @@ export type SourcemapPathTransformOption = (
|
|
|
492
499
|
sourcemapPath: string
|
|
493
500
|
) => string;
|
|
494
501
|
|
|
502
|
+
export type InputPluginOption = MaybePromise<Plugin | FalsyValue | InputPluginOption[]>;
|
|
503
|
+
|
|
495
504
|
export interface InputOptions {
|
|
496
505
|
acorn?: Record<string, unknown>;
|
|
497
506
|
acornInjectPlugins?: (() => unknown)[] | (() => unknown);
|
|
@@ -511,7 +520,7 @@ export interface InputOptions {
|
|
|
511
520
|
moduleContext?: ((id: string) => string | null | void) | { [id: string]: string };
|
|
512
521
|
onwarn?: WarningHandlerWithDefault;
|
|
513
522
|
perf?: boolean;
|
|
514
|
-
plugins?:
|
|
523
|
+
plugins?: InputPluginOption;
|
|
515
524
|
preserveEntrySignatures?: PreserveEntrySignaturesOption;
|
|
516
525
|
/** @deprecated Use the "preserveModules" output option instead. */
|
|
517
526
|
preserveModules?: boolean;
|
|
@@ -522,6 +531,10 @@ export interface InputOptions {
|
|
|
522
531
|
watch?: WatcherOptions | false;
|
|
523
532
|
}
|
|
524
533
|
|
|
534
|
+
export interface InputOptionsWithPlugins extends InputOptions {
|
|
535
|
+
plugins: Plugin[];
|
|
536
|
+
}
|
|
537
|
+
|
|
525
538
|
export interface NormalizedInputOptions {
|
|
526
539
|
acorn: Record<string, unknown>;
|
|
527
540
|
acornInjectPlugins: (() => unknown)[];
|
|
@@ -610,6 +623,8 @@ export type NormalizedAmdOptions = (
|
|
|
610
623
|
|
|
611
624
|
type AddonFunction = (chunk: RenderedChunk) => string | Promise<string>;
|
|
612
625
|
|
|
626
|
+
type OutputPluginOption = MaybePromise<OutputPlugin | FalsyValue | OutputPluginOption[]>;
|
|
627
|
+
|
|
613
628
|
export interface OutputOptions {
|
|
614
629
|
amd?: AmdOptions;
|
|
615
630
|
assetFileNames?: string | ((chunkInfo: PreRenderedAsset) => string);
|
|
@@ -647,7 +662,7 @@ export interface OutputOptions {
|
|
|
647
662
|
noConflict?: boolean;
|
|
648
663
|
outro?: string | AddonFunction;
|
|
649
664
|
paths?: OptionsPaths;
|
|
650
|
-
plugins?:
|
|
665
|
+
plugins?: OutputPluginOption;
|
|
651
666
|
/** @deprecated Use "generatedCode.constBindings" instead. */
|
|
652
667
|
preferConst?: boolean;
|
|
653
668
|
preserveModules?: boolean;
|
|
@@ -800,7 +815,7 @@ export interface RollupOptions extends InputOptions {
|
|
|
800
815
|
output?: OutputOptions | OutputOptions[];
|
|
801
816
|
}
|
|
802
817
|
|
|
803
|
-
export interface MergedRollupOptions extends
|
|
818
|
+
export interface MergedRollupOptions extends InputOptionsWithPlugins {
|
|
804
819
|
output: OutputOptions[];
|
|
805
820
|
}
|
|
806
821
|
|
|
@@ -846,13 +861,13 @@ export interface RollupWatchOptions extends InputOptions {
|
|
|
846
861
|
}
|
|
847
862
|
|
|
848
863
|
export type AwaitedEventListener<
|
|
849
|
-
T extends { [event: string]: (...
|
|
864
|
+
T extends { [event: string]: (...parameters: any) => any },
|
|
850
865
|
K extends keyof T
|
|
851
|
-
> = (...
|
|
866
|
+
> = (...parameters: Parameters<T[K]>) => void | Promise<void>;
|
|
852
867
|
|
|
853
|
-
export interface AwaitingEventEmitter<T extends { [event: string]: (...
|
|
868
|
+
export interface AwaitingEventEmitter<T extends { [event: string]: (...parameters: any) => any }> {
|
|
854
869
|
close(): Promise<void>;
|
|
855
|
-
emit<K extends keyof T>(event: K, ...
|
|
870
|
+
emit<K extends keyof T>(event: K, ...parameters: Parameters<T[K]>): Promise<unknown>;
|
|
856
871
|
/**
|
|
857
872
|
* Removes an event listener.
|
|
858
873
|
*/
|
|
@@ -872,7 +887,7 @@ export interface AwaitingEventEmitter<T extends { [event: string]: (...args: any
|
|
|
872
887
|
*/
|
|
873
888
|
onCurrentRun<K extends keyof T>(
|
|
874
889
|
event: K,
|
|
875
|
-
listener: (...
|
|
890
|
+
listener: (...parameters: Parameters<T[K]>) => Promise<ReturnType<T[K]>>
|
|
876
891
|
): this;
|
|
877
892
|
removeAllListeners(): this;
|
|
878
893
|
removeListenersForCurrentRun(): this;
|