rollup 2.7.5 → 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,14 @@
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
+
3
12
  ## 2.7.5
4
13
  *2020-04-29*
5
14
 
package/dist/bin/rollup CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  /*
4
4
  @license
5
- Rollup.js v2.7.5
6
- Wed, 29 Apr 2020 19:48:24 GMT - commit a2b48832de11ad38eacfeacad08ba4dfceecfe96
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
@@ -1204,6 +1204,8 @@ var parseMs = milliseconds => {
1204
1204
 
1205
1205
  const pluralize = (word, count) => count === 1 ? word : `${word}s`;
1206
1206
 
1207
+ const SECOND_ROUNDING_EPSILON = 0.0000001;
1208
+
1207
1209
  var prettyMs = (milliseconds, options = {}) => {
1208
1210
  if (!Number.isFinite(milliseconds)) {
1209
1211
  throw new TypeError('Expected a finite number');
@@ -1223,6 +1225,12 @@ var prettyMs = (milliseconds, options = {}) => {
1223
1225
 
1224
1226
  const result = [];
1225
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
+
1226
1234
  const add = (value, long, short, valueString) => {
1227
1235
  if ((result.length === 0 || !options.colonNotation) && value === 0 && !(options.colonNotation && short === 'm')) {
1228
1236
  return;
@@ -1245,32 +1253,6 @@ var prettyMs = (milliseconds, options = {}) => {
1245
1253
  result.push(prefix + valueString + suffix);
1246
1254
  };
1247
1255
 
1248
- const secondsDecimalDigits =
1249
- typeof options.secondsDecimalDigits === 'number' ?
1250
- options.secondsDecimalDigits :
1251
- 1;
1252
-
1253
- if (secondsDecimalDigits < 1) {
1254
- const difference = 1000 - (milliseconds % 1000);
1255
- if (difference < 500) {
1256
- milliseconds += difference;
1257
- }
1258
- }
1259
-
1260
- // Round up milliseconds for values lager than 1 minute - 50ms since these
1261
- // always need to be round up. This fixes issues when rounding seconds
1262
- // independently of minutes later on.
1263
- if (
1264
- milliseconds >= (1000 * 60) - 50 &&
1265
- !options.separateMilliseconds &&
1266
- !options.formatSubMilliseconds
1267
- ) {
1268
- const difference = 60 - (milliseconds % 60);
1269
- if (difference <= 50) {
1270
- milliseconds += difference;
1271
- }
1272
- }
1273
-
1274
1256
  const parsed = parseMs(milliseconds);
1275
1257
 
1276
1258
  add(Math.trunc(parsed.days / 365), 'year', 'y');
@@ -1308,7 +1290,7 @@ var prettyMs = (milliseconds, options = {}) => {
1308
1290
  roundedMiliseconds;
1309
1291
 
1310
1292
  add(
1311
- parseFloat(millisecondsString, 10),
1293
+ Number.parseFloat(millisecondsString, 10),
1312
1294
  'millisecond',
1313
1295
  'ms',
1314
1296
  millisecondsString
@@ -1320,11 +1302,11 @@ var prettyMs = (milliseconds, options = {}) => {
1320
1302
  typeof options.secondsDecimalDigits === 'number' ?
1321
1303
  options.secondsDecimalDigits :
1322
1304
  1;
1323
- const secondsFixed = seconds.toFixed(secondsDecimalDigits);
1305
+ const secondsFixed = floorDecimals(seconds, secondsDecimalDigits);
1324
1306
  const secondsString = options.keepDecimalsOnWholeSeconds ?
1325
1307
  secondsFixed :
1326
1308
  secondsFixed.replace(/\.0+$/, '');
1327
- add(parseFloat(secondsString, 10), 'second', 's', secondsString);
1309
+ add(Number.parseFloat(secondsString, 10), 'second', 's', secondsString);
1328
1310
  }
1329
1311
 
1330
1312
  if (result.length === 0) {