Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 579d3cc

Browse filesBrowse files
authored
Merge pull request plotly#2187 from plotly/bundle-up
Upgrade bundling
2 parents accae1a + 25fd2e4 commit 579d3cc
Copy full SHA for 579d3cc

File tree

Expand file treeCollapse file tree

6 files changed

+25
-49
lines changed
Filter options
Expand file treeCollapse file tree

6 files changed

+25
-49
lines changed

‎package.json

Copy file name to clipboardExpand all lines: package.json
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
"has-hover": "^1.0.1",
8787
"mapbox-gl": "^0.22.0",
8888
"matrix-camera-controller": "^2.1.3",
89+
"minify-stream": "^1.1.0",
8990
"mouse-change": "^1.4.0",
9091
"mouse-event-offset": "^3.0.2",
9192
"mouse-wheel": "^1.0.2",
@@ -109,6 +110,7 @@
109110
"brfs": "^1.4.3",
110111
"browserify": "^14.1.0",
111112
"browserify-transform-tools": "^1.7.0",
113+
"cross-spawn": "^5.1.0",
112114
"deep-equal": "^1.0.1",
113115
"ecstatic": "^2.1.0",
114116
"eslint": "^3.17.1",
@@ -140,7 +142,6 @@
140142
"read-last-lines": "^1.1.0",
141143
"requirejs": "^2.3.1",
142144
"through2": "^2.0.3",
143-
"uglify-js": "^2.8.12",
144145
"watchify": "^3.9.0",
145146
"xml2js": "^0.4.16"
146147
}

‎tasks/bundle.js

Copy file name to clipboardExpand all lines: tasks/bundle.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ _bundle(constants.pathToPlotlyIndex, constants.pathToPlotlyDist, {
3333
pathToMinBundle: constants.pathToPlotlyDistMin
3434
});
3535

36+
3637
// Browserify the geo assets
3738
_bundle(constants.pathToPlotlyGeoAssetsSrc, constants.pathToPlotlyGeoAssetsDist, {
3839
standalone: 'PlotlyGeoAssets'

‎tasks/stats.js

Copy file name to clipboardExpand all lines: tasks/stats.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var path = require('path');
22
var fs = require('fs');
3-
var spawn = require('child_process').spawn;
3+
var spawn = require('cross-spawn');
44

55
var falafel = require('falafel');
66
var gzipSize = require('gzip-size');

‎tasks/util/browserify_wrapper.js

Copy file name to clipboardExpand all lines: tasks/util/browserify_wrapper.js
+18-21Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ var fs = require('fs');
22
var path = require('path');
33

44
var browserify = require('browserify');
5-
var UglifyJS = require('uglify-js');
5+
var minify = require('minify-stream');
66

77
var constants = require('./constants');
88
var compressAttributes = require('./compress_attributes');
9-
var patchMinified = require('./patch_minified');
109
var strictD3 = require('./strict_d3');
1110

1211
/** Convenience browserify wrapper
@@ -46,30 +45,28 @@ module.exports = function _bundle(pathToIndex, pathToBundle, opts) {
4645
}
4746

4847
var b = browserify(pathToIndex, browserifyOpts);
49-
var bundleWriteStream = fs.createWriteStream(pathToBundle);
5048

51-
bundleWriteStream.on('finish', function() {
52-
logger(pathToBundle);
53-
if(opts.then) {
54-
opts.then();
55-
}
56-
});
57-
58-
b.bundle(function(err, buf) {
49+
var bundleStream = b.bundle(function(err) {
5950
if(err) throw err;
51+
});
6052

61-
if(outputMinified) {
62-
var minifiedCode = UglifyJS.minify(buf.toString(), constants.uglifyOptions).code;
63-
minifiedCode = patchMinified(minifiedCode);
64-
65-
fs.writeFile(pathToMinBundle, minifiedCode, function(err) {
66-
if(err) throw err;
67-
53+
if(outputMinified) {
54+
bundleStream
55+
.pipe(minify(constants.uglifyOptions))
56+
.pipe(fs.createWriteStream(pathToMinBundle))
57+
.on('finish', function() {
6858
logger(pathToMinBundle);
6959
});
70-
}
71-
})
72-
.pipe(bundleWriteStream);
60+
}
61+
62+
bundleStream
63+
.pipe(fs.createWriteStream(pathToBundle))
64+
.on('finish', function() {
65+
logger(pathToBundle);
66+
if(opts.then) {
67+
opts.then();
68+
}
69+
});
7370
};
7471

7572
function logger(pathToOutput) {

‎tasks/util/constants.js

Copy file name to clipboardExpand all lines: tasks/util/constants.js
+3-4Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,15 @@ module.exports = {
8484
testContainerHome: '/var/www/streambed/image_server/plotly.js',
8585

8686
uglifyOptions: {
87-
fromString: true,
8887
mangle: true,
8988
compress: {
90-
warnings: false,
91-
screw_ie8: true
89+
warnings: false
9290
},
9391
output: {
9492
beautify: false,
9593
ascii_only: true
96-
}
94+
},
95+
sourceMap: false
9796
},
9897

9998
licenseDist: [

‎tasks/util/patch_minified.js

Copy file name to clipboardExpand all lines: tasks/util/patch_minified.js
-22Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.