-
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
Cache transformed files #189
Conversation
eb44db8
to
f9ecfda
Compare
@@ -2,6 +2,8 @@ | |||
var resolveFrom = require('resolve-from'); | |||
var createEspowerPlugin = require('babel-plugin-espower/create'); | |||
var requireFromString = require('require-from-string'); | |||
var hasha = require('hasha'); | |||
var cache = require('cacha')('.ava/cache'); |
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.
Can you make sure it follows XDG?
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.
We are going to need a way to include the settings for the transform in the hash as well.
Perhaps it is:
MD5(MD5(source_file_contents) + MD5(
ava_version + '\n' +
settings_file_contents + '\n' +
...???...
));
How do we handle changing dependency versions? What happens when the babel-plugin-transform-runtime
has a patch level bump (meaning the output of the transform may have changed some for the same input). Are we going to have to scan all the plugin version numbers and make those part of the hash? I can't think of an other way.
However we do it, we should compute the part of the hash that is consistent across the test run once (the ava_version
+ plugin_hash
part), and pass that to the forked processes so they only need to compute the hash of the file being require
d
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.
@sindresorhus done.
@jamestalmage you are perfectly right. Until #202 is resolved we can hash with ava
version.
And I dig the module name ;) |
94da0d0
to
eb53eab
Compare
https://github.com/jamestalmage/babel-plugin-detective It is based on Browserify's algorithm for finding dependencies. Once we make the move to Babel 6, we can use this to precompile dependencies before ever launching the test. We will need other strategies for dynamic requires (possibly the server / client option I discussed earlier), but initially we can demand static requires if they want them transpiled (should cover 90% of use cases anyways). |
09f498a
to
a3b5e89
Compare
a3b5e89
to
ce02fb2
Compare
Closing in favor of #352. |
I have some tests hanging with cache, but implementation will look something like this. Opening to gather suggestions.