rollup 2.77.0 → 3.0.0-2
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 +31 -2
- package/dist/bin/rollup +78 -72
- package/dist/es/rollup.browser.js +3 -3
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/rollup.js +1603 -1556
- package/dist/es/shared/watch.js +2 -2
- package/dist/loadConfigFile.js +5 -4
- 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 +126 -12
- package/dist/shared/mergeOptions.js +2 -2
- package/dist/shared/rollup.js +1542 -1495
- package/dist/shared/watch-cli.js +3 -3
- package/dist/shared/watch.js +2 -2
- package/package.json +13 -12
- package/CHANGELOG.md +0 -6671
package/LICENSE.md
CHANGED
|
@@ -240,6 +240,35 @@ Repository: jonschlinkert/fill-range
|
|
|
240
240
|
|
|
241
241
|
---------------------------------------
|
|
242
242
|
|
|
243
|
+
## get-package-type
|
|
244
|
+
License: MIT
|
|
245
|
+
By: Corey Farrell
|
|
246
|
+
Repository: git+https://github.com/cfware/get-package-type.git
|
|
247
|
+
|
|
248
|
+
> MIT License
|
|
249
|
+
>
|
|
250
|
+
> Copyright (c) 2020 CFWare, LLC
|
|
251
|
+
>
|
|
252
|
+
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
253
|
+
> of this software and associated documentation files (the "Software"), to deal
|
|
254
|
+
> in the Software without restriction, including without limitation the rights
|
|
255
|
+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
256
|
+
> copies of the Software, and to permit persons to whom the Software is
|
|
257
|
+
> furnished to do so, subject to the following conditions:
|
|
258
|
+
>
|
|
259
|
+
> The above copyright notice and this permission notice shall be included in all
|
|
260
|
+
> copies or substantial portions of the Software.
|
|
261
|
+
>
|
|
262
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
263
|
+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
264
|
+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
265
|
+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
266
|
+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
267
|
+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
268
|
+
> SOFTWARE.
|
|
269
|
+
|
|
270
|
+
---------------------------------------
|
|
271
|
+
|
|
243
272
|
## glob-parent
|
|
244
273
|
License: ISC
|
|
245
274
|
By: Gulp Team, Elan Shanker, Blaine Bublitz
|
|
@@ -481,7 +510,7 @@ Repository: sindresorhus/parse-ms
|
|
|
481
510
|
|
|
482
511
|
> MIT License
|
|
483
512
|
>
|
|
484
|
-
> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
|
513
|
+
> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
485
514
|
>
|
|
486
515
|
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
487
516
|
>
|
|
@@ -544,7 +573,7 @@ Repository: sindresorhus/pretty-ms
|
|
|
544
573
|
|
|
545
574
|
> MIT License
|
|
546
575
|
>
|
|
547
|
-
> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
|
576
|
+
> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
548
577
|
>
|
|
549
578
|
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
550
579
|
>
|
package/dist/bin/rollup
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
@license
|
|
5
|
-
Rollup.js
|
|
6
|
-
Fri, 15 Jul 2022
|
|
5
|
+
Rollup.js v3.0.0-2
|
|
6
|
+
Fri, 15 Jul 2022 15:25:15 GMT - commit 13b0ef8778ca5ccfd54b113ef545bf235a4c7e34
|
|
7
7
|
|
|
8
8
|
https://github.com/rollup/rollup
|
|
9
9
|
|
|
@@ -16,8 +16,8 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
16
16
|
const process$1 = require('process');
|
|
17
17
|
const rollup = require('../shared/rollup.js');
|
|
18
18
|
const require$$2 = require('util');
|
|
19
|
-
const require$$0$1 = require('fs');
|
|
20
19
|
const require$$0 = require('path');
|
|
20
|
+
const require$$0$1 = require('fs');
|
|
21
21
|
const mergeOptions = require('../shared/mergeOptions.js');
|
|
22
22
|
const loadConfigFile_js = require('../shared/loadConfigFile.js');
|
|
23
23
|
require('perf_hooks');
|
|
@@ -26,7 +26,7 @@ require('events');
|
|
|
26
26
|
require('url');
|
|
27
27
|
require('tty');
|
|
28
28
|
|
|
29
|
-
const help = "rollup version __VERSION__\n=====================================\n\nUsage: rollup [options] <entry file>\n\nBasic options:\n\n-c, --config <filename> Use this config file (if argument is used but value\n is unspecified, defaults to rollup.config.js)\n-d, --dir <dirname> Directory for chunks (if absent, prints to stdout)\n-e, --external <ids> Comma-separate list of module IDs to exclude\n-f, --format <format> Type of output (amd, cjs, es, iife, umd, system)\n-g, --globals <pairs> Comma-separate list of `moduleID:Global` pairs\n-h, --help Show this help message\n-i, --input <filename> Input (alternative to <entry file>)\n-m, --sourcemap Generate sourcemap (`-m inline` for inline map)\n-n, --name <name> Name for UMD export\n-o, --file <output> Single output file (if absent, prints to stdout)\n-p, --plugin <plugin> Use the plugin specified (may be repeated)\n-v, --version Show version number\n-w, --watch Watch files in bundle and rebuild on changes\n--amd.id <id> ID for AMD module (default is anonymous)\n--amd.autoId Generate the AMD ID based off the chunk name\n--amd.basePath <prefix> Path to prepend to auto generated AMD ID\n--amd.define <name> Function to use in place of `define`\n--assetFileNames <pattern> Name pattern for emitted assets\n--banner <text> Code to insert at top of bundle (outside wrapper)\n--chunkFileNames <pattern> Name pattern for emitted secondary chunks\n--compact Minify wrapper code\n--context <variable> Specify top-level `this` value\n--entryFileNames <pattern> Name pattern for emitted entry chunks\n--environment <values> Settings passed to config file (see example)\n--no-esModule Do not add __esModule property\n--exports <mode> Specify export mode (auto, default, named, none)\n--extend Extend global variable defined by --name\n--no-externalLiveBindings Do not generate code to support live bindings\n--failAfterWarnings Exit with an error if the build produced warnings\n--footer <text> Code to insert at end of bundle (outside wrapper)\n--no-freeze Do not freeze namespace objects\n--no-hoistTransitiveImports Do not hoist transitive imports into entry chunks\n--no-indent Don't indent result\n--no-interop Do not include interop block\n--inlineDynamicImports Create single bundle when using dynamic imports\n--intro <text> Code to insert at top of bundle (inside wrapper)\n--minifyInternalExports Force or disable minification of internal exports\n--
|
|
29
|
+
const help = "rollup version __VERSION__\n=====================================\n\nUsage: rollup [options] <entry file>\n\nBasic options:\n\n-c, --config <filename> Use this config file (if argument is used but value\n is unspecified, defaults to rollup.config.js)\n-d, --dir <dirname> Directory for chunks (if absent, prints to stdout)\n-e, --external <ids> Comma-separate list of module IDs to exclude\n-f, --format <format> Type of output (amd, cjs, es, iife, umd, system)\n-g, --globals <pairs> Comma-separate list of `moduleID:Global` pairs\n-h, --help Show this help message\n-i, --input <filename> Input (alternative to <entry file>)\n-m, --sourcemap Generate sourcemap (`-m inline` for inline map)\n-n, --name <name> Name for UMD export\n-o, --file <output> Single output file (if absent, prints to stdout)\n-p, --plugin <plugin> Use the plugin specified (may be repeated)\n-v, --version Show version number\n-w, --watch Watch files in bundle and rebuild on changes\n--amd.id <id> ID for AMD module (default is anonymous)\n--amd.autoId Generate the AMD ID based off the chunk name\n--amd.basePath <prefix> Path to prepend to auto generated AMD ID\n--amd.define <name> Function to use in place of `define`\n--assetFileNames <pattern> Name pattern for emitted assets\n--banner <text> Code to insert at top of bundle (outside wrapper)\n--chunkFileNames <pattern> Name pattern for emitted secondary chunks\n--compact Minify wrapper code\n--context <variable> Specify top-level `this` value\n--entryFileNames <pattern> Name pattern for emitted entry chunks\n--environment <values> Settings passed to config file (see example)\n--no-esModule Do not add __esModule property\n--exports <mode> Specify export mode (auto, default, named, none)\n--extend Extend global variable defined by --name\n--no-externalLiveBindings Do not generate code to support live bindings\n--failAfterWarnings Exit with an error if the build produced warnings\n--footer <text> Code to insert at end of bundle (outside wrapper)\n--no-freeze Do not freeze namespace objects\n--generatedCode <preset> Which code features to use (es5/es2015)\n--no-hoistTransitiveImports Do not hoist transitive imports into entry chunks\n--no-indent Don't indent result\n--no-interop Do not include interop block\n--inlineDynamicImports Create single bundle when using dynamic imports\n--intro <text> Code to insert at top of bundle (inside wrapper)\n--no-makeAbsoluteExternalsRelative Prevent normalization of external imports\n--maxParallelFileReads <value> How many files to read in parallel\n--minifyInternalExports Force or disable minification of internal exports\n--noConflict Generate a noConflict method for UMD globals\n--outro <text> Code to insert at end of bundle (inside wrapper)\n--perf Display performance timings\n--no-preserveEntrySignatures Avoid facade chunks for entry points\n--preserveModules Preserve module structure\n--preserveModulesRoot Put preserved modules under this path at root level\n--preserveSymlinks Do not follow symlinks when resolving files\n--no-sanitizeFileName Do not replace invalid characters in file names\n--shimMissingExports Create shim variables for missing exports\n--silent Don't print warnings\n--sourcemapBaseUrl <url> Emit absolute sourcemap URLs with given base\n--sourcemapExcludeSources Do not include source code in source maps\n--sourcemapFile <file> Specify bundle position for source maps\n--stdin=ext Specify file extension used for stdin input\n--no-stdin Do not read \"-\" from stdin\n--no-strict Don't emit `\"use strict\";` in the generated modules\n--strictDeprecations Throw errors for deprecated features\n--systemNullSetters Replace empty SystemJS setters with `null`\n--no-treeshake Disable tree-shaking optimisations\n--no-treeshake.annotations Ignore pure call annotations\n--no-treeshake.moduleSideEffects Assume modules have no side-effects\n--no-treeshake.propertyReadSideEffects Ignore property access side-effects\n--no-treeshake.tryCatchDeoptimization Do not turn off try-catch-tree-shaking\n--no-treeshake.unknownGlobalSideEffects Assume unknown globals do not throw\n--waitForBundleInput Wait for bundle input files\n--watch.buildDelay <number> Throttle watch rebuilds\n--no-watch.clearScreen Do not clear the screen when rebuilding\n--watch.skipWrite Do not write files to disk when watching\n--watch.exclude <files> Exclude files from being watched\n--watch.include <files> Limit watching to specified files\n--watch.onStart <cmd> Shell command to run on `\"START\"` event\n--watch.onBundleStart <cmd> Shell command to run on `\"BUNDLE_START\"` event\n--watch.onBundleEnd <cmd> Shell command to run on `\"BUNDLE_END\"` event\n--watch.onEnd <cmd> Shell command to run on `\"END\"` event\n--watch.onError <cmd> Shell command to run on `\"ERROR\"` event\n--validate Validate output\n\nExamples:\n\n# use settings in config file\nrollup -c\n\n# in config file, process.env.INCLUDE_DEPS === 'true'\n# and process.env.BUILD === 'production'\nrollup -c --environment INCLUDE_DEPS,BUILD:production\n\n# create CommonJS bundle.js from src/main.js\nrollup --format=cjs --file=bundle.js -- src/main.js\n\n# create self-executing IIFE using `window.jQuery`\n# and `window._` as external globals\nrollup -f iife --globals jquery:jQuery,lodash:_ \\\n -i src/app.js -o build/app.js -m build/app.js.map\n\nNotes:\n\n* When piping to stdout, only inline sourcemaps are permitted\n\nFor more information visit https://rollupjs.org\n";
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* @license
|
|
@@ -180,6 +180,9 @@ class YargsParser {
|
|
|
180
180
|
// allow a string argument to be passed in rather
|
|
181
181
|
// than an argv array.
|
|
182
182
|
const args = tokenizeArgString(argsInput);
|
|
183
|
+
// tokenizeArgString adds extra quotes to args if argsInput is a string
|
|
184
|
+
// only strip those extra quotes in processValue if argsInput is a string
|
|
185
|
+
const inputIsString = typeof argsInput === 'string';
|
|
183
186
|
// aliases might have transitive relationships, normalize this.
|
|
184
187
|
const aliases = combineAliases(Object.assign(Object.create(null), opts.alias));
|
|
185
188
|
const configuration = Object.assign({
|
|
@@ -346,7 +349,7 @@ class YargsParser {
|
|
|
346
349
|
i = eatNargs(i, m[1], args, m[2]);
|
|
347
350
|
}
|
|
348
351
|
else {
|
|
349
|
-
setArg(m[1], m[2]);
|
|
352
|
+
setArg(m[1], m[2], true);
|
|
350
353
|
}
|
|
351
354
|
}
|
|
352
355
|
}
|
|
@@ -619,7 +622,7 @@ class YargsParser {
|
|
|
619
622
|
else {
|
|
620
623
|
// value in --option=value is eaten as is
|
|
621
624
|
if (!isUndefined(argAfterEqualSign)) {
|
|
622
|
-
argsToSet.push(processValue(key, argAfterEqualSign));
|
|
625
|
+
argsToSet.push(processValue(key, argAfterEqualSign, true));
|
|
623
626
|
}
|
|
624
627
|
for (let ii = i + 1; ii < args.length; ii++) {
|
|
625
628
|
if ((!configuration['greedy-arrays'] && argsToSet.length > 0) ||
|
|
@@ -629,7 +632,7 @@ class YargsParser {
|
|
|
629
632
|
if (/^-/.test(next) && !negative.test(next) && !isUnknownOptionAsArg(next))
|
|
630
633
|
break;
|
|
631
634
|
i = ii;
|
|
632
|
-
argsToSet.push(processValue(key, next));
|
|
635
|
+
argsToSet.push(processValue(key, next, inputIsString));
|
|
633
636
|
}
|
|
634
637
|
}
|
|
635
638
|
// If both array and nargs are configured, create an error if less than
|
|
@@ -642,14 +645,14 @@ class YargsParser {
|
|
|
642
645
|
setArg(key, argsToSet);
|
|
643
646
|
return i;
|
|
644
647
|
}
|
|
645
|
-
function setArg(key, val) {
|
|
648
|
+
function setArg(key, val, shouldStripQuotes = inputIsString) {
|
|
646
649
|
if (/-/.test(key) && configuration['camel-case-expansion']) {
|
|
647
650
|
const alias = key.split('.').map(function (prop) {
|
|
648
651
|
return camelCase(prop);
|
|
649
652
|
}).join('.');
|
|
650
653
|
addNewAlias(key, alias);
|
|
651
654
|
}
|
|
652
|
-
const value = processValue(key, val);
|
|
655
|
+
const value = processValue(key, val, shouldStripQuotes);
|
|
653
656
|
const splitKey = key.split('.');
|
|
654
657
|
setKey(argv, splitKey, value);
|
|
655
658
|
// handle populating aliases of the full key
|
|
@@ -699,12 +702,10 @@ class YargsParser {
|
|
|
699
702
|
addNewAlias(alias, key);
|
|
700
703
|
}
|
|
701
704
|
}
|
|
702
|
-
function processValue(key, val) {
|
|
705
|
+
function processValue(key, val, shouldStripQuotes) {
|
|
703
706
|
// strings may be quoted, clean this up as we assign values.
|
|
704
|
-
if (
|
|
705
|
-
|
|
706
|
-
val[val.length - 1] === val[0]) {
|
|
707
|
-
val = val.substring(1, val.length - 1);
|
|
707
|
+
if (shouldStripQuotes) {
|
|
708
|
+
val = stripQuotes(val);
|
|
708
709
|
}
|
|
709
710
|
// handle parsing boolean arguments --foo=true --bar false.
|
|
710
711
|
if (checkAllAliases(key, flags.bools) || checkAllAliases(key, flags.counts)) {
|
|
@@ -1179,6 +1180,13 @@ function sanitizeKey(key) {
|
|
|
1179
1180
|
return '___proto___';
|
|
1180
1181
|
return key;
|
|
1181
1182
|
}
|
|
1183
|
+
function stripQuotes(val) {
|
|
1184
|
+
return (typeof val === 'string' &&
|
|
1185
|
+
(val[0] === "'" || val[0] === '"') &&
|
|
1186
|
+
val[val.length - 1] === val[0])
|
|
1187
|
+
? val.substring(1, val.length - 1)
|
|
1188
|
+
: val;
|
|
1189
|
+
}
|
|
1182
1190
|
|
|
1183
1191
|
/**
|
|
1184
1192
|
* @fileoverview Main entrypoint for libraries using yargs-parser in Node.js
|
|
@@ -1192,7 +1200,7 @@ function sanitizeKey(key) {
|
|
|
1192
1200
|
// version support policy. The YARGS_MIN_NODE_VERSION is used for testing only.
|
|
1193
1201
|
const minNodeVersion = (process && process.env && process.env.YARGS_MIN_NODE_VERSION)
|
|
1194
1202
|
? Number(process.env.YARGS_MIN_NODE_VERSION)
|
|
1195
|
-
:
|
|
1203
|
+
: 12;
|
|
1196
1204
|
if (process && process.version) {
|
|
1197
1205
|
const major = Number(process.version.match(/v([^.]+)/)[1]);
|
|
1198
1206
|
if (major < minNodeVersion) {
|
|
@@ -1216,7 +1224,8 @@ const parser = new YargsParser({
|
|
|
1216
1224
|
return require(path);
|
|
1217
1225
|
}
|
|
1218
1226
|
else if (path.match(/\.json$/)) {
|
|
1219
|
-
|
|
1227
|
+
// Addresses: https://github.com/yargs/yargs/issues/2040
|
|
1228
|
+
return JSON.parse(require$$0$1.readFileSync(path, 'utf8'));
|
|
1220
1229
|
}
|
|
1221
1230
|
else {
|
|
1222
1231
|
throw Error('only .json config files are supported in ESM');
|
|
@@ -1235,7 +1244,7 @@ yargsParser.decamelize = decamelize;
|
|
|
1235
1244
|
yargsParser.looksLikeNumber = looksLikeNumber;
|
|
1236
1245
|
const argParser = yargsParser;
|
|
1237
1246
|
|
|
1238
|
-
|
|
1247
|
+
function parseMilliseconds(milliseconds) {
|
|
1239
1248
|
if (typeof milliseconds !== 'number') {
|
|
1240
1249
|
throw new TypeError('Expected a number');
|
|
1241
1250
|
}
|
|
@@ -1251,15 +1260,13 @@ var parseMs = milliseconds => {
|
|
|
1251
1260
|
microseconds: roundTowardsZero(milliseconds * 1000) % 1000,
|
|
1252
1261
|
nanoseconds: roundTowardsZero(milliseconds * 1e6) % 1000
|
|
1253
1262
|
};
|
|
1254
|
-
}
|
|
1255
|
-
|
|
1256
|
-
const parseMilliseconds = parseMs;
|
|
1263
|
+
}
|
|
1257
1264
|
|
|
1258
1265
|
const pluralize = (word, count) => count === 1 ? word : `${word}s`;
|
|
1259
1266
|
|
|
1260
|
-
const SECOND_ROUNDING_EPSILON = 0.
|
|
1267
|
+
const SECOND_ROUNDING_EPSILON = 0.000_000_1;
|
|
1261
1268
|
|
|
1262
|
-
|
|
1269
|
+
function prettyMilliseconds(milliseconds, options = {}) {
|
|
1263
1270
|
if (!Number.isFinite(milliseconds)) {
|
|
1264
1271
|
throw new TypeError('Expected a finite number');
|
|
1265
1272
|
}
|
|
@@ -1314,9 +1321,9 @@ var prettyMs = (milliseconds, options = {}) => {
|
|
|
1314
1321
|
add(parsed.minutes, 'minute', 'm');
|
|
1315
1322
|
|
|
1316
1323
|
if (
|
|
1317
|
-
options.separateMilliseconds
|
|
1318
|
-
options.formatSubMilliseconds
|
|
1319
|
-
(!options.colonNotation && milliseconds < 1000)
|
|
1324
|
+
options.separateMilliseconds
|
|
1325
|
+
|| options.formatSubMilliseconds
|
|
1326
|
+
|| (!options.colonNotation && milliseconds < 1000)
|
|
1320
1327
|
) {
|
|
1321
1328
|
add(parsed.seconds, 'second', 's');
|
|
1322
1329
|
if (options.formatSubMilliseconds) {
|
|
@@ -1324,42 +1331,42 @@ var prettyMs = (milliseconds, options = {}) => {
|
|
|
1324
1331
|
add(parsed.microseconds, 'microsecond', 'µs');
|
|
1325
1332
|
add(parsed.nanoseconds, 'nanosecond', 'ns');
|
|
1326
1333
|
} else {
|
|
1327
|
-
const millisecondsAndBelow
|
|
1328
|
-
parsed.milliseconds
|
|
1329
|
-
(parsed.microseconds / 1000)
|
|
1330
|
-
(parsed.nanoseconds / 1e6);
|
|
1334
|
+
const millisecondsAndBelow
|
|
1335
|
+
= parsed.milliseconds
|
|
1336
|
+
+ (parsed.microseconds / 1000)
|
|
1337
|
+
+ (parsed.nanoseconds / 1e6);
|
|
1331
1338
|
|
|
1332
|
-
const millisecondsDecimalDigits
|
|
1333
|
-
typeof options.millisecondsDecimalDigits === 'number'
|
|
1334
|
-
options.millisecondsDecimalDigits
|
|
1335
|
-
0;
|
|
1339
|
+
const millisecondsDecimalDigits
|
|
1340
|
+
= typeof options.millisecondsDecimalDigits === 'number'
|
|
1341
|
+
? options.millisecondsDecimalDigits
|
|
1342
|
+
: 0;
|
|
1336
1343
|
|
|
1337
|
-
const roundedMiliseconds = millisecondsAndBelow >= 1
|
|
1338
|
-
Math.round(millisecondsAndBelow)
|
|
1339
|
-
Math.ceil(millisecondsAndBelow);
|
|
1344
|
+
const roundedMiliseconds = millisecondsAndBelow >= 1
|
|
1345
|
+
? Math.round(millisecondsAndBelow)
|
|
1346
|
+
: Math.ceil(millisecondsAndBelow);
|
|
1340
1347
|
|
|
1341
|
-
const millisecondsString = millisecondsDecimalDigits
|
|
1342
|
-
millisecondsAndBelow.toFixed(millisecondsDecimalDigits)
|
|
1343
|
-
roundedMiliseconds;
|
|
1348
|
+
const millisecondsString = millisecondsDecimalDigits
|
|
1349
|
+
? millisecondsAndBelow.toFixed(millisecondsDecimalDigits)
|
|
1350
|
+
: roundedMiliseconds;
|
|
1344
1351
|
|
|
1345
1352
|
add(
|
|
1346
|
-
Number.parseFloat(millisecondsString
|
|
1353
|
+
Number.parseFloat(millisecondsString),
|
|
1347
1354
|
'millisecond',
|
|
1348
1355
|
'ms',
|
|
1349
|
-
millisecondsString
|
|
1356
|
+
millisecondsString,
|
|
1350
1357
|
);
|
|
1351
1358
|
}
|
|
1352
1359
|
} else {
|
|
1353
1360
|
const seconds = (milliseconds / 1000) % 60;
|
|
1354
|
-
const secondsDecimalDigits
|
|
1355
|
-
typeof options.secondsDecimalDigits === 'number'
|
|
1356
|
-
options.secondsDecimalDigits
|
|
1357
|
-
1;
|
|
1361
|
+
const secondsDecimalDigits
|
|
1362
|
+
= typeof options.secondsDecimalDigits === 'number'
|
|
1363
|
+
? options.secondsDecimalDigits
|
|
1364
|
+
: 1;
|
|
1358
1365
|
const secondsFixed = floorDecimals(seconds, secondsDecimalDigits);
|
|
1359
|
-
const secondsString = options.keepDecimalsOnWholeSeconds
|
|
1360
|
-
secondsFixed
|
|
1361
|
-
secondsFixed.replace(/\.0+$/, '');
|
|
1362
|
-
add(Number.parseFloat(secondsString
|
|
1366
|
+
const secondsString = options.keepDecimalsOnWholeSeconds
|
|
1367
|
+
? secondsFixed
|
|
1368
|
+
: secondsFixed.replace(/\.0+$/, '');
|
|
1369
|
+
add(Number.parseFloat(secondsString), 'second', 's', secondsString);
|
|
1363
1370
|
}
|
|
1364
1371
|
|
|
1365
1372
|
if (result.length === 0) {
|
|
@@ -1376,9 +1383,7 @@ var prettyMs = (milliseconds, options = {}) => {
|
|
|
1376
1383
|
}
|
|
1377
1384
|
|
|
1378
1385
|
return options.colonNotation ? result.join('') : result.join(' ');
|
|
1379
|
-
}
|
|
1380
|
-
|
|
1381
|
-
const ms = prettyMs;
|
|
1386
|
+
}
|
|
1382
1387
|
|
|
1383
1388
|
const BYTE_UNITS = [
|
|
1384
1389
|
'B',
|
|
@@ -1389,7 +1394,7 @@ const BYTE_UNITS = [
|
|
|
1389
1394
|
'PB',
|
|
1390
1395
|
'EB',
|
|
1391
1396
|
'ZB',
|
|
1392
|
-
'YB'
|
|
1397
|
+
'YB',
|
|
1393
1398
|
];
|
|
1394
1399
|
|
|
1395
1400
|
const BIBYTE_UNITS = [
|
|
@@ -1401,7 +1406,7 @@ const BIBYTE_UNITS = [
|
|
|
1401
1406
|
'PiB',
|
|
1402
1407
|
'EiB',
|
|
1403
1408
|
'ZiB',
|
|
1404
|
-
'YiB'
|
|
1409
|
+
'YiB',
|
|
1405
1410
|
];
|
|
1406
1411
|
|
|
1407
1412
|
const BIT_UNITS = [
|
|
@@ -1413,7 +1418,7 @@ const BIT_UNITS = [
|
|
|
1413
1418
|
'Pbit',
|
|
1414
1419
|
'Ebit',
|
|
1415
1420
|
'Zbit',
|
|
1416
|
-
'Ybit'
|
|
1421
|
+
'Ybit',
|
|
1417
1422
|
];
|
|
1418
1423
|
|
|
1419
1424
|
const BIBIT_UNITS = [
|
|
@@ -1425,7 +1430,7 @@ const BIBIT_UNITS = [
|
|
|
1425
1430
|
'Pibit',
|
|
1426
1431
|
'Eibit',
|
|
1427
1432
|
'Zibit',
|
|
1428
|
-
'Yibit'
|
|
1433
|
+
'Yibit',
|
|
1429
1434
|
];
|
|
1430
1435
|
|
|
1431
1436
|
/*
|
|
@@ -1445,16 +1450,20 @@ const toLocaleString = (number, locale, options) => {
|
|
|
1445
1450
|
return result;
|
|
1446
1451
|
};
|
|
1447
1452
|
|
|
1448
|
-
|
|
1453
|
+
function prettyBytes(number, options) {
|
|
1449
1454
|
if (!Number.isFinite(number)) {
|
|
1450
1455
|
throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
|
|
1451
1456
|
}
|
|
1452
1457
|
|
|
1453
|
-
options =
|
|
1458
|
+
options = {
|
|
1459
|
+
bits: false,
|
|
1460
|
+
binary: false,
|
|
1461
|
+
...options,
|
|
1462
|
+
};
|
|
1454
1463
|
|
|
1455
|
-
const UNITS = options.bits
|
|
1456
|
-
(options.binary ? BIBIT_UNITS : BIT_UNITS)
|
|
1457
|
-
(options.binary ? BIBYTE_UNITS : BYTE_UNITS);
|
|
1464
|
+
const UNITS = options.bits
|
|
1465
|
+
? (options.binary ? BIBIT_UNITS : BIT_UNITS)
|
|
1466
|
+
: (options.binary ? BIBYTE_UNITS : BYTE_UNITS);
|
|
1458
1467
|
|
|
1459
1468
|
if (options.signed && number === 0) {
|
|
1460
1469
|
return ` 0 ${UNITS[0]}`;
|
|
@@ -1474,7 +1483,7 @@ var prettyBytes = (number, options) => {
|
|
|
1474
1483
|
}
|
|
1475
1484
|
|
|
1476
1485
|
if (options.maximumFractionDigits !== undefined) {
|
|
1477
|
-
localeOptions =
|
|
1486
|
+
localeOptions = {maximumFractionDigits: options.maximumFractionDigits, ...localeOptions};
|
|
1478
1487
|
}
|
|
1479
1488
|
|
|
1480
1489
|
if (number < 1) {
|
|
@@ -1483,8 +1492,7 @@ var prettyBytes = (number, options) => {
|
|
|
1483
1492
|
}
|
|
1484
1493
|
|
|
1485
1494
|
const exponent = Math.min(Math.floor(options.binary ? Math.log(number) / Math.log(1024) : Math.log10(number) / 3), UNITS.length - 1);
|
|
1486
|
-
|
|
1487
|
-
number /= Math.pow(options.binary ? 1024 : 1000, exponent);
|
|
1495
|
+
number /= (options.binary ? 1024 : 1000) ** exponent;
|
|
1488
1496
|
|
|
1489
1497
|
if (!localeOptions) {
|
|
1490
1498
|
number = number.toPrecision(3);
|
|
@@ -1495,14 +1503,12 @@ var prettyBytes = (number, options) => {
|
|
|
1495
1503
|
const unit = UNITS[exponent];
|
|
1496
1504
|
|
|
1497
1505
|
return prefix + numberString + ' ' + unit;
|
|
1498
|
-
}
|
|
1499
|
-
|
|
1500
|
-
const prettyBytes$1 = prettyBytes;
|
|
1506
|
+
}
|
|
1501
1507
|
|
|
1502
1508
|
function printTimings(timings) {
|
|
1503
1509
|
Object.entries(timings).forEach(([label, [time, memory, total]]) => {
|
|
1504
1510
|
const appliedColor = label[0] === '#' ? (label[1] !== '#' ? loadConfigFile_js.underline : loadConfigFile_js.bold) : (text) => text;
|
|
1505
|
-
const row = `${label}: ${time.toFixed(0)}ms, ${prettyBytes
|
|
1511
|
+
const row = `${label}: ${time.toFixed(0)}ms, ${prettyBytes(memory)} / ${prettyBytes(total)}`;
|
|
1506
1512
|
console.info(appliedColor(row));
|
|
1507
1513
|
});
|
|
1508
1514
|
}
|
|
@@ -1559,7 +1565,7 @@ async function build(inputOptions, warnings, silent = false) {
|
|
|
1559
1565
|
await bundle.close();
|
|
1560
1566
|
if (!silent) {
|
|
1561
1567
|
warnings.flush();
|
|
1562
|
-
loadConfigFile_js.stderr(loadConfigFile_js.green(`created ${loadConfigFile_js.bold(files.join(', '))} in ${loadConfigFile_js.bold(
|
|
1568
|
+
loadConfigFile_js.stderr(loadConfigFile_js.green(`created ${loadConfigFile_js.bold(files.join(', '))} in ${loadConfigFile_js.bold(prettyMilliseconds(Date.now() - start))}`));
|
|
1563
1569
|
if (bundle && bundle.getTimings) {
|
|
1564
1570
|
printTimings(bundle.getTimings());
|
|
1565
1571
|
}
|
|
@@ -1576,7 +1582,7 @@ async function getConfigPath(commandConfig) {
|
|
|
1576
1582
|
try {
|
|
1577
1583
|
return require.resolve(`rollup-config-${pkgName}`, { paths: [process$1.cwd()] });
|
|
1578
1584
|
}
|
|
1579
|
-
catch
|
|
1585
|
+
catch {
|
|
1580
1586
|
try {
|
|
1581
1587
|
return require.resolve(pkgName, { paths: [process$1.cwd()] });
|
|
1582
1588
|
}
|
|
@@ -1708,7 +1714,7 @@ else {
|
|
|
1708
1714
|
try {
|
|
1709
1715
|
require('source-map-support').install();
|
|
1710
1716
|
}
|
|
1711
|
-
catch
|
|
1717
|
+
catch {
|
|
1712
1718
|
// do nothing
|
|
1713
1719
|
}
|
|
1714
1720
|
runRollup(command);
|
|
@@ -1716,6 +1722,6 @@ else {
|
|
|
1716
1722
|
|
|
1717
1723
|
exports.getConfigPath = getConfigPath;
|
|
1718
1724
|
exports.loadConfigFromCommand = loadConfigFromCommand;
|
|
1719
|
-
exports.
|
|
1725
|
+
exports.prettyMilliseconds = prettyMilliseconds;
|
|
1720
1726
|
exports.printTimings = printTimings;
|
|
1721
1727
|
//# sourceMappingURL=rollup.map
|