rollup 1.15.5 → 1.16.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/CHANGELOG.md CHANGED
@@ -1,5 +1,48 @@
1
1
  # rollup changelog
2
2
 
3
+ ## 1.16.2
4
+ *2019-06-22*
5
+
6
+ ### Bug Fixes
7
+ * Properly wrap dynamic imports in Promises that can be caught when generating CJS output (#2958)
8
+
9
+ ### Pull Requests
10
+ * [#2958](https://github.com/rollup/rollup/pull/2958): Make sure errors from dynamic imports can be caught (@lukastaegert)
11
+
12
+ ## 1.16.1
13
+ *2019-06-21*
14
+
15
+ ### Pull Requests
16
+ * [#2956](https://github.com/rollup/rollup/pull/2956): Add missing CLI docs for strictDeprecations (@lukastaegert)
17
+
18
+ ## 1.16.0
19
+ *2019-06-21*
20
+
21
+ ### Features
22
+ * Add strictDeprecations option to throw when currently or upcoming deprecated features are used (#2945)
23
+ * Keep annotations and comments when simplifying logical and conditional expressions (#2955)
24
+
25
+ ### Bug Fixes
26
+ * Generate proper namespace objects when dynamically importing external dependencies for AMD or CJS formats (#2954)
27
+ * Fix dynamically imported variables not being resolved correctly when importing from an entry chunk with only a default export (#2954)
28
+ * Do not reexport default when reexporting a namespace (#2954)
29
+
30
+ ### Pull Requests
31
+ * [#2945](https://github.com/rollup/rollup/pull/2945): Add option to handle use of features marked for deprecation as errors (@lukastaegert)
32
+ * [#2954](https://github.com/rollup/rollup/pull/2954): Improve dynamic import interop (@lukastaegert)
33
+ * [#2955](https://github.com/rollup/rollup/pull/2955): Keep annotations and comments when simplifying logical and conditional expressions (@lukastaegert)
34
+
35
+ ## 1.15.6
36
+ *2019-06-16*
37
+
38
+ ### Bug Fixes
39
+ * No longer use an alternate screen in watch mode to allow scrolling (#2942)
40
+ * Prioritize non-external imports over external ones when resolving conflicting namespace re-exports (#2893)
41
+
42
+ ### Pull Requests
43
+ * [#2893](https://github.com/rollup/rollup/pull/2893): Improve handling of conflicting namespace exports (@aleclarson)
44
+ * [#2942](https://github.com/rollup/rollup/pull/2942): Get rid of alternate screen and simplify screen clearing (@lukastaegert)
45
+
3
46
  ## 1.15.5
4
47
  *2019-06-14*
5
48
 
package/bin/rollup CHANGED
@@ -13,7 +13,7 @@ var rollup__default = _interopDefault(rollup);
13
13
  var assert = _interopDefault(require('assert'));
14
14
  var events = _interopDefault(require('events'));
15
15
 
16
- 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, esm, iife, umd)\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-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--dynamicImportFunction <name> Rename the dynamic `import()` function\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--footer <text> Code to insert at end of bundle (outside wrapper)\n--no-freeze Do not freeze namespace objects\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--namespaceToStringTag Create proper `.toString` methods for namespaces\n--noConflict Generate a noConflict method for UMD globals\n--no-strict Don't emit `\"use strict\";` in the generated modules\n--outro <text> Code to insert at end of bundle (inside wrapper)\n--preferConst Use `const` instead of `var` for exports\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--sourcemapExcludeSources Do not include source code in source maps\n--sourcemapFile <file> Specify bundle position for source maps\n--no-treeshake Disable tree-shaking optimisations\n--no-treeshake.annotations Ignore pure call annotations\n--no-treeshake.propertyReadSideEffects Ignore property access side-effects\n--treeshake.pureExternalModules Assume side-effect free externals\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";
16
+ 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, esm, iife, umd)\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-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--dynamicImportFunction <name> Rename the dynamic `import()` function\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--footer <text> Code to insert at end of bundle (outside wrapper)\n--no-freeze Do not freeze namespace objects\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--namespaceToStringTag Create proper `.toString` methods for namespaces\n--noConflict Generate a noConflict method for UMD globals\n--no-strict Don't emit `\"use strict\";` in the generated modules\n--outro <text> Code to insert at end of bundle (inside wrapper)\n--preferConst Use `const` instead of `var` for exports\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--sourcemapExcludeSources Do not include source code in source maps\n--sourcemapFile <file> Specify bundle position for source maps\n--strictDeprecations Throw errors for deprecated features\n--no-treeshake Disable tree-shaking optimisations\n--no-treeshake.annotations Ignore pure call annotations\n--no-treeshake.propertyReadSideEffects Ignore property access side-effects\n--treeshake.pureExternalModules Assume side-effect free externals\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";
17
17
 
18
18
  var minimist = function (args, opts) {
19
19
  if (!opts)
@@ -223,7 +223,7 @@ function isNumber(x) {
223
223
  return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
224
224
  }
225
225
 
226
- var version = "1.15.5";
226
+ var version = "1.16.2";
227
227
 
228
228
  const createGetOption = (config, command) => (name, defaultValue) => command[name] !== undefined
229
229
  ? command[name]
@@ -350,6 +350,7 @@ function getInputOptions(config, command = { external: [], globals: undefined },
350
350
  preserveModules: getOption('preserveModules'),
351
351
  preserveSymlinks: getOption('preserveSymlinks'),
352
352
  shimMissingExports: getOption('shimMissingExports'),
353
+ strictDeprecations: getOption('strictDeprecations', false),
353
354
  treeshake: getObjectOption(config, command, 'treeshake'),
354
355
  watch: config.watch
355
356
  };
@@ -512,7 +513,7 @@ function handleError(err, recover = false) {
512
513
  if (err.name)
513
514
  description = `${err.name}: ${description}`;
514
515
  const message = (err.plugin
515
- ? `(${err.plugin} plugin) ${description}`
516
+ ? `(plugin ${err.plugin}) ${description}`
516
517
  : description) || err;
517
518
  stderr(turbocolor.bold.red(`[!] ${turbocolor.bold(message.toString())}`));
518
519
  if (err.url) {
@@ -1287,149 +1288,16 @@ signalExit.unload = unload_1;
1287
1288
  signalExit.signals = signals_1;
1288
1289
  signalExit.load = load_1;
1289
1290
 
1290
- var ansiEscapes_1 = createCommonjsModule(function (module) {
1291
- const ansiEscapes = module.exports;
1292
- // TODO: remove this in the next major version
1293
- module.exports.default = ansiEscapes;
1294
- const ESC = '\u001B[';
1295
- const OSC = '\u001B]';
1296
- const BEL = '\u0007';
1297
- const SEP = ';';
1298
- const isTerminalApp = process.env.TERM_PROGRAM === 'Apple_Terminal';
1299
- ansiEscapes.cursorTo = (x, y) => {
1300
- if (typeof x !== 'number') {
1301
- throw new TypeError('The `x` argument is required');
1302
- }
1303
- if (typeof y !== 'number') {
1304
- return ESC + (x + 1) + 'G';
1305
- }
1306
- return ESC + (y + 1) + ';' + (x + 1) + 'H';
1307
- };
1308
- ansiEscapes.cursorMove = (x, y) => {
1309
- if (typeof x !== 'number') {
1310
- throw new TypeError('The `x` argument is required');
1311
- }
1312
- let ret = '';
1313
- if (x < 0) {
1314
- ret += ESC + (-x) + 'D';
1315
- }
1316
- else if (x > 0) {
1317
- ret += ESC + x + 'C';
1318
- }
1319
- if (y < 0) {
1320
- ret += ESC + (-y) + 'A';
1321
- }
1322
- else if (y > 0) {
1323
- ret += ESC + y + 'B';
1324
- }
1325
- return ret;
1326
- };
1327
- ansiEscapes.cursorUp = (count = 1) => ESC + count + 'A';
1328
- ansiEscapes.cursorDown = (count = 1) => ESC + count + 'B';
1329
- ansiEscapes.cursorForward = (count = 1) => ESC + count + 'C';
1330
- ansiEscapes.cursorBackward = (count = 1) => ESC + count + 'D';
1331
- ansiEscapes.cursorLeft = ESC + 'G';
1332
- ansiEscapes.cursorSavePosition = ESC + (isTerminalApp ? '7' : 's');
1333
- ansiEscapes.cursorRestorePosition = ESC + (isTerminalApp ? '8' : 'u');
1334
- ansiEscapes.cursorGetPosition = ESC + '6n';
1335
- ansiEscapes.cursorNextLine = ESC + 'E';
1336
- ansiEscapes.cursorPrevLine = ESC + 'F';
1337
- ansiEscapes.cursorHide = ESC + '?25l';
1338
- ansiEscapes.cursorShow = ESC + '?25h';
1339
- ansiEscapes.eraseLines = count => {
1340
- let clear = '';
1341
- for (let i = 0; i < count; i++) {
1342
- clear += ansiEscapes.eraseLine + (i < count - 1 ? ansiEscapes.cursorUp() : '');
1343
- }
1344
- if (count) {
1345
- clear += ansiEscapes.cursorLeft;
1346
- }
1347
- return clear;
1348
- };
1349
- ansiEscapes.eraseEndLine = ESC + 'K';
1350
- ansiEscapes.eraseStartLine = ESC + '1K';
1351
- ansiEscapes.eraseLine = ESC + '2K';
1352
- ansiEscapes.eraseDown = ESC + 'J';
1353
- ansiEscapes.eraseUp = ESC + '1J';
1354
- ansiEscapes.eraseScreen = ESC + '2J';
1355
- ansiEscapes.scrollUp = ESC + 'S';
1356
- ansiEscapes.scrollDown = ESC + 'T';
1357
- ansiEscapes.clearScreen = '\u001Bc';
1358
- ansiEscapes.clearTerminal = process.platform === 'win32' ?
1359
- `${ansiEscapes.eraseScreen}${ESC}0f` :
1360
- // 1. Erases the screen (Only done in case `2` is not supported)
1361
- // 2. Erases the whole screen including scrollback buffer
1362
- // 3. Moves cursor to the top-left position
1363
- // More info: https://www.real-world-systems.com/docs/ANSIcode.html
1364
- `${ansiEscapes.eraseScreen}${ESC}3J${ESC}H`;
1365
- ansiEscapes.beep = BEL;
1366
- ansiEscapes.link = (text, url) => {
1367
- return [
1368
- OSC,
1369
- '8',
1370
- SEP,
1371
- SEP,
1372
- url,
1373
- BEL,
1374
- text,
1375
- OSC,
1376
- '8',
1377
- SEP,
1378
- SEP,
1379
- BEL
1380
- ].join('');
1381
- };
1382
- ansiEscapes.image = (buffer, options = {}) => {
1383
- let ret = `${OSC}1337;File=inline=1`;
1384
- if (options.width) {
1385
- ret += `;width=${options.width}`;
1386
- }
1387
- if (options.height) {
1388
- ret += `;height=${options.height}`;
1389
- }
1390
- if (options.preserveAspectRatio === false) {
1391
- ret += ';preserveAspectRatio=0';
1392
- }
1393
- return ret + ':' + buffer.toString('base64') + BEL;
1394
- };
1395
- ansiEscapes.iTerm = {
1396
- setCwd: (cwd = process.cwd()) => `${OSC}50;CurrentDir=${cwd}${BEL}`
1397
- };
1398
- });
1399
-
1400
- const SHOW_ALTERNATE_SCREEN = '\u001B[?1049h';
1401
- const HIDE_ALTERNATE_SCREEN = '\u001B[?1049l';
1402
- const isWindows = process.platform === 'win32';
1403
- const isMintty = isWindows && !!(process.env.SHELL || process.env.TERM);
1404
- const isConEmuAnsiOn = (process.env.ConEmuANSI || '').toLowerCase() === 'on';
1405
- const supportsAnsi = !isWindows || isMintty || isConEmuAnsiOn;
1406
- function alternateScreen(enabled) {
1407
- if (!enabled) {
1408
- let needAnnounce = true;
1409
- return {
1410
- open() { },
1411
- close() { },
1412
- reset(heading) {
1413
- if (needAnnounce) {
1414
- stderr(heading);
1415
- needAnnounce = false;
1416
- }
1417
- }
1418
- };
1419
- }
1420
- return {
1421
- open() {
1422
- if (supportsAnsi) {
1423
- process.stderr.write(SHOW_ALTERNATE_SCREEN);
1424
- }
1425
- },
1426
- close() {
1427
- if (supportsAnsi) {
1428
- process.stderr.write(HIDE_ALTERNATE_SCREEN);
1429
- }
1430
- },
1431
- reset(heading) {
1432
- stderr(`${ansiEscapes_1.eraseScreen}${ansiEscapes_1.cursorTo(0, 0)}${heading}`);
1291
+ const CLEAR_SCREEN = '\u001Bc';
1292
+ function getResetScreen(clearScreen) {
1293
+ if (clearScreen) {
1294
+ return (heading) => stderr(CLEAR_SCREEN + heading);
1295
+ }
1296
+ let firstRun = true;
1297
+ return (heading) => {
1298
+ if (firstRun) {
1299
+ stderr(heading);
1300
+ firstRun = false;
1433
1301
  }
1434
1302
  };
1435
1303
  }
@@ -1437,11 +1305,9 @@ function alternateScreen(enabled) {
1437
1305
  function watch(configFile, configs, command, silent = false) {
1438
1306
  const isTTY = Boolean(process.stderr.isTTY);
1439
1307
  const warnings = batchWarnings();
1440
- let processConfigsErr;
1441
1308
  const initialConfigs = processConfigs(configs);
1442
1309
  const clearScreen = initialConfigs.every(config => config.watch.clearScreen !== false);
1443
- const screen = alternateScreen(isTTY && clearScreen);
1444
- screen.open();
1310
+ const resetScreen = getResetScreen(isTTY && clearScreen);
1445
1311
  let watcher;
1446
1312
  let configWatcher;
1447
1313
  function processConfigs(configs) {
@@ -1459,20 +1325,14 @@ function watch(configFile, configs, command, silent = false) {
1459
1325
  code: 'UNKNOWN_OPTION',
1460
1326
  message: merged.optionError
1461
1327
  });
1462
- if (merged.inputOptions.watch &&
1463
- merged.inputOptions.watch.clearScreen === false) {
1464
- processConfigsErr = stderr;
1465
- }
1466
1328
  return result;
1467
1329
  });
1468
1330
  }
1469
1331
  function start(configs) {
1470
- const screenWriter = processConfigsErr || screen.reset;
1471
1332
  watcher = rollup.watch(configs);
1472
1333
  watcher.on('event', (event) => {
1473
1334
  switch (event.code) {
1474
1335
  case 'FATAL':
1475
- screen.close();
1476
1336
  handleError(event.error, true);
1477
1337
  process.exit(1);
1478
1338
  break;
@@ -1482,7 +1342,7 @@ function watch(configFile, configs, command, silent = false) {
1482
1342
  break;
1483
1343
  case 'START':
1484
1344
  if (!silent) {
1485
- screenWriter(turbocolor.underline(`rollup v${rollup.VERSION}`));
1345
+ resetScreen(turbocolor.underline(`rollup v${rollup.VERSION}`));
1486
1346
  }
1487
1347
  break;
1488
1348
  case 'BUNDLE_START':
@@ -1525,7 +1385,6 @@ function watch(configFile, configs, command, silent = false) {
1525
1385
  process.removeListener('uncaughtException', close);
1526
1386
  // removing a non-existent listener is a no-op
1527
1387
  process.stdin.removeListener('end', close);
1528
- screen.close();
1529
1388
  if (watcher)
1530
1389
  watcher.close();
1531
1390
  if (configWatcher)