rollup 3.7.5-0 → 3.7.5

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/dist/bin/rollup CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  /*
4
4
  @license
5
- Rollup.js v3.7.5-0
6
- Fri, 16 Dec 2022 10:54:15 GMT - commit 1ee5d10583f88926dc36b97e7b3870ee078327e2
5
+ Rollup.js v3.7.5
6
+ Sat, 17 Dec 2022 05:47:48 GMT - commit 5613b96ac5f32a881ed50a275398e140fbf6ba2b
7
7
 
8
8
  https://github.com/rollup/rollup
9
9
 
@@ -1388,10 +1388,130 @@ function prettyMilliseconds(milliseconds, options = {}) {
1388
1388
  return options.colonNotation ? result.join('') : result.join(' ');
1389
1389
  }
1390
1390
 
1391
+ const BYTE_UNITS = [
1392
+ 'B',
1393
+ 'kB',
1394
+ 'MB',
1395
+ 'GB',
1396
+ 'TB',
1397
+ 'PB',
1398
+ 'EB',
1399
+ 'ZB',
1400
+ 'YB',
1401
+ ];
1402
+
1403
+ const BIBYTE_UNITS = [
1404
+ 'B',
1405
+ 'kiB',
1406
+ 'MiB',
1407
+ 'GiB',
1408
+ 'TiB',
1409
+ 'PiB',
1410
+ 'EiB',
1411
+ 'ZiB',
1412
+ 'YiB',
1413
+ ];
1414
+
1415
+ const BIT_UNITS = [
1416
+ 'b',
1417
+ 'kbit',
1418
+ 'Mbit',
1419
+ 'Gbit',
1420
+ 'Tbit',
1421
+ 'Pbit',
1422
+ 'Ebit',
1423
+ 'Zbit',
1424
+ 'Ybit',
1425
+ ];
1426
+
1427
+ const BIBIT_UNITS = [
1428
+ 'b',
1429
+ 'kibit',
1430
+ 'Mibit',
1431
+ 'Gibit',
1432
+ 'Tibit',
1433
+ 'Pibit',
1434
+ 'Eibit',
1435
+ 'Zibit',
1436
+ 'Yibit',
1437
+ ];
1438
+
1439
+ /*
1440
+ Formats the given number using `Number#toLocaleString`.
1441
+ - If locale is a string, the value is expected to be a locale-key (for example: `de`).
1442
+ - If locale is true, the system default locale is used for translation.
1443
+ - If no value for locale is specified, the number is returned unmodified.
1444
+ */
1445
+ const toLocaleString = (number, locale, options) => {
1446
+ let result = number;
1447
+ if (typeof locale === 'string' || Array.isArray(locale)) {
1448
+ result = number.toLocaleString(locale, options);
1449
+ } else if (locale === true || options !== undefined) {
1450
+ result = number.toLocaleString(undefined, options);
1451
+ }
1452
+
1453
+ return result;
1454
+ };
1455
+
1456
+ function prettyBytes(number, options) {
1457
+ if (!Number.isFinite(number)) {
1458
+ throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
1459
+ }
1460
+
1461
+ options = {
1462
+ bits: false,
1463
+ binary: false,
1464
+ ...options,
1465
+ };
1466
+
1467
+ const UNITS = options.bits
1468
+ ? (options.binary ? BIBIT_UNITS : BIT_UNITS)
1469
+ : (options.binary ? BIBYTE_UNITS : BYTE_UNITS);
1470
+
1471
+ if (options.signed && number === 0) {
1472
+ return ` 0 ${UNITS[0]}`;
1473
+ }
1474
+
1475
+ const isNegative = number < 0;
1476
+ const prefix = isNegative ? '-' : (options.signed ? '+' : '');
1477
+
1478
+ if (isNegative) {
1479
+ number = -number;
1480
+ }
1481
+
1482
+ let localeOptions;
1483
+
1484
+ if (options.minimumFractionDigits !== undefined) {
1485
+ localeOptions = {minimumFractionDigits: options.minimumFractionDigits};
1486
+ }
1487
+
1488
+ if (options.maximumFractionDigits !== undefined) {
1489
+ localeOptions = {maximumFractionDigits: options.maximumFractionDigits, ...localeOptions};
1490
+ }
1491
+
1492
+ if (number < 1) {
1493
+ const numberString = toLocaleString(number, options.locale, localeOptions);
1494
+ return prefix + numberString + ' ' + UNITS[0];
1495
+ }
1496
+
1497
+ const exponent = Math.min(Math.floor(options.binary ? Math.log(number) / Math.log(1024) : Math.log10(number) / 3), UNITS.length - 1);
1498
+ number /= (options.binary ? 1024 : 1000) ** exponent;
1499
+
1500
+ if (!localeOptions) {
1501
+ number = number.toPrecision(3);
1502
+ }
1503
+
1504
+ const numberString = toLocaleString(Number(number), options.locale, localeOptions);
1505
+
1506
+ const unit = UNITS[exponent];
1507
+
1508
+ return prefix + numberString + ' ' + unit;
1509
+ }
1510
+
1391
1511
  function printTimings(timings) {
1392
1512
  for (const [label, [time, memory, total]] of Object.entries(timings)) {
1393
1513
  const appliedColor = label[0] === '#' ? (label[1] !== '#' ? rollup.underline : rollup.bold) : (text) => text;
1394
- const row = `${label}: ${time.toFixed(0)}ms, ${rollup.prettyBytes(memory)} / ${rollup.prettyBytes(total)}`;
1514
+ const row = `${label}: ${time.toFixed(0)}ms, ${prettyBytes(memory)} / ${prettyBytes(total)}`;
1395
1515
  console.info(appliedColor(row));
1396
1516
  }
1397
1517
  }
package/dist/es/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.7.5-0
4
- Fri, 16 Dec 2022 10:54:15 GMT - commit 1ee5d10583f88926dc36b97e7b3870ee078327e2
3
+ Rollup.js v3.7.5
4
+ Sat, 17 Dec 2022 05:47:48 GMT - commit 5613b96ac5f32a881ed50a275398e140fbf6ba2b
5
5
 
6
6
  https://github.com/rollup/rollup
7
7