rollup 0.41.0 → 0.41.4

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,8 +1,26 @@
1
1
  # rollup changelog
2
2
 
3
+ ## 0.41.4
4
+
5
+ * Fix cases of multiple `export * from 'external'` declarations ([#1252](https://github.com/rollup/rollup/issues/1252))
6
+ * Fix 'TODO' error message ([#1257](https://github.com/rollup/rollup/issues/1257))
7
+
8
+ ## 0.41.3
9
+
10
+ * Don't treat `this.foo` as possible namespace ([#1258](https://github.com/rollup/rollup/issues/1258))
11
+
12
+ ## 0.41.2
13
+
14
+ * Optimize `namespace['foo']` references ([#1240](https://github.com/rollup/rollup/pull/1240))
15
+
16
+ ## 0.41.1
17
+
18
+ * Include `new` expressions where callee is a class with side-effects ([#980](https://github.com/rollup/rollup/issues/980) [#1233](https://github.com/rollup/rollup/issues/1233))
19
+
3
20
  ## 0.41.0
4
21
 
5
22
  * Add `this.warn(...)` and `this.error(...)` methods to plugin `transform` hook contexts ([#1140](https://github.com/rollup/rollup/issues/1140))
23
+ * `throw` always considered to be a side effect ([#1227](https://github.com/rollup/rollup/pull/1227))
6
24
 
7
25
  ## 0.40.2
8
26
 
package/bin/rollup CHANGED
@@ -245,9 +245,9 @@ function isNumber (x) {
245
245
  return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
246
246
  }
247
247
 
248
- var help = "rollup version __VERSION__\n=====================================\n\nUsage: rollup [options] <entry file>\n\nBasic options:\n\n-v, --version Show version number\n-h, --help Show this help message\n-c, --config Use this config file (if argument is used but value\n is unspecified, defaults to rollup.config.js)\n-w, --watch Watch files in bundle and rebuild on changes\n-i, --input Input (alternative to <entry file>)\n-o, --output <output> Output (if absent, prints to stdout)\n-f, --format [es] Type of output (amd, cjs, es, iife, umd)\n-e, --external Comma-separate list of module IDs to exclude\n-g, --globals Comma-separate list of `module ID:Global` pairs\n Any module IDs defined here are added to external\n-n, --name Name for UMD export\n-u, --id ID for AMD module (default is anonymous)\n-m, --sourcemap Generate sourcemap (`-m inline` for inline map)\n--no-strict Don't emit a `\"use strict\";` in the generated modules.\n--no-indent Don't indent result\n--environment <values> Settings passed to config file (see example)\n--no-conflict Generate a noConflict method for UMD globals\n--intro Content to insert at top of bundle (inside wrapper)\n--outro Content to insert at end of bundle (inside wrapper)\n--banner Content to insert at top of bundle (outside wrapper)\n--footer Content to insert at end of bundle (outside wrapper)\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 --output=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://github.com/rollup/rollup/wiki\n";
248
+ var help = "rollup version __VERSION__\n=====================================\n\nUsage: rollup [options] <entry file>\n\nBasic options:\n\n-v, --version Show version number\n-h, --help Show this help message\n-c, --config Use this config file (if argument is used but value\n is unspecified, defaults to rollup.config.js)\n-w, --watch Watch files in bundle and rebuild on changes\n-i, --input Input (alternative to <entry file>)\n-o, --output <output> Output (if absent, prints to stdout)\n-f, --format [es] Type of output (amd, cjs, es, iife, umd)\n-e, --external Comma-separate list of module IDs to exclude\n-g, --globals Comma-separate list of `module ID:Global` pairs\n Any module IDs defined here are added to external\n-n, --name Name for UMD export\n-u, --id ID for AMD module (default is anonymous)\n-m, --sourcemap Generate sourcemap (`-m inline` for inline map)\n--no-strict Don't emit a `\"use strict\";` in the generated modules.\n--no-indent Don't indent result\n--environment <values> Settings passed to config file (see example)\n--no-conflict Generate a noConflict method for UMD globals\n--silent Don't print warnings\n--intro Content to insert at top of bundle (inside wrapper)\n--outro Content to insert at end of bundle (inside wrapper)\n--banner Content to insert at top of bundle (outside wrapper)\n--footer Content to insert at end of bundle (outside wrapper)\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 --output=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://github.com/rollup/rollup/wiki\n";
249
249
 
250
- var version = "0.41.0";
250
+ var version = "0.41.4";
251
251
 
252
252
  var path$1 = path__default;
253
253
  var Module = module$1;
@@ -747,6 +747,10 @@ function execute ( options, command ) {
747
747
  external = ( optionsExternal || [] ).concat( commandExternal );
748
748
  }
749
749
 
750
+ if ( command.silent ) {
751
+ options.onwarn = function () {};
752
+ }
753
+
750
754
  if ( !options.onwarn ) {
751
755
  var seen = new Set();
752
756
 
@@ -1,6 +1,6 @@
1
1
  /*
2
- Rollup.js v0.41.0
3
- Fri Jan 06 2017 17:01:19 GMT-0500 (EST) - commit e4682a3a476452597c7c69e19359f7e10b2275d0
2
+ Rollup.js v0.41.4
3
+ Sat Jan 14 2017 15:42:17 GMT-0500 (EST) - commit 80da8ecf3e377820a5fc7ca6fcff8a273339614c
4
4
 
5
5
 
6
6
  https://github.com/rollup/rollup
@@ -6021,6 +6021,11 @@ function callHasEffects ( scope, callee, isNew ) {
6021
6021
  if ( fnHasEffects( node, isNew && isES5Function( node ) ) ) return true;
6022
6022
  }
6023
6023
 
6024
+ else if ( /Class/.test( node.type ) ) {
6025
+ // TODO find constructor (may belong to a superclass)
6026
+ return true;
6027
+ }
6028
+
6024
6029
  else if ( isReference( node ) ) {
6025
6030
  var flattened = flatten( node );
6026
6031
  var declaration = scope.findDeclaration( flattened.name );
@@ -6042,12 +6047,14 @@ function callHasEffects ( scope, callee, isNew ) {
6042
6047
  }
6043
6048
  }
6044
6049
 
6045
- else {
6046
- if ( !node.gatherPossibleValues ) {
6047
- throw new Error( 'TODO' );
6048
- }
6050
+ else if ( node.gatherPossibleValues ) {
6049
6051
  node.gatherPossibleValues( values );
6050
6052
  }
6053
+
6054
+ else {
6055
+ // probably an error in the user's code — err on side of caution
6056
+ return true;
6057
+ }
6051
6058
  }
6052
6059
 
6053
6060
  return false;
@@ -7014,13 +7021,24 @@ var LogicalExpression = (function (Node) {
7014
7021
  return LogicalExpression;
7015
7022
  }(Node$1));
7016
7023
 
7024
+ var validProp = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;
7025
+
7017
7026
  var Keypath = function Keypath ( node ) {
7018
7027
  var this$1 = this;
7019
7028
 
7020
7029
  this.parts = [];
7021
7030
 
7022
7031
  while ( node.type === 'MemberExpression' ) {
7023
- this$1.parts.unshift( node.property );
7032
+ var prop = node.property;
7033
+
7034
+ if ( node.computed ) {
7035
+ if ( prop.type !== 'Literal' || typeof prop.value !== 'string' || !validProp.test( prop.value ) ) {
7036
+ this$1.computed = true;
7037
+ return;
7038
+ }
7039
+ }
7040
+
7041
+ this$1.parts.unshift( prop );
7024
7042
  node = node.object;
7025
7043
  }
7026
7044
 
@@ -7042,21 +7060,21 @@ var MemberExpression = (function (Node) {
7042
7060
  // if this resolves to a namespaced declaration, prepare
7043
7061
  // to replace it
7044
7062
  // TODO this code is a bit inefficient
7045
- if ( isReference( this ) ) { // TODO optimise namespace access like `foo['bar']` as well
7046
- var keypath = new Keypath( this );
7063
+ var keypath = new Keypath( this );
7047
7064
 
7065
+ if ( !keypath.computed && keypath.root.type === 'Identifier' ) {
7048
7066
  var declaration = scope.findDeclaration( keypath.root.name );
7049
7067
 
7050
7068
  while ( declaration.isNamespace && keypath.parts.length ) {
7051
7069
  var exporterId = declaration.module.id;
7052
7070
 
7053
7071
  var part = keypath.parts[0];
7054
- declaration = declaration.module.traceExport( part.name );
7072
+ declaration = declaration.module.traceExport( part.name || part.value );
7055
7073
 
7056
7074
  if ( !declaration ) {
7057
7075
  this$1.module.warn({
7058
7076
  code: 'MISSING_EXPORT',
7059
- message: ("'" + (part.name) + "' is not exported by '" + (relativeId( exporterId )) + "'"),
7077
+ message: ("'" + (part.name || part.value) + "' is not exported by '" + (relativeId( exporterId )) + "'"),
7060
7078
  url: "https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module"
7061
7079
  }, part.start );
7062
7080
  this$1.replacement = 'undefined';
@@ -8142,6 +8160,12 @@ Module.prototype.trace = function trace ( name ) {
8142
8160
  Module.prototype.traceExport = function traceExport ( name ) {
8143
8161
  var this$1 = this;
8144
8162
 
8163
+ // export * from 'external'
8164
+ if ( name[0] === '*' ) {
8165
+ var module = this.bundle.moduleById.get( name.slice( 1 ) );
8166
+ return module.traceExport( '*' );
8167
+ }
8168
+
8145
8169
  // export { foo } from './other.js'
8146
8170
  var reexportDeclaration = this.reexports[ name ];
8147
8171
  if ( reexportDeclaration ) {
@@ -8169,8 +8193,8 @@ Module.prototype.traceExport = function traceExport ( name ) {
8169
8193
  if ( name === 'default' ) return;
8170
8194
 
8171
8195
  for ( var i = 0; i < this.exportAllModules.length; i += 1 ) {
8172
- var module = this$1.exportAllModules[i];
8173
- var declaration$2 = module.traceExport( name );
8196
+ var module$1 = this$1.exportAllModules[i];
8197
+ var declaration$2 = module$1.traceExport( name );
8174
8198
 
8175
8199
  if ( declaration$2 ) return declaration$2;
8176
8200
  }
@@ -8716,7 +8740,7 @@ function umd ( bundle, magicString, ref, options ) {
8716
8740
  ("(function() {\n\t\t\t\tvar current = " + (globalProp(options.moduleName)) + ";\n\t\t\t\tvar exports = factory(" + globalDeps + ");\n\t\t\t\t" + (globalProp(options.moduleName)) + " = exports;\n\t\t\t\texports.noConflict = function() { " + (globalProp(options.moduleName)) + " = current; return exports; };\n\t\t\t})()") : ("(" + defaultExport + "factory(" + globalDeps + "))");
8717
8741
 
8718
8742
  var wrapperIntro =
8719
- ("(function (global, factory) {\n\t\t\ttypeof exports === 'object' && typeof module !== 'undefined' ? " + cjsExport + "factory(" + (cjsDeps.join( ', ' )) + ") :\n\t\t\ttypeof define === 'function' && define.amd ? define(" + amdParams + "factory) :\n\t\t\t" + globalExport + ";\n\t\t}(this, (function (" + args + ") {" + useStrict + "\n\n\t\t").replace( /^\t\t/gm, '' ).replace( /^\t/gm, magicString.getIndentString() );
8743
+ ("(function (global, factory) {\n\t\t\ttypeof exports === 'object' && typeof module !== 'undefined' ? " + cjsExport + "factory(" + (cjsDeps.join( ', ' )) + ") :\n\t\t\ttypeof define === 'function' && define.amd ? define(" + amdParams + "factory) :\n\t\t\t" + globalExport + ";\n\t\t}(this, (function (" + args + ") {" + useStrict + "\n\n\t\t").replace( /^\t\t/gm, '' ).replace( /^\t/gm, indentString || '\t' );
8720
8744
 
8721
8745
  // var foo__default = 'default' in foo ? foo['default'] : foo;
8722
8746
  var interopBlock = getInteropBlock( bundle, options );
@@ -9848,7 +9872,7 @@ Bundle$$1.prototype.warn = function warn ( warning ) {
9848
9872
  this.onwarn( warning );
9849
9873
  };
9850
9874
 
9851
- var VERSION = '0.41.0';
9875
+ var VERSION = '0.41.4';
9852
9876
 
9853
9877
  var ALLOWED_KEYS = [
9854
9878
  'acorn',