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.es.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
@@ -5992,12 +5992,14 @@ function callHasEffects ( scope, callee, isNew ) {
5992
5992
  }
5993
5993
  }
5994
5994
 
5995
- else {
5996
- if ( !node.gatherPossibleValues ) {
5997
- throw new Error( 'TODO' );
5998
- }
5995
+ else if ( node.gatherPossibleValues ) {
5999
5996
  node.gatherPossibleValues( values );
6000
5997
  }
5998
+
5999
+ else {
6000
+ // probably an error in the user's code — err on side of caution
6001
+ return true;
6002
+ }
6001
6003
  }
6002
6004
 
6003
6005
  return false;
@@ -6208,10 +6210,18 @@ var ConditionalExpression = (function (Node) {
6208
6210
  else if ( this.testValue ) {
6209
6211
  code.remove( this.start, this.consequent.start );
6210
6212
  code.remove( this.consequent.end, this.end );
6213
+ if ( this.consequent.type === 'SequenceExpression' ) {
6214
+ code.insertRight( this.consequent.start, '(' );
6215
+ code.insertLeft( this.consequent.end, ')' );
6216
+ }
6211
6217
  this.consequent.render( code, es );
6212
6218
  } else {
6213
6219
  code.remove( this.start, this.alternate.start );
6214
6220
  code.remove( this.alternate.end, this.end );
6221
+ if ( this.alternate.type === 'SequenceExpression' ) {
6222
+ code.insertRight( this.alternate.start, '(' );
6223
+ code.insertLeft( this.alternate.end, ')' );
6224
+ }
6215
6225
  this.alternate.render( code, es );
6216
6226
  }
6217
6227
  }
@@ -6381,6 +6391,8 @@ var ExportDefaultDeclaration = (function (Node) {
6381
6391
  var hasEffects = this.declaration.hasEffects( this.module.scope );
6382
6392
  code.remove( this.start, hasEffects ? declaration_start : this.next || this.end );
6383
6393
  }
6394
+ } else if (name === this.declaration.name) {
6395
+ code.remove( this.start, this.next || this.end );
6384
6396
  } else {
6385
6397
  code.overwrite( this.start, declaration_start, ((this.module.bundle.varOrConst) + " " + name + " = ") );
6386
6398
  }
@@ -7005,7 +7017,7 @@ var MemberExpression = (function (Node) {
7005
7017
  // TODO this code is a bit inefficient
7006
7018
  var keypath = new Keypath( this );
7007
7019
 
7008
- if ( !keypath.computed ) {
7020
+ if ( !keypath.computed && keypath.root.type === 'Identifier' ) {
7009
7021
  var declaration = scope.findDeclaration( keypath.root.name );
7010
7022
 
7011
7023
  while ( declaration.isNamespace && keypath.parts.length ) {
@@ -8064,6 +8076,7 @@ Module.prototype.toJSON = function toJSON () {
8064
8076
  dependencies: this.dependencies.map( function (module) { return module.id; } ),
8065
8077
  code: this.code,
8066
8078
  originalCode: this.originalCode,
8079
+ originalSourceMap: this.originalSourceMap,
8067
8080
  ast: this.astClone,
8068
8081
  sourceMapChain: this.sourceMapChain,
8069
8082
  resolvedIds: this.resolvedIds
@@ -8077,8 +8090,8 @@ Module.prototype.trace = function trace ( name ) {
8077
8090
  }
8078
8091
 
8079
8092
  if ( name in this.imports ) {
8080
- var importDeclaration = this.imports[ name ];
8081
- var otherModule = importDeclaration.module;
8093
+ var importDeclaration = this.imports[ name ];
8094
+ var otherModule = importDeclaration.module;
8082
8095
 
8083
8096
  if ( importDeclaration.name === '*' && !otherModule.isExternal ) {
8084
8097
  return otherModule.namespace();
@@ -8103,6 +8116,12 @@ Module.prototype.trace = function trace ( name ) {
8103
8116
  Module.prototype.traceExport = function traceExport ( name ) {
8104
8117
  var this$1 = this;
8105
8118
 
8119
+ // export * from 'external'
8120
+ if ( name[0] === '*' ) {
8121
+ var module = this.bundle.moduleById.get( name.slice( 1 ) );
8122
+ return module.traceExport( '*' );
8123
+ }
8124
+
8106
8125
  // export { foo } from './other.js'
8107
8126
  var reexportDeclaration = this.reexports[ name ];
8108
8127
  if ( reexportDeclaration ) {
@@ -8130,8 +8149,8 @@ Module.prototype.traceExport = function traceExport ( name ) {
8130
8149
  if ( name === 'default' ) return;
8131
8150
 
8132
8151
  for ( var i = 0; i < this.exportAllModules.length; i += 1 ) {
8133
- var module = this$1.exportAllModules[i];
8134
- var declaration$2 = module.traceExport( name );
8152
+ var module$1 = this$1.exportAllModules[i];
8153
+ var declaration$2 = module$1.traceExport( name );
8135
8154
 
8136
8155
  if ( declaration$2 ) return declaration$2;
8137
8156
  }
@@ -8984,6 +9003,9 @@ Link.prototype.traceMappings = function traceMappings () {
8984
9003
 
8985
9004
  line.forEach( function (segment) {
8986
9005
  var source = this$1.sources[ segment[1] ];
9006
+
9007
+ if ( !source ) return;
9008
+
8987
9009
  var traced = source.traceSegment( segment[2], segment[3], this$1.names[ segment[4] ] );
8988
9010
 
8989
9011
  if ( traced ) {
@@ -9483,7 +9505,9 @@ Bundle$$1.prototype.fetchModule = function fetchModule ( id, importer ) {
9483
9505
 
9484
9506
  return this$1.fetchAllDependencies( module ).then( function () {
9485
9507
  keys( module.exports ).forEach( function (name) {
9486
- module.exportsAll[name] = module.id;
9508
+ if ( name !== 'default' ) {
9509
+ module.exportsAll[name] = module.id;
9510
+ }
9487
9511
  });
9488
9512
  module.exportAllSources.forEach( function (source) {
9489
9513
  var id = module.resolvedIds[ source ];
@@ -9494,10 +9518,11 @@ Bundle$$1.prototype.fetchModule = function fetchModule ( id, importer ) {
9494
9518
  if ( name in module.exportsAll ) {
9495
9519
  this$1.warn({
9496
9520
  code: 'NAMESPACE_CONFLICT',
9497
- message: ("Conflicting namespaces: " + (relativeId( module.id )) + " re-exports '" + name + "' from both " + (relativeId( module.exportsAll[ name ] )) + " (will be ignored) and " + (relativeId( exportAllModule.exportsAll[ name ] )))
9521
+ message: ("Conflicting namespaces: " + (relativeId( module.id )) + " re-exports '" + name + "' from both " + (relativeId( module.exportsAll[ name ] )) + " and " + (relativeId( exportAllModule.exportsAll[ name ] )) + " (will be ignored)")
9498
9522
  });
9523
+ } else {
9524
+ module.exportsAll[ name ] = exportAllModule.exportsAll[ name ];
9499
9525
  }
9500
- module.exportsAll[ name ] = exportAllModule.exportsAll[ name ];
9501
9526
  });
9502
9527
  });
9503
9528
  return module;
@@ -9634,7 +9659,7 @@ Bundle$$1.prototype.render = function render ( options ) {
9634
9659
  .filter( Boolean )
9635
9660
  .join( '\n\n' );
9636
9661
 
9637
- if ( intro ) intro += '\n\n';
9662
+ if ( intro ) intro += '\n\n';
9638
9663
 
9639
9664
  var outro = [ options.outro ]
9640
9665
  .concat(
@@ -9645,12 +9670,12 @@ Bundle$$1.prototype.render = function render ( options ) {
9645
9670
 
9646
9671
  if ( outro ) outro = "\n\n" + outro;
9647
9672
 
9648
- var indentString = getIndentString( magicString, options );
9673
+ var indentString = getIndentString( magicString, options );
9649
9674
 
9650
- var finalise = finalisers[ options.format ];
9675
+ var finalise = finalisers[ options.format ];
9651
9676
  if ( !finalise ) {
9652
- error({
9653
- code: 'INVALID_OPTION',
9677
+ error({
9678
+ code: 'INVALID_OPTION',
9654
9679
  message: ("You must specify an output type - valid options are " + (keys( finalisers ).join( ', ' )))
9655
9680
  });
9656
9681
  }
@@ -9761,7 +9786,7 @@ Bundle$$1.prototype.sort = function sort () {
9761
9786
  var b = ordered[i];
9762
9787
 
9763
9788
  // TODO reinstate this! it no longer works
9764
- if ( stronglyDependsOn[ a.id ][ b.id ] ) {
9789
+ if ( stronglyDependsOn[ a.id ][ b.id ] ) {
9765
9790
  // somewhere, there is a module that imports b before a. Because
9766
9791
  // b imports a, a is placed before b. We need to find the module
9767
9792
  // in question, so we can provide a useful error message
@@ -9782,7 +9807,7 @@ Bundle$$1.prototype.sort = function sort () {
9782
9807
 
9783
9808
  findParent( this$1.entryModule );
9784
9809
 
9785
- this$1.onwarn(
9810
+ this$1.onwarn(
9786
9811
  ("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")
9787
9812
  );
9788
9813
  }
@@ -9809,7 +9834,7 @@ Bundle$$1.prototype.warn = function warn ( warning ) {
9809
9834
  this.onwarn( warning );
9810
9835
  };
9811
9836
 
9812
- var VERSION = '0.41.2';
9837
+ var VERSION = '0.41.6';
9813
9838
 
9814
9839
  var ALLOWED_KEYS = [
9815
9840
  'acorn',