@lvce-editor/file-watcher-process 4.6.1 → 4.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +7 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1350,6 +1350,12 @@ const normalizeEvent2 = (id, eventName, path) => {
|
|
|
1350
1350
|
const errorCallback = error => {
|
|
1351
1351
|
console.error(`[file-watcher-process] ${error}`);
|
|
1352
1352
|
};
|
|
1353
|
+
const createIgnored = exclude => {
|
|
1354
|
+
const excludedNames = new Set(exclude);
|
|
1355
|
+
return path => {
|
|
1356
|
+
return path.split(/[\\/]/).some(part => excludedNames.has(part));
|
|
1357
|
+
};
|
|
1358
|
+
};
|
|
1353
1359
|
const watchFolders = async ({
|
|
1354
1360
|
exclude,
|
|
1355
1361
|
id,
|
|
@@ -1372,6 +1378,7 @@ const watchFolders = async ({
|
|
|
1372
1378
|
for (const root of roots) {
|
|
1373
1379
|
const path = fileURLToPath(root);
|
|
1374
1380
|
const watcher = new FSWatcher({
|
|
1381
|
+
ignored: createIgnored(exclude),
|
|
1375
1382
|
ignoreInitial: true,
|
|
1376
1383
|
ignorePermissionErrors: true
|
|
1377
1384
|
});
|