Skip to content
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

`babel --watch` should have equivalent file selection logic with `babel` #10283

Merged
merged 2 commits into from Dec 5, 2019

Conversation

@JLHwung
Copy link
Contributor

JLHwung commented Jul 30, 2019

Q                       A
Fixed Issues? Fixes #10270
Patch: Bug Fix? Yes
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Nope
Documentation PR Link
Any Dependency Changes?
License MIT

In this PR, we align file selection logic of --watch to one time building. In

filenames.forEach(function(filename) {
if (!fs.existsSync(filename)) return;
const stat = fs.statSync(filename);
if (stat.isDirectory()) {
const dirname = filename;
util
.readdirForCompilable(
filename,
cliOptions.includeDotfiles,
cliOptions.extensions,
)
.forEach(function(filename) {
_filenames.push(path.join(dirname, filename));
});
} else {
_filenames.push(filename);
}
});

The cli options --extensions is used to filter compilable files if the filename argument is a directory. However the watch logic excludes all non-compilable files even if it is specified in filename argument.

We also introduce minor performance tweak by passing disableGlobbing: true into chokidar as @babel/cli does not support globbing.

Fixture-based unit test does not work here since we need separate process to trigger a file change.

@babel-bot

This comment has been minimized.

Copy link
Collaborator

babel-bot commented Jul 30, 2019

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/11266/

@nicolo-ribaudo

This comment has been minimized.

Copy link
Member

nicolo-ribaudo commented Dec 4, 2019

@JLHwung Could you rebase and merge?

@JLHwung JLHwung force-pushed the JLHwung:fix-10270 branch from 912a545 to 520e8ab Dec 5, 2019
@nicolo-ribaudo nicolo-ribaudo merged commit c9a6898 into babel:master Dec 5, 2019
4 of 5 checks passed
4 of 5 checks passed
test262 Workflow: test262
Details
Travis CI - Pull Request Build Passed
Details
codecov/project 88.13% (target 80%)
Details
e2e Workflow: e2e
Details
test Workflow: test
Details
@nicolo-ribaudo nicolo-ribaudo deleted the JLHwung:fix-10270 branch Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.