@lvce-editor/file-system-worker 1.10.0 → 1.12.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 +20 -8
- package/package.json +1 -1
|
@@ -1068,7 +1068,7 @@ const WebWorkerRpcClient = {
|
|
|
1068
1068
|
create: create$3
|
|
1069
1069
|
};
|
|
1070
1070
|
|
|
1071
|
-
const readFile$
|
|
1071
|
+
const readFile$3 = async uri => {
|
|
1072
1072
|
const response = await fetch(uri);
|
|
1073
1073
|
if (!response.ok) {
|
|
1074
1074
|
throw new Error(response.statusText);
|
|
@@ -1129,7 +1129,7 @@ const {
|
|
|
1129
1129
|
const remove$1$1 = async uri => {
|
|
1130
1130
|
return invoke$8('FileSystem.remove', uri);
|
|
1131
1131
|
};
|
|
1132
|
-
const readFile$
|
|
1132
|
+
const readFile$2 = async uri => {
|
|
1133
1133
|
return invoke$8('FileSystem.readFile', uri);
|
|
1134
1134
|
};
|
|
1135
1135
|
const readDirWithFileTypes$1$1 = async uri => {
|
|
@@ -1167,19 +1167,24 @@ const copy$1$1 = async (oldUri, newUri) => {
|
|
|
1167
1167
|
// @ts-ignore
|
|
1168
1168
|
return invoke$8('FileSystem.copy', oldUri, newUri);
|
|
1169
1169
|
};
|
|
1170
|
-
const getFolderSize$
|
|
1170
|
+
const getFolderSize$2 = async uri => {
|
|
1171
1171
|
// @ts-ignore
|
|
1172
1172
|
return invoke$8('FileSystem.getFolderSize', uri);
|
|
1173
1173
|
};
|
|
1174
|
+
const exists$1$1 = async uri => {
|
|
1175
|
+
// @ts-ignore
|
|
1176
|
+
return invoke$8('FileSystem.exists', uri);
|
|
1177
|
+
};
|
|
1174
1178
|
const FileSystemProcess = {
|
|
1175
1179
|
__proto__: null,
|
|
1176
1180
|
copy: copy$1$1,
|
|
1177
|
-
|
|
1181
|
+
exists: exists$1$1,
|
|
1182
|
+
getFolderSize: getFolderSize$2,
|
|
1178
1183
|
getPathSeparator: getPathSeparator$1$1,
|
|
1179
1184
|
getRealPath: getRealPath$1$1,
|
|
1180
1185
|
mkdir: mkdir$1$1,
|
|
1181
1186
|
readDirWithFileTypes: readDirWithFileTypes$1$1,
|
|
1182
|
-
readFile: readFile$
|
|
1187
|
+
readFile: readFile$2,
|
|
1183
1188
|
readJson: readJson$2,
|
|
1184
1189
|
remove: remove$1$1,
|
|
1185
1190
|
rename: rename$1$1,
|
|
@@ -1195,7 +1200,6 @@ const RendererWorker = {
|
|
|
1195
1200
|
invokeAndTransfer: invokeAndTransfer$3,
|
|
1196
1201
|
set: set$3};
|
|
1197
1202
|
|
|
1198
|
-
// @ts-ignore
|
|
1199
1203
|
const {
|
|
1200
1204
|
set: set$1,
|
|
1201
1205
|
rename: rename$1,
|
|
@@ -1224,7 +1228,7 @@ const isHttp = uri => {
|
|
|
1224
1228
|
};
|
|
1225
1229
|
const readFile = async uri => {
|
|
1226
1230
|
if (isHttp(uri)) {
|
|
1227
|
-
return readFile$
|
|
1231
|
+
return readFile$3(uri);
|
|
1228
1232
|
}
|
|
1229
1233
|
return readFile$1(uri);
|
|
1230
1234
|
};
|
|
@@ -1324,6 +1328,7 @@ const createFileSystemProcessRpcNode = async () => {
|
|
|
1324
1328
|
}
|
|
1325
1329
|
};
|
|
1326
1330
|
|
|
1331
|
+
const Web = 1;
|
|
1327
1332
|
const Electron = 2;
|
|
1328
1333
|
const Remote = 3;
|
|
1329
1334
|
|
|
@@ -1343,11 +1348,18 @@ const createFileSystemProcessRpc = async platform => {
|
|
|
1343
1348
|
return create();
|
|
1344
1349
|
};
|
|
1345
1350
|
|
|
1346
|
-
const
|
|
1351
|
+
const initializeFileSytemProcess = async platform => {
|
|
1352
|
+
if (platform === Web) {
|
|
1353
|
+
return;
|
|
1354
|
+
}
|
|
1347
1355
|
const rpc = await createFileSystemProcessRpc(platform);
|
|
1348
1356
|
set$1(rpc);
|
|
1349
1357
|
};
|
|
1350
1358
|
|
|
1359
|
+
const initialize = async platform => {
|
|
1360
|
+
await initializeFileSytemProcess(platform);
|
|
1361
|
+
};
|
|
1362
|
+
|
|
1351
1363
|
const commandMap = {
|
|
1352
1364
|
'FileSystem.copy': copy,
|
|
1353
1365
|
'FileSystem.createFile': createFile,
|