@rollup/browser 3.1.0 → 3.2.1

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.
@@ -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: (err: RollupError | string, pos?: number | { column: number; line: number }) => never;
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
- prop: string | null,
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, err?: Error) => void;
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, err?: Error) => void;
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<Fn> = Fn extends (this: infer This, ...args: infer Args) => infer Return
430
- ? (this: This, ...args: Args) => Return | Promise<Return>
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,7 +499,7 @@ export type SourcemapPathTransformOption = (
492
499
  sourcemapPath: string
493
500
  ) => string;
494
501
 
495
- export type InputPluginOption = Plugin | null | false | undefined | InputPluginOption[];
502
+ export type InputPluginOption = MaybePromise<Plugin | FalsyValue | InputPluginOption[]>;
496
503
 
497
504
  export interface InputOptions {
498
505
  acorn?: Record<string, unknown>;
@@ -616,7 +623,7 @@ export type NormalizedAmdOptions = (
616
623
 
617
624
  type AddonFunction = (chunk: RenderedChunk) => string | Promise<string>;
618
625
 
619
- type OutputPluginOption = OutputPlugin | null | false | undefined | OutputPluginOption[];
626
+ type OutputPluginOption = MaybePromise<OutputPlugin | FalsyValue | OutputPluginOption[]>;
620
627
 
621
628
  export interface OutputOptions {
622
629
  amd?: AmdOptions;
@@ -854,13 +861,13 @@ export interface RollupWatchOptions extends InputOptions {
854
861
  }
855
862
 
856
863
  export type AwaitedEventListener<
857
- T extends { [event: string]: (...args: any) => any },
864
+ T extends { [event: string]: (...parameters: any) => any },
858
865
  K extends keyof T
859
- > = (...args: Parameters<T[K]>) => void | Promise<void>;
866
+ > = (...parameters: Parameters<T[K]>) => void | Promise<void>;
860
867
 
861
- export interface AwaitingEventEmitter<T extends { [event: string]: (...args: any) => any }> {
868
+ export interface AwaitingEventEmitter<T extends { [event: string]: (...parameters: any) => any }> {
862
869
  close(): Promise<void>;
863
- emit<K extends keyof T>(event: K, ...args: Parameters<T[K]>): Promise<unknown>;
870
+ emit<K extends keyof T>(event: K, ...parameters: Parameters<T[K]>): Promise<unknown>;
864
871
  /**
865
872
  * Removes an event listener.
866
873
  */
@@ -880,7 +887,7 @@ export interface AwaitingEventEmitter<T extends { [event: string]: (...args: any
880
887
  */
881
888
  onCurrentRun<K extends keyof T>(
882
889
  event: K,
883
- listener: (...args: Parameters<T[K]>) => Promise<ReturnType<T[K]>>
890
+ listener: (...parameters: Parameters<T[K]>) => Promise<ReturnType<T[K]>>
884
891
  ): this;
885
892
  removeAllListeners(): this;
886
893
  removeListenersForCurrentRun(): this;