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.es.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
@@ -5966,6 +5966,11 @@ function callHasEffects ( scope, callee, isNew ) {
5966
5966
  if ( fnHasEffects( node, isNew && isES5Function( node ) ) ) return true;
5967
5967
  }
5968
5968
 
5969
+ else if ( /Class/.test( node.type ) ) {
5970
+ // TODO find constructor (may belong to a superclass)
5971
+ return true;
5972
+ }
5973
+
5969
5974
  else if ( isReference( node ) ) {
5970
5975
  var flattened = flatten( node );
5971
5976
  var declaration = scope.findDeclaration( flattened.name );
@@ -5987,12 +5992,14 @@ function callHasEffects ( scope, callee, isNew ) {
5987
5992
  }
5988
5993
  }
5989
5994
 
5990
- else {
5991
- if ( !node.gatherPossibleValues ) {
5992
- throw new Error( 'TODO' );
5993
- }
5995
+ else if ( node.gatherPossibleValues ) {
5994
5996
  node.gatherPossibleValues( values );
5995
5997
  }
5998
+
5999
+ else {
6000
+ // probably an error in the user's code — err on side of caution
6001
+ return true;
6002
+ }
5996
6003
  }
5997
6004
 
5998
6005
  return false;
@@ -6959,13 +6966,24 @@ var LogicalExpression = (function (Node) {
6959
6966
  return LogicalExpression;
6960
6967
  }(Node$1));
6961
6968
 
6969
+ var validProp = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;
6970
+
6962
6971
  var Keypath = function Keypath ( node ) {
6963
6972
  var this$1 = this;
6964
6973
 
6965
6974
  this.parts = [];
6966
6975
 
6967
6976
  while ( node.type === 'MemberExpression' ) {
6968
- this$1.parts.unshift( node.property );
6977
+ var prop = node.property;
6978
+
6979
+ if ( node.computed ) {
6980
+ if ( prop.type !== 'Literal' || typeof prop.value !== 'string' || !validProp.test( prop.value ) ) {
6981
+ this$1.computed = true;
6982
+ return;
6983
+ }
6984
+ }
6985
+
6986
+ this$1.parts.unshift( prop );
6969
6987
  node = node.object;
6970
6988
  }
6971
6989
 
@@ -6987,21 +7005,21 @@ var MemberExpression = (function (Node) {
6987
7005
  // if this resolves to a namespaced declaration, prepare
6988
7006
  // to replace it
6989
7007
  // TODO this code is a bit inefficient
6990
- if ( isReference( this ) ) { // TODO optimise namespace access like `foo['bar']` as well
6991
- var keypath = new Keypath( this );
7008
+ var keypath = new Keypath( this );
6992
7009
 
7010
+ if ( !keypath.computed && keypath.root.type === 'Identifier' ) {
6993
7011
  var declaration = scope.findDeclaration( keypath.root.name );
6994
7012
 
6995
7013
  while ( declaration.isNamespace && keypath.parts.length ) {
6996
7014
  var exporterId = declaration.module.id;
6997
7015
 
6998
7016
  var part = keypath.parts[0];
6999
- declaration = declaration.module.traceExport( part.name );
7017
+ declaration = declaration.module.traceExport( part.name || part.value );
7000
7018
 
7001
7019
  if ( !declaration ) {
7002
7020
  this$1.module.warn({
7003
7021
  code: 'MISSING_EXPORT',
7004
- message: ("'" + (part.name) + "' is not exported by '" + (relativeId( exporterId )) + "'"),
7022
+ message: ("'" + (part.name || part.value) + "' is not exported by '" + (relativeId( exporterId )) + "'"),
7005
7023
  url: "https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module"
7006
7024
  }, part.start );
7007
7025
  this$1.replacement = 'undefined';
@@ -8087,6 +8105,12 @@ Module.prototype.trace = function trace ( name ) {
8087
8105
  Module.prototype.traceExport = function traceExport ( name ) {
8088
8106
  var this$1 = this;
8089
8107
 
8108
+ // export * from 'external'
8109
+ if ( name[0] === '*' ) {
8110
+ var module = this.bundle.moduleById.get( name.slice( 1 ) );
8111
+ return module.traceExport( '*' );
8112
+ }
8113
+
8090
8114
  // export { foo } from './other.js'
8091
8115
  var reexportDeclaration = this.reexports[ name ];
8092
8116
  if ( reexportDeclaration ) {
@@ -8114,8 +8138,8 @@ Module.prototype.traceExport = function traceExport ( name ) {
8114
8138
  if ( name === 'default' ) return;
8115
8139
 
8116
8140
  for ( var i = 0; i < this.exportAllModules.length; i += 1 ) {
8117
- var module = this$1.exportAllModules[i];
8118
- var declaration$2 = module.traceExport( name );
8141
+ var module$1 = this$1.exportAllModules[i];
8142
+ var declaration$2 = module$1.traceExport( name );
8119
8143
 
8120
8144
  if ( declaration$2 ) return declaration$2;
8121
8145
  }
@@ -8661,7 +8685,7 @@ function umd ( bundle, magicString, ref, options ) {
8661
8685
  ("(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 + "))");
8662
8686
 
8663
8687
  var wrapperIntro =
8664
- ("(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() );
8688
+ ("(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' );
8665
8689
 
8666
8690
  // var foo__default = 'default' in foo ? foo['default'] : foo;
8667
8691
  var interopBlock = getInteropBlock( bundle, options );
@@ -9793,7 +9817,7 @@ Bundle$$1.prototype.warn = function warn ( warning ) {
9793
9817
  this.onwarn( warning );
9794
9818
  };
9795
9819
 
9796
- var VERSION = '0.41.0';
9820
+ var VERSION = '0.41.4';
9797
9821
 
9798
9822
  var ALLOWED_KEYS = [
9799
9823
  'acorn',