A big win recently in the e18e space is that chokidar published a new 4.x version!
This new version drops a whole bunch of dependencies and simplifies the internal logic greatly, leaning more on modern platform capabilities.
For those of you who don't know what chokidar is - it is a widely used file system watcher which provides an abstraction over the top of Node's own watch functions. More than likely, it is somewhere in your dependency tree already!
In chokidar 3.x:
In chokidar 4.x:
Most of the changes are internal and shouldn't affect how you use the library, but will improve performance a huge amount.
A few notable changes:
The one major change from this list that will affect users is the removal of globs.
In chokidar 3.x, it was possible to watch a glob. For example, we could watch src/*.ts and chokidar would expand the pattern internally to watch all TypeScript files inside src/.
In 4.x, this functionality has been removed since you can achieve the same with filters or an external glob library.
An example:
// chokidar v3 watch('src/*.ts'); // chokidar v4 (RegExp) watch('src', { // any path whose end is not preceded by `.ts` ignored: /(? stats?.isFile() && !path.endsWith('.ts') }); // chokidar v4 (glob) // NOTE: this will not watch newly added files. It // will only watch the initial set of files import {glob} from 'tinyglobby'; watch(await glob(['src/*.ts']));
In most cases, you can probably avoid the need for a glob library and use a filter function or RegExp instead (which will also be much faster in many cases).
If you upgrade and have any feedback or find any bugs, we'd love to hear from you via issues.
You can also catch many of us in the e18e discord working hard on migrating popular packages from 3.x to 4.x.
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3