Move Babel transforms to the main process.#349
Conversation
09c8308 to
2ba0686
Compare
|
Rebase went wrong here. |
It wasn't like that last night. |
60c0cbf to
c738c78
Compare
There was a problem hiding this comment.
Use https://github.com/sindresorhus/del-cli to make it work on Windwos too.
There was a problem hiding this comment.
OK, I tried trash-cli first but it fails if the directory doesn't exist. Was just about to push rimraf, does del-cli accept missing directories?
There was a problem hiding this comment.
@jamestalmage Re trash-cli, that's a bug sindresorhus/trash#43, but no point in having the overhead of moving it to the trash, not something you'd ever care about restoring.
235e320 to
21a98a4
Compare
|
@sindresorhus I used |
|
Hmm, it seems implementing caching fixed my Windows errors. I previously saw some errors that made me suspicious the problem was in |
|
@jamestalmage |
|
OK, cool. |
There are many failing tests, but it basically works.
The latest `nyc` uses `append-transform`, which means multiple require extensions can be installed on top of the one `nyc` installs. Previous versions of nyc only allowed one additional transform before breaking. This allows us to use `require-precompiled` and users can still add `babel/register` (whenever we get those working).
`tap` automatically uploads coverage to coveralls for branches, but not PR's. That required an ugly workaround in .travis.yml to manually upload only for PR's. Since we now use `nyc` directly, and pass the the `--no-cov` flag in our `tap` commands, this is no longer a problem.
9c7072e to
4970e6b
Compare
Does not yet handle missing `package.json`
This implements the `--no-cache` flag, but in this commit it's always set. I want to see how well `--no-cache` works on Windows...
I need to decide on a good testing strategy for this.
I have updated it to use `write-file-atomic` to avoid race conditions
|
OK, This is ready for review. // @vdemedes @sindresorhus |
There was a problem hiding this comment.
noCache => cache. I don't like double negatives.
There was a problem hiding this comment.
This could use https://github.com/sindresorhus/md5-hex now.
|
closed in favor of #390 |
This moves Babel transforms to the main process, and caches the transpiled results.
It uses
caching-transformto provide caching. Expensive requires (likebabel) are placed inside thefactoryfunction, whichcaching-transformonly calls when it determines it needs to transform a file.The path to each precompiled test is passed in the options object to
fork:It uses
require-precompiledto install a require hook that pulls the transformed file from the cache.The caching directory is used by the users
package.json, and installing innode_modules/.cache/ava.If the cache directory cannot be found (i.e. if they have no
package.json), or the user provides a--no-cacheflag, pre-compilation still happens on the main thread - but results are published to a temp directory.Speedup is dramatic.
Using the
6.0.0branch of got:ava master branch
this branch using
--no-cacheThis branch with caching enabled
A couple points of interest here:
npm 2even on your first run.npm 3for the best performance.