rollup 1.27.13 → 1.29.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,65 @@
1
1
  # rollup changelog
2
2
 
3
+ ## 1.29.1
4
+ *2020-01-21*
5
+
6
+ ### Bug Fixes
7
+ * Avoid crashes for circular reexports when named exports cannot be found (#3350)
8
+
9
+ ### Pull Requests
10
+ * [#3335](https://github.com/rollup/rollup/pull/3335): Fix typo (@robbinworks)
11
+ * [#3342](https://github.com/rollup/rollup/pull/3342): Remove ":" from test file names for Windows and update dependencies (@lukastaegert)
12
+ * [#3350](https://github.com/rollup/rollup/pull/3350): Properly handle circular reexports (@lukastaegert)
13
+
14
+ ## 1.29.0
15
+ *2020-01-08*
16
+
17
+ ### Features
18
+ * Enable top-level await by default (#3089)
19
+ * Add typings for watch events (#3302)
20
+
21
+ ### Bug Fixes
22
+ * Deconflict files that would conflict only on a case-insensitive OS (#3317)
23
+ * Do not fail in certain scenarios where a logical expression inside a sequence expression was being directly included (#3327)
24
+
25
+ ### Pull Requests
26
+ * [#3089](https://github.com/rollup/rollup/pull/3089): Move top-level await out of experimental (@guybedford)
27
+ * [#3302](https://github.com/rollup/rollup/pull/3302): Adds type definitions for RollupWatcher events (@NotWoods)
28
+ * [#3317](https://github.com/rollup/rollup/pull/3317): Fix module id conflict on a case insensitive OS (@yesmeck)
29
+ * [#3327](https://github.com/rollup/rollup/pull/3327): Handle deoptimizations while a node is being included (@lukastaegert)
30
+
31
+ ## 1.28.0
32
+ *2020-01-04*
33
+
34
+ ### Features
35
+ * Allow piping in stdin via the command line interface (#3312, #3290)
36
+ * Allow plugins to mark modules as having syntheticNamedExports for e.g. better CJS interoperability (#3295)
37
+ * Ignore variable reassignments in dead code when tree-shaking to remove more unneeded code (#3212)
38
+
39
+ ### Bug Fixes
40
+ * Properly respect tree-shaken code when generating sourcemaps (#3318)
41
+
42
+ ### Pull Requests
43
+ * [#3212](https://github.com/rollup/rollup/pull/3212): Handle assignments in dead code (@tjenkinson)
44
+ * [#3290](https://github.com/rollup/rollup/pull/3290): Implement stdin input with optional "-" as the file name (@kzc)
45
+ * [#3295](https://github.com/rollup/rollup/pull/3295): Add syntheticNamedExports (@manucorporat)
46
+ * [#3300](https://github.com/rollup/rollup/pull/3300): Add note about setting `types` in tsconfig file (@tjenkinson)
47
+ * [#3303](https://github.com/rollup/rollup/pull/3303): Use ! to assert not-null in TypeScript (@NotWoods)
48
+ * [#3312](https://github.com/rollup/rollup/pull/3312): Implement stdin input (@lukastaegert)
49
+ * [#3318](https://github.com/rollup/rollup/pull/3318): Update magic-string and other dependencies (@lukastaegert)
50
+
51
+ ## 1.27.14
52
+ *2019-12-22*
53
+
54
+ ### Bug Fixes
55
+ * Update references to official rollup plugins in error messages (#3297, #3298)
56
+
57
+ ### Pull Requests
58
+ * [#3286](https://github.com/rollup/rollup/pull/3286): Update link to JavaScript API documentation (@romankaravia)
59
+ * [#3294](https://github.com/rollup/rollup/pull/3294): Update deprecated references to the node-resolve plugin in the documentation (@Vlad-Shcherbina)
60
+ * [#3297](https://github.com/rollup/rollup/pull/3297): Update references to rollup-plugin-json (@cprecioso)
61
+ * [#3298](https://github.com/rollup/rollup/pull/3298): Update references to official rollup plugins (@cprecioso)
62
+
3
63
  ## 1.27.13
4
64
  *2019-12-14*
5
65
 
package/README.md CHANGED
@@ -34,7 +34,7 @@ Rollup is a module bundler for JavaScript which compiles small pieces of code in
34
34
 
35
35
  ## Quick Start Guide
36
36
 
37
- Install with `npm install --global rollup`. Rollup can be used either through a [command line interface](https://rollupjs.org/#command-line-reference) with an optional configuration file, or else through its [JavaScript API](https://rollupjs.org/#javascript-api). Run `rollup --help` to see the available options and parameters. The starter project templates, [rollup-starter-lib](https://github.com/rollup/rollup-starter-lib) and [rollup-starter-app](https://github.com/rollup/rollup-starter-app), demonstrate common configuration options, and more detailed instructions are available throughout the [user guide](https://rollupjs.org/).
37
+ Install with `npm install --global rollup`. Rollup can be used either through a [command line interface](https://rollupjs.org/#command-line-reference) with an optional configuration file, or else through its [JavaScript API](https://rollupjs.org/guide/en/#javascript-api). Run `rollup --help` to see the available options and parameters. The starter project templates, [rollup-starter-lib](https://github.com/rollup/rollup-starter-lib) and [rollup-starter-app](https://github.com/rollup/rollup-starter-app), demonstrate common configuration options, and more detailed instructions are available throughout the [user guide](https://rollupjs.org/).
38
38
 
39
39
  ### Commands
40
40
 
@@ -97,7 +97,7 @@ Because Rollup includes the bare minimum, it results in lighter, faster, and les
97
97
 
98
98
  ### Importing CommonJS
99
99
 
100
- Rollup can import existing CommonJS modules [through a plugin](https://github.com/rollup/rollup-plugin-commonjs).
100
+ Rollup can import existing CommonJS modules [through a plugin](https://github.com/rollup/plugins/tree/master/packages/commonjs).
101
101
 
102
102
  ### Publishing ES Modules
103
103
 
package/dist/bin/rollup CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  /*
4
4
  @license
5
- Rollup.js v1.27.13
6
- Sat, 14 Dec 2019 19:14:26 GMT - commit 396f2385af69cc933060b4c7e38afc87153f3647
5
+ Rollup.js v1.29.1
6
+ Tue, 21 Jan 2020 06:50:03 GMT - commit 21a1775a019b45bebfc608c8f58f3691080106e5
7
7
 
8
8
 
9
9
  https://github.com/rollup/rollup
@@ -12,8 +12,8 @@
12
12
  */
13
13
  'use strict';
14
14
 
15
- var rollup_js = require('../rollup.js');
16
15
  var index = require('../shared/index.js');
16
+ var rollup_js = require('../rollup.js');
17
17
  require('util');
18
18
  var path = require('path');
19
19
  var fs = require('fs');
@@ -308,7 +308,7 @@ function handleError(err, recover = false) {
308
308
  if (err.name)
309
309
  description = `${err.name}: ${description}`;
310
310
  const message = (err.plugin
311
- ? `(plugin ${err.plugin}) ${description}`
311
+ ? `(plugin ${(err).plugin}) ${description}`
312
312
  : description) || err;
313
313
  stderr(turbocolor.bold.red(`[!] ${turbocolor.bold(message.toString())}`));
314
314
  if (err.url) {
@@ -743,7 +743,7 @@ function build(inputOptions, outputOptions, warnings, silent = false) {
743
743
  ? ['stdout']
744
744
  : outputOptions.map(t => index.relativeId(t.file || t.dir));
745
745
  if (!silent) {
746
- let inputFiles = undefined;
746
+ let inputFiles;
747
747
  if (typeof inputOptions.input === 'string') {
748
748
  inputFiles = inputOptions.input;
749
749
  }
@@ -776,8 +776,7 @@ function build(inputOptions, outputOptions, warnings, silent = false) {
776
776
  else {
777
777
  source = file.code;
778
778
  if (output.sourcemap === 'inline') {
779
- source += `\n//# ${SOURCEMAPPING_URL$1}=${file
780
- .map.toUrl()}\n`;
779
+ source += `\n//# ${SOURCEMAPPING_URL$1}=${file.map.toUrl()}\n`;
781
780
  }
782
781
  }
783
782
  if (outputs.length > 1)
@@ -859,6 +858,39 @@ function loadConfigFile(configFile, commandOptions = {}) {
859
858
  });
860
859
  }
861
860
 
861
+ const stdinName = '-';
862
+ let stdinResult = null;
863
+ function stdinPlugin() {
864
+ return {
865
+ name: 'stdin',
866
+ resolveId(id) {
867
+ if (id === stdinName) {
868
+ return id;
869
+ }
870
+ },
871
+ load(id) {
872
+ if (id === stdinName) {
873
+ return stdinResult || (stdinResult = readStdin());
874
+ }
875
+ }
876
+ };
877
+ }
878
+ function readStdin() {
879
+ return new Promise((resolve, reject) => {
880
+ const chunks = [];
881
+ process.stdin.setEncoding('utf8');
882
+ process.stdin
883
+ .on('data', chunk => chunks.push(chunk))
884
+ .on('end', () => {
885
+ const result = chunks.join('');
886
+ resolve(result);
887
+ })
888
+ .on('error', err => {
889
+ reject(err);
890
+ });
891
+ });
892
+ }
893
+
862
894
  var timeZone = date => {
863
895
  const offset = (date || new Date()).getTimezoneOffset();
864
896
  const absOffset = Math.abs(offset);
@@ -1122,12 +1154,8 @@ function watch(configFile, configs, command, silent = false) {
1122
1154
  }
1123
1155
  function start(configs) {
1124
1156
  watcher = rollup_js.watch(configs);
1125
- watcher.on('event', (event) => {
1157
+ watcher.on('event', event => {
1126
1158
  switch (event.code) {
1127
- case 'FATAL':
1128
- handleError(event.error, true);
1129
- process.exit(1);
1130
- break;
1131
1159
  case 'ERROR':
1132
1160
  warnings.flush();
1133
1161
  handleError(event.error, true);
@@ -1307,35 +1335,40 @@ function runRollup(command) {
1307
1335
  }
1308
1336
  if (command.watch)
1309
1337
  process.env.ROLLUP_WATCH = 'true';
1310
- loadConfigFile(configFile, command)
1338
+ return loadConfigFile(configFile, command)
1311
1339
  .then(configs => execute(configFile, configs, command))
1312
1340
  .catch(handleError);
1313
1341
  }
1314
1342
  else {
1315
- return execute(configFile, [{ input: null }], command);
1343
+ if (!command.input && (command.stdin || !process.stdin.isTTY)) {
1344
+ command.input = stdinName;
1345
+ }
1346
+ return execute(configFile, [{ input: [] }], command);
1316
1347
  }
1317
1348
  }
1318
1349
  function execute(configFile, configs, command) {
1319
- if (command.watch) {
1320
- watch(configFile, configs, command, command.silent);
1321
- }
1322
- else {
1323
- let promise = Promise.resolve();
1324
- for (const config of configs) {
1325
- promise = promise.then(() => {
1350
+ return index.__awaiter(this, void 0, void 0, function* () {
1351
+ if (command.watch) {
1352
+ watch(configFile, configs, command, command.silent);
1353
+ }
1354
+ else {
1355
+ for (const config of configs) {
1326
1356
  const warnings = batchWarnings();
1327
1357
  const { inputOptions, outputOptions, optionError } = index.mergeOptions({
1328
1358
  command,
1329
1359
  config,
1330
1360
  defaultOnWarnHandler: warnings.add
1331
1361
  });
1332
- if (optionError)
1362
+ if (optionError) {
1333
1363
  inputOptions.onwarn({ code: 'UNKNOWN_OPTION', message: optionError });
1334
- return build(inputOptions, outputOptions, warnings, command.silent);
1335
- });
1364
+ }
1365
+ if (command.stdin !== false) {
1366
+ inputOptions.plugins.push(stdinPlugin());
1367
+ }
1368
+ yield build(inputOptions, outputOptions, warnings, command.silent);
1369
+ }
1336
1370
  }
1337
- return promise;
1338
- }
1371
+ });
1339
1372
  }
1340
1373
 
1341
1374
  const command = minimist(process.argv.slice(2), {