@lvce-editor/output-view 1.8.0 → 1.9.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/outputViewWorkerMain.js +90 -20
- package/package.json +1 -1
|
@@ -472,7 +472,7 @@ const create$4$1 = (method, params) => {
|
|
|
472
472
|
};
|
|
473
473
|
};
|
|
474
474
|
const callbacks = Object.create(null);
|
|
475
|
-
const set$
|
|
475
|
+
const set$5 = (id, fn) => {
|
|
476
476
|
callbacks[id] = fn;
|
|
477
477
|
};
|
|
478
478
|
const get$2 = id => {
|
|
@@ -491,7 +491,7 @@ const registerPromise = () => {
|
|
|
491
491
|
resolve,
|
|
492
492
|
promise
|
|
493
493
|
} = Promise.withResolvers();
|
|
494
|
-
set$
|
|
494
|
+
set$5(id, resolve);
|
|
495
495
|
return {
|
|
496
496
|
id,
|
|
497
497
|
promise
|
|
@@ -836,7 +836,7 @@ const send = (transport, method, ...params) => {
|
|
|
836
836
|
const message = create$4$1(method, params);
|
|
837
837
|
transport.send(message);
|
|
838
838
|
};
|
|
839
|
-
const invoke = (ipc, method, ...params) => {
|
|
839
|
+
const invoke$1 = (ipc, method, ...params) => {
|
|
840
840
|
return invokeHelper(ipc, method, params, false);
|
|
841
841
|
};
|
|
842
842
|
const invokeAndTransfer = (ipc, method, ...params) => {
|
|
@@ -875,7 +875,7 @@ const createRpc = ipc => {
|
|
|
875
875
|
send(ipc, method, ...params);
|
|
876
876
|
},
|
|
877
877
|
invoke(method, ...params) {
|
|
878
|
-
return invoke(ipc, method, ...params);
|
|
878
|
+
return invoke$1(ipc, method, ...params);
|
|
879
879
|
},
|
|
880
880
|
invokeAndTransfer(method, ...params) {
|
|
881
881
|
return invokeAndTransfer(ipc, method, ...params);
|
|
@@ -1061,12 +1061,12 @@ const Script = 2;
|
|
|
1061
1061
|
|
|
1062
1062
|
const {
|
|
1063
1063
|
get: get$1,
|
|
1064
|
-
set: set$
|
|
1064
|
+
set: set$4,
|
|
1065
1065
|
wrapCommand,
|
|
1066
1066
|
wrapGetter
|
|
1067
1067
|
} = create$2();
|
|
1068
1068
|
|
|
1069
|
-
const create$1 = (id, uri, x, y, width, height,
|
|
1069
|
+
const create$1 = (id, uri, x, y, width, height, platform) => {
|
|
1070
1070
|
const state = {
|
|
1071
1071
|
uid: id,
|
|
1072
1072
|
uri,
|
|
@@ -1085,14 +1085,15 @@ const create$1 = (id, uri, x, y, width, height, workspaceUri) => {
|
|
|
1085
1085
|
collapsedUris: [],
|
|
1086
1086
|
selectedOption: '',
|
|
1087
1087
|
smallWidthBreakPoint: 650,
|
|
1088
|
-
workspaceUri,
|
|
1088
|
+
workspaceUri: '',
|
|
1089
1089
|
options: [],
|
|
1090
1090
|
error: '',
|
|
1091
1091
|
errorCode: 0,
|
|
1092
1092
|
buttons: [],
|
|
1093
|
-
filteredItems: []
|
|
1093
|
+
filteredItems: [],
|
|
1094
|
+
platform
|
|
1094
1095
|
};
|
|
1095
|
-
set$
|
|
1096
|
+
set$4(id, state, state);
|
|
1096
1097
|
};
|
|
1097
1098
|
|
|
1098
1099
|
const isEqual$1 = (oldState, newState) => {
|
|
@@ -1280,8 +1281,17 @@ const create = rpcId => {
|
|
|
1280
1281
|
}
|
|
1281
1282
|
};
|
|
1282
1283
|
};
|
|
1284
|
+
const ExtensionHostWorker = 44;
|
|
1283
1285
|
const RendererWorker$1 = 1;
|
|
1284
1286
|
const FileSystemWorker$1 = 209;
|
|
1287
|
+
const {
|
|
1288
|
+
invoke: invoke$9,
|
|
1289
|
+
set: set$9} = create(ExtensionHostWorker);
|
|
1290
|
+
const ExtensionHost = {
|
|
1291
|
+
__proto__: null,
|
|
1292
|
+
invoke: invoke$9,
|
|
1293
|
+
set: set$9
|
|
1294
|
+
};
|
|
1285
1295
|
const {
|
|
1286
1296
|
invoke: invoke$7,
|
|
1287
1297
|
set: set$7} = create(FileSystemWorker$1);
|
|
@@ -1305,13 +1315,18 @@ const sendMessagePortToFileSystemWorker$2 = async (port, rpcId) => {
|
|
|
1305
1315
|
// @ts-ignore
|
|
1306
1316
|
await invokeAndTransfer$3('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
|
|
1307
1317
|
};
|
|
1318
|
+
const sendMessagePortToExtensionHostWorker$1 = async (port, rpcId = 0) => {
|
|
1319
|
+
const command = 'HandleMessagePort.handleMessagePort2';
|
|
1320
|
+
await invokeAndTransfer$3('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
|
|
1321
|
+
};
|
|
1308
1322
|
const RendererWorker = {
|
|
1309
1323
|
__proto__: null,
|
|
1324
|
+
sendMessagePortToExtensionHostWorker: sendMessagePortToExtensionHostWorker$1,
|
|
1310
1325
|
sendMessagePortToFileSystemWorker: sendMessagePortToFileSystemWorker$2,
|
|
1311
1326
|
set: set$3};
|
|
1312
1327
|
|
|
1313
1328
|
const {
|
|
1314
|
-
set: set$
|
|
1329
|
+
set: set$2,
|
|
1315
1330
|
readFile,
|
|
1316
1331
|
writeFile
|
|
1317
1332
|
} = FileSystemWorker;
|
|
@@ -1453,8 +1468,34 @@ const handleSelect = async (state, id) => {
|
|
|
1453
1468
|
};
|
|
1454
1469
|
|
|
1455
1470
|
const {
|
|
1471
|
+
sendMessagePortToExtensionHostWorker,
|
|
1456
1472
|
sendMessagePortToFileSystemWorker: sendMessagePortToFileSystemWorker$1,
|
|
1457
|
-
set} = RendererWorker;
|
|
1473
|
+
set: set$1} = RendererWorker;
|
|
1474
|
+
|
|
1475
|
+
const sendMessagePortToExtensionHostWorker2 = async port => {
|
|
1476
|
+
await sendMessagePortToExtensionHostWorker(port);
|
|
1477
|
+
};
|
|
1478
|
+
|
|
1479
|
+
const createExtensionHostRpc = async () => {
|
|
1480
|
+
try {
|
|
1481
|
+
const rpc = await TransferMessagePortRpcParent.create({
|
|
1482
|
+
commandMap: {},
|
|
1483
|
+
send: sendMessagePortToExtensionHostWorker2
|
|
1484
|
+
});
|
|
1485
|
+
return rpc;
|
|
1486
|
+
} catch (error) {
|
|
1487
|
+
throw new VError(error, `Failed to create extension host rpc`);
|
|
1488
|
+
}
|
|
1489
|
+
};
|
|
1490
|
+
|
|
1491
|
+
const {
|
|
1492
|
+
set,
|
|
1493
|
+
invoke} = ExtensionHost;
|
|
1494
|
+
|
|
1495
|
+
const initializeExtensionHost = async () => {
|
|
1496
|
+
const extensionHostRpc = await createExtensionHostRpc();
|
|
1497
|
+
set(extensionHostRpc);
|
|
1498
|
+
};
|
|
1458
1499
|
|
|
1459
1500
|
const sendMessagePortToFileSystemWorker = async port => {
|
|
1460
1501
|
await sendMessagePortToFileSystemWorker$1(port, 0);
|
|
@@ -1474,14 +1515,19 @@ const createFileSystemWorkerRpc = async () => {
|
|
|
1474
1515
|
|
|
1475
1516
|
const initializeFileSystemWorker = async () => {
|
|
1476
1517
|
const rpc = await createFileSystemWorkerRpc();
|
|
1477
|
-
set$
|
|
1518
|
+
set$2(rpc);
|
|
1478
1519
|
};
|
|
1479
1520
|
|
|
1480
1521
|
const initialize = async () => {
|
|
1481
|
-
await initializeFileSystemWorker();
|
|
1522
|
+
await Promise.all([initializeFileSystemWorker(), initializeExtensionHost()]);
|
|
1482
1523
|
};
|
|
1483
1524
|
|
|
1525
|
+
const Web = 1;
|
|
1526
|
+
|
|
1484
1527
|
const getSelectedItem = platform => {
|
|
1528
|
+
if (platform === Web) {
|
|
1529
|
+
return '';
|
|
1530
|
+
}
|
|
1485
1531
|
return MainProcess;
|
|
1486
1532
|
};
|
|
1487
1533
|
|
|
@@ -1501,7 +1547,22 @@ const loadButtons = () => {
|
|
|
1501
1547
|
}];
|
|
1502
1548
|
};
|
|
1503
1549
|
|
|
1550
|
+
const getExtensionOptions = async () => {
|
|
1551
|
+
try {
|
|
1552
|
+
// @ts-ignore
|
|
1553
|
+
const channels = await invoke('ExtensionHost.getOutputChannels');
|
|
1554
|
+
return channels;
|
|
1555
|
+
} catch {
|
|
1556
|
+
return [];
|
|
1557
|
+
}
|
|
1558
|
+
};
|
|
1559
|
+
|
|
1560
|
+
// TODO load options from extensions
|
|
1504
1561
|
const loadOptions = async platform => {
|
|
1562
|
+
const extensionOptions = await getExtensionOptions();
|
|
1563
|
+
if (platform === Web) {
|
|
1564
|
+
return extensionOptions;
|
|
1565
|
+
}
|
|
1505
1566
|
return [{
|
|
1506
1567
|
id: MainProcess,
|
|
1507
1568
|
label: 'Main Process',
|
|
@@ -1510,7 +1571,7 @@ const loadOptions = async platform => {
|
|
|
1510
1571
|
id: SharedProcess,
|
|
1511
1572
|
label: 'Shared Process',
|
|
1512
1573
|
uri: 'file:///tmp/log-shared-process.txt'
|
|
1513
|
-
}];
|
|
1574
|
+
}, ...extensionOptions];
|
|
1514
1575
|
};
|
|
1515
1576
|
|
|
1516
1577
|
const isString = value => {
|
|
@@ -1522,14 +1583,23 @@ const getSavedCollapsedUris = savedState => {
|
|
|
1522
1583
|
}
|
|
1523
1584
|
return [];
|
|
1524
1585
|
};
|
|
1586
|
+
const getMatchingOpen = (options, id) => {
|
|
1587
|
+
return options.find(option => option.id === id) || options[0];
|
|
1588
|
+
};
|
|
1525
1589
|
const loadContent = async (state, savedState) => {
|
|
1590
|
+
const {
|
|
1591
|
+
platform
|
|
1592
|
+
} = state;
|
|
1526
1593
|
const collapsedUris = getSavedCollapsedUris(savedState);
|
|
1527
|
-
const selectedId = getSelectedItem();
|
|
1528
|
-
const options = await loadOptions();
|
|
1529
|
-
const
|
|
1530
|
-
if (!
|
|
1594
|
+
const selectedId = getSelectedItem(platform);
|
|
1595
|
+
const options = await loadOptions(platform);
|
|
1596
|
+
const option = getMatchingOpen(options, selectedId);
|
|
1597
|
+
if (!option) {
|
|
1531
1598
|
throw new Error('option not found');
|
|
1532
1599
|
}
|
|
1600
|
+
const {
|
|
1601
|
+
uri
|
|
1602
|
+
} = option;
|
|
1533
1603
|
const {
|
|
1534
1604
|
lines,
|
|
1535
1605
|
error,
|
|
@@ -1724,7 +1794,7 @@ const render2 = (uid, diffResult) => {
|
|
|
1724
1794
|
oldState,
|
|
1725
1795
|
newState
|
|
1726
1796
|
} = get$1(uid);
|
|
1727
|
-
set$
|
|
1797
|
+
set$4(uid, newState, newState);
|
|
1728
1798
|
const commands = applyRender(oldState, newState, diffResult);
|
|
1729
1799
|
return commands;
|
|
1730
1800
|
};
|
|
@@ -1904,7 +1974,7 @@ const listen = async () => {
|
|
|
1904
1974
|
const rpc = await WebWorkerRpcClient.create({
|
|
1905
1975
|
commandMap: commandMapRef
|
|
1906
1976
|
});
|
|
1907
|
-
set(rpc);
|
|
1977
|
+
set$1(rpc);
|
|
1908
1978
|
};
|
|
1909
1979
|
|
|
1910
1980
|
const main = async () => {
|