@lvce-editor/file-system-worker 1.16.0 → 1.18.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 +46 -8
- package/package.json +1 -1
|
@@ -899,7 +899,7 @@ const send = (transport, method, ...params) => {
|
|
|
899
899
|
const message = create$4$1(method, params);
|
|
900
900
|
transport.send(message);
|
|
901
901
|
};
|
|
902
|
-
const invoke = (ipc, method, ...params) => {
|
|
902
|
+
const invoke$1 = (ipc, method, ...params) => {
|
|
903
903
|
return invokeHelper(ipc, method, params, false);
|
|
904
904
|
};
|
|
905
905
|
const invokeAndTransfer$1 = (ipc, method, ...params) => {
|
|
@@ -938,7 +938,7 @@ const createRpc = ipc => {
|
|
|
938
938
|
send(ipc, method, ...params);
|
|
939
939
|
},
|
|
940
940
|
invoke(method, ...params) {
|
|
941
|
-
return invoke(ipc, method, ...params);
|
|
941
|
+
return invoke$1(ipc, method, ...params);
|
|
942
942
|
},
|
|
943
943
|
invokeAndTransfer(method, ...params) {
|
|
944
944
|
return invokeAndTransfer$1(ipc, method, ...params);
|
|
@@ -1147,6 +1147,10 @@ const remove$1$1 = async uri => {
|
|
|
1147
1147
|
const readFile$2 = async uri => {
|
|
1148
1148
|
return invoke$8('FileSystem.readFile', uri);
|
|
1149
1149
|
};
|
|
1150
|
+
const appendFile$1$1 = async (uri, text) => {
|
|
1151
|
+
// @ts-ignore
|
|
1152
|
+
return invoke$8('FileSystem.appendFile', uri, text);
|
|
1153
|
+
};
|
|
1150
1154
|
const readDirWithFileTypes$1$1 = async uri => {
|
|
1151
1155
|
return invoke$8('FileSystem.readDirWithFileTypes', uri);
|
|
1152
1156
|
};
|
|
@@ -1192,11 +1196,13 @@ const exists$1$1 = async uri => {
|
|
|
1192
1196
|
};
|
|
1193
1197
|
const FileSystemProcess = {
|
|
1194
1198
|
__proto__: null,
|
|
1199
|
+
appendFile: appendFile$1$1,
|
|
1195
1200
|
copy: copy$1$1,
|
|
1196
1201
|
exists: exists$1$1,
|
|
1197
1202
|
getFolderSize: getFolderSize$2,
|
|
1198
1203
|
getPathSeparator: getPathSeparator$1$1,
|
|
1199
1204
|
getRealPath: getRealPath$1$1,
|
|
1205
|
+
invoke: invoke$8,
|
|
1200
1206
|
mkdir: mkdir$1$1,
|
|
1201
1207
|
readDirWithFileTypes: readDirWithFileTypes$1$1,
|
|
1202
1208
|
readFile: readFile$2,
|
|
@@ -1220,6 +1226,7 @@ const {
|
|
|
1220
1226
|
rename: rename$1,
|
|
1221
1227
|
copy: copy$1,
|
|
1222
1228
|
mkdir: mkdir$1,
|
|
1229
|
+
invoke,
|
|
1223
1230
|
getFolderSize: getFolderSize$1,
|
|
1224
1231
|
writeFile: writeFile$1,
|
|
1225
1232
|
stat: stat$1,
|
|
@@ -1229,7 +1236,8 @@ const {
|
|
|
1229
1236
|
readDirWithFileTypes: readDirWithFileTypes$1,
|
|
1230
1237
|
readFile: readFile$1,
|
|
1231
1238
|
remove: remove$1,
|
|
1232
|
-
exists: exists$1
|
|
1239
|
+
exists: exists$1,
|
|
1240
|
+
appendFile: appendFile$1
|
|
1233
1241
|
} = FileSystemProcess;
|
|
1234
1242
|
|
|
1235
1243
|
const Http = 'http:';
|
|
@@ -1248,8 +1256,7 @@ const readFile = async uri => {
|
|
|
1248
1256
|
return readFile$1(uri);
|
|
1249
1257
|
};
|
|
1250
1258
|
const appendFile = async (uri, text) => {
|
|
1251
|
-
|
|
1252
|
-
return undefined(uri, text);
|
|
1259
|
+
return appendFile$1(uri, text);
|
|
1253
1260
|
};
|
|
1254
1261
|
const readDirWithFileTypes = async uri => {
|
|
1255
1262
|
return readDirWithFileTypes$1(uri);
|
|
@@ -1307,6 +1314,34 @@ const getFolderSize = async uri => {
|
|
|
1307
1314
|
return getFolderSize$1(uri);
|
|
1308
1315
|
};
|
|
1309
1316
|
|
|
1317
|
+
const watchCallbacks = Object.create(null);
|
|
1318
|
+
const registerWatchCallback = (id, fn) => {
|
|
1319
|
+
watchCallbacks[id] = fn;
|
|
1320
|
+
};
|
|
1321
|
+
const executeWatchCallBack = async id => {
|
|
1322
|
+
await watchCallbacks[id]();
|
|
1323
|
+
};
|
|
1324
|
+
const unregisterWatchCallback = id => {
|
|
1325
|
+
delete watchCallbacks[id];
|
|
1326
|
+
};
|
|
1327
|
+
|
|
1328
|
+
const watchFile = async (id, uri, rpc) => {
|
|
1329
|
+
const commandId = 'Output.executeWatchCallback';
|
|
1330
|
+
registerWatchCallback(id, async () => {
|
|
1331
|
+
await rpc.invoke(commandId);
|
|
1332
|
+
});
|
|
1333
|
+
// @ts-ignore
|
|
1334
|
+
await invoke('FileSystem.watchFile', id, uri);
|
|
1335
|
+
};
|
|
1336
|
+
const executeWatchCallback = async id => {
|
|
1337
|
+
await executeWatchCallBack(id);
|
|
1338
|
+
};
|
|
1339
|
+
const unwatchFile = async id => {
|
|
1340
|
+
unregisterWatchCallback(id);
|
|
1341
|
+
// @ts-ignore
|
|
1342
|
+
await invoke('FileSystem.unwatchFile', id);
|
|
1343
|
+
};
|
|
1344
|
+
|
|
1310
1345
|
const handleMessagePort = async (port, rpcId) => {
|
|
1311
1346
|
const rpc = await PlainMessagePortRpc.create({
|
|
1312
1347
|
commandMap: {},
|
|
@@ -1399,23 +1434,26 @@ const initialize = async platform => {
|
|
|
1399
1434
|
};
|
|
1400
1435
|
|
|
1401
1436
|
const commandMap = {
|
|
1437
|
+
'FileSystem.appendFile': appendFile,
|
|
1402
1438
|
'FileSystem.copy': copy,
|
|
1403
1439
|
'FileSystem.createFile': createFile,
|
|
1440
|
+
'FileSystem.executeWatchcallback': executeWatchCallback,
|
|
1404
1441
|
'FileSystem.exists': exists,
|
|
1405
1442
|
'FileSystem.getFolderSize': getFolderSize,
|
|
1406
1443
|
'FileSystem.getPathSeparator': getPathSeparator,
|
|
1407
1444
|
'FileSystem.getRealPath': getRealPath,
|
|
1445
|
+
'FileSystem.handleMessagePort': handleMessagePort,
|
|
1408
1446
|
'FileSystem.mkdir': mkdir,
|
|
1409
1447
|
'FileSystem.readDirWithFileTypes': readDirWithFileTypes,
|
|
1410
1448
|
'FileSystem.readFile': readFile,
|
|
1449
|
+
'FileSystem.readFileAsBlob': readFileAsBlob,
|
|
1411
1450
|
'FileSystem.readJson': readJson,
|
|
1412
1451
|
'FileSystem.remove': remove,
|
|
1413
1452
|
'FileSystem.rename': rename,
|
|
1414
1453
|
'FileSystem.stat': stat,
|
|
1454
|
+
'FileSystem.unwatchFile': unwatchFile,
|
|
1455
|
+
'FileSystem.watchFile': watchFile,
|
|
1415
1456
|
'FileSystem.writeFile': writeFile,
|
|
1416
|
-
'FileSystem.appendFile': appendFile,
|
|
1417
|
-
'FileSystem.handleMessagePort': handleMessagePort,
|
|
1418
|
-
'FileSystem.readFileAsBlob': readFileAsBlob,
|
|
1419
1457
|
'Initialize.initialize': initialize
|
|
1420
1458
|
};
|
|
1421
1459
|
|