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/dist/rollup.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*
2
- Rollup.js v0.41.0
3
- Fri Jan 06 2017 17:01:10 GMT-0500 (EST) - commit e4682a3a476452597c7c69e19359f7e10b2275d0
2
+ Rollup.js v0.41.4
3
+ Sat Jan 14 2017 15:42:04 GMT-0500 (EST) - commit 80da8ecf3e377820a5fc7ca6fcff8a273339614c
4
4
 
5
5
 
6
6
  https://github.com/rollup/rollup
@@ -5969,6 +5969,11 @@ function callHasEffects ( scope, callee, isNew ) {
5969
5969
  if ( fnHasEffects( node, isNew && isES5Function( node ) ) ) return true;
5970
5970
  }
5971
5971
 
5972
+ else if ( /Class/.test( node.type ) ) {
5973
+ // TODO find constructor (may belong to a superclass)
5974
+ return true;
5975
+ }
5976
+
5972
5977
  else if ( isReference( node ) ) {
5973
5978
  var flattened = flatten( node );
5974
5979
  var declaration = scope.findDeclaration( flattened.name );
@@ -5990,12 +5995,14 @@ function callHasEffects ( scope, callee, isNew ) {
5990
5995
  }
5991
5996
  }
5992
5997
 
5993
- else {
5994
- if ( !node.gatherPossibleValues ) {
5995
- throw new Error( 'TODO' );
5996
- }
5998
+ else if ( node.gatherPossibleValues ) {
5997
5999
  node.gatherPossibleValues( values );
5998
6000
  }
6001
+
6002
+ else {
6003
+ // probably an error in the user's code — err on side of caution
6004
+ return true;
6005
+ }
5999
6006
  }
6000
6007
 
6001
6008
  return false;
@@ -6962,13 +6969,24 @@ var LogicalExpression = (function (Node) {
6962
6969
  return LogicalExpression;
6963
6970
  }(Node$1));
6964
6971
 
6972
+ var validProp = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;
6973
+
6965
6974
  var Keypath = function Keypath ( node ) {
6966
6975
  var this$1 = this;
6967
6976
 
6968
6977
  this.parts = [];
6969
6978
 
6970
6979
  while ( node.type === 'MemberExpression' ) {
6971
- this$1.parts.unshift( node.property );
6980
+ var prop = node.property;
6981
+
6982
+ if ( node.computed ) {
6983
+ if ( prop.type !== 'Literal' || typeof prop.value !== 'string' || !validProp.test( prop.value ) ) {
6984
+ this$1.computed = true;
6985
+ return;
6986
+ }
6987
+ }
6988
+
6989
+ this$1.parts.unshift( prop );
6972
6990
  node = node.object;
6973
6991
  }
6974
6992
 
@@ -6990,21 +7008,21 @@ var MemberExpression = (function (Node) {
6990
7008
  // if this resolves to a namespaced declaration, prepare
6991
7009
  // to replace it
6992
7010
  // TODO this code is a bit inefficient
6993
- if ( isReference( this ) ) { // TODO optimise namespace access like `foo['bar']` as well
6994
- var keypath = new Keypath( this );
7011
+ var keypath = new Keypath( this );
6995
7012
 
7013
+ if ( !keypath.computed && keypath.root.type === 'Identifier' ) {
6996
7014
  var declaration = scope.findDeclaration( keypath.root.name );
6997
7015
 
6998
7016
  while ( declaration.isNamespace && keypath.parts.length ) {
6999
7017
  var exporterId = declaration.module.id;
7000
7018
 
7001
7019
  var part = keypath.parts[0];
7002
- declaration = declaration.module.traceExport( part.name );
7020
+ declaration = declaration.module.traceExport( part.name || part.value );
7003
7021
 
7004
7022
  if ( !declaration ) {
7005
7023
  this$1.module.warn({
7006
7024
  code: 'MISSING_EXPORT',
7007
- message: ("'" + (part.name) + "' is not exported by '" + (relativeId( exporterId )) + "'"),
7025
+ message: ("'" + (part.name || part.value) + "' is not exported by '" + (relativeId( exporterId )) + "'"),
7008
7026
  url: "https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module"
7009
7027
  }, part.start );
7010
7028
  this$1.replacement = 'undefined';
@@ -8090,6 +8108,12 @@ Module.prototype.trace = function trace ( name ) {
8090
8108
  Module.prototype.traceExport = function traceExport ( name ) {
8091
8109
  var this$1 = this;
8092
8110
 
8111
+ // export * from 'external'
8112
+ if ( name[0] === '*' ) {
8113
+ var module = this.bundle.moduleById.get( name.slice( 1 ) );
8114
+ return module.traceExport( '*' );
8115
+ }
8116
+
8093
8117
  // export { foo } from './other.js'
8094
8118
  var reexportDeclaration = this.reexports[ name ];
8095
8119
  if ( reexportDeclaration ) {
@@ -8117,8 +8141,8 @@ Module.prototype.traceExport = function traceExport ( name ) {
8117
8141
  if ( name === 'default' ) return;
8118
8142
 
8119
8143
  for ( var i = 0; i < this.exportAllModules.length; i += 1 ) {
8120
- var module = this$1.exportAllModules[i];
8121
- var declaration$2 = module.traceExport( name );
8144
+ var module$1 = this$1.exportAllModules[i];
8145
+ var declaration$2 = module$1.traceExport( name );
8122
8146
 
8123
8147
  if ( declaration$2 ) return declaration$2;
8124
8148
  }
@@ -8664,7 +8688,7 @@ function umd ( bundle, magicString, ref, options ) {
8664
8688
  ("(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 + "))");
8665
8689
 
8666
8690
  var wrapperIntro =
8667
- ("(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() );
8691
+ ("(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' );
8668
8692
 
8669
8693
  // var foo__default = 'default' in foo ? foo['default'] : foo;
8670
8694
  var interopBlock = getInteropBlock( bundle, options );
@@ -9796,7 +9820,7 @@ Bundle$$1.prototype.warn = function warn ( warning ) {
9796
9820
  this.onwarn( warning );
9797
9821
  };
9798
9822
 
9799
- var VERSION = '0.41.0';
9823
+ var VERSION = '0.41.4';
9800
9824
 
9801
9825
  var ALLOWED_KEYS = [
9802
9826
  'acorn',