rollup 2.47.0 → 2.48.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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # rollup changelog
2
2
 
3
+ ## 2.48.0
4
+ *2021-05-15*
5
+
6
+ ### Features
7
+ * Add replacement to conditionally insert asset extensions in `entryFileNames` when preserving modules (#4077)
8
+
9
+ ### Bug Fixes
10
+ * Fix crash when dynamically assigning to namespace members (#4070)
11
+ * Do not associate pure annotations in front of a semi-colon or comma with succeeding code (#4068)
12
+
13
+ ### Pull Requests
14
+ * [#4068](https://github.com/rollup/rollup/pull/4068): ignore invalid trailing pure annotations (@kzc)
15
+ * [#4070](https://github.com/rollup/rollup/pull/4070): undefined `deoptimizePath` when the first element is empty string (@si3nloong)
16
+ * [#4071](https://github.com/rollup/rollup/pull/4071): add node.js v16 support (@dnalborczyk)
17
+ * [#4077](https://github.com/rollup/rollup/pull/4077): Add assetExtname replacement in entryFileNames (@BPScott)
18
+ * [#4080](https://github.com/rollup/rollup/pull/4080): Added Rollup logo in README.md (@priyanshurav)
19
+ * [#4081](https://github.com/rollup/rollup/pull/4081): fix comment regarding invalid annotation handling (@kzc)
20
+
3
21
  ## 2.47.0
4
22
  *2021-05-04*
5
23
 
package/LICENSE.md CHANGED
@@ -57,114 +57,6 @@ Repository: https://github.com/acornjs/acorn.git
57
57
 
58
58
  ---------------------------------------
59
59
 
60
- ## acorn-class-fields
61
- License: MIT
62
- By: Adrian Heine
63
- Repository: https://github.com/acornjs/acorn-class-fields
64
-
65
- > Copyright (C) 2017-2018 by Adrian Heine
66
- >
67
- > Permission is hereby granted, free of charge, to any person obtaining a copy
68
- > of this software and associated documentation files (the "Software"), to deal
69
- > in the Software without restriction, including without limitation the rights
70
- > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
71
- > copies of the Software, and to permit persons to whom the Software is
72
- > furnished to do so, subject to the following conditions:
73
- >
74
- > The above copyright notice and this permission notice shall be included in
75
- > all copies or substantial portions of the Software.
76
- >
77
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
78
- > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
79
- > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
80
- > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
81
- > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
82
- > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
83
- > THE SOFTWARE.
84
-
85
- ---------------------------------------
86
-
87
- ## acorn-private-class-elements
88
- License: MIT
89
- By: Adrian Heine
90
- Repository: https://github.com/acornjs/acorn-private-class-elements
91
-
92
- > Copyright (C) 2017-2018 by Adrian Heine
93
- >
94
- > Permission is hereby granted, free of charge, to any person obtaining a copy
95
- > of this software and associated documentation files (the "Software"), to deal
96
- > in the Software without restriction, including without limitation the rights
97
- > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
98
- > copies of the Software, and to permit persons to whom the Software is
99
- > furnished to do so, subject to the following conditions:
100
- >
101
- > The above copyright notice and this permission notice shall be included in
102
- > all copies or substantial portions of the Software.
103
- >
104
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
105
- > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
106
- > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
107
- > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
108
- > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
109
- > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
110
- > THE SOFTWARE.
111
-
112
- ---------------------------------------
113
-
114
- ## acorn-private-methods
115
- License: MIT
116
- By: Adrian Heine
117
- Repository: https://github.com/acornjs/acorn-private-methods
118
-
119
- > Copyright (C) 2017-2018 by Adrian Heine
120
- >
121
- > Permission is hereby granted, free of charge, to any person obtaining a copy
122
- > of this software and associated documentation files (the "Software"), to deal
123
- > in the Software without restriction, including without limitation the rights
124
- > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
125
- > copies of the Software, and to permit persons to whom the Software is
126
- > furnished to do so, subject to the following conditions:
127
- >
128
- > The above copyright notice and this permission notice shall be included in
129
- > all copies or substantial portions of the Software.
130
- >
131
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
132
- > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
133
- > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
134
- > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
135
- > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
136
- > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
137
- > THE SOFTWARE.
138
-
139
- ---------------------------------------
140
-
141
- ## acorn-static-class-features
142
- License: MIT
143
- By: Adrian Heine
144
- Repository: https://github.com/acornjs/acorn-static-class-features
145
-
146
- > Copyright (C) 2017-2018 by Adrian Heine
147
- >
148
- > Permission is hereby granted, free of charge, to any person obtaining a copy
149
- > of this software and associated documentation files (the "Software"), to deal
150
- > in the Software without restriction, including without limitation the rights
151
- > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
152
- > copies of the Software, and to permit persons to whom the Software is
153
- > furnished to do so, subject to the following conditions:
154
- >
155
- > The above copyright notice and this permission notice shall be included in
156
- > all copies or substantial portions of the Software.
157
- >
158
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
159
- > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
160
- > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
161
- > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
162
- > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
163
- > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
164
- > THE SOFTWARE.
165
-
166
- ---------------------------------------
167
-
168
60
  ## acorn-walk
169
61
  License: MIT
170
62
  By: Marijn Haverbeke, Ingvar Stepanyan, Adrian Heine
@@ -510,7 +402,7 @@ Repository: https://github.com/rich-harris/magic-string
510
402
 
511
403
  ## micromatch
512
404
  License: MIT
513
- By: Jon Schlinkert, Amila Welihinda, Bogdan Chadkin, Brian Woodward, Devon Govett, Elan Shanker, Fabrício Matté, Martin Kolárik, Olsten Larck, Paul Miller, Tom Byrer, Tyler Akins, Peter Bright
405
+ By: Jon Schlinkert, Amila Welihinda, Bogdan Chadkin, Brian Woodward, Devon Govett, Elan Shanker, Fabrício Matté, Martin Kolárik, Olsten Larck, Paul Miller, Tom Byrer, Tyler Akins, Peter Bright, Kuba Juszczyk
514
406
  Repository: micromatch/micromatch
515
407
 
516
408
  > The MIT License (MIT)
package/README.md CHANGED
@@ -1,4 +1,6 @@
1
- # Rollup
1
+ <p align="center">
2
+ <a href="https://rollupjs.org/"><img src="https://rollupjs.org/logo.svg" width="150" /></a>
3
+ </p>
2
4
 
3
5
  <p align="center">
4
6
  <a href="https://www.npmjs.com/package/rollup">
@@ -27,6 +29,7 @@
27
29
  </a>
28
30
  </p>
29
31
 
32
+ <h1 align="center">Rollup</h1>
30
33
 
31
34
  ## Overview
32
35
 
@@ -65,20 +68,20 @@ rollup main.js --format umd --name "myBundle" --file bundle.js
65
68
 
66
69
  Developing software is usually easier if you break your project into smaller separate pieces, since that often removes unexpected interactions and dramatically reduces the complexity of the problems you'll need to solve, and simply writing smaller projects in the first place [isn't necessarily the answer](https://medium.com/@Rich_Harris/small-modules-it-s-not-quite-that-simple-3ca532d65de4). Unfortunately, JavaScript has not historically included this capability as a core feature in the language.
67
70
 
68
- This finally changed with ES modules support in JavaScript, which provides a syntax for importing and exporting functions and data so they can be shared between separate scripts. Most browsers and Node.js support ES modules. However, Node.js releases before 12.17 support ES modules only behind the `--experimental-modules` flag, and older browsers like Internet Explorer do not support ES modules at all. Rollup allows you to write your code using ES modules, and run your application even in environments that do not support ES modules natively. For environments that support them, Rollup can output optimized ES modules; for environments that don't, Rollup can compile your code to other formats such as CommonJS modules, AMD modules, and IIFE-style scripts. This means that you get to *write future-proof code*, and you also get the tremendous benefits of...
71
+ This finally changed with ES modules support in JavaScript, which provides a syntax for importing and exporting functions and data so they can be shared between separate scripts. Most browsers and Node.js support ES modules. However, Node.js releases before 12.17 support ES modules only behind the `--experimental-modules` flag, and older browsers like Internet Explorer do not support ES modules at all. Rollup allows you to write your code using ES modules, and run your application even in environments that do not support ES modules natively. For environments that support them, Rollup can output optimized ES modules; for environments that don't, Rollup can compile your code to other formats such as CommonJS modules, AMD modules, and IIFE-style scripts. This means that you get to _write future-proof code_, and you also get the tremendous benefits of...
69
72
 
70
73
  ## Tree Shaking
71
74
 
72
75
  In addition to enabling the use of ES modules, Rollup also statically analyzes and optimizes the code you are importing, and will exclude anything that isn't actually used. This allows you to build on top of existing tools and modules without adding extra dependencies or bloating the size of your project.
73
76
 
74
- For example, with CommonJS, the *entire tool or library must be imported*.
77
+ For example, with CommonJS, the _entire tool or library must be imported_.
75
78
 
76
79
  ```js
77
80
  // import the entire utils object with CommonJS
78
- var utils = require( 'utils' );
81
+ var utils = require('utils');
79
82
  var query = 'Rollup';
80
83
  // use the ajax method of the utils object
81
- utils.ajax( 'https://api.example.com?search=' + query ).then( handleResponse );
84
+ utils.ajax('https://api.example.com?search=' + query).then(handleResponse);
82
85
  ```
83
86
 
84
87
  But with ES modules, instead of importing the whole `utils` object, we can just import the one `ajax` function we need:
@@ -88,7 +91,7 @@ But with ES modules, instead of importing the whole `utils` object, we can just
88
91
  import { ajax } from 'utils';
89
92
  var query = 'Rollup';
90
93
  // call the ajax function
91
- ajax( 'https://api.example.com?search=' + query ).then( handleResponse );
94
+ ajax('https://api.example.com?search=' + query).then(handleResponse);
92
95
  ```
93
96
 
94
97
  Because Rollup includes the bare minimum, it results in lighter, faster, and less complicated libraries and applications. Since this approach is based on explicit `import` and `export` statements, it is vastly more effective than simply running an automated minifier to detect unused variables in the compiled output code.
@@ -108,14 +111,12 @@ To make sure your ES modules are immediately usable by tools that work with Comm
108
111
  This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
109
112
  <a href="https://github.com/rollup/rollup/graphs/contributors"><img src="https://opencollective.com/rollup/contributors.svg?width=890" /></a>
110
113
 
111
-
112
114
  ## Backers
113
115
 
114
116
  Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/rollup#backer)]
115
117
 
116
118
  <a href="https://opencollective.com/rollup#backers" target="_blank"><img src="https://opencollective.com/rollup/backers.svg?width=890"></a>
117
119
 
118
-
119
120
  ## Sponsors
120
121
 
121
122
  Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/rollup#sponsor)]
@@ -131,8 +132,6 @@ Support this project by becoming a sponsor. Your logo will show up here with a l
131
132
  <a href="https://opencollective.com/rollup/sponsor/8/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/8/avatar.svg"></a>
132
133
  <a href="https://opencollective.com/rollup/sponsor/9/website" target="_blank"><img src="https://opencollective.com/rollup/sponsor/9/avatar.svg"></a>
133
134
 
134
-
135
-
136
135
  ## License
137
136
 
138
137
  [MIT](https://github.com/rollup/rollup/blob/master/LICENSE.md)
package/dist/bin/rollup CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  /*
4
4
  @license
5
- Rollup.js v2.47.0
6
- Tue, 04 May 2021 05:02:40 GMT - commit 6cc9d6b5137dd80fef9618e97471f89f8fbc54ad
5
+ Rollup.js v2.48.0
6
+ Sat, 15 May 2021 04:50:11 GMT - commit 07b3a02069594147665daa95d3fa3e041a82b2d0
7
7
 
8
8
 
9
9
  https://github.com/rollup/rollup
@@ -41,7 +41,12 @@ var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path$1);
41
41
  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.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--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 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--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";
42
42
 
43
43
  function camelCase(str) {
44
- str = str.toLocaleLowerCase();
44
+ // Handle the case where an argument is provided as camel case, e.g., fooBar.
45
+ // by ensuring that the string isn't already mixed case:
46
+ const isCamelCase = str !== str.toLowerCase() && str !== str.toUpperCase();
47
+ if (!isCamelCase) {
48
+ str = str.toLocaleLowerCase();
49
+ }
45
50
  if (str.indexOf('-') === -1 && str.indexOf('_') === -1) {
46
51
  return str;
47
52
  }
@@ -57,7 +62,6 @@ function camelCase(str) {
57
62
  }
58
63
  if (i !== 0 && (chr === '-' || chr === '_')) {
59
64
  nextChrUpper = true;
60
- continue;
61
65
  }
62
66
  else if (chr !== '-' && chr !== '_') {
63
67
  camelcase += chr;
@@ -302,6 +306,12 @@ class YargsParser {
302
306
  // any unknown option (except for end-of-options, "--")
303
307
  if (arg !== '--' && isUnknownOptionAsArg(arg)) {
304
308
  pushPositional(arg);
309
+ // ---, ---=, ----, etc,
310
+ }
311
+ else if (arg.match(/---+(=|$)/)) {
312
+ // options without key name are invalid.
313
+ pushPositional(arg);
314
+ continue;
305
315
  // -- separated by =
306
316
  }
307
317
  else if (arg.match(/^--.+=/) || (!configuration['short-option-groups'] && arg.match(/^-.+=/))) {
@@ -1400,12 +1410,12 @@ Formats the given number using `Number#toLocaleString`.
1400
1410
  - If locale is true, the system default locale is used for translation.
1401
1411
  - If no value for locale is specified, the number is returned unmodified.
1402
1412
  */
1403
- const toLocaleString = (number, locale) => {
1413
+ const toLocaleString = (number, locale, options) => {
1404
1414
  let result = number;
1405
1415
  if (typeof locale === 'string' || Array.isArray(locale)) {
1406
- result = number.toLocaleString(locale);
1407
- } else if (locale === true) {
1408
- result = number.toLocaleString();
1416
+ result = number.toLocaleString(locale, options);
1417
+ } else if (locale === true || options !== undefined) {
1418
+ result = number.toLocaleString(undefined, options);
1409
1419
  }
1410
1420
 
1411
1421
  return result;
@@ -1433,15 +1443,30 @@ var prettyBytes = (number, options) => {
1433
1443
  number = -number;
1434
1444
  }
1435
1445
 
1446
+ let localeOptions;
1447
+
1448
+ if (options.minimumFractionDigits !== undefined) {
1449
+ localeOptions = {minimumFractionDigits: options.minimumFractionDigits};
1450
+ }
1451
+
1452
+ if (options.maximumFractionDigits !== undefined) {
1453
+ localeOptions = Object.assign({maximumFractionDigits: options.maximumFractionDigits}, localeOptions);
1454
+ }
1455
+
1436
1456
  if (number < 1) {
1437
- const numberString = toLocaleString(number, options.locale);
1457
+ const numberString = toLocaleString(number, options.locale, localeOptions);
1438
1458
  return prefix + numberString + ' ' + UNITS[0];
1439
1459
  }
1440
1460
 
1441
1461
  const exponent = Math.min(Math.floor(options.binary ? Math.log(number) / Math.log(1024) : Math.log10(number) / 3), UNITS.length - 1);
1442
1462
  // eslint-disable-next-line unicorn/prefer-exponentiation-operator
1443
- number = Number((number / Math.pow(options.binary ? 1024 : 1000, exponent)).toPrecision(3));
1444
- const numberString = toLocaleString(number, options.locale);
1463
+ number /= Math.pow(options.binary ? 1024 : 1000, exponent);
1464
+
1465
+ if (!localeOptions) {
1466
+ number = number.toPrecision(3);
1467
+ }
1468
+
1469
+ const numberString = toLocaleString(Number(number), options.locale, localeOptions);
1445
1470
 
1446
1471
  const unit = UNITS[exponent];
1447
1472