mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
build - use uglifyify and gulp-multi-process for better performance
This commit is contained in:
parent
ee1acf0a7e
commit
bd6f554766
29
gulpfile.js
29
gulpfile.js
@ -28,8 +28,14 @@ const uglify = require('gulp-uglify-es').default
|
||||
const babel = require('gulp-babel')
|
||||
const debug = require('gulp-debug')
|
||||
const pify = require('pify')
|
||||
const gulpMultiProcess = require('gulp-multi-process')
|
||||
const endOfStream = pify(require('end-of-stream'))
|
||||
|
||||
function gulpParallel (...args) {
|
||||
return function spawnGulpChildProcess(cb) {
|
||||
return gulpMultiProcess(args, cb, true)
|
||||
}
|
||||
}
|
||||
|
||||
const browserPlatforms = [
|
||||
'firefox',
|
||||
@ -418,7 +424,7 @@ gulp.task('build',
|
||||
gulp.series(
|
||||
'clean',
|
||||
'build:scss',
|
||||
gulp.parallel(
|
||||
gulpParallel(
|
||||
'build:extension:js',
|
||||
'build:mascara:js',
|
||||
'copy'
|
||||
@ -476,6 +482,16 @@ function generateBundler(opts, performBundle) {
|
||||
|
||||
let bundler = browserify(browserifyOpts)
|
||||
|
||||
// Minification
|
||||
if (opts.minifyBuild) {
|
||||
bundler.transform('uglifyify', {
|
||||
global: true,
|
||||
mangle: {
|
||||
reserved: [ 'MetamaskInpageProvider' ]
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
if (opts.watch) {
|
||||
bundler = watchify(bundler)
|
||||
// on any file update, re-runs the bundler
|
||||
@ -544,7 +560,6 @@ function bundleTask(opts) {
|
||||
// buffer file contents (?)
|
||||
.pipe(buffer())
|
||||
|
||||
|
||||
// Initialize Source Maps
|
||||
if (opts.buildSourceMaps) {
|
||||
buildStream = buildStream
|
||||
@ -552,16 +567,6 @@ function bundleTask(opts) {
|
||||
.pipe(sourcemaps.init({ loadMaps: true }))
|
||||
}
|
||||
|
||||
// Minification
|
||||
if (opts.minifyBuild) {
|
||||
buildStream = buildStream
|
||||
.pipe(uglify({
|
||||
mangle: {
|
||||
reserved: [ 'MetamaskInpageProvider' ]
|
||||
},
|
||||
}))
|
||||
}
|
||||
|
||||
// Finalize Source Maps (writes .map file)
|
||||
if (opts.buildSourceMaps) {
|
||||
buildStream = buildStream
|
||||
|
123
package-lock.json
generated
123
package-lock.json
generated
@ -907,6 +907,65 @@
|
||||
"async-done": "1.2.4"
|
||||
}
|
||||
},
|
||||
"async.queue": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/async.queue/-/async.queue-0.5.2.tgz",
|
||||
"integrity": "sha1-jV2QgS4UgQZrwJBOjMFxKxfDvXw=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"async.util.queue": "0.5.2"
|
||||
}
|
||||
},
|
||||
"async.util.arrayeach": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/async.util.arrayeach/-/async.util.arrayeach-0.5.2.tgz",
|
||||
"integrity": "sha1-WMTpgCjVXWm/sFrrOvROClVagpw=",
|
||||
"dev": true
|
||||
},
|
||||
"async.util.isarray": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/async.util.isarray/-/async.util.isarray-0.5.2.tgz",
|
||||
"integrity": "sha1-5i2sjyY29lh13PdSHC0k0N+yu98=",
|
||||
"dev": true
|
||||
},
|
||||
"async.util.map": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/async.util.map/-/async.util.map-0.5.2.tgz",
|
||||
"integrity": "sha1-5YjvhuCzq18CfZevTWg10FXKadY=",
|
||||
"dev": true
|
||||
},
|
||||
"async.util.noop": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/async.util.noop/-/async.util.noop-0.5.2.tgz",
|
||||
"integrity": "sha1-vdYrl8sKo/YLWGrRSEaGmJdeWLk=",
|
||||
"dev": true
|
||||
},
|
||||
"async.util.onlyonce": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/async.util.onlyonce/-/async.util.onlyonce-0.5.2.tgz",
|
||||
"integrity": "sha1-uOb8AErckjFk154y8oE+5GXCT/I=",
|
||||
"dev": true
|
||||
},
|
||||
"async.util.queue": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/async.util.queue/-/async.util.queue-0.5.2.tgz",
|
||||
"integrity": "sha1-V/Zavho83yc9MavSirlUJfgiLuU=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"async.util.arrayeach": "0.5.2",
|
||||
"async.util.isarray": "0.5.2",
|
||||
"async.util.map": "0.5.2",
|
||||
"async.util.noop": "0.5.2",
|
||||
"async.util.onlyonce": "0.5.2",
|
||||
"async.util.setimmediate": "0.5.2"
|
||||
}
|
||||
},
|
||||
"async.util.setimmediate": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/async.util.setimmediate/-/async.util.setimmediate-0.5.2.tgz",
|
||||
"integrity": "sha1-KBLrq/KlgCd1jUvHeT0cz68QJV8=",
|
||||
"dev": true
|
||||
},
|
||||
"asynckit": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||
@ -7148,12 +7207,6 @@
|
||||
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
|
||||
"integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE="
|
||||
},
|
||||
"fork-stream": {
|
||||
"version": "0.0.4",
|
||||
"resolved": "https://registry.npmjs.org/fork-stream/-/fork-stream-0.0.4.tgz",
|
||||
"integrity": "sha1-24Sfznf2cIpfjzhq5TOgkHtUrnA=",
|
||||
"dev": true
|
||||
},
|
||||
"form-data": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.1.tgz",
|
||||
@ -8683,17 +8736,6 @@
|
||||
"gulp-util": "3.0.8"
|
||||
}
|
||||
},
|
||||
"gulp-if": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/gulp-if/-/gulp-if-2.0.2.tgz",
|
||||
"integrity": "sha1-pJe351cwBQQcqivIt92jyARE1ik=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"gulp-match": "1.0.3",
|
||||
"ternary-stream": "2.0.1",
|
||||
"through2": "2.0.3"
|
||||
}
|
||||
},
|
||||
"gulp-json-editor": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/gulp-json-editor/-/gulp-json-editor-2.2.1.tgz",
|
||||
@ -8845,13 +8887,13 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"gulp-match": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/gulp-match/-/gulp-match-1.0.3.tgz",
|
||||
"integrity": "sha1-kcfA1/Kb7NZgbVfYCn+Hdqh6uo4=",
|
||||
"gulp-multi-process": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/gulp-multi-process/-/gulp-multi-process-1.3.1.tgz",
|
||||
"integrity": "sha512-okxYy3mxUkekM0RNjkBg8OPuzpnD2yXMAdnGOaQPSJ2wzBdE9R9pkTV+tzPZ65ORK7b57YUc6s+gROA4+EIOLg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"minimatch": "3.0.4"
|
||||
"async.queue": "0.5.2"
|
||||
}
|
||||
},
|
||||
"gulp-replace": {
|
||||
@ -13247,15 +13289,6 @@
|
||||
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
|
||||
"integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E="
|
||||
},
|
||||
"merge-stream": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-1.0.1.tgz",
|
||||
"integrity": "sha1-QEEgLVCKNCugAXQAjfDCUbjBNeE=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"readable-stream": "2.3.3"
|
||||
}
|
||||
},
|
||||
"merkle-patricia-tree": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/merkle-patricia-tree/-/merkle-patricia-tree-2.3.0.tgz",
|
||||
@ -20753,18 +20786,6 @@
|
||||
"inherits": "2.0.3"
|
||||
}
|
||||
},
|
||||
"ternary-stream": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ternary-stream/-/ternary-stream-2.0.1.tgz",
|
||||
"integrity": "sha1-Bk5Im0tb9gumpre8fy9cJ07Pgmk=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"duplexify": "3.5.1",
|
||||
"fork-stream": "0.0.4",
|
||||
"merge-stream": "1.0.1",
|
||||
"through2": "2.0.3"
|
||||
}
|
||||
},
|
||||
"testem": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/testem/-/testem-2.0.0.tgz",
|
||||
@ -21415,19 +21436,19 @@
|
||||
"integrity": "sha512-uRdSdu1oA1rncCQL7sCj8vSyZkgtL7faaw9Tc9rZ3mGgraQ7+Pdx7w5mnOSF3gw9ZNG6oc+KXfkon3bKuROm0g=="
|
||||
},
|
||||
"uglify-es": {
|
||||
"version": "3.3.4",
|
||||
"resolved": "https://registry.npmjs.org/uglify-es/-/uglify-es-3.3.4.tgz",
|
||||
"integrity": "sha512-vDOyDaf7LcABZI5oJt8bin5FD8kYONux5jd8FY6SsV2SfD+MMXaPeGUotysbycSxdu170y5IQ8FvlKzU/TUryw==",
|
||||
"version": "3.3.9",
|
||||
"resolved": "https://registry.npmjs.org/uglify-es/-/uglify-es-3.3.9.tgz",
|
||||
"integrity": "sha512-r+MU0rfv4L/0eeW3xZrd16t4NZfK8Ld4SWVglYBb7ez5uXFWHuVRs6xCTrf1yirs9a4j4Y27nn7SRfO6v67XsQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"commander": "2.12.2",
|
||||
"commander": "2.13.0",
|
||||
"source-map": "0.6.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"commander": {
|
||||
"version": "2.12.2",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.12.2.tgz",
|
||||
"integrity": "sha512-BFnaq5ZOGcDN7FlrtBT4xxkgIToalIIxwjxLWVJ8bGTpe1LroqMiqQXdA7ygc7CRvaYS+9zfPGFnJqFSayx+AA==",
|
||||
"version": "2.13.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.13.0.tgz",
|
||||
"integrity": "sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA==",
|
||||
"dev": true
|
||||
},
|
||||
"source-map": {
|
||||
@ -21454,7 +21475,7 @@
|
||||
"extend": "1.3.0",
|
||||
"minimatch": "3.0.4",
|
||||
"through": "2.3.8",
|
||||
"uglify-es": "3.3.4"
|
||||
"uglify-es": "3.3.9"
|
||||
},
|
||||
"dependencies": {
|
||||
"extend": {
|
||||
|
@ -223,6 +223,7 @@
|
||||
"gulp-eslint": "^4.0.0",
|
||||
"gulp-json-editor": "^2.2.1",
|
||||
"gulp-livereload": "^3.8.1",
|
||||
"gulp-multi-process": "^1.3.1",
|
||||
"gulp-replace": "^0.6.1",
|
||||
"gulp-sourcemaps": "^2.6.0",
|
||||
"gulp-stylefmt": "^1.1.0",
|
||||
@ -262,7 +263,7 @@
|
||||
"stylelint-config-standard": "^18.2.0",
|
||||
"tape": "^4.5.1",
|
||||
"testem": "^2.0.0",
|
||||
"uglifyify": "^4.0.2",
|
||||
"uglifyify": "^4.0.5",
|
||||
"vinyl-buffer": "^1.0.1",
|
||||
"vinyl-source-stream": "^2.0.0",
|
||||
"watchify": "^3.9.0"
|
||||
|
Loading…
Reference in New Issue
Block a user