-
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
Replace babel require hook with transformFileSync #103
Conversation
fc962aa
to
90394d0
Compare
blacklist: hasGenerators ? ['regenerator'] : [], | ||
optional: hasGenerators ? ['asyncToGenerator'] : [], | ||
optional: hasGenerators ? ['asyncToGenerator'] : ['runtime'], |
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.
Runtime should still be included, even if hasGenerators
is true.
Does the caching still work with this solution? Since Babel is relatively slow, the caching is very important. |
90394d0
to
29d4c8e
Compare
@sindresorhus I'm afraid, cache should be implemented by hands.
|
@floatdrop in order to support the stuff that "generator community" is used to, |
@floatdrop Maybe you could either extract this into a separate module we can depend on or do a PR on Babel to expose it? |
@vdemedes yeah, I know, but you can't use @sindresorhus okay, but need to do some performance tests - I wonder, how fast cache file will fill up and parsing time eat all the benefit. |
@floatdrop generators are only being used in node 0.11, iojs and node v4.x projects, so we don't have to worry about that. |
@vdemedes |
@floatdrop Hmm, did not understand the point. I am just saying that nobody uses generators on the old node.js versions. |
@vdemedes generators are not a problem, yes. But ava do require co at the top of |
JFYI: seems like babel require hook have some polyfill side-effect - https://github.com/floatdrop/ava-in-node-0.10 |
Just to keep track - waiting for tj/co#250 |
Doesn't look like |
Why do we even depend on |
Because co implements some very nice features, which babel's regenerator does not implement. Babel's implementation only makes Promises yieldable, but nothing else. Why don't we use @floatdrop's fixed fork for now, until they merge his fix into master? |
👍 |
3773b95
to
3f4cbfa
Compare
"bluebird": "^3.0.0", | ||
"chalk": "^1.0.0", | ||
"co": "^4.6.0", | ||
"co": "git://github.com/floatdrop/co", |
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.
"co": "floatdrop/co#343xsv324",
use the shorthand format and use a specific commit hash (first 6 chars of the hash is enough), otherwise the npm cache will become stale.
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.
🆗
3f4cbfa
to
adcf8e0
Compare
@floatdrop I'm ok with merging this now if you commit to looking into caching later? Compilation is a lot larger overhead than just reading in a cached file from disk. I do think we can do caching better than Babel itself, though. Mainly using separate cache files for each test file (Babel uses one large file) and a LRU cache. |
"bluebird": "^3.0.0", | ||
"chalk": "^1.0.0", | ||
"co": "^4.6.0", | ||
"co": "floatdrop/co#343xsv324", |
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.
lol, that was a fake hash, i don't know which hash you want to use.
adcf8e0
to
55d5982
Compare
@sindresorhus sure. I'm started to use |
😍 |
This looks good to me. @vdemedes Can you take a final look? |
Good to go! 👍 |
Thanks again @floatdrop :) |
Start of discussion - 52b0ccb#commitcomment-13971327
If you have
babel
and want to use require hook in application code and want to run tests withava
- you can get syntax errors (SyntaxError: Unexpected reserved word
) because babel will get options fromava
.