Skip to content

Commit ec8721b

Browse files
committed
chore: upgrade to chokidar 4
1 parent 0921d65 commit ec8721b

File tree

4 files changed

+29
-10
lines changed

4 files changed

+29
-10
lines changed

packages/language-server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"dependencies": {
5353
"@jridgewell/trace-mapping": "^0.3.25",
5454
"@vscode/emmet-helper": "2.8.4",
55-
"chokidar": "^3.4.1",
55+
"chokidar": "^4.0.0",
5656
"estree-walker": "^2.0.1",
5757
"fdir": "^6.2.0",
5858
"lodash": "^4.17.21",

packages/svelte-check/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
},
2828
"dependencies": {
2929
"@jridgewell/trace-mapping": "^0.3.25",
30-
"chokidar": "^3.4.1",
30+
"chokidar": "^4.0.0",
3131
"fdir": "^6.2.0",
3232
"picocolors": "^1.0.0",
3333
"sade": "^1.7.4"

packages/svelte-check/src/index.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,15 +149,20 @@ class DiagnosticsWatcher {
149149
filePathsToIgnore: string[],
150150
ignoreInitialAdd: boolean
151151
) {
152-
watch(`${workspaceUri.fsPath}/**/*.{svelte,d.ts,ts,js,jsx,tsx,mjs,cjs,mts,cts}`, {
152+
const ifMatching = (path: string, f: Function) => {
153+
if (/\.(svelte|d\.ts|ts|js|jsx|tsx|mjs|cjs|mts|cts)$/.test(path)) {
154+
f();
155+
}
156+
}
157+
watch(workspaceUri.fsPath, {
153158
ignored: ['node_modules', 'vite.config.{js,ts}.timestamp-*']
154159
.concat(filePathsToIgnore)
155160
.map((ignore) => path.join(workspaceUri.fsPath, ignore)),
156161
ignoreInitial: ignoreInitialAdd
157162
})
158-
.on('add', (path) => this.updateDocument(path, true))
159-
.on('unlink', (path) => this.removeDocument(path))
160-
.on('change', (path) => this.updateDocument(path, false));
163+
.on('add', (path) => ifMatching(path, () => this.updateDocument(path, true)))
164+
.on('unlink', (path) => ifMatching(path, () => this.removeDocument(path)))
165+
.on('change', (path) => ifMatching(path, () => this.updateDocument(path, false)));
161166

162167
if (ignoreInitialAdd) {
163168
this.scheduleDiagnostics();

pnpm-lock.yaml

Lines changed: 18 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)