|
|
@ -28,8 +28,14 @@ const uglify = require('gulp-uglify-es').default |
|
|
|
const babel = require('gulp-babel') |
|
|
|
const babel = require('gulp-babel') |
|
|
|
const debug = require('gulp-debug') |
|
|
|
const debug = require('gulp-debug') |
|
|
|
const pify = require('pify') |
|
|
|
const pify = require('pify') |
|
|
|
|
|
|
|
const gulpMultiProcess = require('gulp-multi-process') |
|
|
|
const endOfStream = pify(require('end-of-stream')) |
|
|
|
const endOfStream = pify(require('end-of-stream')) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function gulpParallel (...args) { |
|
|
|
|
|
|
|
return function spawnGulpChildProcess(cb) { |
|
|
|
|
|
|
|
return gulpMultiProcess(args, cb, true) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const browserPlatforms = [ |
|
|
|
const browserPlatforms = [ |
|
|
|
'firefox', |
|
|
|
'firefox', |
|
|
@ -420,7 +426,7 @@ gulp.task('build', |
|
|
|
gulp.series( |
|
|
|
gulp.series( |
|
|
|
'clean', |
|
|
|
'clean', |
|
|
|
'build:scss', |
|
|
|
'build:scss', |
|
|
|
gulp.parallel( |
|
|
|
gulpParallel( |
|
|
|
'build:extension:js', |
|
|
|
'build:extension:js', |
|
|
|
'build:mascara:js', |
|
|
|
'build:mascara:js', |
|
|
|
'copy' |
|
|
|
'copy' |
|
|
@ -478,6 +484,16 @@ function generateBundler(opts, performBundle) { |
|
|
|
|
|
|
|
|
|
|
|
let bundler = browserify(browserifyOpts) |
|
|
|
let bundler = browserify(browserifyOpts) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Minification
|
|
|
|
|
|
|
|
if (opts.minifyBuild) { |
|
|
|
|
|
|
|
bundler.transform('uglifyify', { |
|
|
|
|
|
|
|
global: true, |
|
|
|
|
|
|
|
mangle: { |
|
|
|
|
|
|
|
reserved: [ 'MetamaskInpageProvider' ] |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (opts.watch) { |
|
|
|
if (opts.watch) { |
|
|
|
bundler = watchify(bundler) |
|
|
|
bundler = watchify(bundler) |
|
|
|
// on any file update, re-runs the bundler
|
|
|
|
// on any file update, re-runs the bundler
|
|
|
@ -546,7 +562,6 @@ function bundleTask(opts) { |
|
|
|
// buffer file contents (?)
|
|
|
|
// buffer file contents (?)
|
|
|
|
.pipe(buffer()) |
|
|
|
.pipe(buffer()) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Initialize Source Maps
|
|
|
|
// Initialize Source Maps
|
|
|
|
if (opts.buildSourceMaps) { |
|
|
|
if (opts.buildSourceMaps) { |
|
|
|
buildStream = buildStream |
|
|
|
buildStream = buildStream |
|
|
@ -554,16 +569,6 @@ function bundleTask(opts) { |
|
|
|
.pipe(sourcemaps.init({ loadMaps: true })) |
|
|
|
.pipe(sourcemaps.init({ loadMaps: true })) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Minification
|
|
|
|
|
|
|
|
if (opts.minifyBuild) { |
|
|
|
|
|
|
|
buildStream = buildStream |
|
|
|
|
|
|
|
.pipe(uglify({ |
|
|
|
|
|
|
|
mangle: { |
|
|
|
|
|
|
|
reserved: [ 'MetamaskInpageProvider' ] |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
})) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Finalize Source Maps (writes .map file)
|
|
|
|
// Finalize Source Maps (writes .map file)
|
|
|
|
if (opts.buildSourceMaps) { |
|
|
|
if (opts.buildSourceMaps) { |
|
|
|
buildStream = buildStream |
|
|
|
buildStream = buildStream |
|
|
|