Skip to content

Commit 49783da

Browse files
authored
revert: use chokidar v3 (#18659)
1 parent 5a2103f commit 49783da

File tree

15 files changed

+530
-165
lines changed

15 files changed

+530
-165
lines changed

docs/config/server-options.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,11 @@ export default defineConfig({
214214

215215
- **Type:** `object | null`
216216

217-
File system watcher options to pass on to [chokidar](https://github.com/paulmillr/chokidar#getting-started). If the `ignored` option is passed, Vite will also automatically convert any strings as [picomatch patterns](https://github.com/micromatch/picomatch#globbing-features).
217+
File system watcher options to pass on to [chokidar](https://github.com/paulmillr/chokidar/tree/3.6.0#api).
218218

219219
The Vite server watcher watches the `root` and skips the `.git/`, `node_modules/`, and Vite's `cacheDir` and `build.outDir` directories by default. When updating a watched file, Vite will apply HMR and update the page only if needed.
220220

221-
If set to `null`, no files will be watched. `server.watcher` will not watch any files and calling `add` will have no effect.
221+
If set to `null`, no files will be watched. `server.watcher` will provide a compatible event emitter, but calling `add` or `unwatch` will have no effect.
222222

223223
::: warning Watching files in `node_modules`
224224

@@ -235,7 +235,7 @@ To fix it, you could either:
235235
- **Recommended**: Use WSL2 applications to edit your files.
236236
- It is also recommended to move the project folder outside of a Windows filesystem. Accessing Windows filesystem from WSL2 is slow. Removing that overhead will improve performance.
237237
- Set `{ usePolling: true }`.
238-
- Note that [`usePolling` leads to high CPU utilization](https://github.com/paulmillr/chokidar#performance).
238+
- Note that [`usePolling` leads to high CPU utilization](https://github.com/paulmillr/chokidar/tree/3.6.0#performance).
239239

240240
:::
241241

docs/guide/api-javascript.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ interface ViteDevServer {
110110
httpServer: http.Server | null
111111
/**
112112
* Chokidar watcher instance. If `config.server.watch` is set to `null`,
113-
* it will not watch any files and calling `add` will have no effect.
114-
* https://github.com/paulmillr/chokidar#getting-started
113+
* it will not watch any files and calling `add` or `unwatch` will have no effect.
114+
* https://github.com/paulmillr/chokidar/tree/3.6.0#api
115115
*/
116116
watcher: FSWatcher
117117
/**

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@
102102
},
103103
"patchedDependencies": {
104104
"http-proxy@1.18.1": "patches/http-proxy@1.18.1.patch",
105-
"sirv@3.0.0": "patches/sirv@3.0.0.patch"
105+
"sirv@3.0.0": "patches/sirv@3.0.0.patch",
106+
"chokidar@3.6.0": "patches/chokidar@3.6.0.patch"
106107
},
107108
"peerDependencyRules": {
108109
"allowedVersions": {

packages/vite/LICENSE.md

Lines changed: 236 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,29 @@ Repository: rollup/plugins
401401
402402
---------------------------------------
403403

404+
## anymatch
405+
License: ISC
406+
By: Elan Shanker
407+
Repository: https://github.com/micromatch/anymatch
408+
409+
> The ISC License
410+
>
411+
> Copyright (c) 2019 Elan Shanker, Paul Miller (https://paulmillr.com)
412+
>
413+
> Permission to use, copy, modify, and/or distribute this software for any
414+
> purpose with or without fee is hereby granted, provided that the above
415+
> copyright notice and this permission notice appear in all copies.
416+
>
417+
> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
418+
> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
419+
> MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
420+
> ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
421+
> WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
422+
> ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
423+
> IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
424+
425+
---------------------------------------
426+
404427
## artichokie
405428
License: MIT
406429
By: sapphi-red, Evan You
@@ -431,6 +454,61 @@ Repository: git+https://github.com/sapphi-red/artichokie.git
431454
432455
---------------------------------------
433456

457+
## binary-extensions
458+
License: MIT
459+
By: Sindre Sorhus
460+
Repository: sindresorhus/binary-extensions
461+
462+
> MIT License
463+
>
464+
> Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
465+
> Copyright (c) Paul Miller (https://paulmillr.com)
466+
>
467+
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
468+
>
469+
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
470+
>
471+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
472+
473+
---------------------------------------
474+
475+
## braces, fill-range, is-number
476+
License: MIT
477+
By: Jon Schlinkert, Brian Woodward, Elan Shanker, Eugene Sharygin, hemanth.hm
478+
Repository: micromatch/braces
479+
480+
License: MIT
481+
By: Jon Schlinkert, Edo Rivai, Paul Miller, Rouven Weßling
482+
Repository: jonschlinkert/fill-range
483+
484+
License: MIT
485+
By: Jon Schlinkert, Olsten Larck, Rouven Weßling
486+
Repository: jonschlinkert/is-number
487+
488+
> The MIT License (MIT)
489+
>
490+
> Copyright (c) 2014-present, Jon Schlinkert.
491+
>
492+
> Permission is hereby granted, free of charge, to any person obtaining a copy
493+
> of this software and associated documentation files (the "Software"), to deal
494+
> in the Software without restriction, including without limitation the rights
495+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
496+
> copies of the Software, and to permit persons to whom the Software is
497+
> furnished to do so, subject to the following conditions:
498+
>
499+
> The above copyright notice and this permission notice shall be included in
500+
> all copies or substantial portions of the Software.
501+
>
502+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
503+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
504+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
505+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
506+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
507+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
508+
> THE SOFTWARE.
509+
510+
---------------------------------------
511+
434512
## bundle-name, default-browser, default-browser-id, define-lazy-prop, is-docker, is-inside-container, is-wsl, open, run-applescript
435513
License: MIT
436514
By: Sindre Sorhus
@@ -479,12 +557,12 @@ Repository: egoist/cac
479557

480558
## chokidar
481559
License: MIT
482-
By: Paul Miller
560+
By: Paul Miller, Elan Shanker
483561
Repository: git+https://github.com/paulmillr/chokidar.git
484562

485563
> The MIT License (MIT)
486564
>
487-
> Copyright (c) 2012 Paul Miller (https://paulmillr.com), Elan Shanker
565+
> Copyright (c) 2012-2019 Paul Miller (https://paulmillr.com), Elan Shanker
488566
>
489567
> Permission is hereby granted, free of charge, to any person obtaining a copy
490568
> of this software and associated documentation files (the “Software”), to deal
@@ -1078,6 +1156,29 @@ Repository: git+https://github.com/css-modules/generic-names.git
10781156
10791157
---------------------------------------
10801158

1159+
## glob-parent
1160+
License: ISC
1161+
By: Gulp Team, Elan Shanker, Blaine Bublitz
1162+
Repository: gulpjs/glob-parent
1163+
1164+
> The ISC License
1165+
>
1166+
> Copyright (c) 2015, 2019 Elan Shanker
1167+
>
1168+
> Permission to use, copy, modify, and/or distribute this software for any
1169+
> purpose with or without fee is hereby granted, provided that the above
1170+
> copyright notice and this permission notice appear in all copies.
1171+
>
1172+
> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1173+
> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1174+
> MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1175+
> ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1176+
> WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1177+
> ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
1178+
> IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1179+
1180+
---------------------------------------
1181+
10811182
## http-proxy
10821183
License: MIT
10831184
By: Charlie Robbins, jcrugzz <jcrugzz@gmail.com>
@@ -1122,6 +1223,81 @@ Repository: git+https://github.com/css-modules/icss-utils.git
11221223
11231224
---------------------------------------
11241225

1226+
## is-binary-path
1227+
License: MIT
1228+
By: Sindre Sorhus
1229+
Repository: sindresorhus/is-binary-path
1230+
1231+
> MIT License
1232+
>
1233+
> Copyright (c) 2019 Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com), Paul Miller (https://paulmillr.com)
1234+
>
1235+
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1236+
>
1237+
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
1238+
>
1239+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1240+
1241+
---------------------------------------
1242+
1243+
## is-extglob
1244+
License: MIT
1245+
By: Jon Schlinkert
1246+
Repository: jonschlinkert/is-extglob
1247+
1248+
> The MIT License (MIT)
1249+
>
1250+
> Copyright (c) 2014-2016, Jon Schlinkert
1251+
>
1252+
> Permission is hereby granted, free of charge, to any person obtaining a copy
1253+
> of this software and associated documentation files (the "Software"), to deal
1254+
> in the Software without restriction, including without limitation the rights
1255+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1256+
> copies of the Software, and to permit persons to whom the Software is
1257+
> furnished to do so, subject to the following conditions:
1258+
>
1259+
> The above copyright notice and this permission notice shall be included in
1260+
> all copies or substantial portions of the Software.
1261+
>
1262+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1263+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1264+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1265+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1266+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1267+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1268+
> THE SOFTWARE.
1269+
1270+
---------------------------------------
1271+
1272+
## is-glob
1273+
License: MIT
1274+
By: Jon Schlinkert, Brian Woodward, Daniel Perez
1275+
Repository: micromatch/is-glob
1276+
1277+
> The MIT License (MIT)
1278+
>
1279+
> Copyright (c) 2014-2017, Jon Schlinkert.
1280+
>
1281+
> Permission is hereby granted, free of charge, to any person obtaining a copy
1282+
> of this software and associated documentation files (the "Software"), to deal
1283+
> in the Software without restriction, including without limitation the rights
1284+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1285+
> copies of the Software, and to permit persons to whom the Software is
1286+
> furnished to do so, subject to the following conditions:
1287+
>
1288+
> The above copyright notice and this permission notice shall be included in
1289+
> all copies or substantial portions of the Software.
1290+
>
1291+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1292+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1293+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1294+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1295+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1296+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1297+
> THE SOFTWARE.
1298+
1299+
---------------------------------------
1300+
11251301
## is-reference
11261302
License: MIT
11271303
By: Rich Harris
@@ -1422,6 +1598,35 @@ Repository: vercel/ms
14221598
14231599
---------------------------------------
14241600

1601+
## normalize-path
1602+
License: MIT
1603+
By: Jon Schlinkert, Blaine Bublitz
1604+
Repository: jonschlinkert/normalize-path
1605+
1606+
> The MIT License (MIT)
1607+
>
1608+
> Copyright (c) 2014-2018, Jon Schlinkert.
1609+
>
1610+
> Permission is hereby granted, free of charge, to any person obtaining a copy
1611+
> of this software and associated documentation files (the "Software"), to deal
1612+
> in the Software without restriction, including without limitation the rights
1613+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1614+
> copies of the Software, and to permit persons to whom the Software is
1615+
> furnished to do so, subject to the following conditions:
1616+
>
1617+
> The above copyright notice and this permission notice shall be included in
1618+
> all copies or substantial portions of the Software.
1619+
>
1620+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1621+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1622+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1623+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1624+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1625+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1626+
> THE SOFTWARE.
1627+
1628+
---------------------------------------
1629+
14251630
## object-assign
14261631
License: MIT
14271632
By: Sindre Sorhus
@@ -2044,6 +2249,35 @@ Repository: git+https://github.com/SuperchupuDev/tinyglobby.git
20442249
20452250
---------------------------------------
20462251

2252+
## to-regex-range
2253+
License: MIT
2254+
By: Jon Schlinkert, Rouven Weßling
2255+
Repository: micromatch/to-regex-range
2256+
2257+
> The MIT License (MIT)
2258+
>
2259+
> Copyright (c) 2015-present, Jon Schlinkert.
2260+
>
2261+
> Permission is hereby granted, free of charge, to any person obtaining a copy
2262+
> of this software and associated documentation files (the "Software"), to deal
2263+
> in the Software without restriction, including without limitation the rights
2264+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2265+
> copies of the Software, and to permit persons to whom the Software is
2266+
> furnished to do so, subject to the following conditions:
2267+
>
2268+
> The above copyright notice and this permission notice shall be included in
2269+
> all copies or substantial portions of the Software.
2270+
>
2271+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2272+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2273+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2274+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2275+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2276+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2277+
> THE SOFTWARE.
2278+
2279+
---------------------------------------
2280+
20472281
## tsconfck
20482282
License: MIT
20492283
By: dominikg

packages/vite/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@
9090
"postcss": "^8.4.48",
9191
"rollup": "^4.23.0"
9292
},
93+
"optionalDependencies": {
94+
"fsevents": "~2.3.3"
95+
},
9396
"devDependencies": {
9497
"@ampproject/remapping": "^2.3.0",
9598
"@babel/parser": "^7.26.2",
@@ -105,7 +108,7 @@
105108
"@types/pnpapi": "^0.0.5",
106109
"artichokie": "^0.2.1",
107110
"cac": "^6.7.14",
108-
"chokidar": "^4.0.1",
111+
"chokidar": "^3.6.0",
109112
"connect": "^3.7.0",
110113
"convert-source-map": "^2.0.0",
111114
"cors": "^2.8.5",

packages/vite/rollup.config.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ const nodeConfig = defineConfig({
109109
},
110110
external: [
111111
/^vite\//,
112+
'fsevents',
112113
'rollup/parseAst',
113114
/^tsx\//,
114115
...Object.keys(pkg.dependencies),
@@ -119,6 +120,13 @@ const nodeConfig = defineConfig({
119120
// generate code that force require them upfront for side effects.
120121
// Shim them with eval() so rollup can skip these calls.
121122
shimDepsPlugin({
123+
// chokidar -> fsevents
124+
'fsevents-handler.js': [
125+
{
126+
src: `require('fsevents')`,
127+
replacement: `__require('fsevents')`,
128+
},
129+
],
122130
// postcss-import -> sugarss
123131
'process-content.js': [
124132
{
@@ -179,6 +187,7 @@ const moduleRunnerConfig = defineConfig({
179187
'module-runner': path.resolve(__dirname, 'src/module-runner/index.ts'),
180188
},
181189
external: [
190+
'fsevents',
182191
'lightningcss',
183192
'rollup/parseAst',
184193
...Object.keys(pkg.dependencies),
@@ -200,7 +209,7 @@ const cjsConfig = defineConfig({
200209
chunkFileNames: 'node-cjs/chunks/dep-[hash].js',
201210
format: 'cjs',
202211
},
203-
external: Object.keys(pkg.dependencies),
212+
external: ['fsevents', ...Object.keys(pkg.dependencies)],
204213
plugins: [
205214
...createSharedNodePlugins({}),
206215
bundleSizeLimit(175),

0 commit comments

Comments
 (0)