rollup 2.26.11 → 2.28.1

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,46 @@
1
1
  # rollup changelog
2
2
 
3
+ ## 2.28.1
4
+ *2020-09-21*
5
+
6
+ ### Bug Fixes
7
+ * Fix a path slash issue when using the preserveModulesRoot option on Windows (#3791)
8
+
9
+ ### Pull Requests
10
+ * [#3791](https://github.com/rollup/rollup/pull/3791): Fix preserveModulesRoot path on Windows (@lukastaegert)
11
+
12
+ ## 2.28.0
13
+ *2020-09-21*
14
+
15
+ ### Features
16
+ * Add an option to treat modules at a given path as located at root when preserving modules (#3786)
17
+
18
+ ### Pull Requests
19
+ * [#3786](https://github.com/rollup/rollup/pull/3786): Add preserveModulesRoot config option (@davidroeca)
20
+
21
+ ## 2.27.1
22
+ *2020-09-17*
23
+
24
+ ### Bug Fixes
25
+ * Do not fail when using ES module imports in symlinked config files (#3783)
26
+
27
+ ### Pull Requests
28
+ * [#3783](https://github.com/rollup/rollup/pull/3783): Handle loading symlinked config files (@lukastaegert)
29
+
30
+ ## 2.27.0
31
+ *2020-09-16*
32
+
33
+ ### Features
34
+ * Support specifying a file extension when reading from stdin (#3775)
35
+
36
+ ### Bug Fixes
37
+ * Do not break logic if a branch with hoisted variables is tree-shaken in an else-if statement (#3782)
38
+
39
+ ### Pull Requests
40
+ * [#3770](https://github.com/rollup/rollup/pull/3770): Docs: Exception for babel plugin and commonjs plugin (@jsk7)
41
+ * [#3775](https://github.com/rollup/rollup/pull/3775): add ability to specify stdin file extension via --stdin=ext (@kzc)
42
+ * [#3782](https://github.com/rollup/rollup/pull/3782): Handle hoisted variables in dead branches of nested if statements (@lukastaegert)
43
+
3
44
  ## 2.26.11
4
45
  *2020-09-08*
5
46
 
@@ -16,6 +57,7 @@
16
57
  * Do not create invalid code when simplifying expressions in return statements that contain line comments (#3762)
17
58
 
18
59
  ### Pull Requests
60
+ * [#3757](https://github.com/rollup/rollup/pull/3757): Fix api docs loadconfigfile (@maxwell8888)
19
61
  * [#3762](https://github.com/rollup/rollup/pull/3762): Handle line-comments when removing line-breaks to prevent ASI (@lukastaegert)
20
62
 
21
63
  ## 2.26.9
package/dist/bin/rollup CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  /*
4
4
  @license
5
- Rollup.js v2.26.11
6
- Tue, 08 Sep 2020 05:49:27 GMT - commit 022770a8058cb3598ea8b0c5df12384bcf7bc7ff
5
+ Rollup.js v2.28.1
6
+ Mon, 21 Sep 2020 06:38:23 GMT - commit 1040292e0b1ad6496d8cf0a3eee63b17d9a39a4f
7
7
 
8
8
 
9
9
  https://github.com/rollup/rollup
@@ -25,7 +25,7 @@ require('events');
25
25
  var Module = require('module');
26
26
  require('url');
27
27
 
28
- var 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.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--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--namespaceToStringTag Create proper `.toString` methods for namespaces\n--noConflict Generate a noConflict method for UMD globals\n--outro <text> Code to insert at end of bundle (inside wrapper)\n--preferConst Use `const` instead of `var` for exports\n--no-preserveEntrySignatures Avoid facade chunks for entry points\n--preserveModules Preserve module structure\n--preserveSymlinks Do not follow symlinks when resolving files\n--shimMissingExports Create shim variables for missing exports\n--silent Don't print warnings\n--failAfterWarnings Exit with an error code if there was a warning during the build\n--sourcemapExcludeSources Do not include source code in source maps\n--sourcemapFile <file> Specify bundle position for source maps\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\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";
28
+ var 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.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--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--namespaceToStringTag Create proper `.toString` methods for namespaces\n--noConflict Generate a noConflict method for UMD globals\n--outro <text> Code to insert at end of bundle (inside wrapper)\n--preferConst Use `const` instead of `var` for exports\n--no-preserveEntrySignatures Avoid facade chunks for entry points\n--preserveModules Preserve module structure\n--preserveModulesRoot Preserved modules under this path are rooted in output `dir`\n--preserveSymlinks Do not follow symlinks when resolving files\n--shimMissingExports Create shim variables for missing exports\n--silent Don't print warnings\n--failAfterWarnings Exit with an error code if there was a warning during the build\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 - default is none\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\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";
29
29
 
30
30
  function camelCase(str) {
31
31
  str = str.toLocaleLowerCase();
@@ -60,7 +60,7 @@ function decamelize(str, joinString) {
60
60
  for (let i = 0; i < str.length; i++) {
61
61
  const chrLower = lowercase.charAt(i);
62
62
  const chrString = str.charAt(i);
63
- if (chrLower !== chrString) {
63
+ if (chrLower !== chrString && i > 0) {
64
64
  notCamelcase += `${joinString}${lowercase.charAt(i)}`;
65
65
  }
66
66
  else {
@@ -486,7 +486,7 @@ class YargsParser {
486
486
  }
487
487
  if (configuration['strip-aliased']) {
488
488
  [].concat(...Object.keys(aliases).map(k => aliases[k])).forEach(alias => {
489
- if (configuration['camel-case-expansion']) {
489
+ if (configuration['camel-case-expansion'] && alias.includes('-')) {
490
490
  delete argv[alias.split('.').map(prop => camelCase(prop)).join('.')];
491
491
  }
492
492
  delete argv[alias];
@@ -1333,6 +1333,18 @@ const BYTE_UNITS = [
1333
1333
  'YB'
1334
1334
  ];
1335
1335
 
1336
+ const BIBYTE_UNITS = [
1337
+ 'B',
1338
+ 'kiB',
1339
+ 'MiB',
1340
+ 'GiB',
1341
+ 'TiB',
1342
+ 'PiB',
1343
+ 'EiB',
1344
+ 'ZiB',
1345
+ 'YiB'
1346
+ ];
1347
+
1336
1348
  const BIT_UNITS = [
1337
1349
  'b',
1338
1350
  'kbit',
@@ -1345,6 +1357,18 @@ const BIT_UNITS = [
1345
1357
  'Ybit'
1346
1358
  ];
1347
1359
 
1360
+ const BIBIT_UNITS = [
1361
+ 'b',
1362
+ 'kibit',
1363
+ 'Mibit',
1364
+ 'Gibit',
1365
+ 'Tibit',
1366
+ 'Pibit',
1367
+ 'Eibit',
1368
+ 'Zibit',
1369
+ 'Yibit'
1370
+ ];
1371
+
1348
1372
  /*
1349
1373
  Formats the given number using `Number#toLocaleString`.
1350
1374
  - If locale is a string, the value is expected to be a locale-key (for example: `de`).
@@ -1367,8 +1391,10 @@ var prettyBytes = (number, options) => {
1367
1391
  throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
1368
1392
  }
1369
1393
 
1370
- options = Object.assign({bits: false}, options);
1371
- const UNITS = options.bits ? BIT_UNITS : BYTE_UNITS;
1394
+ options = Object.assign({bits: false, binary: false}, options);
1395
+ const UNITS = options.bits ?
1396
+ (options.binary ? BIBIT_UNITS : BIT_UNITS) :
1397
+ (options.binary ? BIBYTE_UNITS : BYTE_UNITS);
1372
1398
 
1373
1399
  if (options.signed && number === 0) {
1374
1400
  return ' 0 ' + UNITS[0];
@@ -1386,9 +1412,9 @@ var prettyBytes = (number, options) => {
1386
1412
  return prefix + numberString + ' ' + UNITS[0];
1387
1413
  }
1388
1414
 
1389
- const exponent = Math.min(Math.floor(Math.log10(number) / 3), UNITS.length - 1);
1415
+ const exponent = Math.min(Math.floor(options.binary ? Math.log(number) / Math.log(1024) : Math.log10(number) / 3), UNITS.length - 1);
1390
1416
  // eslint-disable-next-line unicorn/prefer-exponentiation-operator
1391
- number = Number((number / Math.pow(1000, exponent)).toPrecision(3));
1417
+ number = Number((number / Math.pow(options.binary ? 1024 : 1000, exponent)).toPrecision(3));
1392
1418
  const numberString = toLocaleString(number, options.locale);
1393
1419
 
1394
1420
  const unit = UNITS[exponent];
@@ -1496,7 +1522,7 @@ const DEFAULT_CONFIG_BASE = 'rollup.config';
1496
1522
  function getConfigPath(commandConfig) {
1497
1523
  const cwd = process.cwd();
1498
1524
  if (commandConfig === true) {
1499
- return sysPath.join(cwd, findConfigFileNameInCwd());
1525
+ return sysPath.resolve(findConfigFileNameInCwd());
1500
1526
  }
1501
1527
  if (commandConfig.slice(0, 5) === 'node:') {
1502
1528
  const pkgName = commandConfig.slice(5);
@@ -1518,7 +1544,7 @@ function getConfigPath(commandConfig) {
1518
1544
  }
1519
1545
  }
1520
1546
  }
1521
- return fs.realpathSync(commandConfig);
1547
+ return sysPath.resolve(commandConfig);
1522
1548
  }
1523
1549
  function findConfigFileNameInCwd() {
1524
1550
  const filesInWorkingDir = new Set(fs.readdirSync(process.cwd()));