@lvce-editor/renderer-process 8.6.0 → 9.0.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/rendererProcessMain.js +76 -4
- package/package.json +1 -1
|
@@ -1051,7 +1051,7 @@ const state$9 = {
|
|
|
1051
1051
|
*/
|
|
1052
1052
|
ipc: undefined
|
|
1053
1053
|
};
|
|
1054
|
-
const hydrate$
|
|
1054
|
+
const hydrate$4 = async () => {
|
|
1055
1055
|
const ipc = await launchRendererWorker();
|
|
1056
1056
|
handleIpc(ipc);
|
|
1057
1057
|
// @ts-expect-error
|
|
@@ -1083,7 +1083,7 @@ const invokeAndTransfer = (method, ...params) => {
|
|
|
1083
1083
|
const RendererWorker = {
|
|
1084
1084
|
__proto__: null,
|
|
1085
1085
|
dispose: dispose$j,
|
|
1086
|
-
hydrate: hydrate$
|
|
1086
|
+
hydrate: hydrate$4,
|
|
1087
1087
|
invoke: invoke$1,
|
|
1088
1088
|
invokeAndTransfer,
|
|
1089
1089
|
send,
|
|
@@ -1454,6 +1454,73 @@ const handleUnhandledError = (message, filename, lineno, colno, error) => {
|
|
|
1454
1454
|
handleError$8(error, Boolean(error), '[renderer-process] Unhandled Error: ');
|
|
1455
1455
|
};
|
|
1456
1456
|
|
|
1457
|
+
const editorWorkerUrl = `${assetDir}/packages/renderer-worker/node_modules/@lvce-editor/editor-worker/dist/editorWorkerMain.js`;
|
|
1458
|
+
|
|
1459
|
+
const launchEditorWorker = async () => {
|
|
1460
|
+
return launchWorker({
|
|
1461
|
+
name: 'Editor Worker',
|
|
1462
|
+
url: editorWorkerUrl
|
|
1463
|
+
});
|
|
1464
|
+
};
|
|
1465
|
+
|
|
1466
|
+
const hydrate$3 = async () => {
|
|
1467
|
+
// TODO only launch port and send to renderer worker
|
|
1468
|
+
await launchEditorWorker();
|
|
1469
|
+
};
|
|
1470
|
+
|
|
1471
|
+
const extensionHostWorkerUrl = `${assetDir}/packages/extension-host-worker/src/extensionHostWorkerMain.ts`;
|
|
1472
|
+
|
|
1473
|
+
const launchExtensionHostWorker = async () => {
|
|
1474
|
+
return launchWorker({
|
|
1475
|
+
name: 'Extension Host Worker',
|
|
1476
|
+
url: extensionHostWorkerUrl
|
|
1477
|
+
});
|
|
1478
|
+
};
|
|
1479
|
+
|
|
1480
|
+
const hydrate$2 = async () => {
|
|
1481
|
+
// TODO only launch port and send to renderer worker
|
|
1482
|
+
await launchExtensionHostWorker();
|
|
1483
|
+
};
|
|
1484
|
+
|
|
1485
|
+
const hasFlag = key => {
|
|
1486
|
+
if (typeof location === 'undefined' || typeof document === 'undefined') {
|
|
1487
|
+
return false;
|
|
1488
|
+
}
|
|
1489
|
+
const configElement = document.getElementById('Config');
|
|
1490
|
+
if (!configElement) {
|
|
1491
|
+
return false;
|
|
1492
|
+
}
|
|
1493
|
+
const text = configElement.textContent;
|
|
1494
|
+
if (!text) {
|
|
1495
|
+
return false;
|
|
1496
|
+
}
|
|
1497
|
+
const config = JSON.parse(text);
|
|
1498
|
+
const result = config[key];
|
|
1499
|
+
return result;
|
|
1500
|
+
};
|
|
1501
|
+
|
|
1502
|
+
const syntaxHighlightingWorkerUrl = `${assetDir}/packages/renderer-worker/node_modules/@lvce-editor/syntax-highlighting-worker/dist/syntaxHighlightingWorkerMain.js`;
|
|
1503
|
+
|
|
1504
|
+
const launchSyntaxHighlightingWorker = async () => {
|
|
1505
|
+
return launchWorker({
|
|
1506
|
+
name: 'Syntax Highlighting Worker',
|
|
1507
|
+
url: syntaxHighlightingWorkerUrl
|
|
1508
|
+
});
|
|
1509
|
+
};
|
|
1510
|
+
|
|
1511
|
+
const hydrate$1 = async () => {
|
|
1512
|
+
// TODO only launch port and send to renderer worker
|
|
1513
|
+
await launchSyntaxHighlightingWorker();
|
|
1514
|
+
};
|
|
1515
|
+
|
|
1516
|
+
const launchMultipleWorkers = hasFlag('prelaunchWorkers');
|
|
1517
|
+
const launchWorkers = () => {
|
|
1518
|
+
if (launchMultipleWorkers) {
|
|
1519
|
+
return Promise.all([hydrate$4(), hydrate$3(), hydrate$1(), hydrate$2()]);
|
|
1520
|
+
}
|
|
1521
|
+
return hydrate$4();
|
|
1522
|
+
};
|
|
1523
|
+
|
|
1457
1524
|
const Alert = 'alert';
|
|
1458
1525
|
const Application = 'application';
|
|
1459
1526
|
const Code = 'code';
|
|
@@ -2509,7 +2576,7 @@ const main = async () => {
|
|
|
2509
2576
|
window.onbeforeinstallprompt = handleBeforeInstallPrompt;
|
|
2510
2577
|
}
|
|
2511
2578
|
// TODO this is discovered very late
|
|
2512
|
-
await
|
|
2579
|
+
await launchWorkers();
|
|
2513
2580
|
setIpc(RendererWorker);
|
|
2514
2581
|
};
|
|
2515
2582
|
|
|
@@ -5394,6 +5461,11 @@ const listen$3 = async () => {
|
|
|
5394
5461
|
}
|
|
5395
5462
|
const type = firstMessage.params[0];
|
|
5396
5463
|
if (type === 'message-port') {
|
|
5464
|
+
parentIpc.send({
|
|
5465
|
+
jsonrpc: '2.0',
|
|
5466
|
+
id: firstMessage.id,
|
|
5467
|
+
result: null
|
|
5468
|
+
});
|
|
5397
5469
|
parentIpc.dispose();
|
|
5398
5470
|
const port = firstMessage.params[1];
|
|
5399
5471
|
return port;
|
|
@@ -5827,7 +5899,7 @@ const create$y = async ({
|
|
|
5827
5899
|
// TODO await promise
|
|
5828
5900
|
// TODO call separate method HandleMessagePort.handleMessagePort or
|
|
5829
5901
|
// HandleIncomingIpc.handleIncomingIpc
|
|
5830
|
-
invokeAndTransfer$1(ipc,
|
|
5902
|
+
await invokeAndTransfer$1(ipc, 'initialize', 'message-port', port);
|
|
5831
5903
|
unhandleIpc(ipc);
|
|
5832
5904
|
return undefined;
|
|
5833
5905
|
};
|