@lvce-editor/file-watcher-process 1.1.0 → 1.2.0
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 +5 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import * as sysPath from 'path';
|
|
|
8
8
|
import { Readable } from 'node:stream';
|
|
9
9
|
import { resolve, join, relative, sep } from 'node:path';
|
|
10
10
|
import { type } from 'os';
|
|
11
|
+
import { pathToFileURL, fileURLToPath } from 'node:url';
|
|
11
12
|
import { ElectronMessagePortRpcClient, ElectronUtilityProcessRpcClient, NodeWorkerRpcClient, NodeForkedProcessRpcClient } from '@lvce-editor/rpc';
|
|
12
13
|
|
|
13
14
|
const SharedProcess = 1;
|
|
@@ -1592,13 +1593,14 @@ function watch(paths, options = {}) {
|
|
|
1592
1593
|
}
|
|
1593
1594
|
|
|
1594
1595
|
const normalizeEvent = (eventName, path) => {
|
|
1596
|
+
const uri = pathToFileURL(path).toString();
|
|
1595
1597
|
return {
|
|
1596
1598
|
eventName,
|
|
1597
|
-
|
|
1599
|
+
uri
|
|
1598
1600
|
};
|
|
1599
1601
|
};
|
|
1600
1602
|
|
|
1601
|
-
const watchFolder = async
|
|
1603
|
+
const watchFolder = async uri => {
|
|
1602
1604
|
const callBackInternal = async (eventName, path, stats) => {
|
|
1603
1605
|
const event = normalizeEvent(eventName, path);
|
|
1604
1606
|
await invoke('FileWatcher.handleChange', event);
|
|
@@ -1606,6 +1608,7 @@ const watchFolder = async path => {
|
|
|
1606
1608
|
const callback = (eventName, path, stats) => {
|
|
1607
1609
|
void callBackInternal(eventName, path);
|
|
1608
1610
|
};
|
|
1611
|
+
const path = fileURLToPath(uri);
|
|
1609
1612
|
const watcher = watch(path);
|
|
1610
1613
|
watcher.on('all', callback);
|
|
1611
1614
|
const {
|