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

gulp.watch not works if watched glob contains Japanese characters folder name #2153

Closed
aruku7230 opened this issue Apr 13, 2018 · 10 comments · Fixed by #2758
Closed

gulp.watch not works if watched glob contains Japanese characters folder name #2153

aruku7230 opened this issue Apr 13, 2018 · 10 comments · Fixed by #2758
Labels
bug upstream Issues that need to be fixed upstream

Comments

@aruku7230
Copy link

  • gulp: 4.00
  • node: 8.9.4
  • npm: 5.8.0
  • OS: macOS 10.12.6

gulpfile.json

const gulp = require('gulp');
const watchGlob = 'folder/**/*';

gulp.task('test', () => {
    gulp.watch(watchGlob, (done) => { done() })
            .on('change', (path) => {
                console.log(`File ${path} changed.`);
            });
});

run test task and change folder/foo file
result output is:

Starting 'test'...
File folder/foo changed.
Starting ''...
Finished '' after 1.45 ms

change watchGlob

const watchGlob = 'フォルダ/**/*';

run test task and change フォルダ/foo file.
result output is:

Starting 'test'...

@rgroothuijsen
Copy link

rgroothuijsen commented Apr 30, 2018

This is most likely a bug in one of the underlying libraries gulp uses for file watching. Interestingly, the フォルダ/** and フォルダ/* glob patterns do react as expected, as does changing a file like フォルダ/foo/bar.

@yocontra
Copy link
Member

yocontra commented Apr 30, 2018

Can you test it with https://github.com/paulmillr/chokidar directly and see if you can reproduce it? If so the issue goes there, if not we can look into it here.

Thanks for the report.

@aruku7230
Copy link
Author

Reproduce it use chokidar. It's a issue with chokidar.

const watchGlob = 'フォルダ/**/*';

gulp.task('test', () => {
    const chokidar = require('chokidar');
    chokidar.watch(watchGlob, (done) => { done() })
            .on('change', (path) => {
                console.log(`File ${path} changed.`);
            });
});

@sttk
Copy link
Contributor

sttk commented May 12, 2018

This issue is due to micromatch which is used in chokidar.

@MasatoMakino
Copy link

I think it related to NFD filename on macOSX.
NFD's "ダ" is "タ" + " " ".
NFD's "ダ" chrcode deffer from NFC's "ダ" chrcode.

@phated phated added bug help wanted upstream Issues that need to be fixed upstream Bug Bounty: $50 Fix this issue to claim the $50 bounty. labels Nov 14, 2018
@phated
Copy link
Member

phated commented Nov 14, 2018

We've just added a Bug Bounty of $50 on this issue if anyone wants to solve it.

@pe8ter
Copy link

pe8ter commented Nov 18, 2018

I think I have the issue narrowed down to a RegExp in the nanomatch package. This issue is not restricted to Japanese, but to any directory that doesn't end in 0-9, a-z, A-Z, or _. I opened micromatch/nanomatch#18.

@jonschlinkert
Copy link

but to any directory that doesn't end in 0-9, a-z, A-Z, or _.

The regex was written to only match valid path characters, but this clearly was shortsighted and insensitive to non-English languages. I will get that fixed.

@jonschlinkert
Copy link

I'd also happily accept a PR to fix it if someone wants to earn the bounty. Just let me know.

@phated
Copy link
Member

phated commented Apr 20, 2019

This is actually going to have to wait until gulp 5.0 to be fixed because it relies on a rewrite of the micromatch parser (which only made sense to be released as a major), and that version will only be used in a version of chokidar that doesn't support all versions of nodejs we support in 4.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug upstream Issues that need to be fixed upstream
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants