You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
807 B

10 years ago
var gobble = require( 'gobble' );
var fs = require( 'fs' );
10 years ago
var src = gobble( 'src' );
10 years ago
var node = src
.transform( 'rollup', {
entry: 'rollup.js',
dest: 'rollup.js',
format: 'cjs',
9 years ago
external: [ 'fs' ],
sourceMap: true
})
.transform( 'babel' );
10 years ago
var browserPlaceholders = {
fs: fs.readFileSync( 'browser/fs.js' ).toString(),
promise: fs.readFileSync( 'browser/promise.js' ).toString()
};
var browser = src
.transform( 'rollup-babel', {
entry: 'rollup.js',
dest: 'rollup.browser.js',
9 years ago
format: 'umd',
moduleName: 'rollup',
load: function ( id ) {
9 years ago
if ( ~id.indexOf( 'fs.js' ) ) return browserPlaceholders.fs;
if ( ~id.indexOf( 'es6-promise' ) ) return browserPlaceholders.promise;
return fs.readFileSync( id ).toString();
9 years ago
}
});
module.exports = gobble([ node, browser ]);