rollup 0.36.0 → 0.36.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 +22 -0
- package/README.md +3 -1
- package/bin/rollup +1 -1
- package/dist/rollup.browser.js +151 -53
- package/dist/rollup.browser.js.map +1 -1
- package/dist/rollup.es.js +151 -53
- package/dist/rollup.es.js.map +1 -1
- package/dist/rollup.js +151 -53
- package/dist/rollup.js.map +1 -1
- package/package.json +1 -1
package/dist/rollup.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Rollup.js v0.36.
|
|
3
|
-
|
|
2
|
+
Rollup.js v0.36.4
|
|
3
|
+
Wed Nov 23 2016 09:01:35 GMT-0500 (EST) - commit fca14dbab102a9fa8efc7249287e2145583712ea
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
@@ -181,9 +181,7 @@ function mapSequence ( array, fn ) {
|
|
|
181
181
|
return promise.then( function () { return results; } );
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
function validateKeys (
|
|
185
|
-
var actualKeys = keys( object );
|
|
186
|
-
|
|
184
|
+
function validateKeys ( actualKeys, allowedKeys ) {
|
|
187
185
|
var i = actualKeys.length;
|
|
188
186
|
|
|
189
187
|
while ( i-- ) {
|
|
@@ -5006,6 +5004,11 @@ function makeLegalIdentifier ( str ) {
|
|
|
5006
5004
|
return str;
|
|
5007
5005
|
}
|
|
5008
5006
|
|
|
5007
|
+
function relativeId ( id ) {
|
|
5008
|
+
if ( typeof process === 'undefined' ) return id;
|
|
5009
|
+
return id.replace( process.cwd(), '' ).replace( /^[\/\\]/, '' );
|
|
5010
|
+
}
|
|
5011
|
+
|
|
5009
5012
|
// properties are for debugging purposes only
|
|
5010
5013
|
var ARRAY = { ARRAY: true, toString: function () { return '[[ARRAY]]'; } };
|
|
5011
5014
|
var NUMBER = { NUMBER: true, toString: function () { return '[[NUMBER]]'; } };
|
|
@@ -5050,7 +5053,7 @@ SyntheticNamespaceDeclaration.prototype.getName = function getName () {
|
|
|
5050
5053
|
return this.name;
|
|
5051
5054
|
};
|
|
5052
5055
|
|
|
5053
|
-
SyntheticNamespaceDeclaration.prototype.renderBlock = function renderBlock ( es, indentString ) {
|
|
5056
|
+
SyntheticNamespaceDeclaration.prototype.renderBlock = function renderBlock ( es, legacy, indentString ) {
|
|
5054
5057
|
var this$1 = this;
|
|
5055
5058
|
|
|
5056
5059
|
var members = keys( this.originals ).map( function (name) {
|
|
@@ -5063,7 +5066,8 @@ SyntheticNamespaceDeclaration.prototype.renderBlock = function renderBlock ( es,
|
|
|
5063
5066
|
return ("" + indentString + name + ": " + (original.getName( es )));
|
|
5064
5067
|
});
|
|
5065
5068
|
|
|
5066
|
-
|
|
5069
|
+
var callee = legacy ? "(Object.freeze || Object)" : "Object.freeze";
|
|
5070
|
+
return ((this.module.bundle.varOrConst) + " " + (this.getName( es )) + " = " + callee + "({\n" + (members.join( ',\n' )) + "\n});\n\n");
|
|
5067
5071
|
};
|
|
5068
5072
|
|
|
5069
5073
|
var ExternalDeclaration = function ExternalDeclaration ( module, name ) {
|
|
@@ -5213,6 +5217,12 @@ Node$1.prototype.initialise = function initialise ( scope ) {
|
|
|
5213
5217
|
this.eachChild( function (child) { return child.initialise( this$1.scope || scope ); } );
|
|
5214
5218
|
};
|
|
5215
5219
|
|
|
5220
|
+
Node$1.prototype.insertSemicolon = function insertSemicolon ( code ) {
|
|
5221
|
+
if ( code.original[ this.end - 1 ] !== ';' ) {
|
|
5222
|
+
code.insertLeft( this.end, ';' );
|
|
5223
|
+
}
|
|
5224
|
+
};
|
|
5225
|
+
|
|
5216
5226
|
Node$1.prototype.locate = function locate () {
|
|
5217
5227
|
// useful for debugging
|
|
5218
5228
|
var location = getLocation( this.module.code, this.start );
|
|
@@ -5281,7 +5291,7 @@ Parameter.prototype.getName = function getName () {
|
|
|
5281
5291
|
};
|
|
5282
5292
|
|
|
5283
5293
|
var Scope = function Scope ( options ) {
|
|
5284
|
-
options
|
|
5294
|
+
if ( options === void 0 ) options = {};
|
|
5285
5295
|
|
|
5286
5296
|
this.parent = options.parent;
|
|
5287
5297
|
this.isBlockScope = !!options.isBlockScope;
|
|
@@ -5656,6 +5666,16 @@ var BlockStatement = (function (Statement) {
|
|
|
5656
5666
|
}
|
|
5657
5667
|
};
|
|
5658
5668
|
|
|
5669
|
+
BlockStatement.prototype.render = function render ( code, es ) {
|
|
5670
|
+
if (this.body.length) {
|
|
5671
|
+
for ( var node of this.body ) {
|
|
5672
|
+
node.render( code, es );
|
|
5673
|
+
}
|
|
5674
|
+
} else {
|
|
5675
|
+
Statement.prototype.render.call(this, code, es);
|
|
5676
|
+
}
|
|
5677
|
+
};
|
|
5678
|
+
|
|
5659
5679
|
return BlockStatement;
|
|
5660
5680
|
}(Statement));
|
|
5661
5681
|
|
|
@@ -5843,7 +5863,9 @@ var CallExpression = (function (Node) {
|
|
|
5843
5863
|
};
|
|
5844
5864
|
|
|
5845
5865
|
CallExpression.prototype.initialise = function initialise ( scope ) {
|
|
5846
|
-
|
|
5866
|
+
if ( isProgramLevel( this ) ) {
|
|
5867
|
+
this.module.bundle.dependentExpressions.push( this );
|
|
5868
|
+
}
|
|
5847
5869
|
Node.prototype.initialise.call( this, scope );
|
|
5848
5870
|
};
|
|
5849
5871
|
|
|
@@ -5854,6 +5876,17 @@ var CallExpression = (function (Node) {
|
|
|
5854
5876
|
return CallExpression;
|
|
5855
5877
|
}(Node$1));
|
|
5856
5878
|
|
|
5879
|
+
function isProgramLevel ( node ) {
|
|
5880
|
+
do {
|
|
5881
|
+
if ( node.type === 'Program' ) {
|
|
5882
|
+
return true;
|
|
5883
|
+
}
|
|
5884
|
+
node = node.parent;
|
|
5885
|
+
} while ( node && !/Function/.test( node.type ) );
|
|
5886
|
+
|
|
5887
|
+
return false;
|
|
5888
|
+
}
|
|
5889
|
+
|
|
5857
5890
|
// TODO is this basically identical to FunctionDeclaration?
|
|
5858
5891
|
var ClassDeclaration = (function (Node) {
|
|
5859
5892
|
function ClassDeclaration () {
|
|
@@ -6110,7 +6143,7 @@ var ExportDefaultDeclaration = (function (Node) {
|
|
|
6110
6143
|
var treeshake = this.module.bundle.treeshake;
|
|
6111
6144
|
var name = this.getName( es );
|
|
6112
6145
|
|
|
6113
|
-
if ( this.shouldInclude ) {
|
|
6146
|
+
if ( this.shouldInclude || this.declaration.activated ) {
|
|
6114
6147
|
if ( this.activated ) {
|
|
6115
6148
|
if ( functionOrClassDeclaration.test( this.declaration.type ) ) {
|
|
6116
6149
|
if ( this.declaration.id ) {
|
|
@@ -6128,6 +6161,8 @@ var ExportDefaultDeclaration = (function (Node) {
|
|
|
6128
6161
|
} else {
|
|
6129
6162
|
code.overwrite( this.start, this.declaration.start, ((this.module.bundle.varOrConst) + " " + name + " = ") );
|
|
6130
6163
|
}
|
|
6164
|
+
|
|
6165
|
+
this.insertSemicolon( code );
|
|
6131
6166
|
}
|
|
6132
6167
|
} else {
|
|
6133
6168
|
// remove `var foo` from `var foo = bar()`, if `foo` is unused
|
|
@@ -6137,7 +6172,7 @@ var ExportDefaultDeclaration = (function (Node) {
|
|
|
6137
6172
|
Node.prototype.render.call( this, code, es );
|
|
6138
6173
|
} else {
|
|
6139
6174
|
if ( treeshake ) {
|
|
6140
|
-
if ( functionOrClassDeclaration.test( this.declaration.type )
|
|
6175
|
+
if ( functionOrClassDeclaration.test( this.declaration.type ) ) {
|
|
6141
6176
|
code.remove( this.leadingCommentStart || this.start, this.next || this.end );
|
|
6142
6177
|
} else {
|
|
6143
6178
|
var hasEffects = this.declaration.hasEffects( this.module.scope );
|
|
@@ -6247,11 +6282,16 @@ var ExportNamedDeclaration = (function (Node) {
|
|
|
6247
6282
|
var ExpressionStatement = (function (Statement) {
|
|
6248
6283
|
function ExpressionStatement () {
|
|
6249
6284
|
Statement.apply(this, arguments);
|
|
6250
|
-
}
|
|
6285
|
+
}
|
|
6286
|
+
|
|
6287
|
+
if ( Statement ) ExpressionStatement.__proto__ = Statement;
|
|
6251
6288
|
ExpressionStatement.prototype = Object.create( Statement && Statement.prototype );
|
|
6252
6289
|
ExpressionStatement.prototype.constructor = ExpressionStatement;
|
|
6253
6290
|
|
|
6254
|
-
|
|
6291
|
+
ExpressionStatement.prototype.render = function render ( code, es ) {
|
|
6292
|
+
Statement.prototype.render.call( this, code, es );
|
|
6293
|
+
if ( this.shouldInclude ) this.insertSemicolon( code );
|
|
6294
|
+
};
|
|
6255
6295
|
|
|
6256
6296
|
return ExpressionStatement;
|
|
6257
6297
|
}(Statement));
|
|
@@ -6514,6 +6554,16 @@ var Identifier = (function (Node) {
|
|
|
6514
6554
|
return Identifier;
|
|
6515
6555
|
}(Node$1));
|
|
6516
6556
|
|
|
6557
|
+
// Statement types which may contain if-statements as direct children.
|
|
6558
|
+
var statementsWithIfStatements = new Set([
|
|
6559
|
+
'DoWhileStatement',
|
|
6560
|
+
'ForInStatement',
|
|
6561
|
+
'ForOfStatement',
|
|
6562
|
+
'ForStatement',
|
|
6563
|
+
'IfStatement',
|
|
6564
|
+
'WhileStatement'
|
|
6565
|
+
]);
|
|
6566
|
+
|
|
6517
6567
|
// TODO DRY this out
|
|
6518
6568
|
var IfStatement = (function (Statement) {
|
|
6519
6569
|
function IfStatement () {
|
|
@@ -6535,7 +6585,9 @@ var IfStatement = (function (Statement) {
|
|
|
6535
6585
|
else if ( this.testValue ) {
|
|
6536
6586
|
this.consequent.initialise( scope );
|
|
6537
6587
|
this.alternate = null;
|
|
6538
|
-
}
|
|
6588
|
+
}
|
|
6589
|
+
|
|
6590
|
+
else {
|
|
6539
6591
|
if ( this.alternate ) this.alternate.initialise( scope );
|
|
6540
6592
|
this.consequent = null;
|
|
6541
6593
|
}
|
|
@@ -6562,9 +6614,18 @@ var IfStatement = (function (Statement) {
|
|
|
6562
6614
|
code.remove( this.start, this.consequent.start );
|
|
6563
6615
|
code.remove( this.consequent.end, this.end );
|
|
6564
6616
|
this.consequent.render( code, es );
|
|
6565
|
-
}
|
|
6617
|
+
}
|
|
6618
|
+
|
|
6619
|
+
else {
|
|
6566
6620
|
code.remove( this.start, this.alternate ? this.alternate.start : this.next || this.end );
|
|
6567
|
-
|
|
6621
|
+
|
|
6622
|
+
if ( this.alternate ) {
|
|
6623
|
+
this.alternate.render( code, es );
|
|
6624
|
+
}
|
|
6625
|
+
|
|
6626
|
+
else if ( statementsWithIfStatements.has( this.parent.type ) ) {
|
|
6627
|
+
code.insertRight( this.start, '{}' );
|
|
6628
|
+
}
|
|
6568
6629
|
}
|
|
6569
6630
|
}
|
|
6570
6631
|
}
|
|
@@ -6792,6 +6853,8 @@ var TemplateLiteral = (function (Node) {
|
|
|
6792
6853
|
return TemplateLiteral;
|
|
6793
6854
|
}(Node$1));
|
|
6794
6855
|
|
|
6856
|
+
var warning = "The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten. See https://github.com/rollup/rollup/wiki/Troubleshooting#this-is-undefined for more information";
|
|
6857
|
+
|
|
6795
6858
|
var ThisExpression = (function (Node) {
|
|
6796
6859
|
function ThisExpression () {
|
|
6797
6860
|
Node.apply(this, arguments);
|
|
@@ -6805,9 +6868,13 @@ var ThisExpression = (function (Node) {
|
|
|
6805
6868
|
var lexicalBoundary = scope.findLexicalBoundary();
|
|
6806
6869
|
|
|
6807
6870
|
if ( lexicalBoundary.isModuleScope ) {
|
|
6808
|
-
this.alias = this.module.
|
|
6871
|
+
this.alias = this.module.context;
|
|
6809
6872
|
if ( this.alias === 'undefined' ) {
|
|
6810
|
-
|
|
6873
|
+
var ref = getLocation( this.module.code, this.start );
|
|
6874
|
+
var line = ref.line;
|
|
6875
|
+
var column = ref.column;
|
|
6876
|
+
var detail = (relativeId( this.module.id )) + " (" + line + ":" + (column + 1) + ")"; // use one-based column number convention
|
|
6877
|
+
this.module.bundle.onwarn( (detail + " " + warning) );
|
|
6811
6878
|
}
|
|
6812
6879
|
}
|
|
6813
6880
|
};
|
|
@@ -7038,7 +7105,7 @@ function getSeparator ( code, start ) {
|
|
|
7038
7105
|
return (";\n" + lineStart);
|
|
7039
7106
|
}
|
|
7040
7107
|
|
|
7041
|
-
var forStatement = /^For(?:Of|In)Statement/;
|
|
7108
|
+
var forStatement = /^For(?:Of|In)?Statement/;
|
|
7042
7109
|
|
|
7043
7110
|
var VariableDeclaration = (function (Node) {
|
|
7044
7111
|
function VariableDeclaration () {
|
|
@@ -7128,9 +7195,16 @@ var VariableDeclaration = (function (Node) {
|
|
|
7128
7195
|
|
|
7129
7196
|
if ( treeshake && empty ) {
|
|
7130
7197
|
code.remove( this.leadingCommentStart || this.start, this.next || this.end );
|
|
7131
|
-
} else
|
|
7132
|
-
|
|
7133
|
-
|
|
7198
|
+
} else {
|
|
7199
|
+
// always include a semi-colon (https://github.com/rollup/rollup/pull/1013),
|
|
7200
|
+
// unless it's a var declaration in a loop head
|
|
7201
|
+
var needsSemicolon = !forStatement.test( this.parent.type );
|
|
7202
|
+
|
|
7203
|
+
if ( this.end > c ) {
|
|
7204
|
+
code.overwrite( c, this.end, needsSemicolon ? ';' : '' );
|
|
7205
|
+
} else if ( needsSemicolon ) {
|
|
7206
|
+
this.insertSemicolon( code );
|
|
7207
|
+
}
|
|
7134
7208
|
}
|
|
7135
7209
|
};
|
|
7136
7210
|
|
|
@@ -7347,6 +7421,7 @@ var Module = function Module (ref) {
|
|
|
7347
7421
|
this.bundle = bundle;
|
|
7348
7422
|
this.id = id;
|
|
7349
7423
|
this.excludeFromSourcemap = /\0/.test( id );
|
|
7424
|
+
this.context = bundle.getModuleContext( id );
|
|
7350
7425
|
|
|
7351
7426
|
// all dependencies
|
|
7352
7427
|
this.sources = [];
|
|
@@ -7495,11 +7570,11 @@ Module.prototype.addImport = function addImport ( node ) {
|
|
|
7495
7570
|
if ( !~this.sources.indexOf( source ) ) this.sources.push( source );
|
|
7496
7571
|
|
|
7497
7572
|
node.specifiers.forEach( function (specifier) {
|
|
7498
|
-
|
|
7573
|
+
var localName = specifier.local.name;
|
|
7499
7574
|
|
|
7500
7575
|
if ( this$1.imports[ localName ] ) {
|
|
7501
7576
|
var err = new Error( ("Duplicated import '" + localName + "'") );
|
|
7502
|
-
|
|
7577
|
+
err.file = this$1.id;
|
|
7503
7578
|
err.loc = getLocation( this$1.code, specifier.start );
|
|
7504
7579
|
throw err;
|
|
7505
7580
|
}
|
|
@@ -7586,18 +7661,18 @@ Module.prototype.findParent = function findParent () {
|
|
|
7586
7661
|
|
|
7587
7662
|
Module.prototype.findScope = function findScope () {
|
|
7588
7663
|
return this.scope;
|
|
7589
|
-
|
|
7664
|
+
};
|
|
7590
7665
|
|
|
7591
|
-
|
|
7592
|
-
|
|
7666
|
+
Module.prototype.getExports = function getExports () {
|
|
7667
|
+
var exports = blank();
|
|
7593
7668
|
|
|
7594
|
-
|
|
7669
|
+
keys( this.exports ).forEach( function (name) {
|
|
7595
7670
|
exports[ name ] = true;
|
|
7596
7671
|
});
|
|
7597
7672
|
|
|
7598
7673
|
keys( this.reexports ).forEach( function (name) {
|
|
7599
|
-
|
|
7600
|
-
|
|
7674
|
+
exports[ name ] = true;
|
|
7675
|
+
});
|
|
7601
7676
|
|
|
7602
7677
|
this.exportAllModules.forEach( function (module) {
|
|
7603
7678
|
if ( module.isExternal ) return; // TODO
|
|
@@ -7618,7 +7693,7 @@ Module.prototype.namespace = function namespace () {
|
|
|
7618
7693
|
return this.declarations['*'];
|
|
7619
7694
|
};
|
|
7620
7695
|
|
|
7621
|
-
Module.prototype.render = function render ( es ) {
|
|
7696
|
+
Module.prototype.render = function render ( es, legacy ) {
|
|
7622
7697
|
var magicString = this.magicString.clone();
|
|
7623
7698
|
|
|
7624
7699
|
for ( var node of this.ast.body ) {
|
|
@@ -7626,7 +7701,7 @@ Module.prototype.render = function render ( es ) {
|
|
|
7626
7701
|
}
|
|
7627
7702
|
|
|
7628
7703
|
if ( this.namespace().needsNamespaceBlock ) {
|
|
7629
|
-
magicString.append( '\n\n' + this.namespace().renderBlock( es, '\t' ) ); // TODO use correct indentation
|
|
7704
|
+
magicString.append( '\n\n' + this.namespace().renderBlock( es, legacy, '\t' ) ); // TODO use correct indentation
|
|
7630
7705
|
}
|
|
7631
7706
|
|
|
7632
7707
|
return magicString.trim();
|
|
@@ -7670,7 +7745,7 @@ Module.prototype.trace = function trace ( name ) {
|
|
|
7670
7745
|
|
|
7671
7746
|
var declaration = otherModule.traceExport( importDeclaration.name );
|
|
7672
7747
|
|
|
7673
|
-
if ( !declaration ) throw new Error( ("
|
|
7748
|
+
if ( !declaration ) throw new Error( ("'" + (importDeclaration.name) + "' is not exported by " + (relativeId( otherModule.id )) + " (imported by " + (relativeId( this.id )) + "). For help fixing this error see https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module") );
|
|
7674
7749
|
return declaration;
|
|
7675
7750
|
}
|
|
7676
7751
|
|
|
@@ -8173,7 +8248,11 @@ function badExports ( option, keys ) {
|
|
|
8173
8248
|
throw new Error( ("'" + option + "' was specified for options.exports, but entry module has following exports: " + (keys.join(', '))) );
|
|
8174
8249
|
}
|
|
8175
8250
|
|
|
8176
|
-
function getExportMode ( bundle,
|
|
8251
|
+
function getExportMode ( bundle, ref ) {
|
|
8252
|
+
var exportMode = ref.exports;
|
|
8253
|
+
var moduleName = ref.moduleName;
|
|
8254
|
+
var format = ref.format;
|
|
8255
|
+
|
|
8177
8256
|
var exportKeys = keys( bundle.entryModule.exports )
|
|
8178
8257
|
.concat( keys( bundle.entryModule.reexports ) )
|
|
8179
8258
|
.concat( bundle.entryModule.exportAllSources ); // not keys, but makes our job easier this way
|
|
@@ -8192,7 +8271,7 @@ function getExportMode ( bundle, exportMode, moduleName ) {
|
|
|
8192
8271
|
} else if ( exportKeys.length === 1 && exportKeys[0] === 'default' ) {
|
|
8193
8272
|
exportMode = 'default';
|
|
8194
8273
|
} else {
|
|
8195
|
-
if ( bundle.entryModule.exports.default ) {
|
|
8274
|
+
if ( bundle.entryModule.exports.default && format !== 'es') {
|
|
8196
8275
|
bundle.onwarn( ("Using named and default exports together. Consumers of your bundle will have to use " + (moduleName || 'bundle') + "['default'] to access the default export, which may not be what you want. Use `exports: 'named'` to disable this warning. See https://github.com/rollup/rollup/wiki/JavaScript-API#exports for more information") );
|
|
8197
8276
|
}
|
|
8198
8277
|
exportMode = 'named';
|
|
@@ -8530,11 +8609,10 @@ var Bundle = function Bundle ( options ) {
|
|
|
8530
8609
|
|
|
8531
8610
|
this.plugins = ensureArray( options.plugins );
|
|
8532
8611
|
|
|
8533
|
-
this.plugins.
|
|
8534
|
-
if ( plugin.options )
|
|
8535
|
-
|
|
8536
|
-
|
|
8537
|
-
});
|
|
8612
|
+
options = this.plugins.reduce( function ( acc, plugin ) {
|
|
8613
|
+
if ( plugin.options ) return plugin.options( acc ) || acc;
|
|
8614
|
+
return acc;
|
|
8615
|
+
}, options);
|
|
8538
8616
|
|
|
8539
8617
|
this.entry = options.entry;
|
|
8540
8618
|
this.entryId = null;
|
|
@@ -8572,6 +8650,18 @@ var Bundle = function Bundle ( options ) {
|
|
|
8572
8650
|
|
|
8573
8651
|
this.context = String( options.context );
|
|
8574
8652
|
|
|
8653
|
+
if ( typeof options.moduleContext === 'function' ) {
|
|
8654
|
+
this.getModuleContext = function (id) { return options.moduleContext( id ) || this$1.context; };
|
|
8655
|
+
} else if ( typeof options.moduleContext === 'object' ) {
|
|
8656
|
+
var moduleContext = new Map();
|
|
8657
|
+
Object.keys( options.moduleContext ).forEach( function (key) {
|
|
8658
|
+
moduleContext.set( resolve( key ), options.moduleContext[ key ] );
|
|
8659
|
+
});
|
|
8660
|
+
this.getModuleContext = function (id) { return moduleContext.get( id ) || this$1.context; };
|
|
8661
|
+
} else {
|
|
8662
|
+
this.getModuleContext = function () { return this$1.context; };
|
|
8663
|
+
}
|
|
8664
|
+
|
|
8575
8665
|
if ( typeof options.external === 'function' ) {
|
|
8576
8666
|
this.isExternal = options.external;
|
|
8577
8667
|
} else {
|
|
@@ -8582,6 +8672,7 @@ var Bundle = function Bundle ( options ) {
|
|
|
8582
8672
|
this.onwarn = options.onwarn || makeOnwarn();
|
|
8583
8673
|
|
|
8584
8674
|
this.varOrConst = options.preferConst ? 'const' : 'var';
|
|
8675
|
+
this.legacy = options.legacy;
|
|
8585
8676
|
this.acornOptions = options.acorn || {};
|
|
8586
8677
|
|
|
8587
8678
|
this.dependentExpressions = [];
|
|
@@ -8777,7 +8868,7 @@ Bundle.prototype.fetchModule = function fetchModule ( id, importer ) {
|
|
|
8777
8868
|
});
|
|
8778
8869
|
|
|
8779
8870
|
this$1.modules.push( module );
|
|
8780
|
-
|
|
8871
|
+
this$1.moduleById.set( id, module );
|
|
8781
8872
|
|
|
8782
8873
|
return this$1.fetchAllDependencies( module ).then( function () {
|
|
8783
8874
|
keys( module.exports ).forEach( function (name) {
|
|
@@ -8852,6 +8943,7 @@ Bundle.prototype.getPathRelativeToEntryDirname = function getPathRelativeToEntry
|
|
|
8852
8943
|
};
|
|
8853
8944
|
|
|
8854
8945
|
Bundle.prototype.render = function render ( options ) {
|
|
8946
|
+
var this$1 = this;
|
|
8855
8947
|
if ( options === void 0 ) options = {};
|
|
8856
8948
|
|
|
8857
8949
|
if ( options.format === 'es6' ) {
|
|
@@ -8862,7 +8954,7 @@ Bundle.prototype.render = function render ( options ) {
|
|
|
8862
8954
|
var format = options.format || 'es';
|
|
8863
8955
|
|
|
8864
8956
|
// Determine export mode - 'default', 'named', 'none'
|
|
8865
|
-
var exportMode = getExportMode( this, options
|
|
8957
|
+
var exportMode = getExportMode( this, options );
|
|
8866
8958
|
|
|
8867
8959
|
var magicString = new Bundle$1({ separator: '\n\n' });
|
|
8868
8960
|
var usedModules = [];
|
|
@@ -8870,7 +8962,7 @@ Bundle.prototype.render = function render ( options ) {
|
|
|
8870
8962
|
timeStart( 'render modules' );
|
|
8871
8963
|
|
|
8872
8964
|
this.orderedModules.forEach( function (module) {
|
|
8873
|
-
var source = module.render( format === 'es' );
|
|
8965
|
+
var source = module.render( format === 'es', this$1.legacy );
|
|
8874
8966
|
|
|
8875
8967
|
if ( source.toString().length ) {
|
|
8876
8968
|
magicString.addSource( source );
|
|
@@ -8947,7 +9039,7 @@ Bundle.prototype.render = function render ( options ) {
|
|
|
8947
9039
|
return { code: code, map: map };
|
|
8948
9040
|
};
|
|
8949
9041
|
|
|
8950
|
-
Bundle.prototype.sort = function sort () {
|
|
9042
|
+
Bundle.prototype.sort = function sort () {
|
|
8951
9043
|
var this$1 = this;
|
|
8952
9044
|
|
|
8953
9045
|
var hasCycles;
|
|
@@ -9015,7 +9107,7 @@ Bundle.prototype.sort = function sort () {
|
|
|
9015
9107
|
visited[ module.id ] = true;
|
|
9016
9108
|
for ( var i = 0; i < module.dependencies.length; i += 1 ) {
|
|
9017
9109
|
var dependency = module.dependencies[i];
|
|
9018
|
-
|
|
9110
|
+
if ( !visited[ dependency.id ] && findParent( dependency ) ) return true;
|
|
9019
9111
|
}
|
|
9020
9112
|
};
|
|
9021
9113
|
|
|
@@ -9034,7 +9126,7 @@ Bundle.prototype.sort = function sort () {
|
|
|
9034
9126
|
return ordered;
|
|
9035
9127
|
};
|
|
9036
9128
|
|
|
9037
|
-
var VERSION = '0.36.
|
|
9129
|
+
var VERSION = '0.36.4';
|
|
9038
9130
|
|
|
9039
9131
|
var ALLOWED_KEYS = [
|
|
9040
9132
|
'acorn',
|
|
@@ -9051,6 +9143,8 @@ var ALLOWED_KEYS = [
|
|
|
9051
9143
|
'indent',
|
|
9052
9144
|
'interop',
|
|
9053
9145
|
'intro',
|
|
9146
|
+
'legacy',
|
|
9147
|
+
'moduleContext',
|
|
9054
9148
|
'moduleId',
|
|
9055
9149
|
'moduleName',
|
|
9056
9150
|
'noConflict',
|
|
@@ -9066,20 +9160,24 @@ var ALLOWED_KEYS = [
|
|
|
9066
9160
|
'useStrict'
|
|
9067
9161
|
];
|
|
9068
9162
|
|
|
9069
|
-
function
|
|
9163
|
+
function checkOptions ( options ) {
|
|
9070
9164
|
if ( !options || !options.entry ) {
|
|
9071
|
-
return
|
|
9165
|
+
return new Error( 'You must supply options.entry to rollup' );
|
|
9072
9166
|
}
|
|
9073
9167
|
|
|
9074
9168
|
if ( options.transform || options.load || options.resolveId || options.resolveExternal ) {
|
|
9075
|
-
return
|
|
9169
|
+
return new Error( 'The `transform`, `load`, `resolveId` and `resolveExternal` options are deprecated in favour of a unified plugin API. See https://github.com/rollup/rollup/wiki/Plugins for details' );
|
|
9076
9170
|
}
|
|
9077
9171
|
|
|
9078
|
-
var error = validateKeys( options, ALLOWED_KEYS );
|
|
9172
|
+
var error = validateKeys( keys(options), ALLOWED_KEYS );
|
|
9173
|
+
if ( error ) return error;
|
|
9079
9174
|
|
|
9080
|
-
|
|
9081
|
-
|
|
9082
|
-
|
|
9175
|
+
return null;
|
|
9176
|
+
}
|
|
9177
|
+
|
|
9178
|
+
function rollup ( options ) {
|
|
9179
|
+
var error = checkOptions ( options );
|
|
9180
|
+
if ( error ) return Promise.reject( error );
|
|
9083
9181
|
|
|
9084
9182
|
var bundle = new Bundle( options );
|
|
9085
9183
|
|