rollup 0.41.2 → 0.41.6

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.2
3
- Fri Jan 13 2017 14:29:19 GMT-0500 (EST) - commit e2d9b6bb059a881068b574b2af407ee40ff999cf
2
+ Rollup.js v0.41.6
3
+ Thu Mar 16 2017 00:50:25 GMT-0400 (EDT) - commit a96a923d631b9d2c471137542b9c4f578b8faa53
4
4
 
5
5
 
6
6
  https://github.com/rollup/rollup
@@ -5995,12 +5995,14 @@ function callHasEffects ( scope, callee, isNew ) {
5995
5995
  }
5996
5996
  }
5997
5997
 
5998
- else {
5999
- if ( !node.gatherPossibleValues ) {
6000
- throw new Error( 'TODO' );
6001
- }
5998
+ else if ( node.gatherPossibleValues ) {
6002
5999
  node.gatherPossibleValues( values );
6003
6000
  }
6001
+
6002
+ else {
6003
+ // probably an error in the user's code — err on side of caution
6004
+ return true;
6005
+ }
6004
6006
  }
6005
6007
 
6006
6008
  return false;
@@ -6211,10 +6213,18 @@ var ConditionalExpression = (function (Node) {
6211
6213
  else if ( this.testValue ) {
6212
6214
  code.remove( this.start, this.consequent.start );
6213
6215
  code.remove( this.consequent.end, this.end );
6216
+ if ( this.consequent.type === 'SequenceExpression' ) {
6217
+ code.insertRight( this.consequent.start, '(' );
6218
+ code.insertLeft( this.consequent.end, ')' );
6219
+ }
6214
6220
  this.consequent.render( code, es );
6215
6221
  } else {
6216
6222
  code.remove( this.start, this.alternate.start );
6217
6223
  code.remove( this.alternate.end, this.end );
6224
+ if ( this.alternate.type === 'SequenceExpression' ) {
6225
+ code.insertRight( this.alternate.start, '(' );
6226
+ code.insertLeft( this.alternate.end, ')' );
6227
+ }
6218
6228
  this.alternate.render( code, es );
6219
6229
  }
6220
6230
  }
@@ -6384,6 +6394,8 @@ var ExportDefaultDeclaration = (function (Node) {
6384
6394
  var hasEffects = this.declaration.hasEffects( this.module.scope );
6385
6395
  code.remove( this.start, hasEffects ? declaration_start : this.next || this.end );
6386
6396
  }
6397
+ } else if (name === this.declaration.name) {
6398
+ code.remove( this.start, this.next || this.end );
6387
6399
  } else {
6388
6400
  code.overwrite( this.start, declaration_start, ((this.module.bundle.varOrConst) + " " + name + " = ") );
6389
6401
  }
@@ -7008,7 +7020,7 @@ var MemberExpression = (function (Node) {
7008
7020
  // TODO this code is a bit inefficient
7009
7021
  var keypath = new Keypath( this );
7010
7022
 
7011
- if ( !keypath.computed ) {
7023
+ if ( !keypath.computed && keypath.root.type === 'Identifier' ) {
7012
7024
  var declaration = scope.findDeclaration( keypath.root.name );
7013
7025
 
7014
7026
  while ( declaration.isNamespace && keypath.parts.length ) {
@@ -8067,6 +8079,7 @@ Module.prototype.toJSON = function toJSON () {
8067
8079
  dependencies: this.dependencies.map( function (module) { return module.id; } ),
8068
8080
  code: this.code,
8069
8081
  originalCode: this.originalCode,
8082
+ originalSourceMap: this.originalSourceMap,
8070
8083
  ast: this.astClone,
8071
8084
  sourceMapChain: this.sourceMapChain,
8072
8085
  resolvedIds: this.resolvedIds
@@ -8080,8 +8093,8 @@ Module.prototype.trace = function trace ( name ) {
8080
8093
  }
8081
8094
 
8082
8095
  if ( name in this.imports ) {
8083
- var importDeclaration = this.imports[ name ];
8084
- var otherModule = importDeclaration.module;
8096
+ var importDeclaration = this.imports[ name ];
8097
+ var otherModule = importDeclaration.module;
8085
8098
 
8086
8099
  if ( importDeclaration.name === '*' && !otherModule.isExternal ) {
8087
8100
  return otherModule.namespace();
@@ -8106,6 +8119,12 @@ Module.prototype.trace = function trace ( name ) {
8106
8119
  Module.prototype.traceExport = function traceExport ( name ) {
8107
8120
  var this$1 = this;
8108
8121
 
8122
+ // export * from 'external'
8123
+ if ( name[0] === '*' ) {
8124
+ var module = this.bundle.moduleById.get( name.slice( 1 ) );
8125
+ return module.traceExport( '*' );
8126
+ }
8127
+
8109
8128
  // export { foo } from './other.js'
8110
8129
  var reexportDeclaration = this.reexports[ name ];
8111
8130
  if ( reexportDeclaration ) {
@@ -8133,8 +8152,8 @@ Module.prototype.traceExport = function traceExport ( name ) {
8133
8152
  if ( name === 'default' ) return;
8134
8153
 
8135
8154
  for ( var i = 0; i < this.exportAllModules.length; i += 1 ) {
8136
- var module = this$1.exportAllModules[i];
8137
- var declaration$2 = module.traceExport( name );
8155
+ var module$1 = this$1.exportAllModules[i];
8156
+ var declaration$2 = module$1.traceExport( name );
8138
8157
 
8139
8158
  if ( declaration$2 ) return declaration$2;
8140
8159
  }
@@ -8987,6 +9006,9 @@ Link.prototype.traceMappings = function traceMappings () {
8987
9006
 
8988
9007
  line.forEach( function (segment) {
8989
9008
  var source = this$1.sources[ segment[1] ];
9009
+
9010
+ if ( !source ) return;
9011
+
8990
9012
  var traced = source.traceSegment( segment[2], segment[3], this$1.names[ segment[4] ] );
8991
9013
 
8992
9014
  if ( traced ) {
@@ -9486,7 +9508,9 @@ Bundle$$1.prototype.fetchModule = function fetchModule ( id, importer ) {
9486
9508
 
9487
9509
  return this$1.fetchAllDependencies( module ).then( function () {
9488
9510
  keys( module.exports ).forEach( function (name) {
9489
- module.exportsAll[name] = module.id;
9511
+ if ( name !== 'default' ) {
9512
+ module.exportsAll[name] = module.id;
9513
+ }
9490
9514
  });
9491
9515
  module.exportAllSources.forEach( function (source) {
9492
9516
  var id = module.resolvedIds[ source ];
@@ -9497,10 +9521,11 @@ Bundle$$1.prototype.fetchModule = function fetchModule ( id, importer ) {
9497
9521
  if ( name in module.exportsAll ) {
9498
9522
  this$1.warn({
9499
9523
  code: 'NAMESPACE_CONFLICT',
9500
- message: ("Conflicting namespaces: " + (relativeId( module.id )) + " re-exports '" + name + "' from both " + (relativeId( module.exportsAll[ name ] )) + " (will be ignored) and " + (relativeId( exportAllModule.exportsAll[ name ] )))
9524
+ message: ("Conflicting namespaces: " + (relativeId( module.id )) + " re-exports '" + name + "' from both " + (relativeId( module.exportsAll[ name ] )) + " and " + (relativeId( exportAllModule.exportsAll[ name ] )) + " (will be ignored)")
9501
9525
  });
9526
+ } else {
9527
+ module.exportsAll[ name ] = exportAllModule.exportsAll[ name ];
9502
9528
  }
9503
- module.exportsAll[ name ] = exportAllModule.exportsAll[ name ];
9504
9529
  });
9505
9530
  });
9506
9531
  return module;
@@ -9637,7 +9662,7 @@ Bundle$$1.prototype.render = function render ( options ) {
9637
9662
  .filter( Boolean )
9638
9663
  .join( '\n\n' );
9639
9664
 
9640
- if ( intro ) intro += '\n\n';
9665
+ if ( intro ) intro += '\n\n';
9641
9666
 
9642
9667
  var outro = [ options.outro ]
9643
9668
  .concat(
@@ -9648,12 +9673,12 @@ Bundle$$1.prototype.render = function render ( options ) {
9648
9673
 
9649
9674
  if ( outro ) outro = "\n\n" + outro;
9650
9675
 
9651
- var indentString = getIndentString( magicString, options );
9676
+ var indentString = getIndentString( magicString, options );
9652
9677
 
9653
- var finalise = finalisers[ options.format ];
9678
+ var finalise = finalisers[ options.format ];
9654
9679
  if ( !finalise ) {
9655
- error({
9656
- code: 'INVALID_OPTION',
9680
+ error({
9681
+ code: 'INVALID_OPTION',
9657
9682
  message: ("You must specify an output type - valid options are " + (keys( finalisers ).join( ', ' )))
9658
9683
  });
9659
9684
  }
@@ -9764,7 +9789,7 @@ Bundle$$1.prototype.sort = function sort () {
9764
9789
  var b = ordered[i];
9765
9790
 
9766
9791
  // TODO reinstate this! it no longer works
9767
- if ( stronglyDependsOn[ a.id ][ b.id ] ) {
9792
+ if ( stronglyDependsOn[ a.id ][ b.id ] ) {
9768
9793
  // somewhere, there is a module that imports b before a. Because
9769
9794
  // b imports a, a is placed before b. We need to find the module
9770
9795
  // in question, so we can provide a useful error message
@@ -9785,7 +9810,7 @@ Bundle$$1.prototype.sort = function sort () {
9785
9810
 
9786
9811
  findParent( this$1.entryModule );
9787
9812
 
9788
- this$1.onwarn(
9813
+ this$1.onwarn(
9789
9814
  ("Module " + (a.id) + " may be unable to evaluate without " + (b.id) + ", but is included first due to a cyclical dependency. Consider swapping the import statements in " + parent + " to ensure correct ordering")
9790
9815
  );
9791
9816
  }
@@ -9812,7 +9837,7 @@ Bundle$$1.prototype.warn = function warn ( warning ) {
9812
9837
  this.onwarn( warning );
9813
9838
  };
9814
9839
 
9815
- var VERSION = '0.41.2';
9840
+ var VERSION = '0.41.6';
9816
9841
 
9817
9842
  var ALLOWED_KEYS = [
9818
9843
  'acorn',