rollup 2.77.3 → 2.79.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.
- package/CHANGELOG.md +38 -0
- package/dist/bin/rollup +3 -3
- package/dist/es/rollup.browser.js +3 -3
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/rollup.js +139 -84
- package/dist/es/shared/watch.js +2 -2
- package/dist/loadConfigFile.js +2 -2
- package/dist/rollup.browser.js +3 -3
- package/dist/rollup.browser.js.map +1 -1
- package/dist/rollup.d.ts +73 -79
- package/dist/rollup.js +2 -2
- package/dist/shared/index.js +2 -2
- package/dist/shared/loadConfigFile.js +2 -2
- package/dist/shared/mergeOptions.js +2 -2
- package/dist/shared/rollup.js +139 -84
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/package.json +1 -1
package/dist/rollup.d.ts
CHANGED
|
@@ -244,7 +244,7 @@ export type ResolveIdHook = (
|
|
|
244
244
|
source: string,
|
|
245
245
|
importer: string | undefined,
|
|
246
246
|
options: { custom?: CustomPluginOptions; isEntry: boolean }
|
|
247
|
-
) =>
|
|
247
|
+
) => ResolveIdResult;
|
|
248
248
|
|
|
249
249
|
export type ShouldTransformCachedModuleHook = (
|
|
250
250
|
this: PluginContext,
|
|
@@ -257,7 +257,7 @@ export type ShouldTransformCachedModuleHook = (
|
|
|
257
257
|
resolvedSources: ResolvedIdMap;
|
|
258
258
|
syntheticNamedExports: boolean | string;
|
|
259
259
|
}
|
|
260
|
-
) =>
|
|
260
|
+
) => boolean;
|
|
261
261
|
|
|
262
262
|
export type IsExternal = (
|
|
263
263
|
source: string,
|
|
@@ -269,9 +269,9 @@ 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 | void;
|
|
272
|
+
export type LoadResult = SourceDescription | string | null | void;
|
|
273
273
|
|
|
274
|
-
export type LoadHook = (this: PluginContext, id: string) =>
|
|
274
|
+
export type LoadHook = (this: PluginContext, id: string) => LoadResult;
|
|
275
275
|
|
|
276
276
|
export interface TransformPluginContext extends PluginContext {
|
|
277
277
|
getCombinedSourcemap: () => SourceMap;
|
|
@@ -283,27 +283,22 @@ export type TransformHook = (
|
|
|
283
283
|
this: TransformPluginContext,
|
|
284
284
|
code: string,
|
|
285
285
|
id: string
|
|
286
|
-
) =>
|
|
286
|
+
) => TransformResult;
|
|
287
287
|
|
|
288
|
-
export type ModuleParsedHook = (this: PluginContext, info: ModuleInfo) =>
|
|
288
|
+
export type ModuleParsedHook = (this: PluginContext, info: ModuleInfo) => void;
|
|
289
289
|
|
|
290
290
|
export type RenderChunkHook = (
|
|
291
291
|
this: PluginContext,
|
|
292
292
|
code: string,
|
|
293
293
|
chunk: RenderedChunk,
|
|
294
294
|
options: NormalizedOutputOptions
|
|
295
|
-
) =>
|
|
296
|
-
| Promise<{ code: string; map?: SourceMapInput } | null>
|
|
297
|
-
| { code: string; map?: SourceMapInput }
|
|
298
|
-
| string
|
|
299
|
-
| null
|
|
300
|
-
| undefined;
|
|
295
|
+
) => { code: string; map?: SourceMapInput } | string | null | undefined;
|
|
301
296
|
|
|
302
297
|
export type ResolveDynamicImportHook = (
|
|
303
298
|
this: PluginContext,
|
|
304
299
|
specifier: string | AcornNode,
|
|
305
300
|
importer: string
|
|
306
|
-
) =>
|
|
301
|
+
) => ResolveIdResult;
|
|
307
302
|
|
|
308
303
|
export type ResolveImportMetaHook = (
|
|
309
304
|
this: PluginContext,
|
|
@@ -344,7 +339,7 @@ export type WatchChangeHook = (
|
|
|
344
339
|
this: PluginContext,
|
|
345
340
|
id: string,
|
|
346
341
|
change: { event: ChangeEvent }
|
|
347
|
-
) =>
|
|
342
|
+
) => void;
|
|
348
343
|
|
|
349
344
|
/**
|
|
350
345
|
* use this type for plugin annotation
|
|
@@ -371,32 +366,21 @@ export interface OutputBundleWithPlaceholders {
|
|
|
371
366
|
[fileName: string]: OutputAsset | OutputChunk | FilePlaceholder;
|
|
372
367
|
}
|
|
373
368
|
|
|
374
|
-
export interface
|
|
375
|
-
buildEnd: (this: PluginContext, err?: Error) => Promise<void> | void;
|
|
376
|
-
buildStart: (this: PluginContext, options: NormalizedInputOptions) => Promise<void> | void;
|
|
377
|
-
closeBundle: (this: PluginContext) => Promise<void> | void;
|
|
378
|
-
closeWatcher: (this: PluginContext) => Promise<void> | void;
|
|
379
|
-
load: LoadHook;
|
|
380
|
-
moduleParsed: ModuleParsedHook;
|
|
381
|
-
options: (
|
|
382
|
-
this: MinimalPluginContext,
|
|
383
|
-
options: InputOptions
|
|
384
|
-
) => Promise<InputOptions | null | void> | InputOptions | null | void;
|
|
385
|
-
resolveDynamicImport: ResolveDynamicImportHook;
|
|
386
|
-
resolveId: ResolveIdHook;
|
|
387
|
-
shouldTransformCachedModule: ShouldTransformCachedModuleHook;
|
|
388
|
-
transform: TransformHook;
|
|
389
|
-
watchChange: WatchChangeHook;
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
interface OutputPluginHooks {
|
|
369
|
+
export interface FunctionPluginHooks {
|
|
393
370
|
augmentChunkHash: (this: PluginContext, chunk: PreRenderedChunk) => string | void;
|
|
371
|
+
buildEnd: (this: PluginContext, err?: Error) => void;
|
|
372
|
+
buildStart: (this: PluginContext, options: NormalizedInputOptions) => void;
|
|
373
|
+
closeBundle: (this: PluginContext) => void;
|
|
374
|
+
closeWatcher: (this: PluginContext) => void;
|
|
394
375
|
generateBundle: (
|
|
395
376
|
this: PluginContext,
|
|
396
377
|
options: NormalizedOutputOptions,
|
|
397
378
|
bundle: OutputBundle,
|
|
398
379
|
isWrite: boolean
|
|
399
|
-
) => void
|
|
380
|
+
) => void;
|
|
381
|
+
load: LoadHook;
|
|
382
|
+
moduleParsed: ModuleParsedHook;
|
|
383
|
+
options: (this: MinimalPluginContext, options: InputOptions) => InputOptions | null | void;
|
|
400
384
|
outputOptions: (this: PluginContext, options: OutputOptions) => OutputOptions | null | void;
|
|
401
385
|
renderChunk: RenderChunkHook;
|
|
402
386
|
renderDynamicImport: (
|
|
@@ -408,45 +392,52 @@ interface OutputPluginHooks {
|
|
|
408
392
|
targetModuleId: string | null;
|
|
409
393
|
}
|
|
410
394
|
) => { left: string; right: string } | null | void;
|
|
411
|
-
renderError: (this: PluginContext, err?: Error) =>
|
|
395
|
+
renderError: (this: PluginContext, err?: Error) => void;
|
|
412
396
|
renderStart: (
|
|
413
397
|
this: PluginContext,
|
|
414
398
|
outputOptions: NormalizedOutputOptions,
|
|
415
399
|
inputOptions: NormalizedInputOptions
|
|
416
|
-
) =>
|
|
400
|
+
) => void;
|
|
417
401
|
/** @deprecated Use `resolveFileUrl` instead */
|
|
418
402
|
resolveAssetUrl: ResolveAssetUrlHook;
|
|
403
|
+
resolveDynamicImport: ResolveDynamicImportHook;
|
|
419
404
|
resolveFileUrl: ResolveFileUrlHook;
|
|
405
|
+
resolveId: ResolveIdHook;
|
|
420
406
|
resolveImportMeta: ResolveImportMetaHook;
|
|
407
|
+
shouldTransformCachedModule: ShouldTransformCachedModuleHook;
|
|
408
|
+
transform: TransformHook;
|
|
409
|
+
watchChange: WatchChangeHook;
|
|
421
410
|
writeBundle: (
|
|
422
411
|
this: PluginContext,
|
|
423
412
|
options: NormalizedOutputOptions,
|
|
424
413
|
bundle: OutputBundle
|
|
425
|
-
) => void
|
|
414
|
+
) => void;
|
|
426
415
|
}
|
|
427
416
|
|
|
428
|
-
export type
|
|
429
|
-
| '
|
|
430
|
-
| 'buildEnd'
|
|
431
|
-
| 'buildStart'
|
|
417
|
+
export type OutputPluginHooks =
|
|
418
|
+
| 'augmentChunkHash'
|
|
432
419
|
| 'generateBundle'
|
|
433
|
-
| '
|
|
434
|
-
| 'moduleParsed'
|
|
420
|
+
| 'outputOptions'
|
|
435
421
|
| 'renderChunk'
|
|
422
|
+
| 'renderDynamicImport'
|
|
436
423
|
| 'renderError'
|
|
437
424
|
| 'renderStart'
|
|
438
|
-
| '
|
|
439
|
-
| '
|
|
440
|
-
| '
|
|
441
|
-
| '
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
| 'closeWatcher'
|
|
445
|
-
| 'watchChange';
|
|
425
|
+
| 'resolveAssetUrl'
|
|
426
|
+
| 'resolveFileUrl'
|
|
427
|
+
| 'resolveImportMeta'
|
|
428
|
+
| 'writeBundle';
|
|
429
|
+
|
|
430
|
+
export type InputPluginHooks = Exclude<keyof FunctionPluginHooks, OutputPluginHooks>;
|
|
446
431
|
|
|
447
|
-
export type
|
|
432
|
+
export type SyncPluginHooks =
|
|
433
|
+
| 'augmentChunkHash'
|
|
434
|
+
| 'outputOptions'
|
|
435
|
+
| 'renderDynamicImport'
|
|
436
|
+
| 'resolveAssetUrl'
|
|
437
|
+
| 'resolveFileUrl'
|
|
438
|
+
| 'resolveImportMeta';
|
|
448
439
|
|
|
449
|
-
export type
|
|
440
|
+
export type AsyncPluginHooks = Exclude<keyof FunctionPluginHooks, SyncPluginHooks>;
|
|
450
441
|
|
|
451
442
|
export type FirstPluginHooks =
|
|
452
443
|
| 'load'
|
|
@@ -466,37 +457,38 @@ export type SequentialPluginHooks =
|
|
|
466
457
|
| 'renderChunk'
|
|
467
458
|
| 'transform';
|
|
468
459
|
|
|
469
|
-
export type ParallelPluginHooks =
|
|
470
|
-
|
|
|
471
|
-
|
|
|
472
|
-
|
|
473
|
-
| 'footer'
|
|
474
|
-
| 'intro'
|
|
475
|
-
| 'moduleParsed'
|
|
476
|
-
| 'outro'
|
|
477
|
-
| 'renderError'
|
|
478
|
-
| 'renderStart'
|
|
479
|
-
| 'writeBundle'
|
|
480
|
-
| 'closeBundle'
|
|
481
|
-
| 'closeWatcher'
|
|
482
|
-
| 'watchChange';
|
|
460
|
+
export type ParallelPluginHooks = Exclude<
|
|
461
|
+
keyof FunctionPluginHooks | AddonHooks,
|
|
462
|
+
FirstPluginHooks | SequentialPluginHooks
|
|
463
|
+
>;
|
|
483
464
|
|
|
484
|
-
|
|
485
|
-
banner: AddonHook;
|
|
486
|
-
cacheKey: string;
|
|
487
|
-
footer: AddonHook;
|
|
488
|
-
intro: AddonHook;
|
|
489
|
-
outro: AddonHook;
|
|
490
|
-
}
|
|
465
|
+
export type AddonHooks = 'banner' | 'footer' | 'intro' | 'outro';
|
|
491
466
|
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
467
|
+
type MakeAsync<Fn> = Fn extends (this: infer This, ...args: infer Args) => infer Return
|
|
468
|
+
? (this: This, ...args: Args) => Return | Promise<Return>
|
|
469
|
+
: never;
|
|
470
|
+
|
|
471
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
472
|
+
type ObjectHook<T, O = {}> = T | ({ handler: T; order?: 'pre' | 'post' | null } & O);
|
|
473
|
+
|
|
474
|
+
export type PluginHooks = {
|
|
475
|
+
[K in keyof FunctionPluginHooks]: ObjectHook<
|
|
476
|
+
K extends AsyncPluginHooks ? MakeAsync<FunctionPluginHooks[K]> : FunctionPluginHooks[K],
|
|
477
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
478
|
+
K extends ParallelPluginHooks ? { sequential?: boolean } : {}
|
|
479
|
+
>;
|
|
480
|
+
};
|
|
481
|
+
|
|
482
|
+
export interface OutputPlugin
|
|
483
|
+
extends Partial<{ [K in OutputPluginHooks]: PluginHooks[K] }>,
|
|
484
|
+
Partial<{ [K in AddonHooks]: ObjectHook<AddonHook> }> {
|
|
485
|
+
cacheKey?: string;
|
|
495
486
|
name: string;
|
|
496
487
|
}
|
|
497
488
|
|
|
498
|
-
export interface
|
|
499
|
-
|
|
489
|
+
export interface Plugin extends OutputPlugin, Partial<PluginHooks> {
|
|
490
|
+
// for inter-plugin communication
|
|
491
|
+
api?: any;
|
|
500
492
|
}
|
|
501
493
|
|
|
502
494
|
type TreeshakingPreset = 'smallest' | 'safest' | 'recommended';
|
|
@@ -639,6 +631,7 @@ export type AmdOptions = (
|
|
|
639
631
|
}
|
|
640
632
|
) & {
|
|
641
633
|
define?: string;
|
|
634
|
+
forceJsExtensionForImports?: boolean;
|
|
642
635
|
};
|
|
643
636
|
|
|
644
637
|
export type NormalizedAmdOptions = (
|
|
@@ -652,6 +645,7 @@ export type NormalizedAmdOptions = (
|
|
|
652
645
|
}
|
|
653
646
|
) & {
|
|
654
647
|
define: string;
|
|
648
|
+
forceJsExtensionForImports: boolean;
|
|
655
649
|
};
|
|
656
650
|
|
|
657
651
|
export interface OutputOptions {
|
package/dist/rollup.js
CHANGED
package/dist/shared/index.js
CHANGED