Skip to content

Commit

Permalink
update: handle also the newest babel versions
Browse files Browse the repository at this point in the history
  • Loading branch information
GianlucaGuarini committed May 10, 2018
1 parent d7b04c0 commit fff6229
Show file tree
Hide file tree
Showing 6 changed files with 644 additions and 869 deletions.
2 changes: 1 addition & 1 deletion lib/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ function _compileHTML (html, opts, pcex) {

html = html.trim().replace(/\s+/g, ' ')

if (p.length) html = html.replace(/\u0002/g, function () { return p.shift() })
if (p.length) html = html.replace(/\u0002/g, function () { return p.shift() }) // eslint-disable-line
}

if (opts.compact) html = html.replace(HTML_PACK, '><$1')
Expand Down
13 changes: 12 additions & 1 deletion lib/parsers/es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,20 @@
-------
2016-03-09: Initital release
*/

// The babel core should be handled differently in its newest version
// this function will allow the import of the right babel package installed
function getBabelCore() {
try {
return require('babel-core')
} catch (_) {
return require('@babel/core')
}
}

var
mixobj = require('./_utils').mixobj,
parser = require('babel-core')
parser = getBabelCore()

module.exports = function _babel (js, opts, url) {

Expand Down
Loading

0 comments on commit fff6229

Please sign in to comment.