-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP - Babel 6 #221
WIP - Babel 6 #221
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ var createEspowerPlugin = require('babel-plugin-espower/create'); | |
var requireFromString = require('require-from-string'); | ||
var loudRejection = require('loud-rejection/api')(process); | ||
var resolveFrom = require('resolve-from'); | ||
var hasGenerator = require('has-generator'); | ||
var serializeValue = require('./serialize-value'); | ||
var send = require('./send'); | ||
|
||
|
@@ -13,7 +12,7 @@ var testPath = process.argv[2]; | |
var babel; | ||
|
||
try { | ||
var localBabel = resolveFrom('.', 'babel-core') || resolveFrom('.', 'babel'); | ||
var localBabel = resolveFrom('.', 'babel-core'); | ||
babel = require(localBabel); | ||
} catch (err) { | ||
babel = require('babel-core'); | ||
|
@@ -24,11 +23,9 @@ var powerAssert = createEspowerPlugin(babel, { | |
patterns: require('./enhance-assert').PATTERNS | ||
}); | ||
|
||
// if generators are not supported, use regenerator | ||
var options = { | ||
blacklist: hasGenerator ? ['regenerator'] : [], | ||
optional: hasGenerator ? ['asyncToGenerator', 'runtime'] : ['runtime'], | ||
plugins: [powerAssert] | ||
presets: ['stage-3', 'es2015'], | ||
plugins: [powerAssert, 'transform-runtime'] | ||
}; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is the generator check no longer needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also curious about this one. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, it still would be if we want to avoid the unnecessary transform. I think maybe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was included in that preset, that's why I dropped it. Every intention of adding it back. We are still waiting on https://phabricator.babeljs.io/T6644. I will approach this again when that closes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, I didn't realize async functions went to stage3. That's great! :) |
||
// check if test files required ava and show error, when they didn't | ||
|
@@ -40,9 +37,7 @@ process.on('uncaughtException', function (exception) { | |
|
||
// include test file | ||
var transpiled = babel.transformFileSync(testPath, options); | ||
requireFromString(transpiled.code, testPath, { | ||
appendPaths: module.paths | ||
}); | ||
requireFromString(transpiled.code, testPath); | ||
|
||
// if ava was not required, show an error | ||
if (!exports.avaRequired) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,9 +73,13 @@ | |
"dependencies": { | ||
"arr-flatten": "^1.0.1", | ||
"ava-init": "^0.1.0", | ||
"babel-core": "^5.8.23", | ||
"babel-plugin-espower": "^1.1.0", | ||
"babel-runtime": "^5.8.29", | ||
"babel-core": "6.0.14", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use caret There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, at the time, latest was There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jamestalmage Yeah, was only commenting what I want the final PR to look like. We can wait on doing it until this PR is ready. |
||
"babel-plugin-espower": "^2.0.0", | ||
"babel-plugin-transform-runtime": "6.0.14", | ||
"babel-polyfill": "6.0.14", | ||
"babel-preset-es2015": "6.0.14", | ||
"babel-preset-stage-3": "6.0.14", | ||
"babel-runtime": "^5.8.34", | ||
"bluebird": "^3.0.0", | ||
"chalk": "^1.0.0", | ||
"co-with-promise": "^4.6.0", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should drop using the the user's local Babel version. Instead we should just document that to use npm@3 or
npm deduplicate
. The user can then just enforce any Babel 6 version and we will use the same since our dependency is loose.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree.