mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Move babel config to a separate file in static directory
This commit is contained in:
@@ -3,7 +3,7 @@ path = require 'path'
|
||||
os = require 'os'
|
||||
glob = require 'glob'
|
||||
usesBabel = require './lib/uses-babel'
|
||||
babelOptions = require('../src/babel').defaultOptions
|
||||
babelOptions = require('../static/babelrc.json')
|
||||
|
||||
# Add support for obselete APIs of vm module so we can make some third-party
|
||||
# modules work under node v0.11.x.
|
||||
|
||||
21
src/babel.js
21
src/babel.js
@@ -7,26 +7,7 @@ const path = require('path')
|
||||
let babel = null
|
||||
let babelVersionDirectory = null
|
||||
|
||||
// This field is used by the Gruntfile for compiling babel in bundled packages.
|
||||
exports.defaultOptions = {
|
||||
|
||||
// Currently, the cache key is a function of:
|
||||
// * The version of Babel used to transpile the .js file.
|
||||
// * The contents of this defaultOptions object.
|
||||
// * The contents of the .js file.
|
||||
// That means that we cannot allow information from an unknown source
|
||||
// to affect the cache key for the output of transpilation, which means
|
||||
// we cannot allow users to override these default options via a .babelrc
|
||||
// file, because the contents of that .babelrc file will not make it into
|
||||
// the cache key. It would be great to support .babelrc files once we
|
||||
// have a way to do so that is safe with respect to caching.
|
||||
breakConfig: true,
|
||||
|
||||
sourceMap: 'inline',
|
||||
blacklist: ['es6.forOf', 'useStrict'],
|
||||
optional: ['asyncToGenerator'],
|
||||
stage: 0
|
||||
}
|
||||
const defaultOptions = require('../static/babelrc.json')
|
||||
|
||||
exports.shouldCompile = function(sourceCode) {
|
||||
return sourceCode.startsWith('/** use babel */') ||
|
||||
|
||||
7
static/babelrc.json
Normal file
7
static/babelrc.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"breakConfig": true,
|
||||
"sourceMap": "inline",
|
||||
"blacklist": ["es6.forOf", "useStrict"],
|
||||
"optional": ["asyncToGenerator"],
|
||||
"stage": 0
|
||||
}
|
||||
Reference in New Issue
Block a user