rollup 2.59.0 → 2.61.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 +57 -0
- package/dist/bin/rollup +6 -5
- package/dist/es/rollup.browser.js +3 -3
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/rollup.js +671 -648
- package/dist/es/shared/watch.js +4 -6
- package/dist/loadConfigFile.js +3 -2
- package/dist/rollup.browser.js +3 -3
- package/dist/rollup.browser.js.map +1 -1
- package/dist/rollup.d.ts +1 -0
- package/dist/rollup.js +2 -2
- package/dist/shared/index.js +3 -5
- package/dist/shared/loadConfigFile.js +120 -50
- package/dist/shared/mergeOptions.js +2 -2
- package/dist/shared/rollup.js +670 -649
- package/dist/shared/watch-cli.js +36 -13
- package/dist/shared/watch.js +2 -2
- package/package.json +21 -21
package/dist/rollup.d.ts
CHANGED
|
@@ -198,6 +198,7 @@ export interface PluginContext extends MinimalPluginContext {
|
|
|
198
198
|
getWatchFiles: () => string[];
|
|
199
199
|
/** @deprecated Use `this.resolve` instead */
|
|
200
200
|
isExternal: IsExternal;
|
|
201
|
+
load: (options: { id: string } & Partial<PartialNull<ModuleOptions>>) => Promise<ModuleInfo>;
|
|
201
202
|
/** @deprecated Use `this.getModuleIds` instead */
|
|
202
203
|
moduleIds: IterableIterator<string>;
|
|
203
204
|
parse: (input: string, options?: any) => AcornNode;
|
package/dist/rollup.js
CHANGED
package/dist/shared/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.61.0
|
|
4
|
+
Thu, 09 Dec 2021 05:43:43 GMT - commit 49d41f78987a1dd13488df009fe2db1b5d1b6e7c
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -3056,15 +3056,13 @@ var nodefsHandler = NodeFsHandler$1;
|
|
|
3056
3056
|
|
|
3057
3057
|
var fseventsHandler = {exports: {}};
|
|
3058
3058
|
|
|
3059
|
-
const require$$3 = /*@__PURE__*/rollup.getAugmentedNamespace(rollup.fseventsImporter);
|
|
3060
|
-
|
|
3061
3059
|
const fs$1 = fs$4;
|
|
3062
3060
|
const sysPath$1 = path$1;
|
|
3063
3061
|
const { promisify: promisify$1 } = require$$2;
|
|
3064
3062
|
|
|
3065
3063
|
let fsevents;
|
|
3066
3064
|
try {
|
|
3067
|
-
fsevents = require
|
|
3065
|
+
fsevents = require('../../../src/watch/fsevents-importer').getFsEvents();
|
|
3068
3066
|
} catch (error) {
|
|
3069
3067
|
if (process.env.CHOKIDAR_PRINT_FSEVENTS_REQUIRE_ERROR) console.error(error);
|
|
3070
3068
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.61.0
|
|
4
|
+
Thu, 09 Dec 2021 05:43:43 GMT - commit 49d41f78987a1dd13488df009fe2db1b5d1b6e7c
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
const fs = require('fs');
|
|
14
14
|
const path = require('path');
|
|
15
15
|
const url = require('url');
|
|
16
|
+
const process$1 = require('process');
|
|
16
17
|
const tty = require('tty');
|
|
17
18
|
const rollup = require('./rollup.js');
|
|
18
19
|
const mergeOptions = require('./mergeOptions.js');
|
|
@@ -32,58 +33,116 @@ const fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
|
|
|
32
33
|
const path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
|
|
33
34
|
const tty__namespace = /*#__PURE__*/_interopNamespaceDefault(tty);
|
|
34
35
|
|
|
35
|
-
const env = process.env;
|
|
36
|
+
const env = process.env || {};
|
|
37
|
+
const argv = process.argv || [];
|
|
36
38
|
|
|
37
|
-
const isDisabled = "NO_COLOR" in env;
|
|
38
|
-
const isForced = "FORCE_COLOR" in env;
|
|
39
|
+
const isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
|
|
40
|
+
const isForced = "FORCE_COLOR" in env || argv.includes("--color");
|
|
39
41
|
const isWindows = process.platform === "win32";
|
|
40
42
|
|
|
41
43
|
const isCompatibleTerminal =
|
|
42
|
-
tty__namespace && tty__namespace.isatty(1) && env.TERM && env.TERM !== "dumb";
|
|
44
|
+
tty__namespace && tty__namespace.isatty && tty__namespace.isatty(1) && env.TERM && env.TERM !== "dumb";
|
|
43
45
|
|
|
44
46
|
const isCI =
|
|
45
47
|
"CI" in env &&
|
|
46
48
|
("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
|
|
47
49
|
|
|
48
|
-
|
|
50
|
+
const isColorSupported =
|
|
49
51
|
!isDisabled && (isForced || isWindows || isCompatibleTerminal || isCI);
|
|
50
52
|
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
const replaceClose = (
|
|
54
|
+
index,
|
|
55
|
+
string,
|
|
56
|
+
close,
|
|
57
|
+
replace,
|
|
58
|
+
head = string.substring(0, index) + replace,
|
|
59
|
+
tail = string.substring(index + close.length),
|
|
60
|
+
next = tail.indexOf(close)
|
|
61
|
+
) => head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
|
|
59
62
|
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
)
|
|
63
|
+
const clearBleed = (index, string, open, close, replace) =>
|
|
64
|
+
index < 0
|
|
65
|
+
? open + string + close
|
|
66
|
+
: open + replaceClose(index, string, close, replace) + close;
|
|
67
|
+
|
|
68
|
+
const filterEmpty =
|
|
69
|
+
(open, close, replace = open, at = open.length + 1) =>
|
|
70
|
+
(string) =>
|
|
71
|
+
string || !(string === "" || string === undefined)
|
|
72
|
+
? clearBleed(
|
|
73
|
+
("" + string).indexOf(close, at),
|
|
74
|
+
string,
|
|
75
|
+
open,
|
|
76
|
+
close,
|
|
77
|
+
replace
|
|
78
|
+
)
|
|
79
|
+
: "";
|
|
80
|
+
|
|
81
|
+
const init = (open, close, replace) =>
|
|
82
|
+
filterEmpty(`\x1b[${open}m`, `\x1b[${close}m`, replace);
|
|
83
|
+
|
|
84
|
+
const colors = {
|
|
85
|
+
reset: init(0, 0),
|
|
86
|
+
bold: init(1, 22, "\x1b[22m\x1b[1m"),
|
|
87
|
+
dim: init(2, 22, "\x1b[22m\x1b[2m"),
|
|
88
|
+
italic: init(3, 23),
|
|
89
|
+
underline: init(4, 24),
|
|
90
|
+
inverse: init(7, 27),
|
|
91
|
+
hidden: init(8, 28),
|
|
92
|
+
strikethrough: init(9, 29),
|
|
93
|
+
black: init(30, 39),
|
|
94
|
+
red: init(31, 39),
|
|
95
|
+
green: init(32, 39),
|
|
96
|
+
yellow: init(33, 39),
|
|
97
|
+
blue: init(34, 39),
|
|
98
|
+
magenta: init(35, 39),
|
|
99
|
+
cyan: init(36, 39),
|
|
100
|
+
white: init(37, 39),
|
|
101
|
+
gray: init(90, 39),
|
|
102
|
+
bgBlack: init(40, 49),
|
|
103
|
+
bgRed: init(41, 49),
|
|
104
|
+
bgGreen: init(42, 49),
|
|
105
|
+
bgYellow: init(43, 49),
|
|
106
|
+
bgBlue: init(44, 49),
|
|
107
|
+
bgMagenta: init(45, 49),
|
|
108
|
+
bgCyan: init(46, 49),
|
|
109
|
+
bgWhite: init(47, 49),
|
|
110
|
+
blackBright: init(90, 39),
|
|
111
|
+
redBright: init(91, 39),
|
|
112
|
+
greenBright: init(92, 39),
|
|
113
|
+
yellowBright: init(93, 39),
|
|
114
|
+
blueBright: init(94, 39),
|
|
115
|
+
magentaBright: init(95, 39),
|
|
116
|
+
cyanBright: init(96, 39),
|
|
117
|
+
whiteBright: init(97, 39),
|
|
118
|
+
bgBlackBright: init(100, 49),
|
|
119
|
+
bgRedBright: init(101, 49),
|
|
120
|
+
bgGreenBright: init(102, 49),
|
|
121
|
+
bgYellowBright: init(103, 49),
|
|
122
|
+
bgBlueBright: init(104, 49),
|
|
123
|
+
bgMagentaBright: init(105, 49),
|
|
124
|
+
bgCyanBright: init(106, 49),
|
|
125
|
+
bgWhiteBright: init(107, 49),
|
|
67
126
|
};
|
|
68
127
|
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const gray = init(90, 39);
|
|
128
|
+
const none = (any) => any;
|
|
129
|
+
|
|
130
|
+
const createColors = ({ useColor = isColorSupported } = {}) =>
|
|
131
|
+
useColor
|
|
132
|
+
? colors
|
|
133
|
+
: Object.keys(colors).reduce(
|
|
134
|
+
(colors, key) => ({ ...colors, [key]: none }),
|
|
135
|
+
{}
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
createColors();
|
|
81
139
|
|
|
82
140
|
// @see https://no-color.org
|
|
83
141
|
// @see https://www.npmjs.com/package/chalk
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
142
|
+
const { bold, cyan, dim, gray, green, red, underline, yellow } = createColors({
|
|
143
|
+
useColor: process$1.env.FORCE_COLOR !== '0' && !process$1.env.NO_COLOR
|
|
144
|
+
});
|
|
145
|
+
|
|
87
146
|
// log to stderr to keep `rollup main.js > bundle.js` from breaking
|
|
88
147
|
const stderr = console.error.bind(console);
|
|
89
148
|
function handleError(err, recover = false) {
|
|
@@ -385,33 +444,35 @@ function waitForInputPlugin() {
|
|
|
385
444
|
};
|
|
386
445
|
}
|
|
387
446
|
|
|
388
|
-
function addCommandPluginsToInputOptions(inputOptions, command) {
|
|
447
|
+
async function addCommandPluginsToInputOptions(inputOptions, command) {
|
|
389
448
|
if (command.stdin !== false) {
|
|
390
449
|
inputOptions.plugins.push(stdinPlugin(command.stdin));
|
|
391
450
|
}
|
|
392
451
|
if (command.waitForBundleInput === true) {
|
|
393
452
|
inputOptions.plugins.push(waitForInputPlugin());
|
|
394
453
|
}
|
|
395
|
-
addPluginsFromCommandOption(command.plugin, inputOptions);
|
|
454
|
+
await addPluginsFromCommandOption(command.plugin, inputOptions);
|
|
396
455
|
}
|
|
397
|
-
function addPluginsFromCommandOption(commandPlugin, inputOptions) {
|
|
456
|
+
async function addPluginsFromCommandOption(commandPlugin, inputOptions) {
|
|
398
457
|
if (commandPlugin) {
|
|
399
458
|
const plugins = Array.isArray(commandPlugin) ? commandPlugin : [commandPlugin];
|
|
400
459
|
for (const plugin of plugins) {
|
|
401
460
|
if (/[={}]/.test(plugin)) {
|
|
402
461
|
// -p plugin=value
|
|
403
462
|
// -p "{transform(c,i){...}}"
|
|
404
|
-
loadAndRegisterPlugin(inputOptions, plugin);
|
|
463
|
+
await loadAndRegisterPlugin(inputOptions, plugin);
|
|
405
464
|
}
|
|
406
465
|
else {
|
|
407
466
|
// split out plugins joined by commas
|
|
408
467
|
// -p node-resolve,commonjs,buble
|
|
409
|
-
plugin.split(',')
|
|
468
|
+
for (const p of plugin.split(',')) {
|
|
469
|
+
await loadAndRegisterPlugin(inputOptions, p);
|
|
470
|
+
}
|
|
410
471
|
}
|
|
411
472
|
}
|
|
412
473
|
}
|
|
413
474
|
}
|
|
414
|
-
function loadAndRegisterPlugin(inputOptions, pluginText) {
|
|
475
|
+
async function loadAndRegisterPlugin(inputOptions, pluginText) {
|
|
415
476
|
let plugin = null;
|
|
416
477
|
let pluginArg = undefined;
|
|
417
478
|
if (pluginText[0] === '{') {
|
|
@@ -434,7 +495,7 @@ function loadAndRegisterPlugin(inputOptions, pluginText) {
|
|
|
434
495
|
// Prefix order is significant - left has higher precedence.
|
|
435
496
|
for (const prefix of ['@rollup/plugin-', 'rollup-plugin-']) {
|
|
436
497
|
try {
|
|
437
|
-
plugin =
|
|
498
|
+
plugin = await requireOrImport(prefix + pluginText);
|
|
438
499
|
break;
|
|
439
500
|
}
|
|
440
501
|
catch (_a) {
|
|
@@ -446,7 +507,7 @@ function loadAndRegisterPlugin(inputOptions, pluginText) {
|
|
|
446
507
|
try {
|
|
447
508
|
if (pluginText[0] == '.')
|
|
448
509
|
pluginText = path__namespace.resolve(pluginText);
|
|
449
|
-
plugin =
|
|
510
|
+
plugin = await requireOrImport(pluginText);
|
|
450
511
|
}
|
|
451
512
|
catch (err) {
|
|
452
513
|
throw new Error(`Cannot load plugin "${pluginText}": ${err.message}.`);
|
|
@@ -473,6 +534,14 @@ function getCamelizedPluginBaseName(pluginText) {
|
|
|
473
534
|
.map((part, index) => (index === 0 || !part ? part : part[0].toUpperCase() + part.slice(1)))
|
|
474
535
|
.join('');
|
|
475
536
|
}
|
|
537
|
+
async function requireOrImport(pluginPath) {
|
|
538
|
+
try {
|
|
539
|
+
return require(pluginPath);
|
|
540
|
+
}
|
|
541
|
+
catch (_a) {
|
|
542
|
+
return import(pluginPath);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
476
545
|
|
|
477
546
|
function supportsNativeESM() {
|
|
478
547
|
return Number(/^v(\d+)/.exec(process.version)[1]) >= 13;
|
|
@@ -481,11 +550,12 @@ async function loadAndParseConfigFile(fileName, commandOptions = {}) {
|
|
|
481
550
|
const configs = await loadConfigFile(fileName, commandOptions);
|
|
482
551
|
const warnings = batchWarnings();
|
|
483
552
|
try {
|
|
484
|
-
const normalizedConfigs =
|
|
553
|
+
const normalizedConfigs = [];
|
|
554
|
+
for (const config of configs) {
|
|
485
555
|
const options = mergeOptions.mergeOptions(config, commandOptions, warnings.add);
|
|
486
|
-
addCommandPluginsToInputOptions(options, commandOptions);
|
|
487
|
-
|
|
488
|
-
}
|
|
556
|
+
await addCommandPluginsToInputOptions(options, commandOptions);
|
|
557
|
+
normalizedConfigs.push(options);
|
|
558
|
+
}
|
|
489
559
|
return { options: normalizedConfigs, warnings };
|
|
490
560
|
}
|
|
491
561
|
catch (err) {
|
|
@@ -515,7 +585,7 @@ async function getDefaultFromTranspiledConfigFile(fileName, commandOptions) {
|
|
|
515
585
|
plugins: [],
|
|
516
586
|
treeshake: false
|
|
517
587
|
};
|
|
518
|
-
addPluginsFromCommandOption(commandOptions.configPlugin, inputOptions);
|
|
588
|
+
await addPluginsFromCommandOption(commandOptions.configPlugin, inputOptions);
|
|
519
589
|
const bundle = await rollup.rollup(inputOptions);
|
|
520
590
|
if (!commandOptions.silent && warnings.count > 0) {
|
|
521
591
|
stderr(bold(`loaded ${rollup.relativeId(fileName)} with warnings`));
|