Move babel config to a separate file in static directory

This commit is contained in:
Max Brunsfeld
2015-08-19 17:27:57 -07:00
parent 49e37f5410
commit 2285e8a42c
3 changed files with 9 additions and 21 deletions

View File

@@ -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.

View File

@@ -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
View File

@@ -0,0 +1,7 @@
{
"breakConfig": true,
"sourceMap": "inline",
"blacklist": ["es6.forOf", "useStrict"],
"optional": ["asyncToGenerator"],
"stage": 0
}