@lvce-editor/file-search-worker 1.10.0 → 1.11.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/fileSearchWorkerMain.js +12 -3
- package/package.json +1 -1
|
@@ -21,6 +21,13 @@ const execute = (command, ...args) => {
|
|
|
21
21
|
const Directory$1 = 3;
|
|
22
22
|
const File$1 = 7;
|
|
23
23
|
|
|
24
|
+
class FileNotFoundError extends Error {
|
|
25
|
+
constructor(uri) {
|
|
26
|
+
super(`File not found: ${uri}`);
|
|
27
|
+
this.code = 'ENOENT';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
24
31
|
const Slash$1 = '/';
|
|
25
32
|
|
|
26
33
|
const Slash = Slash$1;
|
|
@@ -34,7 +41,7 @@ const getDirent = uri => {
|
|
|
34
41
|
const readFile = uri => {
|
|
35
42
|
const dirent = getDirent(uri);
|
|
36
43
|
if (!dirent) {
|
|
37
|
-
throw new
|
|
44
|
+
throw new FileNotFoundError(uri);
|
|
38
45
|
}
|
|
39
46
|
if (dirent.type !== File$1) {
|
|
40
47
|
throw new Error('file is a directory');
|
|
@@ -161,8 +168,10 @@ const SearchFileMemfs = {
|
|
|
161
168
|
};
|
|
162
169
|
|
|
163
170
|
const removeLeadingSlash = path => {
|
|
164
|
-
|
|
165
|
-
|
|
171
|
+
if (path.startsWith('/')) {
|
|
172
|
+
return path.slice(1);
|
|
173
|
+
}
|
|
174
|
+
return path;
|
|
166
175
|
};
|
|
167
176
|
const searchFile$3 = async (path, value, prepare, assetDir) => {
|
|
168
177
|
const fetchUri = `${assetDir}/config/fileMap.json`;
|