mirror of
https://github.com/atom/atom.git
synced 2026-02-10 22:55:09 -05:00
Revert "Upgrade to Babel 6 and apply fewer transformations when transpiling babel files"
This commit is contained in:
committed by
GitHub
parent
ab17e4042b
commit
bade347e01
20
src/babel.js
20
src/babel.js
@@ -6,7 +6,6 @@ var defaultOptions = require('../static/babelrc.json')
|
||||
|
||||
var babel = null
|
||||
var babelVersionDirectory = null
|
||||
var options = null
|
||||
|
||||
var PREFIXES = [
|
||||
'/** @babel */',
|
||||
@@ -48,27 +47,16 @@ exports.compile = function (sourceCode, filePath) {
|
||||
var noop = function () {}
|
||||
Logger.prototype.debug = noop
|
||||
Logger.prototype.verbose = noop
|
||||
|
||||
options = {ast: false, babelrc: false}
|
||||
for (var key in defaultOptions) {
|
||||
if (key === 'plugins') {
|
||||
const plugins = []
|
||||
for (const [pluginName, pluginOptions] of defaultOptions[key]) {
|
||||
plugins.push([require.resolve(`babel-plugin-${pluginName}`), pluginOptions])
|
||||
}
|
||||
options[key] = plugins
|
||||
} else {
|
||||
options[key] = defaultOptions[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
filePath = 'file:///' + path.resolve(filePath).replace(/\\/g, '/')
|
||||
}
|
||||
|
||||
options.filename = filePath
|
||||
|
||||
var options = {filename: filePath}
|
||||
for (var key in defaultOptions) {
|
||||
options[key] = defaultOptions[key]
|
||||
}
|
||||
return babel.transform(sourceCode, options).code
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user