rollup 2.75.5 → 3.0.0-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/LICENSE.md +2 -2
- package/dist/bin/rollup +75 -70
- package/dist/es/rollup.browser.js +3 -3
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/rollup.js +2207 -2244
- package/dist/es/shared/watch.js +2 -2
- package/dist/loadConfigFile.js +6 -6
- package/dist/rollup.browser.js +3 -3
- package/dist/rollup.browser.js.map +1 -1
- package/dist/rollup.d.ts +26 -55
- package/dist/rollup.js +2 -2
- package/dist/shared/index.js +2 -2
- package/dist/shared/loadConfigFile.js +16 -13
- package/dist/shared/mergeOptions.js +2 -2
- package/dist/shared/rollup.js +2272 -2309
- package/dist/shared/watch-cli.js +17 -17
- package/dist/shared/watch.js +2 -2
- package/package.json +28 -27
- package/CHANGELOG.md +0 -6601
package/dist/rollup.d.ts
CHANGED
|
@@ -150,10 +150,6 @@ export interface EmittedChunk {
|
|
|
150
150
|
|
|
151
151
|
export type EmittedFile = EmittedAsset | EmittedChunk;
|
|
152
152
|
|
|
153
|
-
export type EmitAsset = (name: string, source?: string | Uint8Array) => string;
|
|
154
|
-
|
|
155
|
-
export type EmitChunk = (id: string, options?: { name?: string }) => string;
|
|
156
|
-
|
|
157
153
|
export type EmitFile = (emittedFile: EmittedFile) => string;
|
|
158
154
|
|
|
159
155
|
interface ModuleInfo extends ModuleOptions {
|
|
@@ -185,22 +181,12 @@ export interface CustomPluginOptions {
|
|
|
185
181
|
export interface PluginContext extends MinimalPluginContext {
|
|
186
182
|
addWatchFile: (id: string) => void;
|
|
187
183
|
cache: PluginCache;
|
|
188
|
-
/** @deprecated Use `this.emitFile` instead */
|
|
189
|
-
emitAsset: EmitAsset;
|
|
190
|
-
/** @deprecated Use `this.emitFile` instead */
|
|
191
|
-
emitChunk: EmitChunk;
|
|
192
184
|
emitFile: EmitFile;
|
|
193
185
|
error: (err: RollupError | string, pos?: number | { column: number; line: number }) => never;
|
|
194
|
-
/** @deprecated Use `this.getFileName` instead */
|
|
195
|
-
getAssetFileName: (assetReferenceId: string) => string;
|
|
196
|
-
/** @deprecated Use `this.getFileName` instead */
|
|
197
|
-
getChunkFileName: (chunkReferenceId: string) => string;
|
|
198
186
|
getFileName: (fileReferenceId: string) => string;
|
|
199
187
|
getModuleIds: () => IterableIterator<string>;
|
|
200
188
|
getModuleInfo: GetModuleInfo;
|
|
201
189
|
getWatchFiles: () => string[];
|
|
202
|
-
/** @deprecated Use `this.resolve` instead */
|
|
203
|
-
isExternal: IsExternal;
|
|
204
190
|
load: (
|
|
205
191
|
options: { id: string; resolveDependencies?: boolean } & Partial<PartialNull<ModuleOptions>>
|
|
206
192
|
) => Promise<ModuleInfo>;
|
|
@@ -212,8 +198,6 @@ export interface PluginContext extends MinimalPluginContext {
|
|
|
212
198
|
importer?: string,
|
|
213
199
|
options?: { custom?: CustomPluginOptions; isEntry?: boolean; skipSelf?: boolean }
|
|
214
200
|
) => Promise<ResolvedId | null>;
|
|
215
|
-
/** @deprecated Use `this.resolve` instead */
|
|
216
|
-
resolveId: (source: string, importer?: string) => Promise<string | null>;
|
|
217
201
|
setAssetSource: (assetReferenceId: string, source: string | Uint8Array) => void;
|
|
218
202
|
warn: (warning: RollupWarning | string, pos?: number | { column: number; line: number }) => void;
|
|
219
203
|
}
|
|
@@ -291,7 +275,8 @@ export type RenderChunkHook = (
|
|
|
291
275
|
this: PluginContext,
|
|
292
276
|
code: string,
|
|
293
277
|
chunk: RenderedChunk,
|
|
294
|
-
options: NormalizedOutputOptions
|
|
278
|
+
options: NormalizedOutputOptions,
|
|
279
|
+
meta: { chunks: Record<string, RenderedChunk> }
|
|
295
280
|
) =>
|
|
296
281
|
| Promise<{ code: string; map?: SourceMapInput } | null>
|
|
297
282
|
| { code: string; map?: SourceMapInput }
|
|
@@ -311,23 +296,10 @@ export type ResolveImportMetaHook = (
|
|
|
311
296
|
options: { chunkId: string; format: InternalModuleFormat; moduleId: string }
|
|
312
297
|
) => string | null | void;
|
|
313
298
|
|
|
314
|
-
export type ResolveAssetUrlHook = (
|
|
315
|
-
this: PluginContext,
|
|
316
|
-
options: {
|
|
317
|
-
assetFileName: string;
|
|
318
|
-
chunkId: string;
|
|
319
|
-
format: InternalModuleFormat;
|
|
320
|
-
moduleId: string;
|
|
321
|
-
relativeAssetPath: string;
|
|
322
|
-
}
|
|
323
|
-
) => string | null | void;
|
|
324
|
-
|
|
325
299
|
export type ResolveFileUrlHook = (
|
|
326
300
|
this: PluginContext,
|
|
327
301
|
options: {
|
|
328
|
-
assetReferenceId: string | null;
|
|
329
302
|
chunkId: string;
|
|
330
|
-
chunkReferenceId: string | null;
|
|
331
303
|
fileName: string;
|
|
332
304
|
format: InternalModuleFormat;
|
|
333
305
|
moduleId: string;
|
|
@@ -336,7 +308,10 @@ export type ResolveFileUrlHook = (
|
|
|
336
308
|
}
|
|
337
309
|
) => string | null | void;
|
|
338
310
|
|
|
339
|
-
export type AddonHookFunction = (
|
|
311
|
+
export type AddonHookFunction = (
|
|
312
|
+
this: PluginContext,
|
|
313
|
+
chunk: RenderedChunk
|
|
314
|
+
) => string | Promise<string>;
|
|
340
315
|
export type AddonHook = string | AddonHookFunction;
|
|
341
316
|
|
|
342
317
|
export type ChangeEvent = 'create' | 'update' | 'delete';
|
|
@@ -390,7 +365,7 @@ export interface PluginHooks extends OutputPluginHooks {
|
|
|
390
365
|
}
|
|
391
366
|
|
|
392
367
|
interface OutputPluginHooks {
|
|
393
|
-
augmentChunkHash: (this: PluginContext, chunk:
|
|
368
|
+
augmentChunkHash: (this: PluginContext, chunk: RenderedChunk) => string | void;
|
|
394
369
|
generateBundle: (
|
|
395
370
|
this: PluginContext,
|
|
396
371
|
options: NormalizedOutputOptions,
|
|
@@ -414,8 +389,6 @@ interface OutputPluginHooks {
|
|
|
414
389
|
outputOptions: NormalizedOutputOptions,
|
|
415
390
|
inputOptions: NormalizedInputOptions
|
|
416
391
|
) => Promise<void> | void;
|
|
417
|
-
/** @deprecated Use `resolveFileUrl` instead */
|
|
418
|
-
resolveAssetUrl: ResolveAssetUrlHook;
|
|
419
392
|
resolveFileUrl: ResolveFileUrlHook;
|
|
420
393
|
resolveImportMeta: ResolveImportMetaHook;
|
|
421
394
|
writeBundle: (
|
|
@@ -451,7 +424,6 @@ export type SyncPluginHooks = Exclude<keyof PluginHooks, AsyncPluginHooks>;
|
|
|
451
424
|
export type FirstPluginHooks =
|
|
452
425
|
| 'load'
|
|
453
426
|
| 'renderDynamicImport'
|
|
454
|
-
| 'resolveAssetUrl'
|
|
455
427
|
| 'resolveDynamicImport'
|
|
456
428
|
| 'resolveFileUrl'
|
|
457
429
|
| 'resolveId'
|
|
@@ -514,15 +486,13 @@ export interface TreeshakingOptions
|
|
|
514
486
|
extends Partial<Omit<NormalizedTreeshakingOptions, 'moduleSideEffects'>> {
|
|
515
487
|
moduleSideEffects?: ModuleSideEffectsOption;
|
|
516
488
|
preset?: TreeshakingPreset;
|
|
517
|
-
/** @deprecated Use `moduleSideEffects` instead */
|
|
518
|
-
pureExternalModules?: PureModulesOption;
|
|
519
489
|
}
|
|
520
490
|
|
|
521
|
-
interface
|
|
491
|
+
interface ManualChunkMeta {
|
|
522
492
|
getModuleIds: () => IterableIterator<string>;
|
|
523
493
|
getModuleInfo: GetModuleInfo;
|
|
524
494
|
}
|
|
525
|
-
export type GetManualChunk = (id: string,
|
|
495
|
+
export type GetManualChunk = (id: string, meta: ManualChunkMeta) => string | null | void;
|
|
526
496
|
|
|
527
497
|
export type ExternalOption =
|
|
528
498
|
| (string | RegExp)[]
|
|
@@ -650,10 +620,12 @@ export type NormalizedAmdOptions = (
|
|
|
650
620
|
define: string;
|
|
651
621
|
};
|
|
652
622
|
|
|
623
|
+
type AddonFunction = (chunk: RenderedChunk) => string | Promise<string>;
|
|
624
|
+
|
|
653
625
|
export interface OutputOptions {
|
|
654
626
|
amd?: AmdOptions;
|
|
655
627
|
assetFileNames?: string | ((chunkInfo: PreRenderedAsset) => string);
|
|
656
|
-
banner?: string |
|
|
628
|
+
banner?: string | AddonFunction;
|
|
657
629
|
chunkFileNames?: string | ((chunkInfo: PreRenderedChunk) => string);
|
|
658
630
|
compact?: boolean;
|
|
659
631
|
// only required for bundle.write
|
|
@@ -667,7 +639,7 @@ export interface OutputOptions {
|
|
|
667
639
|
externalLiveBindings?: boolean;
|
|
668
640
|
// only required for bundle.write
|
|
669
641
|
file?: string;
|
|
670
|
-
footer?: string |
|
|
642
|
+
footer?: string | AddonFunction;
|
|
671
643
|
format?: ModuleFormat;
|
|
672
644
|
freeze?: boolean;
|
|
673
645
|
generatedCode?: GeneratedCodePreset | GeneratedCodeOptions;
|
|
@@ -676,14 +648,14 @@ export interface OutputOptions {
|
|
|
676
648
|
indent?: string | boolean;
|
|
677
649
|
inlineDynamicImports?: boolean;
|
|
678
650
|
interop?: InteropType | GetInterop;
|
|
679
|
-
intro?: string |
|
|
651
|
+
intro?: string | AddonFunction;
|
|
680
652
|
manualChunks?: ManualChunksOption;
|
|
681
653
|
minifyInternalExports?: boolean;
|
|
682
654
|
name?: string;
|
|
683
655
|
/** @deprecated Use "generatedCode.symbols" instead. */
|
|
684
656
|
namespaceToStringTag?: boolean;
|
|
685
657
|
noConflict?: boolean;
|
|
686
|
-
outro?: string |
|
|
658
|
+
outro?: string | AddonFunction;
|
|
687
659
|
paths?: OptionsPaths;
|
|
688
660
|
plugins?: (OutputPlugin | null | false | undefined)[];
|
|
689
661
|
/** @deprecated Use "generatedCode.constBindings" instead. */
|
|
@@ -703,7 +675,7 @@ export interface OutputOptions {
|
|
|
703
675
|
export interface NormalizedOutputOptions {
|
|
704
676
|
amd: NormalizedAmdOptions;
|
|
705
677
|
assetFileNames: string | ((chunkInfo: PreRenderedAsset) => string);
|
|
706
|
-
banner:
|
|
678
|
+
banner: AddonFunction;
|
|
707
679
|
chunkFileNames: string | ((chunkInfo: PreRenderedChunk) => string);
|
|
708
680
|
compact: boolean;
|
|
709
681
|
dir: string | undefined;
|
|
@@ -715,7 +687,7 @@ export interface NormalizedOutputOptions {
|
|
|
715
687
|
extend: boolean;
|
|
716
688
|
externalLiveBindings: boolean;
|
|
717
689
|
file: string | undefined;
|
|
718
|
-
footer:
|
|
690
|
+
footer: AddonFunction;
|
|
719
691
|
format: InternalModuleFormat;
|
|
720
692
|
freeze: boolean;
|
|
721
693
|
generatedCode: NormalizedGeneratedCodeOptions;
|
|
@@ -724,16 +696,17 @@ export interface NormalizedOutputOptions {
|
|
|
724
696
|
indent: true | string;
|
|
725
697
|
inlineDynamicImports: boolean;
|
|
726
698
|
interop: GetInterop;
|
|
727
|
-
intro:
|
|
699
|
+
intro: AddonFunction;
|
|
728
700
|
manualChunks: ManualChunksOption;
|
|
729
701
|
minifyInternalExports: boolean;
|
|
730
702
|
name: string | undefined;
|
|
703
|
+
/** @deprecated Use "generatedCode.symbols" instead. */
|
|
731
704
|
namespaceToStringTag: boolean;
|
|
732
705
|
noConflict: boolean;
|
|
733
|
-
outro:
|
|
706
|
+
outro: AddonFunction;
|
|
734
707
|
paths: OptionsPaths;
|
|
735
708
|
plugins: OutputPlugin[];
|
|
736
|
-
/** @deprecated Use
|
|
709
|
+
/** @deprecated Use "generatedCode.constBindings" instead. */
|
|
737
710
|
preferConst: boolean;
|
|
738
711
|
preserveModules: boolean;
|
|
739
712
|
preserveModulesRoot: string | undefined;
|
|
@@ -765,8 +738,6 @@ export interface PreRenderedAsset {
|
|
|
765
738
|
|
|
766
739
|
export interface OutputAsset extends PreRenderedAsset {
|
|
767
740
|
fileName: string;
|
|
768
|
-
/** @deprecated Accessing "isAsset" on files in the bundle is deprecated, please use "type === \'asset\'" instead */
|
|
769
|
-
isAsset: true;
|
|
770
741
|
}
|
|
771
742
|
|
|
772
743
|
export interface RenderedModule {
|
|
@@ -783,15 +754,12 @@ export interface PreRenderedChunk {
|
|
|
783
754
|
isDynamicEntry: boolean;
|
|
784
755
|
isEntry: boolean;
|
|
785
756
|
isImplicitEntry: boolean;
|
|
786
|
-
|
|
787
|
-
[id: string]: RenderedModule;
|
|
788
|
-
};
|
|
757
|
+
moduleIds: string[];
|
|
789
758
|
name: string;
|
|
790
759
|
type: 'chunk';
|
|
791
760
|
}
|
|
792
761
|
|
|
793
762
|
export interface RenderedChunk extends PreRenderedChunk {
|
|
794
|
-
code?: string;
|
|
795
763
|
dynamicImports: string[];
|
|
796
764
|
fileName: string;
|
|
797
765
|
implicitlyLoadedBefore: string[];
|
|
@@ -799,12 +767,15 @@ export interface RenderedChunk extends PreRenderedChunk {
|
|
|
799
767
|
[imported: string]: string[];
|
|
800
768
|
};
|
|
801
769
|
imports: string[];
|
|
802
|
-
|
|
770
|
+
modules: {
|
|
771
|
+
[id: string]: RenderedModule;
|
|
772
|
+
};
|
|
803
773
|
referencedFiles: string[];
|
|
804
774
|
}
|
|
805
775
|
|
|
806
776
|
export interface OutputChunk extends RenderedChunk {
|
|
807
777
|
code: string;
|
|
778
|
+
map: SourceMap | null;
|
|
808
779
|
}
|
|
809
780
|
|
|
810
781
|
export interface SerializablePluginCache {
|
package/dist/rollup.js
CHANGED
package/dist/shared/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js
|
|
4
|
-
|
|
3
|
+
Rollup.js v3.0.0-0
|
|
4
|
+
Tue, 05 Jul 2022 04:32:12 GMT - commit 7a8316af2262c390e7ed72586cb83add1286dec2
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
const require$$0 = require('path');
|
|
13
13
|
const process$1 = require('process');
|
|
14
14
|
const url = require('url');
|
|
15
|
-
const rollup = require('./rollup.js');
|
|
16
15
|
const tty = require('tty');
|
|
16
|
+
const rollup = require('./rollup.js');
|
|
17
17
|
const mergeOptions = require('./mergeOptions.js');
|
|
18
18
|
|
|
19
19
|
function _interopNamespaceDefault(e) {
|
|
@@ -29,22 +29,27 @@ function _interopNamespaceDefault(e) {
|
|
|
29
29
|
|
|
30
30
|
const tty__namespace = /*#__PURE__*/_interopNamespaceDefault(tty);
|
|
31
31
|
|
|
32
|
-
const
|
|
33
|
-
|
|
32
|
+
const {
|
|
33
|
+
env = {},
|
|
34
|
+
argv = [],
|
|
35
|
+
platform = "",
|
|
36
|
+
} = typeof process === "undefined" ? {} : process;
|
|
34
37
|
|
|
35
38
|
const isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
|
|
36
39
|
const isForced = "FORCE_COLOR" in env || argv.includes("--color");
|
|
37
|
-
const isWindows =
|
|
40
|
+
const isWindows = platform === "win32";
|
|
41
|
+
const isDumbTerminal = env.TERM === "dumb";
|
|
38
42
|
|
|
39
43
|
const isCompatibleTerminal =
|
|
40
|
-
tty__namespace && tty__namespace.isatty && tty__namespace.isatty(1) && env.TERM &&
|
|
44
|
+
tty__namespace && tty__namespace.isatty && tty__namespace.isatty(1) && env.TERM && !isDumbTerminal;
|
|
41
45
|
|
|
42
46
|
const isCI =
|
|
43
47
|
"CI" in env &&
|
|
44
48
|
("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
|
|
45
49
|
|
|
46
50
|
const isColorSupported =
|
|
47
|
-
!isDisabled &&
|
|
51
|
+
!isDisabled &&
|
|
52
|
+
(isForced || (isWindows && !isDumbTerminal) || isCompatibleTerminal || isCI);
|
|
48
53
|
|
|
49
54
|
const replaceClose = (
|
|
50
55
|
index,
|
|
@@ -121,13 +126,11 @@ const colors = {
|
|
|
121
126
|
bgWhiteBright: init(107, 49),
|
|
122
127
|
};
|
|
123
128
|
|
|
124
|
-
const none = (any) => any;
|
|
125
|
-
|
|
126
129
|
const createColors = ({ useColor = isColorSupported } = {}) =>
|
|
127
130
|
useColor
|
|
128
131
|
? colors
|
|
129
132
|
: Object.keys(colors).reduce(
|
|
130
|
-
(colors, key) => ({ ...colors, [key]:
|
|
133
|
+
(colors, key) => ({ ...colors, [key]: String }),
|
|
131
134
|
{}
|
|
132
135
|
);
|
|
133
136
|
|
|
@@ -492,7 +495,7 @@ async function loadAndRegisterPlugin(inputOptions, pluginText) {
|
|
|
492
495
|
plugin = await requireOrImport(prefix + pluginText);
|
|
493
496
|
break;
|
|
494
497
|
}
|
|
495
|
-
catch
|
|
498
|
+
catch {
|
|
496
499
|
// if this does not work, we try requiring the actual name below
|
|
497
500
|
}
|
|
498
501
|
}
|
|
@@ -532,7 +535,7 @@ async function requireOrImport(pluginPath) {
|
|
|
532
535
|
try {
|
|
533
536
|
return require(pluginPath);
|
|
534
537
|
}
|
|
535
|
-
catch
|
|
538
|
+
catch {
|
|
536
539
|
return import(pluginPath);
|
|
537
540
|
}
|
|
538
541
|
}
|