@rollup/browser 3.2.0 → 3.2.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.
@@ -1,9 +1,14 @@
1
1
  export const VERSION: string;
2
2
 
3
- type FalsyValue = false | null | undefined;
3
+ // utils
4
+ type NullValue = null | undefined | void;
4
5
  type MaybeArray<T> = T | T[];
5
6
  type MaybePromise<T> = T | Promise<T>;
6
7
 
8
+ type PartialNull<T> = {
9
+ [P in keyof T]: T[P] | null;
10
+ };
11
+
7
12
  export interface RollupError extends RollupLog {
8
13
  name?: string;
9
14
  stack?: string;
@@ -82,10 +87,6 @@ export interface SourceMap {
82
87
 
83
88
  export type SourceMapInput = ExistingRawSourceMap | string | null | { mappings: '' };
84
89
 
85
- type PartialNull<T> = {
86
- [P in keyof T]: T[P] | null;
87
- };
88
-
89
90
  interface ModuleOptions {
90
91
  assertions: Record<string, string>;
91
92
  meta: CustomPluginOptions;
@@ -224,7 +225,7 @@ interface PartialResolvedId extends Partial<PartialNull<ModuleOptions>> {
224
225
  id: string;
225
226
  }
226
227
 
227
- export type ResolveIdResult = string | false | null | void | PartialResolvedId;
228
+ export type ResolveIdResult = string | NullValue | false | PartialResolvedId;
228
229
 
229
230
  export type ResolveIdHook = (
230
231
  this: PluginContext,
@@ -252,11 +253,11 @@ export type IsExternal = (
252
253
  isResolved: boolean
253
254
  ) => boolean;
254
255
 
255
- export type IsPureModule = (id: string) => boolean | null | void;
256
+ export type IsPureModule = (id: string) => boolean | NullValue;
256
257
 
257
258
  export type HasModuleSideEffects = (id: string, external: boolean) => boolean;
258
259
 
259
- export type LoadResult = SourceDescription | string | null | void;
260
+ export type LoadResult = SourceDescription | string | NullValue;
260
261
 
261
262
  export type LoadHook = (this: PluginContext, id: string) => LoadResult;
262
263
 
@@ -264,7 +265,7 @@ export interface TransformPluginContext extends PluginContext {
264
265
  getCombinedSourcemap: () => SourceMap;
265
266
  }
266
267
 
267
- export type TransformResult = string | null | void | Partial<SourceDescription>;
268
+ export type TransformResult = string | NullValue | Partial<SourceDescription>;
268
269
 
269
270
  export type TransformHook = (
270
271
  this: TransformPluginContext,
@@ -280,7 +281,7 @@ export type RenderChunkHook = (
280
281
  chunk: RenderedChunk,
281
282
  options: NormalizedOutputOptions,
282
283
  meta: { chunks: Record<string, RenderedChunk> }
283
- ) => { code: string; map?: SourceMapInput } | string | null | undefined;
284
+ ) => { code: string; map?: SourceMapInput } | string | NullValue;
284
285
 
285
286
  export type ResolveDynamicImportHook = (
286
287
  this: PluginContext,
@@ -293,7 +294,7 @@ export type ResolveImportMetaHook = (
293
294
  this: PluginContext,
294
295
  property: string | null,
295
296
  options: { chunkId: string; format: InternalModuleFormat; moduleId: string }
296
- ) => string | null | void;
297
+ ) => string | NullValue;
297
298
 
298
299
  export type ResolveFileUrlHook = (
299
300
  this: PluginContext,
@@ -305,7 +306,7 @@ export type ResolveFileUrlHook = (
305
306
  referenceId: string;
306
307
  relativePath: string;
307
308
  }
308
- ) => string | null | void;
309
+ ) => string | NullValue;
309
310
 
310
311
  export type AddonHookFunction = (
311
312
  this: PluginContext,
@@ -351,8 +352,8 @@ export interface FunctionPluginHooks {
351
352
  ) => void;
352
353
  load: LoadHook;
353
354
  moduleParsed: ModuleParsedHook;
354
- options: (this: MinimalPluginContext, options: InputOptions) => InputOptions | null | void;
355
- outputOptions: (this: PluginContext, options: OutputOptions) => OutputOptions | null | void;
355
+ options: (this: MinimalPluginContext, options: InputOptions) => InputOptions | NullValue;
356
+ outputOptions: (this: PluginContext, options: OutputOptions) => OutputOptions | NullValue;
356
357
  renderChunk: RenderChunkHook;
357
358
  renderDynamicImport: (
358
359
  this: PluginContext,
@@ -362,7 +363,7 @@ export interface FunctionPluginHooks {
362
363
  moduleId: string;
363
364
  targetModuleId: string | null;
364
365
  }
365
- ) => { left: string; right: string } | null | void;
366
+ ) => { left: string; right: string } | NullValue;
366
367
  renderError: (this: PluginContext, error?: Error) => void;
367
368
  renderStart: (
368
369
  this: PluginContext,
@@ -481,13 +482,13 @@ interface ManualChunkMeta {
481
482
  getModuleIds: () => IterableIterator<string>;
482
483
  getModuleInfo: GetModuleInfo;
483
484
  }
484
- export type GetManualChunk = (id: string, meta: ManualChunkMeta) => string | null | void;
485
+ export type GetManualChunk = (id: string, meta: ManualChunkMeta) => string | NullValue;
485
486
 
486
487
  export type ExternalOption =
487
488
  | (string | RegExp)[]
488
489
  | string
489
490
  | RegExp
490
- | ((source: string, importer: string | undefined, isResolved: boolean) => boolean | null | void);
491
+ | ((source: string, importer: string | undefined, isResolved: boolean) => boolean | NullValue);
491
492
  export type PureModulesOption = boolean | string[] | IsPureModule;
492
493
  export type GlobalsOption = { [name: string]: string } | ((name: string) => string);
493
494
  export type InputOption = string | string[] | { [entryAlias: string]: string };
@@ -499,7 +500,7 @@ export type SourcemapPathTransformOption = (
499
500
  sourcemapPath: string
500
501
  ) => string;
501
502
 
502
- export type InputPluginOption = MaybePromise<Plugin | FalsyValue | InputPluginOption[]>;
503
+ export type InputPluginOption = MaybePromise<Plugin | NullValue | false | InputPluginOption[]>;
503
504
 
504
505
  export interface InputOptions {
505
506
  acorn?: Record<string, unknown>;
@@ -517,7 +518,7 @@ export interface InputOptions {
517
518
  maxParallelFileOps?: number;
518
519
  /** @deprecated Use the "maxParallelFileOps" option instead. */
519
520
  maxParallelFileReads?: number;
520
- moduleContext?: ((id: string) => string | null | void) | { [id: string]: string };
521
+ moduleContext?: ((id: string) => string | NullValue) | { [id: string]: string };
521
522
  onwarn?: WarningHandlerWithDefault;
522
523
  perf?: boolean;
523
524
  plugins?: InputPluginOption;
@@ -623,7 +624,7 @@ export type NormalizedAmdOptions = (
623
624
 
624
625
  type AddonFunction = (chunk: RenderedChunk) => string | Promise<string>;
625
626
 
626
- type OutputPluginOption = MaybePromise<OutputPlugin | FalsyValue | OutputPluginOption[]>;
627
+ type OutputPluginOption = MaybePromise<OutputPlugin | NullValue | false | OutputPluginOption[]>;
627
628
 
628
629
  export interface OutputOptions {
629
630
  amd?: AmdOptions;