rollup 0.43.1 → 0.45.2
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 +19 -0
- package/LICENSE.md +1 -1
- package/bin/rollup +16 -9
- package/dist/rollup.browser.js +264 -169
- package/dist/rollup.browser.js.map +1 -1
- package/dist/rollup.es.js +264 -169
- package/dist/rollup.es.js.map +1 -1
- package/dist/rollup.js +264 -169
- package/dist/rollup.js.map +1 -1
- package/package.json +3 -5
package/dist/rollup.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Rollup.js v0.
|
|
3
|
-
|
|
2
|
+
Rollup.js v0.45.2
|
|
3
|
+
Wed Jul 12 2017 22:24:48 GMT-0400 (EDT) - commit b7a4edf2b7c26f58c8201a63c820541d9b37186d
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
@@ -5445,13 +5445,26 @@ var builtins = 'Infinity NaN undefined null true false eval uneval isFinite isNa
|
|
|
5445
5445
|
var blacklisted = blank();
|
|
5446
5446
|
reservedWords$1.concat( builtins ).forEach( function (word) { return blacklisted[ word ] = true; } );
|
|
5447
5447
|
|
|
5448
|
+
var illegalCharacters = /[^$_a-zA-Z0-9]/g;
|
|
5448
5449
|
|
|
5449
|
-
function
|
|
5450
|
+
var startsWithDigit = function (str) { return /\d/.test( str[0] ); };
|
|
5451
|
+
|
|
5452
|
+
function isLegal ( str ) {
|
|
5453
|
+
if ( startsWithDigit(str) || blacklisted[ str ] ) {
|
|
5454
|
+
return false;
|
|
5455
|
+
}
|
|
5456
|
+
if ( illegalCharacters.test(str) ) {
|
|
5457
|
+
return false;
|
|
5458
|
+
}
|
|
5459
|
+
return true;
|
|
5460
|
+
}
|
|
5461
|
+
|
|
5462
|
+
function makeLegal ( str ) {
|
|
5450
5463
|
str = str
|
|
5451
5464
|
.replace( /-(\w)/g, function ( _, letter ) { return letter.toUpperCase(); } )
|
|
5452
|
-
.replace(
|
|
5465
|
+
.replace( illegalCharacters, '_' );
|
|
5453
5466
|
|
|
5454
|
-
if (
|
|
5467
|
+
if ( startsWithDigit(str) || blacklisted[ str ] ) { str = "_" + str; }
|
|
5455
5468
|
|
|
5456
5469
|
return str;
|
|
5457
5470
|
}
|
|
@@ -5534,7 +5547,7 @@ Declaration.prototype.addReference = function addReference ( reference ) {
|
|
|
5534
5547
|
reference.declaration = this;
|
|
5535
5548
|
|
|
5536
5549
|
if ( reference.name !== this.name ) {
|
|
5537
|
-
this.name =
|
|
5550
|
+
this.name = makeLegal( reference.name ); // TODO handle differences of opinion
|
|
5538
5551
|
}
|
|
5539
5552
|
|
|
5540
5553
|
if ( reference.isReassignment ) { this.isReassigned = true; }
|
|
@@ -6462,6 +6475,25 @@ var CallExpression = (function (Node) {
|
|
|
6462
6475
|
return CallExpression;
|
|
6463
6476
|
}(Node$1));
|
|
6464
6477
|
|
|
6478
|
+
var CatchClause = (function (Node) {
|
|
6479
|
+
function CatchClause () {
|
|
6480
|
+
Node.apply(this, arguments);
|
|
6481
|
+
}
|
|
6482
|
+
|
|
6483
|
+
if ( Node ) CatchClause.__proto__ = Node;
|
|
6484
|
+
CatchClause.prototype = Object.create( Node && Node.prototype );
|
|
6485
|
+
CatchClause.prototype.constructor = CatchClause;
|
|
6486
|
+
|
|
6487
|
+
CatchClause.prototype.initialise = function initialise ( scope ) {
|
|
6488
|
+
this.body.createScope( scope );
|
|
6489
|
+
this.scope = this.body.scope;
|
|
6490
|
+
|
|
6491
|
+
this.body.initialise( this.scope );
|
|
6492
|
+
};
|
|
6493
|
+
|
|
6494
|
+
return CatchClause;
|
|
6495
|
+
}(Node$1));
|
|
6496
|
+
|
|
6465
6497
|
// TODO is this basically identical to FunctionDeclaration?
|
|
6466
6498
|
var ClassDeclaration = (function (Node) {
|
|
6467
6499
|
function ClassDeclaration () {
|
|
@@ -7907,6 +7939,7 @@ var nodes = {
|
|
|
7907
7939
|
BinaryExpression: BinaryExpression,
|
|
7908
7940
|
BlockStatement: BlockStatement,
|
|
7909
7941
|
CallExpression: CallExpression,
|
|
7942
|
+
CatchClause: CatchClause,
|
|
7910
7943
|
ClassDeclaration: ClassDeclaration,
|
|
7911
7944
|
ClassExpression: ClassExpression,
|
|
7912
7945
|
ConditionalExpression: ConditionalExpression,
|
|
@@ -8113,6 +8146,7 @@ var Module = function Module (ref) {
|
|
|
8113
8146
|
var ast = ref.ast;
|
|
8114
8147
|
var sourceMapChain = ref.sourceMapChain;
|
|
8115
8148
|
var resolvedIds = ref.resolvedIds;
|
|
8149
|
+
var resolvedExternalIds = ref.resolvedExternalIds;
|
|
8116
8150
|
var bundle = ref.bundle;
|
|
8117
8151
|
|
|
8118
8152
|
this.code = code;
|
|
@@ -8145,6 +8179,7 @@ var Module = function Module (ref) {
|
|
|
8145
8179
|
this.sources = [];
|
|
8146
8180
|
this.dependencies = [];
|
|
8147
8181
|
this.resolvedIds = resolvedIds || blank();
|
|
8182
|
+
this.resolvedExternalIds = resolvedExternalIds || blank();
|
|
8148
8183
|
|
|
8149
8184
|
// imports and exports, indexed by local name
|
|
8150
8185
|
this.imports = blank();
|
|
@@ -8339,7 +8374,7 @@ Module.prototype.basename = function basename$1 () {
|
|
|
8339
8374
|
var base = path.basename( this.id );
|
|
8340
8375
|
var ext = path.extname( this.id );
|
|
8341
8376
|
|
|
8342
|
-
return
|
|
8377
|
+
return makeLegal( ext ? base.slice( 0, -ext.length ) : base );
|
|
8343
8378
|
};
|
|
8344
8379
|
|
|
8345
8380
|
Module.prototype.bindImportSpecifiers = function bindImportSpecifiers () {
|
|
@@ -8349,21 +8384,23 @@ Module.prototype.bindImportSpecifiers = function bindImportSpecifiers () {
|
|
|
8349
8384
|
keys( specifiers ).forEach( function (name) {
|
|
8350
8385
|
var specifier = specifiers[ name ];
|
|
8351
8386
|
|
|
8352
|
-
var id = this$1.resolvedIds[ specifier.source ];
|
|
8387
|
+
var id = this$1.resolvedIds[ specifier.source ] || this$1.resolvedExternalIds[ specifier.source ];
|
|
8353
8388
|
specifier.module = this$1.bundle.moduleById.get( id );
|
|
8354
8389
|
});
|
|
8355
8390
|
});
|
|
8356
8391
|
|
|
8357
8392
|
this.exportAllModules = this.exportAllSources.map( function (source) {
|
|
8358
|
-
var id = this$1.resolvedIds[ source ];
|
|
8393
|
+
var id = this$1.resolvedIds[ source ] || this$1.resolvedExternalIds[ source ];
|
|
8359
8394
|
return this$1.bundle.moduleById.get( id );
|
|
8360
8395
|
});
|
|
8361
8396
|
|
|
8362
8397
|
this.sources.forEach( function (source) {
|
|
8363
8398
|
var id = this$1.resolvedIds[ source ];
|
|
8364
|
-
var module = this$1.bundle.moduleById.get( id );
|
|
8365
8399
|
|
|
8366
|
-
if (
|
|
8400
|
+
if ( id ) {
|
|
8401
|
+
var module = this$1.bundle.moduleById.get( id );
|
|
8402
|
+
this$1.dependencies.push( module );
|
|
8403
|
+
}
|
|
8367
8404
|
});
|
|
8368
8405
|
};
|
|
8369
8406
|
|
|
@@ -8474,7 +8511,8 @@ Module.prototype.toJSON = function toJSON () {
|
|
|
8474
8511
|
originalSourceMap: this.originalSourceMap,
|
|
8475
8512
|
ast: this.astClone,
|
|
8476
8513
|
sourceMapChain: this.sourceMapChain,
|
|
8477
|
-
resolvedIds: this.resolvedIds
|
|
8514
|
+
resolvedIds: this.resolvedIds,
|
|
8515
|
+
resolvedExternalIds: this.resolvedExternalIds
|
|
8478
8516
|
};
|
|
8479
8517
|
};
|
|
8480
8518
|
|
|
@@ -8570,7 +8608,7 @@ var ExternalModule = function ExternalModule ( id, relativePath ) {
|
|
|
8570
8608
|
this.id = id;
|
|
8571
8609
|
this.path = relativePath;
|
|
8572
8610
|
|
|
8573
|
-
this.name =
|
|
8611
|
+
this.name = makeLegal( relativePath );
|
|
8574
8612
|
|
|
8575
8613
|
this.nameSuggestions = blank();
|
|
8576
8614
|
this.mostCommonSuggestion = 0;
|
|
@@ -8626,7 +8664,7 @@ function getInteropBlock ( bundle, options ) {
|
|
|
8626
8664
|
return ((bundle.varOrConst) + " " + (module.name) + "__default = 'default' in " + (module.name) + " ? " + (module.name) + "['default'] : " + (module.name) + ";");
|
|
8627
8665
|
}
|
|
8628
8666
|
|
|
8629
|
-
return ((module.name) + " = " + (module.name) + " &&
|
|
8667
|
+
return ((module.name) + " = " + (module.name) + " && " + (module.name) + ".hasOwnProperty('default') ? " + (module.name) + "['default'] : " + (module.name) + ";");
|
|
8630
8668
|
})
|
|
8631
8669
|
.filter( Boolean )
|
|
8632
8670
|
.join( '\n' );
|
|
@@ -8982,8 +9020,17 @@ function iife ( bundle, magicString, ref, options ) {
|
|
|
8982
9020
|
|
|
8983
9021
|
var globalNameMaker = getGlobalNameMaker( options.globals || blank(), bundle, 'null' );
|
|
8984
9022
|
|
|
9023
|
+
var extend = options.extend;
|
|
8985
9024
|
var name = options.moduleName;
|
|
8986
|
-
var isNamespaced = name &&
|
|
9025
|
+
var isNamespaced = name && name.indexOf( '.' ) !== -1;
|
|
9026
|
+
var possibleVariableAssignment = !extend && !isNamespaced;
|
|
9027
|
+
|
|
9028
|
+
if ( name && possibleVariableAssignment && !isLegal(name) ) {
|
|
9029
|
+
error({
|
|
9030
|
+
code: 'ILLEGAL_IDENTIFIER_AS_NAME',
|
|
9031
|
+
message: ("Given moduleName (" + name + ") is not legal JS identifier. If you need this you can try --extend option")
|
|
9032
|
+
});
|
|
9033
|
+
}
|
|
8987
9034
|
|
|
8988
9035
|
warnOnBuiltins( bundle );
|
|
8989
9036
|
|
|
@@ -8998,17 +9045,19 @@ function iife ( bundle, magicString, ref, options ) {
|
|
|
8998
9045
|
});
|
|
8999
9046
|
}
|
|
9000
9047
|
|
|
9001
|
-
if (
|
|
9048
|
+
if ( extend ) {
|
|
9002
9049
|
dependencies.unshift( ("(" + (thisProp(name)) + " = " + (thisProp(name)) + " || {})") );
|
|
9003
9050
|
args.unshift( 'exports' );
|
|
9051
|
+
} else if ( exportMode === 'named' ) {
|
|
9052
|
+
dependencies.unshift( '{}' );
|
|
9053
|
+
args.unshift( 'exports' );
|
|
9004
9054
|
}
|
|
9005
9055
|
|
|
9006
9056
|
var useStrict = options.useStrict !== false ? (indentString + "'use strict';\n\n") : "";
|
|
9007
9057
|
|
|
9008
9058
|
var wrapperIntro = "(function (" + args + ") {\n" + useStrict;
|
|
9009
|
-
var wrapperOutro = "\n\n}(" + dependencies + "));";
|
|
9010
9059
|
|
|
9011
|
-
if ( exportMode
|
|
9060
|
+
if ( exportMode !== 'none' && !extend) {
|
|
9012
9061
|
wrapperIntro = ( isNamespaced ? thisProp(name) : ((bundle.varOrConst) + " " + name) ) + " = " + wrapperIntro;
|
|
9013
9062
|
}
|
|
9014
9063
|
|
|
@@ -9016,6 +9065,12 @@ function iife ( bundle, magicString, ref, options ) {
|
|
|
9016
9065
|
wrapperIntro = setupNamespace( name ) + wrapperIntro;
|
|
9017
9066
|
}
|
|
9018
9067
|
|
|
9068
|
+
var wrapperOutro = "\n\n}(" + dependencies + "));";
|
|
9069
|
+
|
|
9070
|
+
if (possibleVariableAssignment && exportMode === 'named') {
|
|
9071
|
+
wrapperOutro = "\n\n" + indentString + "return exports;" + wrapperOutro;
|
|
9072
|
+
}
|
|
9073
|
+
|
|
9019
9074
|
// var foo__default = 'default' in foo ? foo['default'] : foo;
|
|
9020
9075
|
var interopBlock = getInteropBlock( bundle, options );
|
|
9021
9076
|
if ( interopBlock ) { magicString.prepend( interopBlock + '\n\n' ); }
|
|
@@ -9048,6 +9103,15 @@ function setupNamespace$1 ( name ) {
|
|
|
9048
9103
|
.join( ', ' );
|
|
9049
9104
|
}
|
|
9050
9105
|
|
|
9106
|
+
function safeAccess ( name ) {
|
|
9107
|
+
var parts = name.split( '.' );
|
|
9108
|
+
|
|
9109
|
+
var acc = 'global';
|
|
9110
|
+
return parts
|
|
9111
|
+
.map( function (part) { return ( acc += property( part ), acc ); } )
|
|
9112
|
+
.join( " && " );
|
|
9113
|
+
}
|
|
9114
|
+
|
|
9051
9115
|
var wrapperOutro = '\n\n})));';
|
|
9052
9116
|
|
|
9053
9117
|
function umd ( bundle, magicString, ref, options ) {
|
|
@@ -9077,7 +9141,7 @@ function umd ( bundle, magicString, ref, options ) {
|
|
|
9077
9141
|
if ( exportMode === 'named' ) {
|
|
9078
9142
|
amdDeps.unshift( "'exports'" );
|
|
9079
9143
|
cjsDeps.unshift( "exports" );
|
|
9080
|
-
globalDeps.unshift( ("(" + (setupNamespace$1(options.moduleName)) + " = " + (globalProp(options.moduleName)) + " || {})") );
|
|
9144
|
+
globalDeps.unshift( ("(" + (setupNamespace$1(options.moduleName)) + " = " + (options.extend ? ((globalProp(options.moduleName)) + " || ") : '') + "{})") );
|
|
9081
9145
|
|
|
9082
9146
|
args.unshift( 'exports' );
|
|
9083
9147
|
}
|
|
@@ -9095,8 +9159,21 @@ function umd ( bundle, magicString, ref, options ) {
|
|
|
9095
9159
|
|
|
9096
9160
|
var useStrict = options.useStrict !== false ? " 'use strict';" : "";
|
|
9097
9161
|
|
|
9098
|
-
var globalExport
|
|
9099
|
-
|
|
9162
|
+
var globalExport;
|
|
9163
|
+
|
|
9164
|
+
if (options.noConflict === true) {
|
|
9165
|
+
var factory;
|
|
9166
|
+
|
|
9167
|
+
if ( exportMode === 'default' ) {
|
|
9168
|
+
factory = "var exports = factory(" + globalDeps + ");";
|
|
9169
|
+
} else if ( exportMode === 'named' ) {
|
|
9170
|
+
var module = globalDeps.shift();
|
|
9171
|
+
factory = "var exports = " + module + ";\n\t\t\t\tfactory(" + (['exports'].concat(globalDeps)) + ");";
|
|
9172
|
+
}
|
|
9173
|
+
globalExport = "(function() {\n\t\t\t\tvar current = " + (safeAccess(options.moduleName)) + ";\n\t\t\t\t" + factory + "\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})()";
|
|
9174
|
+
} else {
|
|
9175
|
+
globalExport = "(" + defaultExport + "factory(" + globalDeps + "))";
|
|
9176
|
+
}
|
|
9100
9177
|
|
|
9101
9178
|
var wrapperIntro =
|
|
9102
9179
|
("(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' );
|
|
@@ -9351,39 +9428,40 @@ function transform ( bundle, source, id, plugins ) {
|
|
|
9351
9428
|
}
|
|
9352
9429
|
|
|
9353
9430
|
function transformBundle ( code, plugins, sourceMapChain, options ) {
|
|
9354
|
-
return plugins.reduce( function (
|
|
9355
|
-
if ( !plugin.transformBundle ) { return
|
|
9356
|
-
|
|
9357
|
-
|
|
9358
|
-
|
|
9359
|
-
|
|
9360
|
-
|
|
9361
|
-
|
|
9362
|
-
|
|
9363
|
-
|
|
9364
|
-
|
|
9365
|
-
|
|
9366
|
-
|
|
9367
|
-
|
|
9368
|
-
|
|
9369
|
-
if ( result == null ) { return code; }
|
|
9431
|
+
return plugins.reduce( function ( promise, plugin ) {
|
|
9432
|
+
if ( !plugin.transformBundle ) { return promise; }
|
|
9433
|
+
|
|
9434
|
+
return promise.then( function (code) {
|
|
9435
|
+
return Promise.resolve().then( function () {
|
|
9436
|
+
return plugin.transformBundle( code, { format : options.format } );
|
|
9437
|
+
}).then( function (result) {
|
|
9438
|
+
if ( result == null ) { return code; }
|
|
9439
|
+
|
|
9440
|
+
if ( typeof result === 'string' ) {
|
|
9441
|
+
result = {
|
|
9442
|
+
code: result,
|
|
9443
|
+
map: null
|
|
9444
|
+
};
|
|
9445
|
+
}
|
|
9370
9446
|
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
|
|
9374
|
-
|
|
9375
|
-
};
|
|
9376
|
-
}
|
|
9447
|
+
var map = typeof result.map === 'string' ? JSON.parse( result.map ) : result.map;
|
|
9448
|
+
if ( map && typeof map.mappings === 'string' ) {
|
|
9449
|
+
map.mappings = decode$$1( map.mappings );
|
|
9450
|
+
}
|
|
9377
9451
|
|
|
9378
|
-
|
|
9379
|
-
if ( map && typeof map.mappings === 'string' ) {
|
|
9380
|
-
map.mappings = decode$$1( map.mappings );
|
|
9381
|
-
}
|
|
9452
|
+
sourceMapChain.push( map );
|
|
9382
9453
|
|
|
9383
|
-
|
|
9454
|
+
return result.code;
|
|
9455
|
+
}).catch( function (err) {
|
|
9456
|
+
error({
|
|
9457
|
+
code: 'BAD_BUNDLE_TRANSFORMER',
|
|
9458
|
+
message: ("Error transforming bundle" + (plugin.name ? (" with '" + (plugin.name) + "' plugin") : '') + ": " + (err.message)),
|
|
9459
|
+
plugin: plugin.name
|
|
9460
|
+
});
|
|
9461
|
+
});
|
|
9462
|
+
});
|
|
9384
9463
|
|
|
9385
|
-
|
|
9386
|
-
}, code );
|
|
9464
|
+
}, Promise.resolve( code ) );
|
|
9387
9465
|
}
|
|
9388
9466
|
|
|
9389
9467
|
var Source = function Source ( filename, content ) {
|
|
@@ -9950,7 +10028,7 @@ Bundle.prototype.fetchModule = function fetchModule ( id, importer ) {
|
|
|
9950
10028
|
}
|
|
9951
10029
|
});
|
|
9952
10030
|
module.exportAllSources.forEach( function (source) {
|
|
9953
|
-
var id = module.resolvedIds[ source ];
|
|
10031
|
+
var id = module.resolvedIds[ source ] || module.resolvedExternalIds[ source ];
|
|
9954
10032
|
var exportAllModule = this$1.moduleById.get( id );
|
|
9955
10033
|
if ( exportAllModule.isExternal ) { return; }
|
|
9956
10034
|
|
|
@@ -10000,7 +10078,7 @@ Bundle.prototype.fetchAllDependencies = function fetchAllDependencies ( module )
|
|
|
10000
10078
|
}
|
|
10001
10079
|
|
|
10002
10080
|
if ( isExternal ) {
|
|
10003
|
-
module.
|
|
10081
|
+
module.resolvedExternalIds[ source ] = externalId;
|
|
10004
10082
|
|
|
10005
10083
|
if ( !this$1.moduleById.has( externalId ) ) {
|
|
10006
10084
|
var module$1 = new ExternalModule( externalId, this$1.getPath( externalId ) );
|
|
@@ -10053,119 +10131,121 @@ Bundle.prototype.render = function render ( options ) {
|
|
|
10053
10131
|
var this$1 = this;
|
|
10054
10132
|
if ( options === void 0 ) options = {};
|
|
10055
10133
|
|
|
10056
|
-
|
|
10057
|
-
|
|
10058
|
-
|
|
10059
|
-
|
|
10060
|
-
|
|
10061
|
-
|
|
10062
|
-
options.format = 'es';
|
|
10063
|
-
}
|
|
10134
|
+
return Promise.resolve().then( function () {
|
|
10135
|
+
if ( options.format === 'es6' ) {
|
|
10136
|
+
this$1.warn({
|
|
10137
|
+
code: 'DEPRECATED_ES6',
|
|
10138
|
+
message: 'The es6 format is deprecated – use `es` instead'
|
|
10139
|
+
});
|
|
10064
10140
|
|
|
10065
|
-
|
|
10066
|
-
|
|
10141
|
+
options.format = 'es';
|
|
10142
|
+
}
|
|
10067
10143
|
|
|
10068
|
-
|
|
10069
|
-
|
|
10144
|
+
// Determine export mode - 'default', 'named', 'none'
|
|
10145
|
+
var exportMode = getExportMode( this$1, options );
|
|
10070
10146
|
|
|
10071
|
-
|
|
10147
|
+
var magicString = new Bundle$2({ separator: '\n\n' });
|
|
10148
|
+
var usedModules = [];
|
|
10072
10149
|
|
|
10073
|
-
|
|
10074
|
-
var source = module.render( options.format === 'es', this$1.legacy );
|
|
10150
|
+
timeStart( 'render modules' );
|
|
10075
10151
|
|
|
10076
|
-
|
|
10077
|
-
|
|
10078
|
-
usedModules.push( module );
|
|
10079
|
-
}
|
|
10080
|
-
});
|
|
10152
|
+
this$1.orderedModules.forEach( function (module) {
|
|
10153
|
+
var source = module.render( options.format === 'es', this$1.legacy );
|
|
10081
10154
|
|
|
10082
|
-
|
|
10083
|
-
|
|
10084
|
-
|
|
10085
|
-
|
|
10155
|
+
if ( source.toString().length ) {
|
|
10156
|
+
magicString.addSource( source );
|
|
10157
|
+
usedModules.push( module );
|
|
10158
|
+
}
|
|
10086
10159
|
});
|
|
10087
|
-
}
|
|
10088
10160
|
|
|
10089
|
-
|
|
10161
|
+
if ( !magicString.toString().trim() && this$1.entryModule.getExports().length === 0 ) {
|
|
10162
|
+
this$1.warn({
|
|
10163
|
+
code: 'EMPTY_BUNDLE',
|
|
10164
|
+
message: 'Generated an empty bundle'
|
|
10165
|
+
});
|
|
10166
|
+
}
|
|
10090
10167
|
|
|
10091
|
-
|
|
10092
|
-
.concat(
|
|
10093
|
-
this.plugins.map( function (plugin) { return plugin.intro && plugin.intro(); } )
|
|
10094
|
-
)
|
|
10095
|
-
.filter( Boolean )
|
|
10096
|
-
.join( '\n\n' );
|
|
10168
|
+
timeEnd( 'render modules' );
|
|
10097
10169
|
|
|
10098
|
-
|
|
10170
|
+
var intro = [ options.intro ]
|
|
10171
|
+
.concat(
|
|
10172
|
+
this$1.plugins.map( function (plugin) { return plugin.intro && plugin.intro(); } )
|
|
10173
|
+
)
|
|
10174
|
+
.filter( Boolean )
|
|
10175
|
+
.join( '\n\n' );
|
|
10099
10176
|
|
|
10100
|
-
|
|
10101
|
-
.concat(
|
|
10102
|
-
this.plugins.map( function (plugin) { return plugin.outro && plugin.outro(); } )
|
|
10103
|
-
)
|
|
10104
|
-
.filter( Boolean )
|
|
10105
|
-
.join( '\n\n' );
|
|
10177
|
+
if ( intro ) { intro += '\n\n'; }
|
|
10106
10178
|
|
|
10107
|
-
|
|
10179
|
+
var outro = [ options.outro ]
|
|
10180
|
+
.concat(
|
|
10181
|
+
this$1.plugins.map( function (plugin) { return plugin.outro && plugin.outro(); } )
|
|
10182
|
+
)
|
|
10183
|
+
.filter( Boolean )
|
|
10184
|
+
.join( '\n\n' );
|
|
10108
10185
|
|
|
10109
|
-
|
|
10186
|
+
if ( outro ) { outro = "\n\n" + outro; }
|
|
10110
10187
|
|
|
10111
|
-
|
|
10112
|
-
if ( !finalise ) {
|
|
10113
|
-
error({
|
|
10114
|
-
code: 'INVALID_OPTION',
|
|
10115
|
-
message: ("You must specify an output type - valid options are " + (keys( finalisers ).join( ', ' )))
|
|
10116
|
-
});
|
|
10117
|
-
}
|
|
10188
|
+
var indentString = getIndentString( magicString, options );
|
|
10118
10189
|
|
|
10119
|
-
|
|
10190
|
+
var finalise = finalisers[ options.format ];
|
|
10191
|
+
if ( !finalise ) {
|
|
10192
|
+
error({
|
|
10193
|
+
code: 'INVALID_OPTION',
|
|
10194
|
+
message: ("You must specify an output type - valid options are " + (keys( finalisers ).join( ', ' )))
|
|
10195
|
+
});
|
|
10196
|
+
}
|
|
10120
10197
|
|
|
10121
|
-
|
|
10198
|
+
timeStart( 'render format' );
|
|
10122
10199
|
|
|
10123
|
-
|
|
10200
|
+
magicString = finalise( this$1, magicString.trim(), { exportMode: exportMode, indentString: indentString, intro: intro, outro: outro }, options );
|
|
10124
10201
|
|
|
10125
|
-
|
|
10126
|
-
.concat( this.plugins.map( function (plugin) { return plugin.banner; } ) )
|
|
10127
|
-
.map( callIfFunction )
|
|
10128
|
-
.filter( Boolean )
|
|
10129
|
-
.join( '\n' );
|
|
10202
|
+
timeEnd( 'render format' );
|
|
10130
10203
|
|
|
10131
|
-
|
|
10132
|
-
|
|
10133
|
-
|
|
10134
|
-
|
|
10135
|
-
|
|
10204
|
+
var banner = [ options.banner ]
|
|
10205
|
+
.concat( this$1.plugins.map( function (plugin) { return plugin.banner; } ) )
|
|
10206
|
+
.map( callIfFunction )
|
|
10207
|
+
.filter( Boolean )
|
|
10208
|
+
.join( '\n' );
|
|
10136
10209
|
|
|
10137
|
-
|
|
10138
|
-
|
|
10210
|
+
var footer = [ options.footer ]
|
|
10211
|
+
.concat( this$1.plugins.map( function (plugin) { return plugin.footer; } ) )
|
|
10212
|
+
.map( callIfFunction )
|
|
10213
|
+
.filter( Boolean )
|
|
10214
|
+
.join( '\n' );
|
|
10139
10215
|
|
|
10140
|
-
|
|
10141
|
-
|
|
10142
|
-
var bundleSourcemapChain = [];
|
|
10216
|
+
if ( banner ) { magicString.prepend( banner + '\n' ); }
|
|
10217
|
+
if ( footer ) { magicString.append( '\n' + footer ); }
|
|
10143
10218
|
|
|
10144
|
-
|
|
10219
|
+
var prevCode = magicString.toString();
|
|
10220
|
+
var map = null;
|
|
10221
|
+
var bundleSourcemapChain = [];
|
|
10145
10222
|
|
|
10146
|
-
|
|
10147
|
-
|
|
10223
|
+
return transformBundle( prevCode, this$1.plugins, bundleSourcemapChain, options ).then( function (code) {
|
|
10224
|
+
if ( options.sourceMap ) {
|
|
10225
|
+
timeStart( 'sourceMap' );
|
|
10148
10226
|
|
|
10149
|
-
|
|
10150
|
-
|
|
10227
|
+
var file = options.sourceMapFile || options.dest;
|
|
10228
|
+
if ( file ) { file = path.resolve( typeof process !== 'undefined' ? process.cwd() : '', file ); }
|
|
10151
10229
|
|
|
10152
|
-
|
|
10153
|
-
|
|
10154
|
-
|
|
10155
|
-
|
|
10156
|
-
|
|
10157
|
-
|
|
10158
|
-
|
|
10159
|
-
|
|
10160
|
-
|
|
10230
|
+
if ( this$1.hasLoaders || find( this$1.plugins, function (plugin) { return plugin.transform || plugin.transformBundle; } ) ) {
|
|
10231
|
+
map = magicString.generateMap({});
|
|
10232
|
+
if ( typeof map.mappings === 'string' ) {
|
|
10233
|
+
map.mappings = decode$$1( map.mappings );
|
|
10234
|
+
}
|
|
10235
|
+
map = collapseSourcemaps( this$1, file, map, usedModules, bundleSourcemapChain );
|
|
10236
|
+
} else {
|
|
10237
|
+
map = magicString.generateMap({ file: file, includeContent: true });
|
|
10238
|
+
}
|
|
10161
10239
|
|
|
10162
|
-
|
|
10240
|
+
map.sources = map.sources.map( normalize );
|
|
10163
10241
|
|
|
10164
|
-
|
|
10165
|
-
|
|
10242
|
+
timeEnd( 'sourceMap' );
|
|
10243
|
+
}
|
|
10166
10244
|
|
|
10167
|
-
|
|
10168
|
-
|
|
10245
|
+
if ( code[ code.length - 1 ] !== '\n' ) { code += '\n'; }
|
|
10246
|
+
return { code: code, map: map };
|
|
10247
|
+
});
|
|
10248
|
+
});
|
|
10169
10249
|
};
|
|
10170
10250
|
|
|
10171
10251
|
Bundle.prototype.sort = function sort () {
|
|
@@ -10270,7 +10350,7 @@ Bundle.prototype.warn = function warn ( warning ) {
|
|
|
10270
10350
|
this.onwarn( warning );
|
|
10271
10351
|
};
|
|
10272
10352
|
|
|
10273
|
-
var VERSION = '0.
|
|
10353
|
+
var VERSION = '0.45.2';
|
|
10274
10354
|
|
|
10275
10355
|
var ALLOWED_KEYS = [
|
|
10276
10356
|
'acorn',
|
|
@@ -10281,6 +10361,7 @@ var ALLOWED_KEYS = [
|
|
|
10281
10361
|
'dest',
|
|
10282
10362
|
'entry',
|
|
10283
10363
|
'exports',
|
|
10364
|
+
'extend',
|
|
10284
10365
|
'external',
|
|
10285
10366
|
'footer',
|
|
10286
10367
|
'format',
|
|
@@ -10337,6 +10418,12 @@ function checkOptions ( options ) {
|
|
|
10337
10418
|
if ( err ) { throw err; }
|
|
10338
10419
|
}
|
|
10339
10420
|
|
|
10421
|
+
var throwAsyncGenerateError = {
|
|
10422
|
+
get: function get () {
|
|
10423
|
+
throw new Error( "bundle.generate(...) now returns a Promise instead of a { code, map } object" );
|
|
10424
|
+
}
|
|
10425
|
+
};
|
|
10426
|
+
|
|
10340
10427
|
function rollup ( options ) {
|
|
10341
10428
|
try {
|
|
10342
10429
|
checkOptions( options );
|
|
@@ -10364,21 +10451,28 @@ function rollup ( options ) {
|
|
|
10364
10451
|
|
|
10365
10452
|
timeStart( '--GENERATE--' );
|
|
10366
10453
|
|
|
10367
|
-
var
|
|
10454
|
+
var promise = Promise.resolve()
|
|
10455
|
+
.then( function () { return bundle.render( options ); } )
|
|
10456
|
+
.then( function (rendered) {
|
|
10457
|
+
timeEnd( '--GENERATE--' );
|
|
10368
10458
|
|
|
10369
|
-
|
|
10459
|
+
bundle.plugins.forEach( function (plugin) {
|
|
10460
|
+
if ( plugin.ongenerate ) {
|
|
10461
|
+
plugin.ongenerate( assign({
|
|
10462
|
+
bundle: result
|
|
10463
|
+
}, options ), rendered);
|
|
10464
|
+
}
|
|
10465
|
+
});
|
|
10370
10466
|
|
|
10371
|
-
|
|
10372
|
-
if ( plugin.ongenerate ) {
|
|
10373
|
-
plugin.ongenerate( assign({
|
|
10374
|
-
bundle: result
|
|
10375
|
-
}, options ), rendered);
|
|
10376
|
-
}
|
|
10377
|
-
});
|
|
10467
|
+
flushTime();
|
|
10378
10468
|
|
|
10379
|
-
|
|
10469
|
+
return rendered;
|
|
10470
|
+
});
|
|
10471
|
+
|
|
10472
|
+
Object.defineProperty( promise, 'code', throwAsyncGenerateError );
|
|
10473
|
+
Object.defineProperty( promise, 'map', throwAsyncGenerateError );
|
|
10380
10474
|
|
|
10381
|
-
return
|
|
10475
|
+
return promise;
|
|
10382
10476
|
}
|
|
10383
10477
|
|
|
10384
10478
|
var result = {
|
|
@@ -10396,31 +10490,32 @@ function rollup ( options ) {
|
|
|
10396
10490
|
}
|
|
10397
10491
|
|
|
10398
10492
|
var dest = options.dest;
|
|
10399
|
-
|
|
10400
|
-
|
|
10401
|
-
|
|
10493
|
+
return generate( options ).then( function (output) {
|
|
10494
|
+
var code = output.code;
|
|
10495
|
+
var map = output.map;
|
|
10402
10496
|
|
|
10403
|
-
|
|
10497
|
+
var promises = [];
|
|
10404
10498
|
|
|
10405
|
-
|
|
10406
|
-
|
|
10499
|
+
if ( options.sourceMap ) {
|
|
10500
|
+
var url;
|
|
10407
10501
|
|
|
10408
|
-
|
|
10409
|
-
|
|
10410
|
-
|
|
10411
|
-
|
|
10412
|
-
|
|
10413
|
-
|
|
10502
|
+
if ( options.sourceMap === 'inline' ) {
|
|
10503
|
+
url = map.toUrl();
|
|
10504
|
+
} else {
|
|
10505
|
+
url = (path.basename( dest )) + ".map";
|
|
10506
|
+
promises.push( writeFile$1( dest + '.map', map.toString() ) );
|
|
10507
|
+
}
|
|
10414
10508
|
|
|
10415
|
-
|
|
10416
|
-
|
|
10509
|
+
code += "//# " + SOURCEMAPPING_URL + "=" + url + "\n";
|
|
10510
|
+
}
|
|
10417
10511
|
|
|
10418
|
-
|
|
10419
|
-
|
|
10420
|
-
|
|
10421
|
-
|
|
10422
|
-
|
|
10423
|
-
|
|
10512
|
+
promises.push( writeFile$1( dest, code ) );
|
|
10513
|
+
return Promise.all( promises ).then( function () {
|
|
10514
|
+
return mapSequence( bundle.plugins.filter( function (plugin) { return plugin.onwrite; } ), function (plugin) {
|
|
10515
|
+
return Promise.resolve( plugin.onwrite( assign({
|
|
10516
|
+
bundle: result
|
|
10517
|
+
}, options ), output));
|
|
10518
|
+
});
|
|
10424
10519
|
});
|
|
10425
10520
|
});
|
|
10426
10521
|
}
|