rollup 2.69.2 → 2.70.2

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.d.ts CHANGED
@@ -237,7 +237,7 @@ interface PartialResolvedId extends Partial<PartialNull<ModuleOptions>> {
237
237
  id: string;
238
238
  }
239
239
 
240
- export type ResolveIdResult = string | false | null | undefined | PartialResolvedId;
240
+ export type ResolveIdResult = string | false | null | void | PartialResolvedId;
241
241
 
242
242
  export type ResolveIdHook = (
243
243
  this: PluginContext,
@@ -265,11 +265,11 @@ export type IsExternal = (
265
265
  isResolved: boolean
266
266
  ) => boolean;
267
267
 
268
- export type IsPureModule = (id: string) => boolean | null | undefined;
268
+ export type IsPureModule = (id: string) => boolean | null | void;
269
269
 
270
270
  export type HasModuleSideEffects = (id: string, external: boolean) => boolean;
271
271
 
272
- type LoadResult = SourceDescription | string | null | undefined;
272
+ type LoadResult = SourceDescription | string | null | void;
273
273
 
274
274
  export type LoadHook = (this: PluginContext, id: string) => Promise<LoadResult> | LoadResult;
275
275
 
@@ -277,7 +277,7 @@ export interface TransformPluginContext extends PluginContext {
277
277
  getCombinedSourcemap: () => SourceMap;
278
278
  }
279
279
 
280
- export type TransformResult = string | null | undefined | Partial<SourceDescription>;
280
+ export type TransformResult = string | null | void | Partial<SourceDescription>;
281
281
 
282
282
  export type TransformHook = (
283
283
  this: TransformPluginContext,
@@ -309,7 +309,7 @@ export type ResolveImportMetaHook = (
309
309
  this: PluginContext,
310
310
  prop: string | null,
311
311
  options: { chunkId: string; format: InternalModuleFormat; moduleId: string }
312
- ) => string | null | undefined;
312
+ ) => string | null | void;
313
313
 
314
314
  export type ResolveAssetUrlHook = (
315
315
  this: PluginContext,
@@ -320,7 +320,7 @@ export type ResolveAssetUrlHook = (
320
320
  moduleId: string;
321
321
  relativeAssetPath: string;
322
322
  }
323
- ) => string | null | undefined;
323
+ ) => string | null | void;
324
324
 
325
325
  export type ResolveFileUrlHook = (
326
326
  this: PluginContext,
@@ -334,7 +334,7 @@ export type ResolveFileUrlHook = (
334
334
  referenceId: string;
335
335
  relativePath: string;
336
336
  }
337
- ) => string | null | undefined;
337
+ ) => string | null | void;
338
338
 
339
339
  export type AddonHookFunction = (this: PluginContext) => string | Promise<string>;
340
340
  export type AddonHook = string | AddonHookFunction;
@@ -344,7 +344,7 @@ export type WatchChangeHook = (
344
344
  this: PluginContext,
345
345
  id: string,
346
346
  change: { event: ChangeEvent }
347
- ) => void;
347
+ ) => Promise<void> | void;
348
348
 
349
349
  /**
350
350
  * use this type for plugin annotation
@@ -375,13 +375,13 @@ export interface PluginHooks extends OutputPluginHooks {
375
375
  buildEnd: (this: PluginContext, err?: Error) => Promise<void> | void;
376
376
  buildStart: (this: PluginContext, options: NormalizedInputOptions) => Promise<void> | void;
377
377
  closeBundle: (this: PluginContext) => Promise<void> | void;
378
- closeWatcher: (this: PluginContext) => void;
378
+ closeWatcher: (this: PluginContext) => Promise<void> | void;
379
379
  load: LoadHook;
380
380
  moduleParsed: ModuleParsedHook;
381
381
  options: (
382
382
  this: MinimalPluginContext,
383
383
  options: InputOptions
384
- ) => Promise<InputOptions | null | undefined> | InputOptions | null | undefined;
384
+ ) => Promise<InputOptions | null | void> | InputOptions | null | void;
385
385
  resolveDynamicImport: ResolveDynamicImportHook;
386
386
  resolveId: ResolveIdHook;
387
387
  shouldTransformCachedModule: ShouldTransformCachedModuleHook;
@@ -397,7 +397,7 @@ interface OutputPluginHooks {
397
397
  bundle: OutputBundle,
398
398
  isWrite: boolean
399
399
  ) => void | Promise<void>;
400
- outputOptions: (this: PluginContext, options: OutputOptions) => OutputOptions | null | undefined;
400
+ outputOptions: (this: PluginContext, options: OutputOptions) => OutputOptions | null | void;
401
401
  renderChunk: RenderChunkHook;
402
402
  renderDynamicImport: (
403
403
  this: PluginContext,
@@ -407,7 +407,7 @@ interface OutputPluginHooks {
407
407
  moduleId: string;
408
408
  targetModuleId: string | null;
409
409
  }
410
- ) => { left: string; right: string } | null | undefined;
410
+ ) => { left: string; right: string } | null | void;
411
411
  renderError: (this: PluginContext, err?: Error) => Promise<void> | void;
412
412
  renderStart: (
413
413
  this: PluginContext,
@@ -440,7 +440,9 @@ export type AsyncPluginHooks =
440
440
  | 'shouldTransformCachedModule'
441
441
  | 'transform'
442
442
  | 'writeBundle'
443
- | 'closeBundle';
443
+ | 'closeBundle'
444
+ | 'closeWatcher'
445
+ | 'watchChange';
444
446
 
445
447
  export type PluginValueHooks = 'banner' | 'footer' | 'intro' | 'outro';
446
448
 
@@ -458,13 +460,11 @@ export type FirstPluginHooks =
458
460
 
459
461
  export type SequentialPluginHooks =
460
462
  | 'augmentChunkHash'
461
- | 'closeWatcher'
462
463
  | 'generateBundle'
463
464
  | 'options'
464
465
  | 'outputOptions'
465
466
  | 'renderChunk'
466
- | 'transform'
467
- | 'watchChange';
467
+ | 'transform';
468
468
 
469
469
  export type ParallelPluginHooks =
470
470
  | 'banner'
@@ -477,7 +477,9 @@ export type ParallelPluginHooks =
477
477
  | 'renderError'
478
478
  | 'renderStart'
479
479
  | 'writeBundle'
480
- | 'closeBundle';
480
+ | 'closeBundle'
481
+ | 'closeWatcher'
482
+ | 'watchChange';
481
483
 
482
484
  interface OutputPluginValueHooks {
483
485
  banner: AddonHook;
@@ -520,17 +522,13 @@ interface GetManualChunkApi {
520
522
  getModuleIds: () => IterableIterator<string>;
521
523
  getModuleInfo: GetModuleInfo;
522
524
  }
523
- export type GetManualChunk = (id: string, api: GetManualChunkApi) => string | null | undefined;
525
+ export type GetManualChunk = (id: string, api: GetManualChunkApi) => string | null | void;
524
526
 
525
527
  export type ExternalOption =
526
528
  | (string | RegExp)[]
527
529
  | string
528
530
  | RegExp
529
- | ((
530
- source: string,
531
- importer: string | undefined,
532
- isResolved: boolean
533
- ) => boolean | null | undefined);
531
+ | ((source: string, importer: string | undefined, isResolved: boolean) => boolean | null | void);
534
532
  export type PureModulesOption = boolean | string[] | IsPureModule;
535
533
  export type GlobalsOption = { [name: string]: string } | ((name: string) => string);
536
534
  export type InputOption = string | string[] | { [entryAlias: string]: string };
@@ -556,7 +554,7 @@ export interface InputOptions {
556
554
  /** @deprecated Use the "manualChunks" output option instead. */
557
555
  manualChunks?: ManualChunksOption;
558
556
  maxParallelFileReads?: number;
559
- moduleContext?: ((id: string) => string | null | undefined) | { [id: string]: string };
557
+ moduleContext?: ((id: string) => string | null | void) | { [id: string]: string };
560
558
  onwarn?: WarningHandlerWithDefault;
561
559
  perf?: boolean;
562
560
  plugins?: (Plugin | null | false | undefined)[];
@@ -898,6 +896,24 @@ interface TypedEventEmitter<T extends { [event: string]: (...args: any) => any }
898
896
  setMaxListeners(n: number): this;
899
897
  }
900
898
 
899
+ export interface RollupAwaitingEmitter<T extends { [event: string]: (...args: any) => any }>
900
+ extends TypedEventEmitter<T> {
901
+ close(): Promise<void>;
902
+ emitAndAwait<K extends keyof T>(event: K, ...args: Parameters<T[K]>): Promise<ReturnType<T[K]>[]>;
903
+ /**
904
+ * Registers an event listener that will be awaited before Rollup continues
905
+ * for events emitted via emitAndAwait. All listeners will be awaited in
906
+ * parallel while rejections are tracked via Promise.all.
907
+ * Listeners are removed automatically when removeAwaited is called, which
908
+ * happens automatically after each run.
909
+ */
910
+ onCurrentAwaited<K extends keyof T>(
911
+ event: K,
912
+ listener: (...args: Parameters<T[K]>) => Promise<ReturnType<T[K]>>
913
+ ): this;
914
+ removeAwaited(): this;
915
+ }
916
+
901
917
  export type RollupWatcherEvent =
902
918
  | { code: 'START' }
903
919
  | { code: 'BUNDLE_START'; input?: InputOption; output: readonly string[] }
@@ -911,15 +927,12 @@ export type RollupWatcherEvent =
911
927
  | { code: 'END' }
912
928
  | { code: 'ERROR'; error: RollupError; result: RollupBuild | null };
913
929
 
914
- export interface RollupWatcher
915
- extends TypedEventEmitter<{
916
- change: (id: string, change: { event: ChangeEvent }) => void;
917
- close: () => void;
918
- event: (event: RollupWatcherEvent) => void;
919
- restart: () => void;
920
- }> {
921
- close(): void;
922
- }
930
+ export type RollupWatcher = RollupAwaitingEmitter<{
931
+ change: (id: string, change: { event: ChangeEvent }) => void;
932
+ close: () => void;
933
+ event: (event: RollupWatcherEvent) => void;
934
+ restart: () => void;
935
+ }>;
923
936
 
924
937
  export function watch(config: RollupWatchOptions | RollupWatchOptions[]): RollupWatcher;
925
938
 
package/dist/rollup.js CHANGED
@@ -1,8 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.69.2
4
- Sun, 06 Mar 2022 06:43:03 GMT - commit 68817534499a6a1392c465d7fe92a1ef6804ad45
5
-
3
+ Rollup.js v2.70.2
4
+ Fri, 15 Apr 2022 05:14:21 GMT - commit 030c56fd6b186a0ddfd57d143ad703f34fd2c17a
6
5
 
7
6
  https://github.com/rollup/rollup
8
7
 
@@ -1,8 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.69.2
4
- Sun, 06 Mar 2022 06:43:03 GMT - commit 68817534499a6a1392c465d7fe92a1ef6804ad45
5
-
3
+ Rollup.js v2.70.2
4
+ Fri, 15 Apr 2022 05:14:21 GMT - commit 030c56fd6b186a0ddfd57d143ad703f34fd2c17a
6
5
 
7
6
  https://github.com/rollup/rollup
8
7
 
@@ -1,8 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.69.2
4
- Sun, 06 Mar 2022 06:43:03 GMT - commit 68817534499a6a1392c465d7fe92a1ef6804ad45
5
-
3
+ Rollup.js v2.70.2
4
+ Fri, 15 Apr 2022 05:14:21 GMT - commit 030c56fd6b186a0ddfd57d143ad703f34fd2c17a
6
5
 
7
6
  https://github.com/rollup/rollup
8
7
 
@@ -1,8 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.69.2
4
- Sun, 06 Mar 2022 06:43:03 GMT - commit 68817534499a6a1392c465d7fe92a1ef6804ad45
5
-
3
+ Rollup.js v2.70.2
4
+ Fri, 15 Apr 2022 05:14:21 GMT - commit 030c56fd6b186a0ddfd57d143ad703f34fd2c17a
6
5
 
7
6
  https://github.com/rollup/rollup
8
7