Skip to content

Commit 9d34652

Browse files
committed
fixup debug X sourcemap intersect
1 parent 9ca5d44 commit 9d34652

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

tasks/partial_bundle.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ if(process.argv.length > 2) {
6262

6363
name: out,
6464
index: path.join(constants.pathToLib, 'index-' + out + '.js'),
65+
sourceMap: path.join(constants.pathToDist, 'plotly-' + out + '.js.map'),
6566
dist: path.join(constants.pathToDist, 'plotly-' + out + '.js'),
6667
distMin: path.join(constants.pathToDist, 'plotly-' + out + '.min.js')
6768
};
6869

6970
console.log(opts);
7071

71-
opts.sourcemap = true;
7272
opts.calendars = true;
7373

7474
var tasks = [];
@@ -89,7 +89,7 @@ function partialBundle(tasks, opts) {
8989
var traceList = opts.traceList;
9090
var transformList = opts.transformList;
9191
var calendars = opts.calendars;
92-
var sourcemap = opts.sourcemap;
92+
var sourceMap = opts.sourceMap;
9393

9494
tasks.push(function(done) {
9595
var partialIndex = mainIndex;
@@ -123,7 +123,7 @@ function partialBundle(tasks, opts) {
123123

124124
tasks.push(function(done) {
125125
var bundleOpts = {
126-
debug: sourcemap,
126+
pathToSourceMap: sourceMap,
127127
standalone: 'Plotly',
128128
pathToMinBundle: distMin
129129
};

tasks/util/browserify_wrapper.js

+14-6
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ var strictD3 = require('./strict_d3');
2323
* - noCompress {boolean} skip attribute meta compression?
2424
* @param {function} cb callback
2525
*
26-
* Outputs one bundle (un-minified) file if opts.pathToMinBundle is omitted
27-
* or opts.debug is true. Otherwise outputs two file: one un-minified bundle and
28-
* one minified bundle.
26+
* Outputs one bundle (un-minified) file if opts.pathToMinBundle is omitted.
27+
* Otherwise outputs two file: one un-minified bundle and one minified bundle.
2928
*
3029
* Logs basename of bundle when completed.
3130
*/
@@ -36,7 +35,8 @@ module.exports = function _bundle(pathToIndex, pathToBundle, opts, cb) {
3635

3736
var browserifyOpts = {};
3837
browserifyOpts.standalone = opts.standalone;
39-
browserifyOpts.debug = opts.debug;
38+
var sourceMap = opts.pathToSourceMap;
39+
browserifyOpts.debug = opts.debug || sourceMap;
4040

4141
if(opts.noCompress) {
4242
browserifyOpts.ignoreTransform = './tasks/compress_attributes.js';
@@ -72,10 +72,18 @@ module.exports = function _bundle(pathToIndex, pathToBundle, opts, cb) {
7272
});
7373
}
7474

75-
if(pathToBundle) {
75+
if(sourceMap) {
76+
bundleStream
77+
.pipe(applyDerequire())
78+
.pipe(exorcist(sourceMap))
79+
.pipe(fs.createWriteStream(pathToBundle))
80+
.on('finish', function() {
81+
logger(pathToBundle);
82+
done();
83+
});
84+
} else {
7685
bundleStream
7786
.pipe(applyDerequire())
78-
.pipe(exorcist(pathToBundle + '.map'))
7987
.pipe(fs.createWriteStream(pathToBundle))
8088
.on('finish', function() {
8189
logger(pathToBundle);

0 commit comments

Comments
 (0)