rollup 2.75.5 → 3.0.0-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/LICENSE.md +2 -2
- package/dist/bin/rollup +75 -70
- package/dist/es/rollup.browser.js +3 -3
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/rollup.js +2207 -2244
- package/dist/es/shared/watch.js +2 -2
- package/dist/loadConfigFile.js +6 -6
- 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 +16 -13
- package/dist/shared/mergeOptions.js +2 -2
- package/dist/shared/rollup.js +2272 -2309
- package/dist/shared/watch-cli.js +17 -17
- package/dist/shared/watch.js +2 -2
- package/package.json +28 -27
- package/CHANGELOG.md +0 -6601
package/LICENSE.md
CHANGED
|
@@ -481,7 +481,7 @@ Repository: sindresorhus/parse-ms
|
|
|
481
481
|
|
|
482
482
|
> MIT License
|
|
483
483
|
>
|
|
484
|
-
> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
|
484
|
+
> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
485
485
|
>
|
|
486
486
|
> 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
487
|
>
|
|
@@ -544,7 +544,7 @@ Repository: sindresorhus/pretty-ms
|
|
|
544
544
|
|
|
545
545
|
> MIT License
|
|
546
546
|
>
|
|
547
|
-
> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
|
547
|
+
> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
548
548
|
>
|
|
549
549
|
> 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
550
|
>
|
package/dist/bin/rollup
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
@license
|
|
5
|
-
Rollup.js
|
|
6
|
-
|
|
5
|
+
Rollup.js v3.0.0-0
|
|
6
|
+
Tue, 05 Jul 2022 04:32:12 GMT - commit 7a8316af2262c390e7ed72586cb83add1286dec2
|
|
7
7
|
|
|
8
8
|
https://github.com/rollup/rollup
|
|
9
9
|
|
|
@@ -16,17 +16,17 @@ 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
|
-
const
|
|
22
|
+
const loadConfigFile_js = require('../shared/loadConfigFile.js');
|
|
23
23
|
require('perf_hooks');
|
|
24
24
|
require('crypto');
|
|
25
25
|
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--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',
|
|
@@ -1501,7 +1506,7 @@ const prettyBytes$1 = prettyBytes;
|
|
|
1501
1506
|
|
|
1502
1507
|
function printTimings(timings) {
|
|
1503
1508
|
Object.entries(timings).forEach(([label, [time, memory, total]]) => {
|
|
1504
|
-
const appliedColor = label[0] === '#' ? (label[1] !== '#' ?
|
|
1509
|
+
const appliedColor = label[0] === '#' ? (label[1] !== '#' ? loadConfigFile_js.underline : loadConfigFile_js.bold) : (text) => text;
|
|
1505
1510
|
const row = `${label}: ${time.toFixed(0)}ms, ${prettyBytes$1(memory)} / ${prettyBytes$1(total)}`;
|
|
1506
1511
|
console.info(appliedColor(row));
|
|
1507
1512
|
});
|
|
@@ -1523,13 +1528,13 @@ async function build(inputOptions, warnings, silent = false) {
|
|
|
1523
1528
|
else if (typeof inputOptions.input === 'object' && inputOptions.input !== null) {
|
|
1524
1529
|
inputFiles = Object.values(inputOptions.input).join(', ');
|
|
1525
1530
|
}
|
|
1526
|
-
|
|
1531
|
+
loadConfigFile_js.stderr(loadConfigFile_js.cyan(`\n${loadConfigFile_js.bold(inputFiles)} → ${loadConfigFile_js.bold(files.join(', '))}...`));
|
|
1527
1532
|
}
|
|
1528
1533
|
const bundle = await rollup.rollup(inputOptions);
|
|
1529
1534
|
if (useStdout) {
|
|
1530
1535
|
const output = outputOptions[0];
|
|
1531
1536
|
if (output.sourcemap && output.sourcemap !== 'inline') {
|
|
1532
|
-
|
|
1537
|
+
loadConfigFile_js.handleError({
|
|
1533
1538
|
code: 'ONLY_INLINE_SOURCEMAPS',
|
|
1534
1539
|
message: 'Only inline sourcemaps are supported when bundling to stdout.'
|
|
1535
1540
|
});
|
|
@@ -1547,7 +1552,7 @@ async function build(inputOptions, warnings, silent = false) {
|
|
|
1547
1552
|
}
|
|
1548
1553
|
}
|
|
1549
1554
|
if (outputs.length > 1)
|
|
1550
|
-
process$1.stdout.write(`\n${
|
|
1555
|
+
process$1.stdout.write(`\n${loadConfigFile_js.cyan(loadConfigFile_js.bold(`//→ ${file.fileName}:`))}\n`);
|
|
1551
1556
|
process$1.stdout.write(source);
|
|
1552
1557
|
}
|
|
1553
1558
|
if (!silent) {
|
|
@@ -1559,7 +1564,7 @@ async function build(inputOptions, warnings, silent = false) {
|
|
|
1559
1564
|
await bundle.close();
|
|
1560
1565
|
if (!silent) {
|
|
1561
1566
|
warnings.flush();
|
|
1562
|
-
|
|
1567
|
+
loadConfigFile_js.stderr(loadConfigFile_js.green(`created ${loadConfigFile_js.bold(files.join(', '))} in ${loadConfigFile_js.bold(prettyMilliseconds(Date.now() - start))}`));
|
|
1563
1568
|
if (bundle && bundle.getTimings) {
|
|
1564
1569
|
printTimings(bundle.getTimings());
|
|
1565
1570
|
}
|
|
@@ -1576,13 +1581,13 @@ async function getConfigPath(commandConfig) {
|
|
|
1576
1581
|
try {
|
|
1577
1582
|
return require.resolve(`rollup-config-${pkgName}`, { paths: [process$1.cwd()] });
|
|
1578
1583
|
}
|
|
1579
|
-
catch
|
|
1584
|
+
catch {
|
|
1580
1585
|
try {
|
|
1581
1586
|
return require.resolve(pkgName, { paths: [process$1.cwd()] });
|
|
1582
1587
|
}
|
|
1583
1588
|
catch (err) {
|
|
1584
1589
|
if (err.code === 'MODULE_NOT_FOUND') {
|
|
1585
|
-
|
|
1590
|
+
loadConfigFile_js.handleError({
|
|
1586
1591
|
code: 'MISSING_EXTERNAL_CONFIG',
|
|
1587
1592
|
message: `Could not resolve config file "${commandConfig}"`
|
|
1588
1593
|
});
|
|
@@ -1604,12 +1609,12 @@ async function findConfigFileNameInCwd() {
|
|
|
1604
1609
|
}
|
|
1605
1610
|
|
|
1606
1611
|
async function loadConfigFromCommand(command) {
|
|
1607
|
-
const warnings =
|
|
1612
|
+
const warnings = loadConfigFile_js.batchWarnings();
|
|
1608
1613
|
if (!command.input && (command.stdin || !process$1.stdin.isTTY)) {
|
|
1609
|
-
command.input =
|
|
1614
|
+
command.input = loadConfigFile_js.stdinName;
|
|
1610
1615
|
}
|
|
1611
1616
|
const options = mergeOptions.mergeOptions({ input: [] }, command, warnings.add);
|
|
1612
|
-
await
|
|
1617
|
+
await loadConfigFile_js.addCommandPluginsToInputOptions(options, command);
|
|
1613
1618
|
return { options: [options], warnings };
|
|
1614
1619
|
}
|
|
1615
1620
|
|
|
@@ -1617,7 +1622,7 @@ async function runRollup(command) {
|
|
|
1617
1622
|
let inputSource;
|
|
1618
1623
|
if (command._.length > 0) {
|
|
1619
1624
|
if (command.input) {
|
|
1620
|
-
|
|
1625
|
+
loadConfigFile_js.handleError({
|
|
1621
1626
|
code: 'DUPLICATE_IMPORT_OPTIONS',
|
|
1622
1627
|
message: 'Either use --input, or pass input path as argument'
|
|
1623
1628
|
});
|
|
@@ -1669,7 +1674,7 @@ async function runRollup(command) {
|
|
|
1669
1674
|
}
|
|
1670
1675
|
if (command.failAfterWarnings && warnings.warningOccurred) {
|
|
1671
1676
|
warnings.flush();
|
|
1672
|
-
|
|
1677
|
+
loadConfigFile_js.handleError({
|
|
1673
1678
|
code: 'FAIL_AFTER_WARNINGS',
|
|
1674
1679
|
message: 'Warnings occurred and --failAfterWarnings flag present'
|
|
1675
1680
|
});
|
|
@@ -1677,18 +1682,18 @@ async function runRollup(command) {
|
|
|
1677
1682
|
}
|
|
1678
1683
|
catch (err) {
|
|
1679
1684
|
warnings.flush();
|
|
1680
|
-
|
|
1685
|
+
loadConfigFile_js.handleError(err);
|
|
1681
1686
|
}
|
|
1682
1687
|
}
|
|
1683
1688
|
catch (err) {
|
|
1684
|
-
|
|
1689
|
+
loadConfigFile_js.handleError(err);
|
|
1685
1690
|
}
|
|
1686
1691
|
}
|
|
1687
1692
|
}
|
|
1688
1693
|
async function getConfigs(command) {
|
|
1689
1694
|
if (command.config) {
|
|
1690
1695
|
const configFile = await getConfigPath(command.config);
|
|
1691
|
-
const { options, warnings } = await
|
|
1696
|
+
const { options, warnings } = await loadConfigFile_js.loadAndParseConfigFile(configFile, command);
|
|
1692
1697
|
return { options, warnings };
|
|
1693
1698
|
}
|
|
1694
1699
|
return await loadConfigFromCommand(command);
|
|
@@ -1708,7 +1713,7 @@ else {
|
|
|
1708
1713
|
try {
|
|
1709
1714
|
require('source-map-support').install();
|
|
1710
1715
|
}
|
|
1711
|
-
catch
|
|
1716
|
+
catch {
|
|
1712
1717
|
// do nothing
|
|
1713
1718
|
}
|
|
1714
1719
|
runRollup(command);
|
|
@@ -1716,6 +1721,6 @@ else {
|
|
|
1716
1721
|
|
|
1717
1722
|
exports.getConfigPath = getConfigPath;
|
|
1718
1723
|
exports.loadConfigFromCommand = loadConfigFromCommand;
|
|
1719
|
-
exports.
|
|
1724
|
+
exports.prettyMilliseconds = prettyMilliseconds;
|
|
1720
1725
|
exports.printTimings = printTimings;
|
|
1721
1726
|
//# sourceMappingURL=rollup.map
|