@rollup/browser 4.37.0 → 4.38.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.
@@ -272,6 +272,20 @@ export interface PluginContextMeta {
272
272
  watchMode: boolean;
273
273
  }
274
274
 
275
+ export type StringOrRegExp = string | RegExp;
276
+
277
+ export type StringFilter<Value = StringOrRegExp> =
278
+ | MaybeArray<Value>
279
+ | {
280
+ include?: MaybeArray<Value>;
281
+ exclude?: MaybeArray<Value>;
282
+ };
283
+
284
+ export interface HookFilter {
285
+ id?: StringFilter;
286
+ code?: StringFilter;
287
+ }
288
+
275
289
  export interface ResolvedId extends ModuleOptions {
276
290
  external: boolean | 'absolute';
277
291
  id: string;
@@ -526,11 +540,20 @@ type MakeAsync<Function_> = Function_ extends (
526
540
  // eslint-disable-next-line @typescript-eslint/no-empty-object-type
527
541
  export type ObjectHook<T, O = {}> = T | ({ handler: T; order?: 'pre' | 'post' | null } & O);
528
542
 
543
+ export type HookFilterExtension<K extends keyof FunctionPluginHooks> = K extends 'transform'
544
+ ? { filter?: HookFilter }
545
+ : K extends 'load'
546
+ ? { filter?: Pick<HookFilter, 'id'> }
547
+ : K extends 'resolveId'
548
+ ? { filter?: { id: StringFilter<RegExp> } }
549
+ : // eslint-disable-next-line @typescript-eslint/no-empty-object-type
550
+ {};
551
+
529
552
  export type PluginHooks = {
530
553
  [K in keyof FunctionPluginHooks]: ObjectHook<
531
554
  K extends AsyncPluginHooks ? MakeAsync<FunctionPluginHooks[K]> : FunctionPluginHooks[K],
532
555
  // eslint-disable-next-line @typescript-eslint/no-empty-object-type
533
- K extends ParallelPluginHooks ? { sequential?: boolean } : {}
556
+ HookFilterExtension<K> & (K extends ParallelPluginHooks ? { sequential?: boolean } : {})
534
557
  >;
535
558
  };
536
559