rollup 3.0.0-1 → 3.0.0-4

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,22 +1,26 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.0.0-1
4
- Fri, 08 Jul 2022 11:35:32 GMT - commit 48ce34db70ebc2b4c1be38e6b8b02881be90b9f1
3
+ Rollup.js v3.0.0-3
4
+ Mon, 15 Aug 2022 04:43:13 GMT - commit 84a4a595851ef71494b6f2ab558968bfbc148bdb
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
8
8
  Released under the MIT License.
9
9
  */
10
- import require$$0$2, { resolve } from 'path';
11
- import process$1 from 'process';
10
+ import { resolve } from 'node:path';
11
+ import process$1 from 'node:process';
12
12
  import { ensureArray, warnUnknownOptions, defaultOnWarn, objectifyOptionWithPresets, treeshakePresets, objectifyOption, generatedCodePresets, picomatch as picomatch$2, getAugmentedNamespace, fseventsImporter, createFilter, rollupInternal } from './rollup.js';
13
- import require$$2$1, { platform } from 'os';
13
+ import { platform } from 'node:os';
14
14
  import require$$0$1 from 'fs';
15
15
  import require$$2 from 'util';
16
16
  import require$$1 from 'stream';
17
+ import require$$0$2 from 'path';
18
+ import require$$2$1 from 'os';
17
19
  import require$$0$3 from 'events';
18
- import 'perf_hooks';
19
- import 'crypto';
20
+ import 'node:perf_hooks';
21
+ import 'node:crypto';
22
+ import 'node:fs';
23
+ import 'node:events';
20
24
 
21
25
  const commandAliases = {
22
26
  c: 'config',
@@ -80,6 +84,7 @@ function mergeInputOptions(config, overrides, defaultOnWarnHandler) {
80
84
  input: getOption('input') || [],
81
85
  makeAbsoluteExternalsRelative: getOption('makeAbsoluteExternalsRelative'),
82
86
  manualChunks: getOption('manualChunks'),
87
+ maxParallelFileOps: getOption('maxParallelFileOps'),
83
88
  maxParallelFileReads: getOption('maxParallelFileReads'),
84
89
  moduleContext: getOption('moduleContext'),
85
90
  onwarn: getOnWarn(config, defaultOnWarnHandler),
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.0.0-1
4
- Fri, 08 Jul 2022 11:35:32 GMT - commit 48ce34db70ebc2b4c1be38e6b8b02881be90b9f1
3
+ Rollup.js v3.0.0-3
4
+ Mon, 15 Aug 2022 04:43:13 GMT - commit 84a4a595851ef71494b6f2ab558968bfbc148bdb
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -9,19 +9,24 @@
9
9
  */
10
10
  'use strict';
11
11
 
12
- require('path');
13
- require('process');
14
- require('url');
12
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
13
+
14
+ require('node:path');
15
+ require('node:url');
15
16
  const loadConfigFile_js = require('./shared/loadConfigFile.js');
16
17
  require('./shared/rollup.js');
17
18
  require('./shared/mergeOptions.js');
18
- require('tty');
19
- require('perf_hooks');
20
- require('crypto');
19
+ require('path');
21
20
  require('fs');
22
- require('events');
21
+ require('util');
22
+ require('node:process');
23
+ require('tty');
24
+ require('node:perf_hooks');
25
+ require('node:crypto');
26
+ require('node:fs');
27
+ require('node:events');
23
28
 
24
29
 
25
30
 
26
- module.exports = loadConfigFile_js.loadAndParseConfigFile;
31
+ exports.loadConfigFile = loadConfigFile_js.loadConfigFile;
27
32
  //# sourceMappingURL=loadConfigFile.js.map
package/dist/rollup.d.ts CHANGED
@@ -1,41 +1,33 @@
1
1
  export const VERSION: string;
2
2
 
3
- export interface RollupError extends RollupLogProps {
4
- parserError?: Error;
3
+ export interface RollupError extends RollupLog {
4
+ name?: string;
5
5
  stack?: string;
6
6
  watchFiles?: string[];
7
7
  }
8
8
 
9
- export interface RollupWarning extends RollupLogProps {
10
- chunkName?: string;
11
- cycle?: string[];
12
- exportName?: string;
13
- exporter?: string;
14
- guess?: string;
15
- importer?: string;
16
- missing?: string;
17
- modules?: string[];
18
- names?: string[];
19
- reexporter?: string;
20
- source?: string;
21
- sources?: string[];
22
- }
9
+ export type RollupWarning = RollupLog;
23
10
 
24
- export interface RollupLogProps {
11
+ export interface RollupLog {
12
+ binding?: string;
13
+ cause?: Error;
25
14
  code?: string;
15
+ exporter?: string;
26
16
  frame?: string;
27
17
  hook?: string;
28
18
  id?: string;
19
+ ids?: string[];
29
20
  loc?: {
30
21
  column: number;
31
22
  file?: string;
32
23
  line: number;
33
24
  };
34
25
  message: string;
35
- name?: string;
26
+ names?: string[];
36
27
  plugin?: string;
37
28
  pluginCode?: string;
38
29
  pos?: number;
30
+ reexporter?: string;
39
31
  url?: string;
40
32
  }
41
33
 
@@ -228,7 +220,7 @@ export type ResolveIdHook = (
228
220
  source: string,
229
221
  importer: string | undefined,
230
222
  options: { custom?: CustomPluginOptions; isEntry: boolean }
231
- ) => Promise<ResolveIdResult> | ResolveIdResult;
223
+ ) => ResolveIdResult;
232
224
 
233
225
  export type ShouldTransformCachedModuleHook = (
234
226
  this: PluginContext,
@@ -241,7 +233,7 @@ export type ShouldTransformCachedModuleHook = (
241
233
  resolvedSources: ResolvedIdMap;
242
234
  syntheticNamedExports: boolean | string;
243
235
  }
244
- ) => Promise<boolean> | boolean;
236
+ ) => boolean;
245
237
 
246
238
  export type IsExternal = (
247
239
  source: string,
@@ -253,9 +245,9 @@ export type IsPureModule = (id: string) => boolean | null | void;
253
245
 
254
246
  export type HasModuleSideEffects = (id: string, external: boolean) => boolean;
255
247
 
256
- type LoadResult = SourceDescription | string | null | void;
248
+ export type LoadResult = SourceDescription | string | null | void;
257
249
 
258
- export type LoadHook = (this: PluginContext, id: string) => Promise<LoadResult> | LoadResult;
250
+ export type LoadHook = (this: PluginContext, id: string) => LoadResult;
259
251
 
260
252
  export interface TransformPluginContext extends PluginContext {
261
253
  getCombinedSourcemap: () => SourceMap;
@@ -267,9 +259,9 @@ export type TransformHook = (
267
259
  this: TransformPluginContext,
268
260
  code: string,
269
261
  id: string
270
- ) => Promise<TransformResult> | TransformResult;
262
+ ) => TransformResult;
271
263
 
272
- export type ModuleParsedHook = (this: PluginContext, info: ModuleInfo) => Promise<void> | void;
264
+ export type ModuleParsedHook = (this: PluginContext, info: ModuleInfo) => void;
273
265
 
274
266
  export type RenderChunkHook = (
275
267
  this: PluginContext,
@@ -277,18 +269,13 @@ export type RenderChunkHook = (
277
269
  chunk: RenderedChunk,
278
270
  options: NormalizedOutputOptions,
279
271
  meta: { chunks: Record<string, RenderedChunk> }
280
- ) =>
281
- | Promise<{ code: string; map?: SourceMapInput } | null>
282
- | { code: string; map?: SourceMapInput }
283
- | string
284
- | null
285
- | undefined;
272
+ ) => { code: string; map?: SourceMapInput } | string | null | undefined;
286
273
 
287
274
  export type ResolveDynamicImportHook = (
288
275
  this: PluginContext,
289
276
  specifier: string | AcornNode,
290
277
  importer: string
291
- ) => Promise<ResolveIdResult> | ResolveIdResult;
278
+ ) => ResolveIdResult;
292
279
 
293
280
  export type ResolveImportMetaHook = (
294
281
  this: PluginContext,
@@ -319,7 +306,7 @@ export type WatchChangeHook = (
319
306
  this: PluginContext,
320
307
  id: string,
321
308
  change: { event: ChangeEvent }
322
- ) => Promise<void> | void;
309
+ ) => void;
323
310
 
324
311
  /**
325
312
  * use this type for plugin annotation
@@ -346,32 +333,21 @@ export interface OutputBundleWithPlaceholders {
346
333
  [fileName: string]: OutputAsset | OutputChunk | FilePlaceholder;
347
334
  }
348
335
 
349
- export interface PluginHooks extends OutputPluginHooks {
350
- buildEnd: (this: PluginContext, err?: Error) => Promise<void> | void;
351
- buildStart: (this: PluginContext, options: NormalizedInputOptions) => Promise<void> | void;
352
- closeBundle: (this: PluginContext) => Promise<void> | void;
353
- closeWatcher: (this: PluginContext) => Promise<void> | void;
354
- load: LoadHook;
355
- moduleParsed: ModuleParsedHook;
356
- options: (
357
- this: MinimalPluginContext,
358
- options: InputOptions
359
- ) => Promise<InputOptions | null | void> | InputOptions | null | void;
360
- resolveDynamicImport: ResolveDynamicImportHook;
361
- resolveId: ResolveIdHook;
362
- shouldTransformCachedModule: ShouldTransformCachedModuleHook;
363
- transform: TransformHook;
364
- watchChange: WatchChangeHook;
365
- }
366
-
367
- interface OutputPluginHooks {
336
+ export interface FunctionPluginHooks {
368
337
  augmentChunkHash: (this: PluginContext, chunk: RenderedChunk) => string | void;
338
+ buildEnd: (this: PluginContext, err?: Error) => void;
339
+ buildStart: (this: PluginContext, options: NormalizedInputOptions) => void;
340
+ closeBundle: (this: PluginContext) => void;
341
+ closeWatcher: (this: PluginContext) => void;
369
342
  generateBundle: (
370
343
  this: PluginContext,
371
344
  options: NormalizedOutputOptions,
372
345
  bundle: OutputBundle,
373
346
  isWrite: boolean
374
- ) => void | Promise<void>;
347
+ ) => void;
348
+ load: LoadHook;
349
+ moduleParsed: ModuleParsedHook;
350
+ options: (this: MinimalPluginContext, options: InputOptions) => InputOptions | null | void;
375
351
  outputOptions: (this: PluginContext, options: OutputOptions) => OutputOptions | null | void;
376
352
  renderChunk: RenderChunkHook;
377
353
  renderDynamicImport: (
@@ -383,43 +359,48 @@ interface OutputPluginHooks {
383
359
  targetModuleId: string | null;
384
360
  }
385
361
  ) => { left: string; right: string } | null | void;
386
- renderError: (this: PluginContext, err?: Error) => Promise<void> | void;
362
+ renderError: (this: PluginContext, err?: Error) => void;
387
363
  renderStart: (
388
364
  this: PluginContext,
389
365
  outputOptions: NormalizedOutputOptions,
390
366
  inputOptions: NormalizedInputOptions
391
- ) => Promise<void> | void;
367
+ ) => void;
368
+ resolveDynamicImport: ResolveDynamicImportHook;
392
369
  resolveFileUrl: ResolveFileUrlHook;
370
+ resolveId: ResolveIdHook;
393
371
  resolveImportMeta: ResolveImportMetaHook;
372
+ shouldTransformCachedModule: ShouldTransformCachedModuleHook;
373
+ transform: TransformHook;
374
+ watchChange: WatchChangeHook;
394
375
  writeBundle: (
395
376
  this: PluginContext,
396
377
  options: NormalizedOutputOptions,
397
378
  bundle: OutputBundle
398
- ) => void | Promise<void>;
379
+ ) => void;
399
380
  }
400
381
 
401
- export type AsyncPluginHooks =
402
- | 'options'
403
- | 'buildEnd'
404
- | 'buildStart'
382
+ export type OutputPluginHooks =
383
+ | 'augmentChunkHash'
405
384
  | 'generateBundle'
406
- | 'load'
407
- | 'moduleParsed'
385
+ | 'outputOptions'
408
386
  | 'renderChunk'
387
+ | 'renderDynamicImport'
409
388
  | 'renderError'
410
389
  | 'renderStart'
411
- | 'resolveDynamicImport'
412
- | 'resolveId'
413
- | 'shouldTransformCachedModule'
414
- | 'transform'
415
- | 'writeBundle'
416
- | 'closeBundle'
417
- | 'closeWatcher'
418
- | 'watchChange';
390
+ | 'resolveFileUrl'
391
+ | 'resolveImportMeta'
392
+ | 'writeBundle';
419
393
 
420
- export type PluginValueHooks = 'banner' | 'footer' | 'intro' | 'outro';
394
+ export type InputPluginHooks = Exclude<keyof FunctionPluginHooks, OutputPluginHooks>;
421
395
 
422
- export type SyncPluginHooks = Exclude<keyof PluginHooks, AsyncPluginHooks>;
396
+ export type SyncPluginHooks =
397
+ | 'augmentChunkHash'
398
+ | 'outputOptions'
399
+ | 'renderDynamicImport'
400
+ | 'resolveFileUrl'
401
+ | 'resolveImportMeta';
402
+
403
+ export type AsyncPluginHooks = Exclude<keyof FunctionPluginHooks, SyncPluginHooks>;
423
404
 
424
405
  export type FirstPluginHooks =
425
406
  | 'load'
@@ -438,37 +419,38 @@ export type SequentialPluginHooks =
438
419
  | 'renderChunk'
439
420
  | 'transform';
440
421
 
441
- export type ParallelPluginHooks =
442
- | 'banner'
443
- | 'buildEnd'
444
- | 'buildStart'
445
- | 'footer'
446
- | 'intro'
447
- | 'moduleParsed'
448
- | 'outro'
449
- | 'renderError'
450
- | 'renderStart'
451
- | 'writeBundle'
452
- | 'closeBundle'
453
- | 'closeWatcher'
454
- | 'watchChange';
422
+ export type ParallelPluginHooks = Exclude<
423
+ keyof FunctionPluginHooks | AddonHooks,
424
+ FirstPluginHooks | SequentialPluginHooks
425
+ >;
455
426
 
456
- interface OutputPluginValueHooks {
457
- banner: AddonHook;
458
- cacheKey: string;
459
- footer: AddonHook;
460
- intro: AddonHook;
461
- outro: AddonHook;
462
- }
427
+ export type AddonHooks = 'banner' | 'footer' | 'intro' | 'outro';
463
428
 
464
- export interface Plugin extends Partial<PluginHooks>, Partial<OutputPluginValueHooks> {
465
- // for inter-plugin communication
466
- api?: any;
429
+ type MakeAsync<Fn> = Fn extends (this: infer This, ...args: infer Args) => infer Return
430
+ ? (this: This, ...args: Args) => Return | Promise<Return>
431
+ : never;
432
+
433
+ // eslint-disable-next-line @typescript-eslint/ban-types
434
+ type ObjectHook<T, O = {}> = T | ({ handler: T; order?: 'pre' | 'post' | null } & O);
435
+
436
+ export type PluginHooks = {
437
+ [K in keyof FunctionPluginHooks]: ObjectHook<
438
+ K extends AsyncPluginHooks ? MakeAsync<FunctionPluginHooks[K]> : FunctionPluginHooks[K],
439
+ // eslint-disable-next-line @typescript-eslint/ban-types
440
+ K extends ParallelPluginHooks ? { sequential?: boolean } : {}
441
+ >;
442
+ };
443
+
444
+ export interface OutputPlugin
445
+ extends Partial<{ [K in OutputPluginHooks]: PluginHooks[K] }>,
446
+ Partial<{ [K in AddonHooks]: ObjectHook<AddonHook> }> {
447
+ cacheKey?: string;
467
448
  name: string;
468
449
  }
469
450
 
470
- export interface OutputPlugin extends Partial<OutputPluginHooks>, Partial<OutputPluginValueHooks> {
471
- name: string;
451
+ export interface Plugin extends OutputPlugin, Partial<PluginHooks> {
452
+ // for inter-plugin communication
453
+ api?: any;
472
454
  }
473
455
 
474
456
  type TreeshakingPreset = 'smallest' | 'safest' | 'recommended';
@@ -523,6 +505,8 @@ export interface InputOptions {
523
505
  makeAbsoluteExternalsRelative?: boolean | 'ifRelativeSource';
524
506
  /** @deprecated Use the "manualChunks" output option instead. */
525
507
  manualChunks?: ManualChunksOption;
508
+ maxParallelFileOps?: number;
509
+ /** @deprecated Use the "maxParallelFileOps" option instead. */
526
510
  maxParallelFileReads?: number;
527
511
  moduleContext?: ((id: string) => string | null | void) | { [id: string]: string };
528
512
  onwarn?: WarningHandlerWithDefault;
@@ -551,6 +535,8 @@ export interface NormalizedInputOptions {
551
535
  makeAbsoluteExternalsRelative: boolean | 'ifRelativeSource';
552
536
  /** @deprecated Use the "manualChunks" output option instead. */
553
537
  manualChunks: ManualChunksOption | undefined;
538
+ maxParallelFileOps: number;
539
+ /** @deprecated Use the "maxParallelFileOps" option instead. */
554
540
  maxParallelFileReads: number;
555
541
  moduleContext: (id: string) => string;
556
542
  onwarn: WarningHandler;
package/dist/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.0.0-1
4
- Fri, 08 Jul 2022 11:35:32 GMT - commit 48ce34db70ebc2b4c1be38e6b8b02881be90b9f1
3
+ Rollup.js v3.0.0-3
4
+ Mon, 15 Aug 2022 04:43:13 GMT - commit 84a4a595851ef71494b6f2ab558968bfbc148bdb
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -12,12 +12,13 @@
12
12
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
13
13
 
14
14
  const rollup = require('./shared/rollup.js');
15
+ require('node:path');
15
16
  require('path');
16
- require('process');
17
- require('perf_hooks');
18
- require('crypto');
19
- require('fs');
20
- require('events');
17
+ require('node:process');
18
+ require('node:perf_hooks');
19
+ require('node:crypto');
20
+ require('node:fs');
21
+ require('node:events');
21
22
 
22
23
 
23
24
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.0.0-1
4
- Fri, 08 Jul 2022 11:35:32 GMT - commit 48ce34db70ebc2b4c1be38e6b8b02881be90b9f1
3
+ Rollup.js v3.0.0-3
4
+ Mon, 15 Aug 2022 04:43:13 GMT - commit 84a4a595851ef71494b6f2ab558968bfbc148bdb
5
5
 
6
6
  https://github.com/rollup/rollup
7
7