@lvce-editor/file-system-worker 1.15.0 → 1.17.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 +43 -9
- 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,11 +1314,36 @@ 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 unregisterWatchCallback = id => {
|
|
1322
|
+
delete watchCallbacks[id];
|
|
1323
|
+
};
|
|
1324
|
+
|
|
1325
|
+
const watchFile = async (id, uri, rpc) => {
|
|
1326
|
+
const commandId = 'Output.executeWatchCallback';
|
|
1327
|
+
registerWatchCallback(id, async () => {
|
|
1328
|
+
await rpc.invoke(commandId);
|
|
1329
|
+
});
|
|
1330
|
+
// @ts-ignore
|
|
1331
|
+
await invoke('FileSystem.watchFile', id, uri);
|
|
1332
|
+
};
|
|
1333
|
+
const unwatchFile = async id => {
|
|
1334
|
+
unregisterWatchCallback(id);
|
|
1335
|
+
// @ts-ignore
|
|
1336
|
+
await invoke('FileSystem.unwatchFile', id);
|
|
1337
|
+
};
|
|
1338
|
+
|
|
1310
1339
|
const handleMessagePort = async (port, rpcId) => {
|
|
1311
|
-
await PlainMessagePortRpc.create({
|
|
1340
|
+
const rpc = await PlainMessagePortRpc.create({
|
|
1312
1341
|
commandMap: {},
|
|
1313
1342
|
messagePort: port
|
|
1314
1343
|
});
|
|
1344
|
+
if (rpcId) {
|
|
1345
|
+
set$g(rpcId, rpc);
|
|
1346
|
+
}
|
|
1315
1347
|
};
|
|
1316
1348
|
|
|
1317
1349
|
const getPortTuple = () => {
|
|
@@ -1396,23 +1428,25 @@ const initialize = async platform => {
|
|
|
1396
1428
|
};
|
|
1397
1429
|
|
|
1398
1430
|
const commandMap = {
|
|
1431
|
+
'FileSystem.appendFile': appendFile,
|
|
1399
1432
|
'FileSystem.copy': copy,
|
|
1400
1433
|
'FileSystem.createFile': createFile,
|
|
1401
1434
|
'FileSystem.exists': exists,
|
|
1402
1435
|
'FileSystem.getFolderSize': getFolderSize,
|
|
1403
1436
|
'FileSystem.getPathSeparator': getPathSeparator,
|
|
1404
1437
|
'FileSystem.getRealPath': getRealPath,
|
|
1438
|
+
'FileSystem.handleMessagePort': handleMessagePort,
|
|
1405
1439
|
'FileSystem.mkdir': mkdir,
|
|
1406
1440
|
'FileSystem.readDirWithFileTypes': readDirWithFileTypes,
|
|
1407
1441
|
'FileSystem.readFile': readFile,
|
|
1442
|
+
'FileSystem.readFileAsBlob': readFileAsBlob,
|
|
1408
1443
|
'FileSystem.readJson': readJson,
|
|
1409
1444
|
'FileSystem.remove': remove,
|
|
1410
1445
|
'FileSystem.rename': rename,
|
|
1411
1446
|
'FileSystem.stat': stat,
|
|
1447
|
+
'FileSystem.watchFile': watchFile,
|
|
1448
|
+
'FileSystem.unwatchFile': unwatchFile,
|
|
1412
1449
|
'FileSystem.writeFile': writeFile,
|
|
1413
|
-
'FileSystem.appendFile': appendFile,
|
|
1414
|
-
'FileSystem.handleMessagePort': handleMessagePort,
|
|
1415
|
-
'FileSystem.readFileAsBlob': readFileAsBlob,
|
|
1416
1450
|
'Initialize.initialize': initialize
|
|
1417
1451
|
};
|
|
1418
1452
|
|