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 configs based on mtime and allow .babelrc.js functions #5608

Merged
merged 5 commits into from Apr 17, 2017

Conversation

Projects
None yet
3 participants
@loganfsmyth
Member

loganfsmyth commented Apr 7, 2017

Q A
Patch: Bug Fix? N
Major: Breaking Change? N
Minor: New Feature? Y
Deprecations?
Spec Compliancy?
Tests Added/Pass?
Fixed Tickets
License MIT
Doc PR
Dependency Changes

Curious for feedback. Including the .babelrc.js function logic because it's partially a demonstration of why I'm caching based on mtime. Caching based on the file content doesn't really work with the function-based config, so we might as well just leave it to the configs themselves to invalidate themselves consistently.

The key thing for this PR is that findConfigs and loadConfig will now return the same object consistently, so

loadConfig('./.babelrc.js', process.cwd()) === loadConfig('./.babelrc.js', process.cwd())

which means we can build the caching for the plugins and presets on top of that. So if the config files change mtime, the object they return will change, and that will trigger all of the presets and plugins to change.

@loganfsmyth loganfsmyth added this to the Babel 7 milestone Apr 7, 2017

@codecov

This comment has been minimized.

codecov bot commented Apr 7, 2017

Codecov Report

Merging #5608 into 7.0 will decrease coverage by <.01%.
The diff coverage is 94.38%.

Impacted file tree graph

@@            Coverage Diff             @@
##              7.0    #5608      +/-   ##
==========================================
- Coverage   84.48%   84.47%   -0.01%     
==========================================
  Files         285      286       +1     
  Lines        9653     9719      +66     
  Branches     2714     2731      +17     
==========================================
+ Hits         8155     8210      +55     
- Misses        996     1005       +9     
- Partials      502      504       +2
Impacted Files Coverage Δ
...bel-core/src/config/loading/files/configuration.js 88.75% <92.3%> (-2.16%) ⬇️
packages/babel-core/src/config/caching.js 95.23% <95.23%> (ø)
packages/babel-helper-call-delegate/src/index.js 64% <0%> (-4%) ⬇️
packages/babel-traverse/src/path/context.js 84.48% <0%> (-1.73%) ⬇️
packages/babel-traverse/src/path/modification.js 73.78% <0%> (-0.98%) ⬇️
packages/babel-traverse/src/visitors.js 85.71% <0%> (-0.96%) ⬇️
...bel-plugin-transform-es2015-classes/src/vanilla.js 89.74% <0%> (-0.43%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a2f334b...1c078e5. Read the comment docs.

@loganfsmyth loganfsmyth referenced this pull request Apr 9, 2017

Closed

Config caching #5292

@loganfsmyth

This comment has been minimized.

Member

loganfsmyth commented Apr 14, 2017

I've pushed a new implementation of this PR that aims to standardize a caching API that we can expose to presets, plugins, and .babelrc.js files. This PR implements the API and exposes it for .babelrc.js but does not take it further than that. Once I get feedback and land this PR, I'll do that next.

@hzoo

hzoo approved these changes Apr 17, 2017

@loganfsmyth loganfsmyth merged commit c59e9f5 into babel:7.0 Apr 17, 2017

3 checks passed

ci/circleci Your tests passed on CircleCI!
Details
codecov/project 84.47% (target 80%)
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@loganfsmyth loganfsmyth deleted the loganfsmyth:config-cache branch Apr 17, 2017

@xtuc xtuc referenced this pull request Apr 27, 2017

Closed

[7.0] Default babel-register cache location to node_modules #5198

0 of 6 tasks complete

@hzoo hzoo referenced this pull request Jun 12, 2017

Closed

[7.0] Deprecate env option in .babelrc #5276

0 of 6 tasks complete
@MrsTaylor14

This comment has been minimized.

MrsTaylor14 commented Jan 26, 2018

It works great

@lock lock bot added the outdated label May 2, 2018

@lock lock bot locked as resolved and limited conversation to collaborators May 2, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.