@rollup/browser 3.0.0-4 → 3.0.0-5

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.
@@ -28,6 +28,7 @@ export interface RollupLog {
28
28
  pluginCode?: string;
29
29
  pos?: number;
30
30
  reexporter?: string;
31
+ stack?: string;
31
32
  url?: string;
32
33
  }
33
34
 
@@ -571,7 +572,7 @@ interface GeneratedCodeOptions extends Partial<NormalizedGeneratedCodeOptions> {
571
572
 
572
573
  export type OptionsPaths = Record<string, string> | ((id: string) => string);
573
574
 
574
- export type InteropType = boolean | 'auto' | 'esModule' | 'default' | 'defaultOnly';
575
+ export type InteropType = 'compat' | 'auto' | 'esModule' | 'default' | 'defaultOnly';
575
576
 
576
577
  export type GetInterop = (id: string | null) => InteropType;
577
578
 
@@ -591,6 +592,7 @@ export type AmdOptions = (
591
592
  }
592
593
  ) & {
593
594
  define?: string;
595
+ forceJsExtensionForImports?: boolean;
594
596
  };
595
597
 
596
598
  export type NormalizedAmdOptions = (
@@ -604,6 +606,7 @@ export type NormalizedAmdOptions = (
604
606
  }
605
607
  ) & {
606
608
  define: string;
609
+ forceJsExtensionForImports: boolean;
607
610
  };
608
611
 
609
612
  type AddonFunction = (chunk: RenderedChunk) => string | Promise<string>;
@@ -619,7 +622,7 @@ export interface OutputOptions {
619
622
  /** @deprecated Use the "renderDynamicImport" plugin hook instead. */
620
623
  dynamicImportFunction?: string;
621
624
  entryFileNames?: string | ((chunkInfo: PreRenderedChunk) => string);
622
- esModule?: boolean;
625
+ esModule?: boolean | 'if-default-prop';
623
626
  exports?: 'default' | 'named' | 'none' | 'auto';
624
627
  extend?: boolean;
625
628
  externalLiveBindings?: boolean;
@@ -669,7 +672,7 @@ export interface NormalizedOutputOptions {
669
672
  /** @deprecated Use the "renderDynamicImport" plugin hook instead. */
670
673
  dynamicImportFunction: string | undefined;
671
674
  entryFileNames: string | ((chunkInfo: PreRenderedChunk) => string);
672
- esModule: boolean;
675
+ esModule: boolean | 'if-default-prop';
673
676
  exports: 'default' | 'named' | 'none' | 'auto';
674
677
  extend: boolean;
675
678
  externalLiveBindings: boolean;
@@ -839,40 +842,37 @@ export interface RollupWatchOptions extends InputOptions {
839
842
  watch?: WatcherOptions | false;
840
843
  }
841
844
 
842
- interface TypedEventEmitter<T extends { [event: string]: (...args: any) => any }> {
843
- addListener<K extends keyof T>(event: K, listener: T[K]): this;
844
- emit<K extends keyof T>(event: K, ...args: Parameters<T[K]>): boolean;
845
- eventNames(): Array<keyof T>;
846
- getMaxListeners(): number;
847
- listenerCount(type: keyof T): number;
848
- listeners<K extends keyof T>(event: K): Array<T[K]>;
849
- off<K extends keyof T>(event: K, listener: T[K]): this;
850
- on<K extends keyof T>(event: K, listener: T[K]): this;
851
- once<K extends keyof T>(event: K, listener: T[K]): this;
852
- prependListener<K extends keyof T>(event: K, listener: T[K]): this;
853
- prependOnceListener<K extends keyof T>(event: K, listener: T[K]): this;
854
- rawListeners<K extends keyof T>(event: K): Array<T[K]>;
855
- removeAllListeners<K extends keyof T>(event?: K): this;
856
- removeListener<K extends keyof T>(event: K, listener: T[K]): this;
857
- setMaxListeners(n: number): this;
858
- }
859
-
860
- export interface RollupAwaitingEmitter<T extends { [event: string]: (...args: any) => any }>
861
- extends TypedEventEmitter<T> {
845
+ export type AwaitedEventListener<
846
+ T extends { [event: string]: (...args: any) => any },
847
+ K extends keyof T
848
+ > = (...args: Parameters<T[K]>) => void | Promise<void>;
849
+
850
+ export interface AwaitingEventEmitter<T extends { [event: string]: (...args: any) => any }> {
862
851
  close(): Promise<void>;
863
- emitAndAwait<K extends keyof T>(event: K, ...args: Parameters<T[K]>): Promise<ReturnType<T[K]>[]>;
852
+ emit<K extends keyof T>(event: K, ...args: Parameters<T[K]>): Promise<unknown>;
853
+ /**
854
+ * Removes an event listener.
855
+ */
856
+ off<K extends keyof T>(event: K, listener: AwaitedEventListener<T, K>): this;
857
+ /**
858
+ * Registers an event listener that will be awaited before Rollup continues.
859
+ * All listeners will be awaited in parallel while rejections are tracked via
860
+ * Promise.all.
861
+ */
862
+ on<K extends keyof T>(event: K, listener: AwaitedEventListener<T, K>): this;
864
863
  /**
865
- * Registers an event listener that will be awaited before Rollup continues
866
- * for events emitted via emitAndAwait. All listeners will be awaited in
867
- * parallel while rejections are tracked via Promise.all.
868
- * Listeners are removed automatically when removeAwaited is called, which
869
- * happens automatically after each run.
864
+ * Registers an event listener that will be awaited before Rollup continues.
865
+ * All listeners will be awaited in parallel while rejections are tracked via
866
+ * Promise.all.
867
+ * Listeners are removed automatically when removeListenersForCurrentRun is
868
+ * called, which happens automatically after each run.
870
869
  */
871
- onCurrentAwaited<K extends keyof T>(
870
+ onCurrentRun<K extends keyof T>(
872
871
  event: K,
873
872
  listener: (...args: Parameters<T[K]>) => Promise<ReturnType<T[K]>>
874
873
  ): this;
875
- removeAwaited(): this;
874
+ removeAllListeners(): this;
875
+ removeListenersForCurrentRun(): this;
876
876
  }
877
877
 
878
878
  export type RollupWatcherEvent =
@@ -888,7 +888,7 @@ export type RollupWatcherEvent =
888
888
  | { code: 'END' }
889
889
  | { code: 'ERROR'; error: RollupError; result: RollupBuild | null };
890
890
 
891
- export type RollupWatcher = RollupAwaitingEmitter<{
891
+ export type RollupWatcher = AwaitingEventEmitter<{
892
892
  change: (id: string, change: { event: ChangeEvent }) => void;
893
893
  close: () => void;
894
894
  event: (event: RollupWatcherEvent) => void;