@lvce-editor/file-system-worker 1.6.0 → 1.7.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 +49 -34
- package/package.json +1 -1
|
@@ -545,11 +545,11 @@ const remove$2 = id => {
|
|
|
545
545
|
delete callbacks[id];
|
|
546
546
|
};
|
|
547
547
|
let id = 0;
|
|
548
|
-
const create$3 = () => {
|
|
548
|
+
const create$3$1 = () => {
|
|
549
549
|
return ++id;
|
|
550
550
|
};
|
|
551
551
|
const registerPromise = () => {
|
|
552
|
-
const id = create$3();
|
|
552
|
+
const id = create$3$1();
|
|
553
553
|
const {
|
|
554
554
|
resolve,
|
|
555
555
|
promise
|
|
@@ -1015,11 +1015,41 @@ const create$2 = async ({
|
|
|
1015
1015
|
const rpc = createRpc(ipc);
|
|
1016
1016
|
return rpc;
|
|
1017
1017
|
};
|
|
1018
|
-
const
|
|
1019
|
-
|
|
1020
|
-
|
|
1018
|
+
const Https = 'https:';
|
|
1019
|
+
const Ws = 'ws:';
|
|
1020
|
+
const Wss = 'wss:';
|
|
1021
|
+
const getWebSocketProtocol = locationProtocol => {
|
|
1022
|
+
return locationProtocol === Https ? Wss : Ws;
|
|
1023
|
+
};
|
|
1024
|
+
const getWebSocketUrl = (type, host, locationProtocol) => {
|
|
1025
|
+
const wsProtocol = getWebSocketProtocol(locationProtocol);
|
|
1026
|
+
return `${wsProtocol}//${host}/websocket/${type}`;
|
|
1027
|
+
};
|
|
1028
|
+
const getHost = () => {
|
|
1029
|
+
return location.host;
|
|
1030
|
+
};
|
|
1031
|
+
const getProtocol = () => {
|
|
1032
|
+
return location.protocol;
|
|
1021
1033
|
};
|
|
1022
1034
|
const create$1 = async ({
|
|
1035
|
+
commandMap,
|
|
1036
|
+
type
|
|
1037
|
+
}) => {
|
|
1038
|
+
const host = getHost();
|
|
1039
|
+
const protocol = getProtocol();
|
|
1040
|
+
const wsUrl = getWebSocketUrl(type, host, protocol);
|
|
1041
|
+
const webSocket = new WebSocket(wsUrl);
|
|
1042
|
+
const rpc = await create$2({
|
|
1043
|
+
webSocket,
|
|
1044
|
+
commandMap
|
|
1045
|
+
});
|
|
1046
|
+
return rpc;
|
|
1047
|
+
};
|
|
1048
|
+
const WebSocketRpcParent2 = {
|
|
1049
|
+
__proto__: null,
|
|
1050
|
+
create: create$1
|
|
1051
|
+
};
|
|
1052
|
+
const create$3 = async ({
|
|
1023
1053
|
commandMap
|
|
1024
1054
|
}) => {
|
|
1025
1055
|
// TODO create a commandMap per rpc instance
|
|
@@ -1031,7 +1061,7 @@ const create$1 = async ({
|
|
|
1031
1061
|
};
|
|
1032
1062
|
const WebWorkerRpcClient = {
|
|
1033
1063
|
__proto__: null,
|
|
1034
|
-
create: create$
|
|
1064
|
+
create: create$3
|
|
1035
1065
|
};
|
|
1036
1066
|
|
|
1037
1067
|
const rpcs = Object.create(null);
|
|
@@ -1117,9 +1147,14 @@ const copy$1$1 = async (oldUri, newUri) => {
|
|
|
1117
1147
|
// @ts-ignore
|
|
1118
1148
|
return invoke$8('FileSystem.copy', oldUri, newUri);
|
|
1119
1149
|
};
|
|
1150
|
+
const getFolderSize$1$1 = async uri => {
|
|
1151
|
+
// @ts-ignore
|
|
1152
|
+
return invoke$8('FileSystem.getFolderSize', uri);
|
|
1153
|
+
};
|
|
1120
1154
|
const FileSystemProcess = {
|
|
1121
1155
|
__proto__: null,
|
|
1122
1156
|
copy: copy$1$1,
|
|
1157
|
+
getFolderSize: getFolderSize$1$1,
|
|
1123
1158
|
getPathSeparator: getPathSeparator$1$1,
|
|
1124
1159
|
getRealPath: getRealPath$1$1,
|
|
1125
1160
|
mkdir: mkdir$1$1,
|
|
@@ -1145,6 +1180,7 @@ const {
|
|
|
1145
1180
|
rename: rename$1,
|
|
1146
1181
|
copy: copy$1,
|
|
1147
1182
|
mkdir: mkdir$1,
|
|
1183
|
+
getFolderSize: getFolderSize$1,
|
|
1148
1184
|
writeFile: writeFile$1,
|
|
1149
1185
|
stat: stat$1,
|
|
1150
1186
|
readJson: readJson$1,
|
|
@@ -1191,6 +1227,9 @@ const rename = async (oldUri, newUri) => {
|
|
|
1191
1227
|
const copy = async (oldUri, newUri) => {
|
|
1192
1228
|
return copy$1(oldUri, newUri);
|
|
1193
1229
|
};
|
|
1230
|
+
const getFolderSize = async uri => {
|
|
1231
|
+
return getFolderSize$1(uri);
|
|
1232
|
+
};
|
|
1194
1233
|
|
|
1195
1234
|
const getPortTuple = () => {
|
|
1196
1235
|
const {
|
|
@@ -1205,8 +1244,7 @@ const getPortTuple = () => {
|
|
|
1205
1244
|
|
|
1206
1245
|
const {
|
|
1207
1246
|
invokeAndTransfer,
|
|
1208
|
-
set
|
|
1209
|
-
} = RendererWorker;
|
|
1247
|
+
set} = RendererWorker;
|
|
1210
1248
|
|
|
1211
1249
|
const sendMessagePortToFileSystemProcess = async port => {
|
|
1212
1250
|
const command = 'HandleMessagePortForFileSystemProcess.handleMessagePortForFileSystemProcess';
|
|
@@ -1230,34 +1268,10 @@ const createFileSystemProcessRpcElectron = async () => {
|
|
|
1230
1268
|
}
|
|
1231
1269
|
};
|
|
1232
1270
|
|
|
1233
|
-
const Https = 'https:';
|
|
1234
|
-
const Ws = 'ws:';
|
|
1235
|
-
const Wss = 'wss:';
|
|
1236
|
-
|
|
1237
|
-
const getWebSocketProtocol = locationProtocol => {
|
|
1238
|
-
return locationProtocol === Https ? Wss : Ws;
|
|
1239
|
-
};
|
|
1240
|
-
|
|
1241
|
-
const getWebSocketUrl = (type, host, locationProtocol) => {
|
|
1242
|
-
const wsProtocol = getWebSocketProtocol(locationProtocol);
|
|
1243
|
-
return `${wsProtocol}//${host}/websocket/${type}`;
|
|
1244
|
-
};
|
|
1245
|
-
|
|
1246
|
-
const getHost = () => {
|
|
1247
|
-
return location.host;
|
|
1248
|
-
};
|
|
1249
|
-
const getProtocol = () => {
|
|
1250
|
-
return location.protocol;
|
|
1251
|
-
};
|
|
1252
|
-
|
|
1253
1271
|
const createFileSystemProcessRpcNode = async () => {
|
|
1254
1272
|
try {
|
|
1255
|
-
const
|
|
1256
|
-
|
|
1257
|
-
const wsUrl = getWebSocketUrl('file-system-process', host, protocol);
|
|
1258
|
-
const webSocket = new WebSocket(wsUrl);
|
|
1259
|
-
const rpc = await WebSocketRpcParent.create({
|
|
1260
|
-
webSocket,
|
|
1273
|
+
const rpc = await WebSocketRpcParent2.create({
|
|
1274
|
+
type: 'file-system-process',
|
|
1261
1275
|
commandMap: {}
|
|
1262
1276
|
});
|
|
1263
1277
|
return rpc;
|
|
@@ -1303,6 +1317,7 @@ const commandMap = {
|
|
|
1303
1317
|
'FileSystem.rename': rename,
|
|
1304
1318
|
'FileSystem.stat': stat,
|
|
1305
1319
|
'FileSystem.writeFile': writeFile,
|
|
1320
|
+
'FileSystem.getFolderSize': getFolderSize,
|
|
1306
1321
|
'Initialize.initialize': initialize
|
|
1307
1322
|
};
|
|
1308
1323
|
|