rollup 2.7.2 → 2.7.6

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 CHANGED
@@ -1,5 +1,41 @@
1
1
  # rollup changelog
2
2
 
3
+ ## 2.7.6
4
+ *2020-04-30*
5
+
6
+ ### Bug Fixes
7
+ * Fix a type issue when a default export references a global variable (#3526)
8
+
9
+ ### Pull Requests
10
+ * [#3526](https://github.com/rollup/rollup/pull/3526): Handles default exporting global variables (@lukastaegert)
11
+
12
+ ## 2.7.5
13
+ *2020-04-29*
14
+
15
+ ### Bug Fixes
16
+ * Prevent infinite loop when default values of function parameters in a default export contain a slash (#3522)
17
+
18
+ ### Pull Requests
19
+ * [#3522](https://github.com/rollup/rollup/pull/3522): Avoid infinite loop when finding position for id insertion in default export (@lukastaegert)
20
+
21
+ ## 2.7.4
22
+ *2020-04-29*
23
+
24
+ ### Bug Fixes
25
+ * Fix an issue where wrong variable names were used when preserving modules (#3521)
26
+
27
+ ### Pull Requests
28
+ * [#3521](https://github.com/rollup/rollup/pull/3521): Fix and improve default export alias logic (@lukastaegert)
29
+
30
+ ## 2.7.3
31
+ *2020-04-27*
32
+
33
+ ### Bug Fixes
34
+ * Do not access `__proto__` when running Rollup (#3518)
35
+
36
+ ### Pull Requests
37
+ * [#3518](https://github.com/rollup/rollup/pull/3518): use acorn-class-fields and acorn-static-class-features from npm (@nitsky)
38
+
3
39
  ## 2.7.2
4
40
  *2020-04-22*
5
41
 
package/dist/bin/rollup CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  /*
4
4
  @license
5
- Rollup.js v2.7.2
6
- Wed, 22 Apr 2020 19:00:15 GMT - commit 97e6fa89d2ad14603094af77bad461a1aa81df3b
5
+ Rollup.js v2.7.6
6
+ Thu, 30 Apr 2020 18:55:10 GMT - commit 468010ba801b1e59573b6aa7319461a449aa43df
7
7
 
8
8
 
9
9
  https://github.com/rollup/rollup
@@ -16,8 +16,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
16
16
 
17
17
  var rollup_js = require('../shared/rollup.js');
18
18
  var path = require('path');
19
- require('util');
20
- var _util_commonjsExternal = require('../shared/_util_commonjs-external.js');
19
+ var util = require('util');
21
20
  var mergeOptions = require('../shared/mergeOptions.js');
22
21
  var loadConfigFile_js = require('../shared/loadConfigFile.js');
23
22
  require('crypto');
@@ -193,7 +192,7 @@ function parse (args, opts) {
193
192
  const newAliases = Object.create(null);
194
193
  const defaulted = Object.create(null);
195
194
  // allow a i18n handler to be passed in, default to a fake one (util.format).
196
- const __ = opts.__ || _util_commonjsExternal.require$$1.format;
195
+ const __ = opts.__ || util.format;
197
196
  const flags = {
198
197
  aliases: Object.create(null),
199
198
  arrays: Object.create(null),
@@ -652,7 +651,7 @@ function parse (args, opts) {
652
651
  return val
653
652
  },
654
653
  set (value) {
655
- val = typeof value === 'string' ? _util_commonjsExternal.sysPath.normalize(value) : value;
654
+ val = typeof value === 'string' ? path.normalize(value) : value;
656
655
  }
657
656
  });
658
657
  });
@@ -694,8 +693,8 @@ function parse (args, opts) {
694
693
 
695
694
  // Set normalized value when key is in 'normalize' and in 'arrays'
696
695
  if (checkAllAliases(key, flags.normalize) && checkAllAliases(key, flags.arrays)) {
697
- if (Array.isArray(val)) value = val.map(_util_commonjsExternal.sysPath.normalize);
698
- else value = _util_commonjsExternal.sysPath.normalize(val);
696
+ if (Array.isArray(val)) value = val.map(path.normalize);
697
+ else value = path.normalize(val);
699
698
  }
700
699
  return value
701
700
  }
@@ -724,7 +723,7 @@ function parse (args, opts) {
724
723
  if (configPath) {
725
724
  try {
726
725
  let config = null;
727
- const resolvedConfigPath = _util_commonjsExternal.sysPath.resolve(process.cwd(), configPath);
726
+ const resolvedConfigPath = path.resolve(process.cwd(), configPath);
728
727
 
729
728
  if (typeof flags.configs[configKey] === 'function') {
730
729
  try {
@@ -1205,6 +1204,8 @@ var parseMs = milliseconds => {
1205
1204
 
1206
1205
  const pluralize = (word, count) => count === 1 ? word : `${word}s`;
1207
1206
 
1207
+ const SECOND_ROUNDING_EPSILON = 0.0000001;
1208
+
1208
1209
  var prettyMs = (milliseconds, options = {}) => {
1209
1210
  if (!Number.isFinite(milliseconds)) {
1210
1211
  throw new TypeError('Expected a finite number');
@@ -1224,6 +1225,12 @@ var prettyMs = (milliseconds, options = {}) => {
1224
1225
 
1225
1226
  const result = [];
1226
1227
 
1228
+ const floorDecimals = (value, decimalDigits) => {
1229
+ const flooredInterimValue = Math.floor((value * (10 ** decimalDigits)) + SECOND_ROUNDING_EPSILON);
1230
+ const flooredValue = Math.round(flooredInterimValue) / (10 ** decimalDigits);
1231
+ return flooredValue.toFixed(decimalDigits);
1232
+ };
1233
+
1227
1234
  const add = (value, long, short, valueString) => {
1228
1235
  if ((result.length === 0 || !options.colonNotation) && value === 0 && !(options.colonNotation && short === 'm')) {
1229
1236
  return;
@@ -1246,32 +1253,6 @@ var prettyMs = (milliseconds, options = {}) => {
1246
1253
  result.push(prefix + valueString + suffix);
1247
1254
  };
1248
1255
 
1249
- const secondsDecimalDigits =
1250
- typeof options.secondsDecimalDigits === 'number' ?
1251
- options.secondsDecimalDigits :
1252
- 1;
1253
-
1254
- if (secondsDecimalDigits < 1) {
1255
- const difference = 1000 - (milliseconds % 1000);
1256
- if (difference < 500) {
1257
- milliseconds += difference;
1258
- }
1259
- }
1260
-
1261
- // Round up milliseconds for values lager than 1 minute - 50ms since these
1262
- // always need to be round up. This fixes issues when rounding seconds
1263
- // independently of minutes later on.
1264
- if (
1265
- milliseconds >= (1000 * 60) - 50 &&
1266
- !options.separateMilliseconds &&
1267
- !options.formatSubMilliseconds
1268
- ) {
1269
- const difference = 60 - (milliseconds % 60);
1270
- if (difference <= 50) {
1271
- milliseconds += difference;
1272
- }
1273
- }
1274
-
1275
1256
  const parsed = parseMs(milliseconds);
1276
1257
 
1277
1258
  add(Math.trunc(parsed.days / 365), 'year', 'y');
@@ -1309,7 +1290,7 @@ var prettyMs = (milliseconds, options = {}) => {
1309
1290
  roundedMiliseconds;
1310
1291
 
1311
1292
  add(
1312
- parseFloat(millisecondsString, 10),
1293
+ Number.parseFloat(millisecondsString, 10),
1313
1294
  'millisecond',
1314
1295
  'ms',
1315
1296
  millisecondsString
@@ -1321,11 +1302,11 @@ var prettyMs = (milliseconds, options = {}) => {
1321
1302
  typeof options.secondsDecimalDigits === 'number' ?
1322
1303
  options.secondsDecimalDigits :
1323
1304
  1;
1324
- const secondsFixed = seconds.toFixed(secondsDecimalDigits);
1305
+ const secondsFixed = floorDecimals(seconds, secondsDecimalDigits);
1325
1306
  const secondsString = options.keepDecimalsOnWholeSeconds ?
1326
1307
  secondsFixed :
1327
1308
  secondsFixed.replace(/\.0+$/, '');
1328
- add(parseFloat(secondsString, 10), 'second', 's', secondsString);
1309
+ add(Number.parseFloat(secondsString, 10), 'second', 's', secondsString);
1329
1310
  }
1330
1311
 
1331
1312
  if (result.length === 0) {
@@ -1425,7 +1406,7 @@ var prettyBytes = (number, options) => {
1425
1406
 
1426
1407
  function printTimings(timings) {
1427
1408
  Object.keys(timings).forEach(label => {
1428
- const appliedColor = label[0] === '#' ? (label[1] !== '#' ? loadConfigFile_js.color.underline : loadConfigFile_js.color.bold) : (text) => text;
1409
+ const appliedColor = label[0] === '#' ? (label[1] !== '#' ? loadConfigFile_js.colorette.underline : loadConfigFile_js.colorette.bold) : (text) => text;
1429
1410
  const [time, memory, total] = timings[label];
1430
1411
  const row = `${label}: ${time.toFixed(0)}ms, ${prettyBytes(memory)} / ${prettyBytes(total)}`;
1431
1412
  console.info(appliedColor(row));
@@ -1450,7 +1431,7 @@ async function build(inputOptions, warnings, silent = false) {
1450
1431
  .map((name) => inputOptions.input[name])
1451
1432
  .join(', ');
1452
1433
  }
1453
- loadConfigFile_js.stderr(loadConfigFile_js.color.cyan(`\n${loadConfigFile_js.color.bold(inputFiles)} → ${loadConfigFile_js.color.bold(files.join(', '))}...`));
1434
+ loadConfigFile_js.stderr(loadConfigFile_js.colorette.cyan(`\n${loadConfigFile_js.colorette.bold(inputFiles)} → ${loadConfigFile_js.colorette.bold(files.join(', '))}...`));
1454
1435
  }
1455
1436
  const bundle = await rollup_js.rollup(inputOptions);
1456
1437
  if (useStdout) {
@@ -1474,7 +1455,7 @@ async function build(inputOptions, warnings, silent = false) {
1474
1455
  }
1475
1456
  }
1476
1457
  if (outputs.length > 1)
1477
- process.stdout.write(`\n${loadConfigFile_js.color.cyan(loadConfigFile_js.color.bold(`//→ ${file.fileName}:`))}\n`);
1458
+ process.stdout.write(`\n${loadConfigFile_js.colorette.cyan(loadConfigFile_js.colorette.bold(`//→ ${file.fileName}:`))}\n`);
1478
1459
  process.stdout.write(source);
1479
1460
  }
1480
1461
  if (!silent) {
@@ -1485,7 +1466,7 @@ async function build(inputOptions, warnings, silent = false) {
1485
1466
  await Promise.all(outputOptions.map(bundle.write));
1486
1467
  if (!silent) {
1487
1468
  warnings.flush();
1488
- loadConfigFile_js.stderr(loadConfigFile_js.color.green(`created ${loadConfigFile_js.color.bold(files.join(', '))} in ${loadConfigFile_js.color.bold(prettyMs(Date.now() - start))}`));
1469
+ loadConfigFile_js.stderr(loadConfigFile_js.colorette.green(`created ${loadConfigFile_js.colorette.bold(files.join(', '))} in ${loadConfigFile_js.colorette.bold(prettyMs(Date.now() - start))}`));
1489
1470
  if (bundle && bundle.getTimings) {
1490
1471
  printTimings(bundle.getTimings());
1491
1472
  }
@@ -1495,8 +1476,8 @@ async function build(inputOptions, warnings, silent = false) {
1495
1476
  var modules = {};
1496
1477
 
1497
1478
  var getModule = function(dir) {
1498
- var rootPath = dir ? _util_commonjsExternal.sysPath.resolve(dir) : process.cwd();
1499
- var rootName = _util_commonjsExternal.sysPath.join(rootPath, '@root');
1479
+ var rootPath = dir ? path.resolve(dir) : process.cwd();
1480
+ var rootName = path.join(rootPath, '@root');
1500
1481
  var root = modules[rootName];
1501
1482
  if (!root) {
1502
1483
  root = new module$1(rootName);
@@ -1670,6 +1651,6 @@ else {
1670
1651
 
1671
1652
  exports.getConfigPath = getConfigPath;
1672
1653
  exports.loadConfigFromCommand = loadConfigFromCommand;
1673
- exports.ms = prettyMs;
1654
+ exports.prettyMs = prettyMs;
1674
1655
  exports.printTimings = printTimings;
1675
1656
  //# sourceMappingURL=rollup.map