-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[v2.0.0] Bundle chokidar #3331
[v2.0.0] Bundle chokidar #3331
Conversation
Codecov Report
@@ Coverage Diff @@
## release-2.0.0 #3331 +/- ##
================================================
Coverage ? 93.49%
================================================
Files ? 173
Lines ? 6013
Branches ? 1787
================================================
Hits ? 5622
Misses ? 211
Partials ? 180
Continue to review full report at Codecov.
|
a29affd
to
13012e4
Compare
Ok, this was quite a piece of work. Apparently, there is an issue in chokidar when a file is "updated" by unlinking and then writing it again in that on certain OSs, specifically our Linux images, the file is no longer watched after that. I fixed it by "unwatch"ing and immediately "add"ing again any changed file. I also completely rewrote and simplified the watcher code to fully take advantage of chokidar. Hopefully this will reduce memory consumption and improve the experience for everyone! This is now ready from my side. |
I created paulmillr/chokidar#972 to track the issue in chokidar I discovered. This should not block release, though, as a workaround is in place. |
@lukastaegert I suggest to only do |
66dc348
to
818de7c
Compare
…kidar depends on utils.promisify
818de7c
to
c4d0d9f
Compare
8d2e746
to
6db5c94
Compare
* Create a separate chunk for watch mode via a dynamic import * Bundle chokidar * Handle conditional fsevents import * Only run tests on Node 10 and 12 as we want to do this anyway and chokidar depends on utils.promisify * Improve chunking * Refactor and simplify watcher * Make watcher a proper parameter * Only unwatch and watch on Linux systems * No longer run JS files through TypeScript for improved bundling performance
* Create a separate chunk for watch mode via a dynamic import * Bundle chokidar * Handle conditional fsevents import * Only run tests on Node 10 and 12 as we want to do this anyway and chokidar depends on utils.promisify * Improve chunking * Refactor and simplify watcher * Make watcher a proper parameter * Only unwatch and watch on Linux systems * No longer run JS files through TypeScript for improved bundling performance
* Create a separate chunk for watch mode via a dynamic import * Bundle chokidar * Handle conditional fsevents import * Only run tests on Node 10 and 12 as we want to do this anyway and chokidar depends on utils.promisify * Improve chunking * Refactor and simplify watcher * Make watcher a proper parameter * Only unwatch and watch on Linux systems * No longer run JS files through TypeScript for improved bundling performance
* Create a separate chunk for watch mode via a dynamic import * Bundle chokidar * Handle conditional fsevents import * Only run tests on Node 10 and 12 as we want to do this anyway and chokidar depends on utils.promisify * Improve chunking * Refactor and simplify watcher * Make watcher a proper parameter * Only unwatch and watch on Linux systems * No longer run JS files through TypeScript for improved bundling performance
* Create a separate chunk for watch mode via a dynamic import * Bundle chokidar * Handle conditional fsevents import * Only run tests on Node 10 and 12 as we want to do this anyway and chokidar depends on utils.promisify * Improve chunking * Refactor and simplify watcher * Make watcher a proper parameter * Only unwatch and watch on Linux systems * No longer run JS files through TypeScript for improved bundling performance
* [v2.0.0] Update minimum required Node version to 10 (#3346) * Update CI to only run on Node 10 and 12, add engines to package.json * Update TypeScript target * Remove Bublé as a transpilation option from tests (it is still needed in sourcemap tests) * Remove minNodeVersion form tests * Reformat package.json * [v2.0.0] Bundle chokidar (#3331) * Create a separate chunk for watch mode via a dynamic import * Bundle chokidar * Handle conditional fsevents import * Only run tests on Node 10 and 12 as we want to do this anyway and chokidar depends on utils.promisify * Improve chunking * Refactor and simplify watcher * Make watcher a proper parameter * Only unwatch and watch on Linux systems * No longer run JS files through TypeScript for improved bundling performance * [v2.0.0] Remove active deprecations (#3352) * Remove active deprecations * Make inactive deprecations active * Improve coverage * Improve coverage * Refine transformer * Improve coverage * Refactoring option normalization * Improve coverage * Remove experimentalOptimizeChunks * Remove more unused code
* Create a separate chunk for watch mode via a dynamic import * Bundle chokidar * Handle conditional fsevents import * Only run tests on Node 10 and 12 as we want to do this anyway and chokidar depends on utils.promisify * Improve chunking * Refactor and simplify watcher * Make watcher a proper parameter * Only unwatch and watch on Linux systems * No longer run JS files through TypeScript for improved bundling performance
* [v2.0.0] Update minimum required Node version to 10 (#3346) * Update CI to only run on Node 10 and 12, add engines to package.json * Update TypeScript target * Remove Bublé as a transpilation option from tests (it is still needed in sourcemap tests) * Remove minNodeVersion form tests * Reformat package.json * [v2.0.0] Bundle chokidar (#3331) * Create a separate chunk for watch mode via a dynamic import * Bundle chokidar * Handle conditional fsevents import * Only run tests on Node 10 and 12 as we want to do this anyway and chokidar depends on utils.promisify * Improve chunking * Refactor and simplify watcher * Make watcher a proper parameter * Only unwatch and watch on Linux systems * No longer run JS files through TypeScript for improved bundling performance * [v2.0.0] Remove active deprecations (#3352) * Remove active deprecations * Make inactive deprecations active * Improve coverage * Improve coverage * Refine transformer * Improve coverage * Refactoring option normalization * Improve coverage * Remove experimentalOptimizeChunks * Remove more unused code
* Create a separate chunk for watch mode via a dynamic import * Bundle chokidar * Handle conditional fsevents import * Only run tests on Node 10 and 12 as we want to do this anyway and chokidar depends on utils.promisify * Improve chunking * Refactor and simplify watcher * Make watcher a proper parameter * Only unwatch and watch on Linux systems * No longer run JS files through TypeScript for improved bundling performance
* [v2.0.0] Update minimum required Node version to 10 (#3346) * Update CI to only run on Node 10 and 12, add engines to package.json * Update TypeScript target * Remove Bublé as a transpilation option from tests (it is still needed in sourcemap tests) * Remove minNodeVersion form tests * Reformat package.json * [v2.0.0] Bundle chokidar (#3331) * Create a separate chunk for watch mode via a dynamic import * Bundle chokidar * Handle conditional fsevents import * Only run tests on Node 10 and 12 as we want to do this anyway and chokidar depends on utils.promisify * Improve chunking * Refactor and simplify watcher * Make watcher a proper parameter * Only unwatch and watch on Linux systems * No longer run JS files through TypeScript for improved bundling performance * [v2.0.0] Remove active deprecations (#3352) * Remove active deprecations * Make inactive deprecations active * Improve coverage * Improve coverage * Refine transformer * Improve coverage * Refactoring option normalization * Improve coverage * Remove experimentalOptimizeChunks * Remove more unused code
* Create a separate chunk for watch mode via a dynamic import * Bundle chokidar * Handle conditional fsevents import * Only run tests on Node 10 and 12 as we want to do this anyway and chokidar depends on utils.promisify * Improve chunking * Refactor and simplify watcher * Make watcher a proper parameter * Only unwatch and watch on Linux systems * No longer run JS files through TypeScript for improved bundling performance
* [v2.0.0] Update minimum required Node version to 10 (#3346) * Update CI to only run on Node 10 and 12, add engines to package.json * Update TypeScript target * Remove Bublé as a transpilation option from tests (it is still needed in sourcemap tests) * Remove minNodeVersion form tests * Reformat package.json * [v2.0.0] Bundle chokidar (#3331) * Create a separate chunk for watch mode via a dynamic import * Bundle chokidar * Handle conditional fsevents import * Only run tests on Node 10 and 12 as we want to do this anyway and chokidar depends on utils.promisify * Improve chunking * Refactor and simplify watcher * Make watcher a proper parameter * Only unwatch and watch on Linux systems * No longer run JS files through TypeScript for improved bundling performance * [v2.0.0] Remove active deprecations (#3352) * Remove active deprecations * Make inactive deprecations active * Improve coverage * Improve coverage * Refine transformer * Improve coverage * Refactoring option normalization * Improve coverage * Remove experimentalOptimizeChunks * Remove more unused code
* Create a separate chunk for watch mode via a dynamic import * Bundle chokidar * Handle conditional fsevents import * Only run tests on Node 10 and 12 as we want to do this anyway and chokidar depends on utils.promisify * Improve chunking * Refactor and simplify watcher * Make watcher a proper parameter * Only unwatch and watch on Linux systems * No longer run JS files through TypeScript for improved bundling performance
* [v2.0.0] Update minimum required Node version to 10 (#3346) * Update CI to only run on Node 10 and 12, add engines to package.json * Update TypeScript target * Remove Bublé as a transpilation option from tests (it is still needed in sourcemap tests) * Remove minNodeVersion form tests * Reformat package.json * [v2.0.0] Bundle chokidar (#3331) * Create a separate chunk for watch mode via a dynamic import * Bundle chokidar * Handle conditional fsevents import * Only run tests on Node 10 and 12 as we want to do this anyway and chokidar depends on utils.promisify * Improve chunking * Refactor and simplify watcher * Make watcher a proper parameter * Only unwatch and watch on Linux systems * No longer run JS files through TypeScript for improved bundling performance * [v2.0.0] Remove active deprecations (#3352) * Remove active deprecations * Make inactive deprecations active * Improve coverage * Improve coverage * Refine transformer * Improve coverage * Refactoring option normalization * Improve coverage * Remove experimentalOptimizeChunks * Remove more unused code
This PR contains:
Are tests included?
Breaking Changes?
List any relevant issue numbers:
Resolves #2988
Description
This is the first PR in preparation of the 2.0.0 release: https://github.com/rollup/rollup/projects/2
This will likely receive some additional polishing and testing before it will be merged to the new
release-2.0.0
branch. There may be pre-releases from the branch if there is interest once the first changes are merged.This will make Chokidar the only watcher used by Rollup and bundle it. Also, the code was slightly restructured so that all watch mode related code is in separate chunks that are only loaded on demand via dynamic import (or conditional require in the CJS build). This means that
Bundling chokidar itself was mainly painless. However, its fsevents dependency cannot be bundled as it contains native code. Therefore, it became an optional dependency of Rollup. There is a check in place to make sure its version range matches that of chokidar.
In order to handle the optional require of fsevents in the Rollup code, I created a loader file, patched the chokidar code to load the loader file instead of fsevents and in that loader file, again used a dynamic import to load fsevents. As the watcher itself is already loaded via a dynamic import, I chained these imports so that chokidar will now behave the same no matter if fsevents is present and valid or missing.