@lvce-editor/file-system-worker 1.13.0 → 1.15.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/fileSystemWorkerMain.js +14 -2
- package/package.json +1 -1
|
@@ -634,7 +634,8 @@ const splitLines = lines => {
|
|
|
634
634
|
return lines.split(NewLine);
|
|
635
635
|
};
|
|
636
636
|
const getCurrentStack = () => {
|
|
637
|
-
const
|
|
637
|
+
const stackLinesToSkip = 3;
|
|
638
|
+
const currentStack = joinLines(splitLines(new Error().stack || '').slice(stackLinesToSkip));
|
|
638
639
|
return currentStack;
|
|
639
640
|
};
|
|
640
641
|
const getNewLineIndex = (string, startIndex = undefined) => {
|
|
@@ -905,6 +906,12 @@ const invokeAndTransfer$1 = (ipc, method, ...params) => {
|
|
|
905
906
|
return invokeHelper(ipc, method, params, true);
|
|
906
907
|
};
|
|
907
908
|
|
|
909
|
+
class CommandNotFoundError extends Error {
|
|
910
|
+
constructor(command) {
|
|
911
|
+
super(`Command not found ${command}`);
|
|
912
|
+
this.name = 'CommandNotFoundError';
|
|
913
|
+
}
|
|
914
|
+
}
|
|
908
915
|
const commands = Object.create(null);
|
|
909
916
|
const register = commandMap => {
|
|
910
917
|
Object.assign(commands, commandMap);
|
|
@@ -915,7 +922,7 @@ const getCommand = key => {
|
|
|
915
922
|
const execute = (command, ...args) => {
|
|
916
923
|
const fn = getCommand(command);
|
|
917
924
|
if (!fn) {
|
|
918
|
-
throw new
|
|
925
|
+
throw new CommandNotFoundError(command);
|
|
919
926
|
}
|
|
920
927
|
return fn(...args);
|
|
921
928
|
};
|
|
@@ -1240,6 +1247,10 @@ const readFile = async uri => {
|
|
|
1240
1247
|
}
|
|
1241
1248
|
return readFile$1(uri);
|
|
1242
1249
|
};
|
|
1250
|
+
const appendFile = async (uri, text) => {
|
|
1251
|
+
// @ts-ignore
|
|
1252
|
+
return undefined(uri, text);
|
|
1253
|
+
};
|
|
1243
1254
|
const readDirWithFileTypes = async uri => {
|
|
1244
1255
|
return readDirWithFileTypes$1(uri);
|
|
1245
1256
|
};
|
|
@@ -1399,6 +1410,7 @@ const commandMap = {
|
|
|
1399
1410
|
'FileSystem.rename': rename,
|
|
1400
1411
|
'FileSystem.stat': stat,
|
|
1401
1412
|
'FileSystem.writeFile': writeFile,
|
|
1413
|
+
'FileSystem.appendFile': appendFile,
|
|
1402
1414
|
'FileSystem.handleMessagePort': handleMessagePort,
|
|
1403
1415
|
'FileSystem.readFileAsBlob': readFileAsBlob,
|
|
1404
1416
|
'Initialize.initialize': initialize
|