Skip to content

Commit 846ab94

Browse files
authored
fix(parser): Avoid error about deoptimization on very large files (#621)
This sets compact: false for babelify, so that Babel doesn't complain about not being able to compact'ify very large files * documentationjs/gulp-documentation#14
1 parent 8b04029 commit 846ab94

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

lib/input/dependency.js

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ function dependencyStream(indexes, options, callback) {
4040
}),
4141
transform: [babelify.configure({
4242
sourceMap: false,
43+
compact: false,
4344
presets: [
4445
require('babel-preset-es2015'),
4546
require('babel-preset-stage-0'),

test/bin.js

+17
Original file line numberDiff line numberDiff line change
@@ -375,3 +375,20 @@ test('build --document-exported', function (t) {
375375
t.end();
376376
}, false);
377377
}, options);
378+
379+
test('build large file without error (no deoptimized styling error)', function (t) {
380+
381+
var dstFile = path.join(os.tmpdir(), (Date.now() + Math.random()).toString()) + '.js';
382+
var contents = '';
383+
for (var i = 0; i < 4e4; i++) {
384+
contents += '/* - */\n';
385+
}
386+
fs.writeFileSync(dstFile, contents, 'utf8');
387+
388+
documentation(['build ' + dstFile], {}, function (err, data, stderr) {
389+
t.error(err);
390+
t.equal(stderr, '');
391+
fs.unlinkSync(dstFile);
392+
t.end();
393+
}, false);
394+
}, options);

0 commit comments

Comments
 (0)