@lvce-editor/file-system-worker 5.10.1 → 5.11.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 +61 -11
- package/package.json +1 -1
|
@@ -324,7 +324,6 @@ const walkValue = (value, transferrables, isTransferrable) => {
|
|
|
324
324
|
for (const property of Object.values(value)) {
|
|
325
325
|
walkValue(property, transferrables, isTransferrable);
|
|
326
326
|
}
|
|
327
|
-
return;
|
|
328
327
|
}
|
|
329
328
|
};
|
|
330
329
|
const getTransferrables = value => {
|
|
@@ -478,7 +477,14 @@ class IpcError extends VError {
|
|
|
478
477
|
const cause = new Error(message);
|
|
479
478
|
// @ts-ignore
|
|
480
479
|
cause.code = code;
|
|
481
|
-
|
|
480
|
+
if (stack) {
|
|
481
|
+
Object.defineProperty(cause, 'stack', {
|
|
482
|
+
configurable: true,
|
|
483
|
+
enumerable: false,
|
|
484
|
+
value: stack,
|
|
485
|
+
writable: true
|
|
486
|
+
});
|
|
487
|
+
}
|
|
482
488
|
super(cause, betterMessage);
|
|
483
489
|
} else {
|
|
484
490
|
super(betterMessage);
|
|
@@ -1353,28 +1359,72 @@ const create$3 = async ({
|
|
|
1353
1359
|
}) => {
|
|
1354
1360
|
// TODO create a commandMap per rpc instance
|
|
1355
1361
|
register$1(commandMap);
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1362
|
+
let rawIpc;
|
|
1363
|
+
try {
|
|
1364
|
+
rawIpc = await IpcParentWithWebSocket$1.create({
|
|
1365
|
+
webSocket
|
|
1366
|
+
});
|
|
1367
|
+
} catch (error) {
|
|
1368
|
+
throw new VError(error, 'Failed to create rpc connection');
|
|
1369
|
+
}
|
|
1359
1370
|
const ipc = IpcParentWithWebSocket$1.wrap(rawIpc);
|
|
1360
1371
|
handleIpc(ipc);
|
|
1361
1372
|
const rpc = createRpc(ipc);
|
|
1362
1373
|
return rpc;
|
|
1363
1374
|
};
|
|
1364
1375
|
|
|
1376
|
+
const reconnectDelay = 2000;
|
|
1377
|
+
const waitForReconnect = async () => {
|
|
1378
|
+
await new Promise(resolve => {
|
|
1379
|
+
setTimeout(resolve, reconnectDelay);
|
|
1380
|
+
});
|
|
1381
|
+
};
|
|
1382
|
+
const connect = async ({
|
|
1383
|
+
commandMap,
|
|
1384
|
+
wsUrl
|
|
1385
|
+
}) => {
|
|
1386
|
+
const webSocket = new WebSocket(wsUrl);
|
|
1387
|
+
try {
|
|
1388
|
+
const rpc = await create$3({
|
|
1389
|
+
commandMap,
|
|
1390
|
+
webSocket
|
|
1391
|
+
});
|
|
1392
|
+
return {
|
|
1393
|
+
rpc,
|
|
1394
|
+
webSocket
|
|
1395
|
+
};
|
|
1396
|
+
} catch (error) {
|
|
1397
|
+
webSocket.close();
|
|
1398
|
+
throw error;
|
|
1399
|
+
}
|
|
1400
|
+
};
|
|
1365
1401
|
const create$2 = async ({
|
|
1366
1402
|
commandMap,
|
|
1403
|
+
onClose,
|
|
1367
1404
|
type
|
|
1368
1405
|
}) => {
|
|
1369
1406
|
const host = getHost();
|
|
1370
1407
|
const protocol = getProtocol();
|
|
1371
1408
|
const wsUrl = getWebSocketUrl(type, host, protocol);
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1409
|
+
let connection;
|
|
1410
|
+
try {
|
|
1411
|
+
connection = await connect({
|
|
1412
|
+
commandMap,
|
|
1413
|
+
wsUrl
|
|
1414
|
+
});
|
|
1415
|
+
} catch {
|
|
1416
|
+
await waitForReconnect();
|
|
1417
|
+
connection = await connect({
|
|
1418
|
+
commandMap,
|
|
1419
|
+
wsUrl
|
|
1420
|
+
});
|
|
1421
|
+
}
|
|
1422
|
+
if (onClose) {
|
|
1423
|
+
connection.webSocket.addEventListener('close', onClose, {
|
|
1424
|
+
once: true
|
|
1425
|
+
});
|
|
1426
|
+
}
|
|
1427
|
+
return connection.rpc;
|
|
1378
1428
|
};
|
|
1379
1429
|
|
|
1380
1430
|
const create$1 = async ({
|