@lvce-editor/extension-detail-view 7.1.0 → 7.3.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/extensionDetailViewWorkerMain.js +1642 -1564
- package/package.json +1 -1
|
@@ -283,10 +283,7 @@ const getActivationEventsDetails = async extension => {
|
|
|
283
283
|
};
|
|
284
284
|
|
|
285
285
|
const hasProperty = (object, key) => {
|
|
286
|
-
|
|
287
|
-
return false;
|
|
288
|
-
}
|
|
289
|
-
return true;
|
|
286
|
+
return !!object && typeof object === 'object' && key in object;
|
|
290
287
|
};
|
|
291
288
|
|
|
292
289
|
const featureActivationEventsEnabled = extension => {
|
|
@@ -344,6 +341,7 @@ const None$2 = 0;
|
|
|
344
341
|
const Web$1 = 1;
|
|
345
342
|
const Electron$1 = 2;
|
|
346
343
|
|
|
344
|
+
const ClipBoardWorker = 3400;
|
|
347
345
|
const ExtensionHostWorker = 44;
|
|
348
346
|
const ExtensionManagementWorker = 9006;
|
|
349
347
|
const FileSystemWorker$1 = 209;
|
|
@@ -591,7 +589,6 @@ const diffChildren = (oldChildren, newChildren, patches) => {
|
|
|
591
589
|
patches.push({
|
|
592
590
|
type: NavigateParent
|
|
593
591
|
});
|
|
594
|
-
currentChildIndex = -1;
|
|
595
592
|
}
|
|
596
593
|
// Add remove patches in reverse order (highest index first)
|
|
597
594
|
// This ensures indices remain valid as we remove
|
|
@@ -1443,1771 +1440,1782 @@ const string = value => {
|
|
|
1443
1440
|
}
|
|
1444
1441
|
};
|
|
1445
1442
|
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
super(`Command not found ${command}`);
|
|
1449
|
-
this.name = 'CommandNotFoundError';
|
|
1450
|
-
}
|
|
1451
|
-
}
|
|
1452
|
-
const commands = Object.create(null);
|
|
1453
|
-
const register = commandMap => {
|
|
1454
|
-
Object.assign(commands, commandMap);
|
|
1443
|
+
const isMessagePort = value => {
|
|
1444
|
+
return value && value instanceof MessagePort;
|
|
1455
1445
|
};
|
|
1456
|
-
const
|
|
1457
|
-
return
|
|
1446
|
+
const isMessagePortMain = value => {
|
|
1447
|
+
return value && value.constructor && value.constructor.name === 'MessagePortMain';
|
|
1458
1448
|
};
|
|
1459
|
-
const
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1449
|
+
const isOffscreenCanvas = value => {
|
|
1450
|
+
return typeof OffscreenCanvas !== 'undefined' && value instanceof OffscreenCanvas;
|
|
1451
|
+
};
|
|
1452
|
+
const isInstanceOf = (value, constructorName) => {
|
|
1453
|
+
return value?.constructor?.name === constructorName;
|
|
1454
|
+
};
|
|
1455
|
+
const isSocket = value => {
|
|
1456
|
+
return isInstanceOf(value, 'Socket');
|
|
1457
|
+
};
|
|
1458
|
+
const transferrables = [isMessagePort, isMessagePortMain, isOffscreenCanvas, isSocket];
|
|
1459
|
+
const isTransferrable = value => {
|
|
1460
|
+
for (const fn of transferrables) {
|
|
1461
|
+
if (fn(value)) {
|
|
1462
|
+
return true;
|
|
1463
|
+
}
|
|
1463
1464
|
}
|
|
1464
|
-
return
|
|
1465
|
+
return false;
|
|
1465
1466
|
};
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
}
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1467
|
+
const walkValue = (value, transferrables, isTransferrable) => {
|
|
1468
|
+
if (!value) {
|
|
1469
|
+
return;
|
|
1470
|
+
}
|
|
1471
|
+
if (isTransferrable(value)) {
|
|
1472
|
+
transferrables.push(value);
|
|
1473
|
+
return;
|
|
1474
|
+
}
|
|
1475
|
+
if (Array.isArray(value)) {
|
|
1476
|
+
for (const item of value) {
|
|
1477
|
+
walkValue(item, transferrables, isTransferrable);
|
|
1476
1478
|
}
|
|
1477
|
-
return
|
|
1479
|
+
return;
|
|
1480
|
+
}
|
|
1481
|
+
if (typeof value === 'object') {
|
|
1482
|
+
for (const property of Object.values(value)) {
|
|
1483
|
+
walkValue(property, transferrables, isTransferrable);
|
|
1484
|
+
}
|
|
1485
|
+
return;
|
|
1486
|
+
}
|
|
1487
|
+
};
|
|
1488
|
+
const getTransferrables = value => {
|
|
1489
|
+
const transferrables = [];
|
|
1490
|
+
walkValue(value, transferrables, isTransferrable);
|
|
1491
|
+
return transferrables;
|
|
1492
|
+
};
|
|
1493
|
+
const attachEvents = that => {
|
|
1494
|
+
const handleMessage = (...args) => {
|
|
1495
|
+
const data = that.getData(...args);
|
|
1496
|
+
that.dispatchEvent(new MessageEvent('message', {
|
|
1497
|
+
data
|
|
1498
|
+
}));
|
|
1478
1499
|
};
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
invokeAndTransfer: invoke
|
|
1500
|
+
that.onMessage(handleMessage);
|
|
1501
|
+
const handleClose = event => {
|
|
1502
|
+
that.dispatchEvent(new Event('close'));
|
|
1483
1503
|
};
|
|
1484
|
-
|
|
1485
|
-
};
|
|
1486
|
-
|
|
1487
|
-
const rpcs = Object.create(null);
|
|
1488
|
-
const set$a = (id, rpc) => {
|
|
1489
|
-
rpcs[id] = rpc;
|
|
1504
|
+
that.onClose(handleClose);
|
|
1490
1505
|
};
|
|
1491
|
-
|
|
1492
|
-
|
|
1506
|
+
class Ipc extends EventTarget {
|
|
1507
|
+
constructor(rawIpc) {
|
|
1508
|
+
super();
|
|
1509
|
+
this._rawIpc = rawIpc;
|
|
1510
|
+
attachEvents(this);
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
const E_INCOMPATIBLE_NATIVE_MODULE = 'E_INCOMPATIBLE_NATIVE_MODULE';
|
|
1514
|
+
const E_MODULES_NOT_SUPPORTED_IN_ELECTRON = 'E_MODULES_NOT_SUPPORTED_IN_ELECTRON';
|
|
1515
|
+
const ERR_MODULE_NOT_FOUND = 'ERR_MODULE_NOT_FOUND';
|
|
1516
|
+
const NewLine$1 = '\n';
|
|
1517
|
+
const joinLines$1 = lines => {
|
|
1518
|
+
return lines.join(NewLine$1);
|
|
1493
1519
|
};
|
|
1494
|
-
const
|
|
1495
|
-
|
|
1520
|
+
const RE_AT = /^\s+at/;
|
|
1521
|
+
const RE_AT_PROMISE_INDEX = /^\s*at async Promise.all \(index \d+\)$/;
|
|
1522
|
+
const isNormalStackLine = line => {
|
|
1523
|
+
return RE_AT.test(line) && !RE_AT_PROMISE_INDEX.test(line);
|
|
1496
1524
|
};
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
return rpc.invoke(method, ...params);
|
|
1510
|
-
},
|
|
1511
|
-
// @ts-ignore
|
|
1512
|
-
invokeAndTransfer(method, ...params) {
|
|
1513
|
-
const rpc = get$3(rpcId);
|
|
1514
|
-
// @ts-ignore
|
|
1515
|
-
return rpc.invokeAndTransfer(method, ...params);
|
|
1516
|
-
},
|
|
1517
|
-
registerMockRpc(commandMap) {
|
|
1518
|
-
const mockRpc = createMockRpc({
|
|
1519
|
-
commandMap
|
|
1520
|
-
});
|
|
1521
|
-
set$a(rpcId, mockRpc);
|
|
1522
|
-
// @ts-ignore
|
|
1523
|
-
mockRpc[Symbol.dispose] = () => {
|
|
1524
|
-
remove$1(rpcId);
|
|
1525
|
-
};
|
|
1526
|
-
// @ts-ignore
|
|
1527
|
-
return mockRpc;
|
|
1528
|
-
},
|
|
1529
|
-
set(rpc) {
|
|
1530
|
-
set$a(rpcId, rpc);
|
|
1525
|
+
const getDetails = lines => {
|
|
1526
|
+
const index = lines.findIndex(isNormalStackLine);
|
|
1527
|
+
if (index === -1) {
|
|
1528
|
+
return {
|
|
1529
|
+
actualMessage: joinLines$1(lines),
|
|
1530
|
+
rest: []
|
|
1531
|
+
};
|
|
1532
|
+
}
|
|
1533
|
+
let lastIndex = index - 1;
|
|
1534
|
+
while (++lastIndex < lines.length) {
|
|
1535
|
+
if (!isNormalStackLine(lines[lastIndex])) {
|
|
1536
|
+
break;
|
|
1531
1537
|
}
|
|
1538
|
+
}
|
|
1539
|
+
return {
|
|
1540
|
+
actualMessage: lines[index - 1],
|
|
1541
|
+
rest: lines.slice(index, lastIndex)
|
|
1532
1542
|
};
|
|
1533
1543
|
};
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
invoke: invoke$5,
|
|
1537
|
-
set: set$9
|
|
1538
|
-
} = create$a(ExtensionHostWorker);
|
|
1539
|
-
const getRuntimeStatus$2 = async extensionId => {
|
|
1540
|
-
// @ts-ignore
|
|
1541
|
-
return invoke$5('ExtensionHost.getRuntimeStatus', extensionId);
|
|
1544
|
+
const splitLines$1 = lines => {
|
|
1545
|
+
return lines.split(NewLine$1);
|
|
1542
1546
|
};
|
|
1543
|
-
|
|
1544
|
-
const
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
invoke: invoke$5,
|
|
1548
|
-
set: set$9
|
|
1547
|
+
const RE_MESSAGE_CODE_BLOCK_START = /^Error: The module '.*'$/;
|
|
1548
|
+
const RE_MESSAGE_CODE_BLOCK_END = /^\s* at/;
|
|
1549
|
+
const isMessageCodeBlockStartIndex = line => {
|
|
1550
|
+
return RE_MESSAGE_CODE_BLOCK_START.test(line);
|
|
1549
1551
|
};
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
invoke: invoke$4,
|
|
1553
|
-
set: set$8
|
|
1554
|
-
} = create$a(ExtensionManagementWorker);
|
|
1555
|
-
const enable2 = (id, platform) => {
|
|
1556
|
-
return invoke$4(`Extensions.enable2`, id, platform);
|
|
1552
|
+
const isMessageCodeBlockEndIndex = line => {
|
|
1553
|
+
return RE_MESSAGE_CODE_BLOCK_END.test(line);
|
|
1557
1554
|
};
|
|
1558
|
-
const
|
|
1559
|
-
|
|
1555
|
+
const getMessageCodeBlock = stderr => {
|
|
1556
|
+
const lines = splitLines$1(stderr);
|
|
1557
|
+
const startIndex = lines.findIndex(isMessageCodeBlockStartIndex);
|
|
1558
|
+
const endIndex = startIndex + lines.slice(startIndex).findIndex(isMessageCodeBlockEndIndex, startIndex);
|
|
1559
|
+
const relevantLines = lines.slice(startIndex, endIndex);
|
|
1560
|
+
const relevantMessage = relevantLines.join(' ').slice('Error: '.length);
|
|
1561
|
+
return relevantMessage;
|
|
1560
1562
|
};
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
invoke: invoke$3,
|
|
1564
|
-
set: set$7
|
|
1565
|
-
} = create$a(FileSystemWorker$1);
|
|
1566
|
-
const readFile$2 = async uri => {
|
|
1567
|
-
return invoke$3('FileSystem.readFile', uri);
|
|
1563
|
+
const isModuleNotFoundMessage = line => {
|
|
1564
|
+
return line.includes('[ERR_MODULE_NOT_FOUND]');
|
|
1568
1565
|
};
|
|
1569
|
-
const
|
|
1570
|
-
|
|
1566
|
+
const getModuleNotFoundError = stderr => {
|
|
1567
|
+
const lines = splitLines$1(stderr);
|
|
1568
|
+
const messageIndex = lines.findIndex(isModuleNotFoundMessage);
|
|
1569
|
+
const message = lines[messageIndex];
|
|
1570
|
+
return {
|
|
1571
|
+
code: ERR_MODULE_NOT_FOUND,
|
|
1572
|
+
message
|
|
1573
|
+
};
|
|
1571
1574
|
};
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
readFile: readFile$2,
|
|
1578
|
-
set: set$7
|
|
1575
|
+
const isModuleNotFoundError = stderr => {
|
|
1576
|
+
if (!stderr) {
|
|
1577
|
+
return false;
|
|
1578
|
+
}
|
|
1579
|
+
return stderr.includes('ERR_MODULE_NOT_FOUND');
|
|
1579
1580
|
};
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
const getVirtualDom$1 = async html => {
|
|
1586
|
-
// @ts-ignore
|
|
1587
|
-
return invoke$2('Markdown.getVirtualDom', html);
|
|
1581
|
+
const isModulesSyntaxError = stderr => {
|
|
1582
|
+
if (!stderr) {
|
|
1583
|
+
return false;
|
|
1584
|
+
}
|
|
1585
|
+
return stderr.includes('SyntaxError: Cannot use import statement outside a module');
|
|
1588
1586
|
};
|
|
1589
|
-
const
|
|
1590
|
-
|
|
1591
|
-
|
|
1587
|
+
const RE_NATIVE_MODULE_ERROR = /^innerError Error: Cannot find module '.*.node'/;
|
|
1588
|
+
const RE_NATIVE_MODULE_ERROR_2 = /was compiled against a different Node.js version/;
|
|
1589
|
+
const isUnhelpfulNativeModuleError = stderr => {
|
|
1590
|
+
return RE_NATIVE_MODULE_ERROR.test(stderr) && RE_NATIVE_MODULE_ERROR_2.test(stderr);
|
|
1592
1591
|
};
|
|
1593
|
-
|
|
1594
|
-
const
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
set: set$6
|
|
1592
|
+
const getNativeModuleErrorMessage = stderr => {
|
|
1593
|
+
const message = getMessageCodeBlock(stderr);
|
|
1594
|
+
return {
|
|
1595
|
+
code: E_INCOMPATIBLE_NATIVE_MODULE,
|
|
1596
|
+
message: `Incompatible native node module: ${message}`
|
|
1597
|
+
};
|
|
1600
1598
|
};
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
} = create$a(RendererWorker);
|
|
1607
|
-
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
1608
|
-
number(uid);
|
|
1609
|
-
number(menuId);
|
|
1610
|
-
number(x);
|
|
1611
|
-
number(y);
|
|
1612
|
-
await invoke$1('ContextMenu.show2', uid, menuId, x, y, args);
|
|
1613
|
-
};
|
|
1614
|
-
const setColorTheme$1 = async id => {
|
|
1615
|
-
return invoke$1(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
|
|
1616
|
-
};
|
|
1617
|
-
const sendMessagePortToMarkdownWorker$1 = async (port, rpcId) => {
|
|
1618
|
-
const command = 'Markdown.handleMessagePort';
|
|
1619
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToMarkdownWorker', port, command, rpcId);
|
|
1620
|
-
};
|
|
1621
|
-
const sendMessagePortToFileSystemWorker$1 = async (port, rpcId) => {
|
|
1622
|
-
const command = 'FileSystem.handleMessagePort';
|
|
1623
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
|
|
1624
|
-
};
|
|
1625
|
-
const sendMessagePortToExtensionHostWorker$1 = async (port, rpcId = 0) => {
|
|
1626
|
-
const command = 'HandleMessagePort.handleMessagePort2';
|
|
1627
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
|
|
1628
|
-
};
|
|
1629
|
-
const confirm = async (message, options) => {
|
|
1630
|
-
const result = await invoke$1('ConfirmPrompt.prompt', message, options);
|
|
1631
|
-
return result;
|
|
1632
|
-
};
|
|
1633
|
-
const writeClipBoardText = async text => {
|
|
1634
|
-
await invoke$1('ClipBoard.writeText', /* text */text);
|
|
1635
|
-
};
|
|
1636
|
-
const writeClipBoardImage = async blob => {
|
|
1637
|
-
await invoke$1('ClipBoard.writeImage', /* text */blob);
|
|
1638
|
-
};
|
|
1639
|
-
const sendMessagePortToExtensionManagementWorker = async (port, rpcId) => {
|
|
1640
|
-
const command = 'Extensions.handleMessagePort';
|
|
1641
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionManagementWorker', port, command, rpcId);
|
|
1642
|
-
};
|
|
1643
|
-
const getPreference = async key => {
|
|
1644
|
-
return await invoke$1('Preferences.get', key);
|
|
1645
|
-
};
|
|
1646
|
-
const getAllExtensions$1 = async () => {
|
|
1647
|
-
return invoke$1('ExtensionManagement.getAllExtensions');
|
|
1648
|
-
};
|
|
1649
|
-
const getExtension$2 = async id => {
|
|
1650
|
-
return invoke$1('ExtensionManagement.getExtension', id);
|
|
1651
|
-
};
|
|
1652
|
-
const openNativeFolder = async uri => {
|
|
1653
|
-
await invoke$1('OpenNativeFolder.openNativeFolder', uri);
|
|
1654
|
-
};
|
|
1655
|
-
const uninstallExtension = async id => {
|
|
1656
|
-
return invoke$1('ExtensionManagement.uninstall', id);
|
|
1657
|
-
};
|
|
1658
|
-
const openExtensionSearch$1 = async () => {
|
|
1659
|
-
return invoke$1('SideBar.openViewlet', 'Extensions');
|
|
1660
|
-
};
|
|
1661
|
-
const setExtensionsSearchValue = async searchValue => {
|
|
1662
|
-
return invoke$1('Extensions.handleInput', searchValue, Script$1);
|
|
1663
|
-
};
|
|
1664
|
-
const openExternal$1 = async uri => {
|
|
1665
|
-
await invoke$1('Open.openExternal', uri);
|
|
1666
|
-
};
|
|
1667
|
-
const openUrl = async uri => {
|
|
1668
|
-
await invoke$1('Open.openUrl', uri);
|
|
1669
|
-
};
|
|
1670
|
-
|
|
1671
|
-
/* eslint-disable unicorn/prefer-export-from */
|
|
1672
|
-
|
|
1673
|
-
const {
|
|
1674
|
-
getRuntimeStatus: getRuntimeStatus$1,
|
|
1675
|
-
set: set$4
|
|
1676
|
-
} = ExtensionHost;
|
|
1677
|
-
|
|
1678
|
-
const getRuntimeStatus = async extensionId => {
|
|
1679
|
-
// @ts-ignore
|
|
1680
|
-
const status = await getRuntimeStatus$1(extensionId);
|
|
1681
|
-
// @ts-ignore
|
|
1682
|
-
return status;
|
|
1599
|
+
const getModuleSyntaxError = () => {
|
|
1600
|
+
return {
|
|
1601
|
+
code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON,
|
|
1602
|
+
message: `ES Modules are not supported in electron`
|
|
1603
|
+
};
|
|
1683
1604
|
};
|
|
1684
|
-
|
|
1685
|
-
|
|
1605
|
+
const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
1606
|
+
if (isUnhelpfulNativeModuleError(stderr)) {
|
|
1607
|
+
return getNativeModuleErrorMessage(stderr);
|
|
1608
|
+
}
|
|
1609
|
+
if (isModulesSyntaxError(stderr)) {
|
|
1610
|
+
return getModuleSyntaxError();
|
|
1611
|
+
}
|
|
1612
|
+
if (isModuleNotFoundError(stderr)) {
|
|
1613
|
+
return getModuleNotFoundError(stderr);
|
|
1614
|
+
}
|
|
1615
|
+
const lines = splitLines$1(stderr);
|
|
1686
1616
|
const {
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
status
|
|
1691
|
-
} = await getRuntimeStatus(extension.id);
|
|
1617
|
+
actualMessage,
|
|
1618
|
+
rest
|
|
1619
|
+
} = getDetails(lines);
|
|
1692
1620
|
return {
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
wasActivatedByEvent: activationEvent
|
|
1621
|
+
code: '',
|
|
1622
|
+
message: actualMessage,
|
|
1623
|
+
stack: rest
|
|
1697
1624
|
};
|
|
1698
1625
|
};
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1626
|
+
class IpcError extends VError {
|
|
1627
|
+
// @ts-ignore
|
|
1628
|
+
constructor(betterMessage, stdout = '', stderr = '') {
|
|
1629
|
+
if (stdout || stderr) {
|
|
1630
|
+
// @ts-ignore
|
|
1631
|
+
const {
|
|
1632
|
+
code,
|
|
1633
|
+
message,
|
|
1634
|
+
stack
|
|
1635
|
+
} = getHelpfulChildProcessError(stdout, stderr);
|
|
1636
|
+
const cause = new Error(message);
|
|
1637
|
+
// @ts-ignore
|
|
1638
|
+
cause.code = code;
|
|
1639
|
+
cause.stack = stack;
|
|
1640
|
+
super(cause, betterMessage);
|
|
1641
|
+
} else {
|
|
1642
|
+
super(betterMessage);
|
|
1643
|
+
}
|
|
1644
|
+
// @ts-ignore
|
|
1645
|
+
this.name = 'IpcError';
|
|
1646
|
+
// @ts-ignore
|
|
1647
|
+
this.stdout = stdout;
|
|
1648
|
+
// @ts-ignore
|
|
1649
|
+
this.stderr = stderr;
|
|
1703
1650
|
}
|
|
1704
|
-
|
|
1705
|
-
|
|
1651
|
+
}
|
|
1652
|
+
const readyMessage = 'ready';
|
|
1653
|
+
const getData$2 = event => {
|
|
1654
|
+
return event.data;
|
|
1655
|
+
};
|
|
1656
|
+
const listen$7 = () => {
|
|
1657
|
+
// @ts-ignore
|
|
1658
|
+
if (typeof WorkerGlobalScope === 'undefined') {
|
|
1659
|
+
throw new TypeError('module is not in web worker scope');
|
|
1706
1660
|
}
|
|
1707
|
-
return
|
|
1661
|
+
return globalThis;
|
|
1708
1662
|
};
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
return time.toFixed(2) + 'ms';
|
|
1663
|
+
const signal$8 = global => {
|
|
1664
|
+
global.postMessage(readyMessage);
|
|
1712
1665
|
};
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
return [];
|
|
1666
|
+
class IpcChildWithModuleWorker extends Ipc {
|
|
1667
|
+
getData(event) {
|
|
1668
|
+
return getData$2(event);
|
|
1717
1669
|
}
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
}
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
}
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
}, text(formattedTime)];
|
|
1733
|
-
};
|
|
1734
|
-
|
|
1735
|
-
const None$1 = 0;
|
|
1736
|
-
const Importing = 1;
|
|
1737
|
-
const Activating = 2;
|
|
1738
|
-
const Activated = 3;
|
|
1739
|
-
const Error$1 = 4;
|
|
1740
|
-
|
|
1741
|
-
const getStatusMessage = statusType => {
|
|
1742
|
-
switch (statusType) {
|
|
1743
|
-
case Activated:
|
|
1744
|
-
return 'activated';
|
|
1745
|
-
case Activating:
|
|
1746
|
-
return 'Activating';
|
|
1747
|
-
case Error$1:
|
|
1748
|
-
return 'error';
|
|
1749
|
-
case Importing:
|
|
1750
|
-
return 'importing';
|
|
1751
|
-
case None$1:
|
|
1752
|
-
return 'none';
|
|
1753
|
-
default:
|
|
1754
|
-
return 'unknown';
|
|
1670
|
+
send(message) {
|
|
1671
|
+
// @ts-ignore
|
|
1672
|
+
this._rawIpc.postMessage(message);
|
|
1673
|
+
}
|
|
1674
|
+
sendAndTransfer(message) {
|
|
1675
|
+
const transfer = getTransferrables(message);
|
|
1676
|
+
// @ts-ignore
|
|
1677
|
+
this._rawIpc.postMessage(message, transfer);
|
|
1678
|
+
}
|
|
1679
|
+
dispose() {
|
|
1680
|
+
// ignore
|
|
1681
|
+
}
|
|
1682
|
+
onClose(callback) {
|
|
1683
|
+
// ignore
|
|
1755
1684
|
}
|
|
1685
|
+
onMessage(callback) {
|
|
1686
|
+
this._rawIpc.addEventListener('message', callback);
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
const wrap$f = global => {
|
|
1690
|
+
return new IpcChildWithModuleWorker(global);
|
|
1756
1691
|
};
|
|
1757
|
-
|
|
1758
|
-
const
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1692
|
+
const waitForFirstMessage = async port => {
|
|
1693
|
+
const {
|
|
1694
|
+
promise,
|
|
1695
|
+
resolve
|
|
1696
|
+
} = Promise.withResolvers();
|
|
1697
|
+
port.addEventListener('message', resolve, {
|
|
1698
|
+
once: true
|
|
1699
|
+
});
|
|
1700
|
+
const event = await promise;
|
|
1701
|
+
// @ts-ignore
|
|
1702
|
+
return event.data;
|
|
1762
1703
|
};
|
|
1763
|
-
const
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1704
|
+
const listen$6 = async () => {
|
|
1705
|
+
const parentIpcRaw = listen$7();
|
|
1706
|
+
signal$8(parentIpcRaw);
|
|
1707
|
+
const parentIpc = wrap$f(parentIpcRaw);
|
|
1708
|
+
const firstMessage = await waitForFirstMessage(parentIpc);
|
|
1709
|
+
if (firstMessage.method !== 'initialize') {
|
|
1710
|
+
throw new IpcError('unexpected first message');
|
|
1711
|
+
}
|
|
1712
|
+
const type = firstMessage.params[0];
|
|
1713
|
+
if (type === 'message-port') {
|
|
1714
|
+
parentIpc.send({
|
|
1715
|
+
id: firstMessage.id,
|
|
1716
|
+
jsonrpc: '2.0',
|
|
1717
|
+
result: null
|
|
1718
|
+
});
|
|
1719
|
+
parentIpc.dispose();
|
|
1720
|
+
const port = firstMessage.params[1];
|
|
1721
|
+
return port;
|
|
1722
|
+
}
|
|
1723
|
+
return globalThis;
|
|
1767
1724
|
};
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1725
|
+
class IpcChildWithModuleWorkerAndMessagePort extends Ipc {
|
|
1726
|
+
getData(event) {
|
|
1727
|
+
return getData$2(event);
|
|
1728
|
+
}
|
|
1729
|
+
send(message) {
|
|
1730
|
+
this._rawIpc.postMessage(message);
|
|
1731
|
+
}
|
|
1732
|
+
sendAndTransfer(message) {
|
|
1733
|
+
const transfer = getTransferrables(message);
|
|
1734
|
+
this._rawIpc.postMessage(message, transfer);
|
|
1735
|
+
}
|
|
1736
|
+
dispose() {
|
|
1737
|
+
if (this._rawIpc.close) {
|
|
1738
|
+
this._rawIpc.close();
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
onClose(callback) {
|
|
1742
|
+
// ignore
|
|
1743
|
+
}
|
|
1744
|
+
onMessage(callback) {
|
|
1745
|
+
this._rawIpc.addEventListener('message', callback);
|
|
1746
|
+
this._rawIpc.start();
|
|
1747
|
+
}
|
|
1748
|
+
}
|
|
1749
|
+
const wrap$e = port => {
|
|
1750
|
+
return new IpcChildWithModuleWorkerAndMessagePort(port);
|
|
1772
1751
|
};
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1752
|
+
const IpcChildWithModuleWorkerAndMessagePort$1 = {
|
|
1753
|
+
__proto__: null,
|
|
1754
|
+
listen: listen$6,
|
|
1755
|
+
wrap: wrap$e
|
|
1756
|
+
};
|
|
1757
|
+
const addListener = (emitter, type, callback) => {
|
|
1758
|
+
if ('addEventListener' in emitter) {
|
|
1759
|
+
emitter.addEventListener(type, callback);
|
|
1760
|
+
} else {
|
|
1761
|
+
emitter.on(type, callback);
|
|
1779
1762
|
}
|
|
1780
|
-
return childCount;
|
|
1781
1763
|
};
|
|
1782
|
-
const
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
}
|
|
1788
|
-
const heading = runtimeStatus();
|
|
1789
|
-
const childCount = getChildCount$1(status, activationTime, importTime);
|
|
1790
|
-
return [{
|
|
1791
|
-
childCount: 2,
|
|
1792
|
-
className: FeatureContent,
|
|
1793
|
-
type: Div
|
|
1794
|
-
}, ...getFeatureContentHeadingVirtualDom(heading), {
|
|
1795
|
-
childCount,
|
|
1796
|
-
className: 'RuntimeStatusDefinitionList',
|
|
1797
|
-
type: Dl
|
|
1798
|
-
}, ...getStatusVirtualDom(status), ...getActivationTimeVirtualDom(activationTime, importTime)];
|
|
1764
|
+
const removeListener = (emitter, type, callback) => {
|
|
1765
|
+
if ('removeEventListener' in emitter) {
|
|
1766
|
+
emitter.removeEventListener(type, callback);
|
|
1767
|
+
} else {
|
|
1768
|
+
emitter.off(type, callback);
|
|
1769
|
+
}
|
|
1799
1770
|
};
|
|
1800
|
-
|
|
1801
|
-
const getSettingsTableEntry = setting => {
|
|
1771
|
+
const getFirstEvent = (eventEmitter, eventMap) => {
|
|
1802
1772
|
const {
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
} =
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
value: label
|
|
1813
|
-
}];
|
|
1814
|
-
};
|
|
1815
|
-
|
|
1816
|
-
const getSettingsDetails = async extension => {
|
|
1817
|
-
const settings = extension.settings || [];
|
|
1818
|
-
const rows = settings.map(getSettingsTableEntry);
|
|
1819
|
-
return {
|
|
1820
|
-
settings: rows
|
|
1773
|
+
promise,
|
|
1774
|
+
resolve
|
|
1775
|
+
} = Promise.withResolvers();
|
|
1776
|
+
const listenerMap = Object.create(null);
|
|
1777
|
+
const cleanup = value => {
|
|
1778
|
+
for (const event of Object.keys(eventMap)) {
|
|
1779
|
+
removeListener(eventEmitter, event, listenerMap[event]);
|
|
1780
|
+
}
|
|
1781
|
+
resolve(value);
|
|
1821
1782
|
};
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1783
|
+
for (const [event, type] of Object.entries(eventMap)) {
|
|
1784
|
+
const listener = event => {
|
|
1785
|
+
cleanup({
|
|
1786
|
+
event,
|
|
1787
|
+
type
|
|
1788
|
+
});
|
|
1789
|
+
};
|
|
1790
|
+
addListener(eventEmitter, event, listener);
|
|
1791
|
+
listenerMap[event] = listener;
|
|
1827
1792
|
}
|
|
1828
|
-
return
|
|
1793
|
+
return promise;
|
|
1829
1794
|
};
|
|
1830
|
-
|
|
1831
|
-
const
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
}
|
|
1795
|
+
const Message$1 = 3;
|
|
1796
|
+
const create$5$1 = async ({
|
|
1797
|
+
isMessagePortOpen,
|
|
1798
|
+
messagePort
|
|
1799
|
+
}) => {
|
|
1800
|
+
if (!isMessagePort(messagePort)) {
|
|
1801
|
+
throw new IpcError('port must be of type MessagePort');
|
|
1802
|
+
}
|
|
1803
|
+
if (isMessagePortOpen) {
|
|
1804
|
+
return messagePort;
|
|
1805
|
+
}
|
|
1806
|
+
const eventPromise = getFirstEvent(messagePort, {
|
|
1807
|
+
message: Message$1
|
|
1808
|
+
});
|
|
1809
|
+
messagePort.start();
|
|
1810
|
+
const {
|
|
1811
|
+
event,
|
|
1812
|
+
type
|
|
1813
|
+
} = await eventPromise;
|
|
1814
|
+
if (type !== Message$1) {
|
|
1815
|
+
throw new IpcError('Failed to wait for ipc message');
|
|
1816
|
+
}
|
|
1817
|
+
if (event.data !== readyMessage) {
|
|
1818
|
+
throw new IpcError('unexpected first message');
|
|
1819
|
+
}
|
|
1820
|
+
return messagePort;
|
|
1838
1821
|
};
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
const heading = settings();
|
|
1842
|
-
const tableInfo = getSettingsTableEntries(rows);
|
|
1843
|
-
return [{
|
|
1844
|
-
childCount: 2,
|
|
1845
|
-
className: FeatureContent,
|
|
1846
|
-
type: Div
|
|
1847
|
-
}, ...getFeatureContentHeadingVirtualDom(heading), ...getTableVirtualDom(tableInfo)];
|
|
1822
|
+
const signal$1 = messagePort => {
|
|
1823
|
+
messagePort.start();
|
|
1848
1824
|
};
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1825
|
+
class IpcParentWithMessagePort extends Ipc {
|
|
1826
|
+
getData = getData$2;
|
|
1827
|
+
send(message) {
|
|
1828
|
+
this._rawIpc.postMessage(message);
|
|
1829
|
+
}
|
|
1830
|
+
sendAndTransfer(message) {
|
|
1831
|
+
const transfer = getTransferrables(message);
|
|
1832
|
+
this._rawIpc.postMessage(message, transfer);
|
|
1833
|
+
}
|
|
1834
|
+
dispose() {
|
|
1835
|
+
this._rawIpc.close();
|
|
1836
|
+
}
|
|
1837
|
+
onMessage(callback) {
|
|
1838
|
+
this._rawIpc.addEventListener('message', callback);
|
|
1839
|
+
}
|
|
1840
|
+
onClose(callback) {}
|
|
1841
|
+
}
|
|
1842
|
+
const wrap$5 = messagePort => {
|
|
1843
|
+
return new IpcParentWithMessagePort(messagePort);
|
|
1852
1844
|
};
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
const HandleClickSetColorTheme = 5;
|
|
1859
|
-
const HandleClickSettings = 6;
|
|
1860
|
-
const HandleClickSize = 7;
|
|
1861
|
-
const HandleClickUninstall = 8;
|
|
1862
|
-
const HandleFeaturesClick = 9;
|
|
1863
|
-
const HandleIconError = 10;
|
|
1864
|
-
const HandleImageContextMenu = 11;
|
|
1865
|
-
const HandleReadmeContextMenu = 12;
|
|
1866
|
-
const HandleReadmeScroll = 13;
|
|
1867
|
-
const HandleTabsClick = 14;
|
|
1868
|
-
const HandleAdditionalDetailContextMenu = 15;
|
|
1869
|
-
const HandleReadmeClick = 16;
|
|
1870
|
-
const HandleSelectionChange = 17;
|
|
1871
|
-
const HandleTabFocus = 18;
|
|
1872
|
-
const HandleResourceLinkClick = 19;
|
|
1873
|
-
|
|
1874
|
-
const ActivationEvents = 'ActivationEvents';
|
|
1875
|
-
const Changelog = 'Changelog';
|
|
1876
|
-
const Commands = 'Commands';
|
|
1877
|
-
const Details = 'Details';
|
|
1878
|
-
const Enable = 'Enable';
|
|
1879
|
-
const Disable = 'Disable';
|
|
1880
|
-
const Features = 'Features';
|
|
1881
|
-
const JsonValidation = 'JsonValidation';
|
|
1882
|
-
const ProgrammingLanguages = 'ProgrammingLanguages';
|
|
1883
|
-
const RuntimeStatus = 'RuntimeStatus';
|
|
1884
|
-
const ScrollToTop = 'scrolltotop';
|
|
1885
|
-
const SetColorTheme = 'SetColorTheme';
|
|
1886
|
-
const Settings = 'Settings';
|
|
1887
|
-
const Theme = 'Theme';
|
|
1888
|
-
const Uninstall = 'Uninstall';
|
|
1889
|
-
const WebViews = 'WebViews';
|
|
1890
|
-
|
|
1891
|
-
const getScrollToTopVirtualDom = scrollToTopButtonEnabled => {
|
|
1892
|
-
return [{
|
|
1893
|
-
ariaLabel: scrollToTop(),
|
|
1894
|
-
childCount: 1,
|
|
1895
|
-
className: ScrollToTopButton,
|
|
1896
|
-
name: ScrollToTop,
|
|
1897
|
-
onClick: HandleClickScrollToTop,
|
|
1898
|
-
type: Button$1
|
|
1899
|
-
}, {
|
|
1900
|
-
childCount: 0,
|
|
1901
|
-
className: mergeClassNames(MaskIcon, MaskIconChevronUp),
|
|
1902
|
-
role: None$3,
|
|
1903
|
-
type: Div
|
|
1904
|
-
}];
|
|
1845
|
+
const IpcParentWithMessagePort$1 = {
|
|
1846
|
+
__proto__: null,
|
|
1847
|
+
create: create$5$1,
|
|
1848
|
+
signal: signal$1,
|
|
1849
|
+
wrap: wrap$5
|
|
1905
1850
|
};
|
|
1906
1851
|
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
render,
|
|
1912
|
-
set: set$3
|
|
1913
|
-
} = MarkdownWorker;
|
|
1914
|
-
|
|
1915
|
-
const getMarkdownVirtualDom = async (html, options) => {
|
|
1916
|
-
string(html);
|
|
1917
|
-
const dom = await getVirtualDom(html);
|
|
1918
|
-
if (options?.scrollToTopEnabled) {
|
|
1919
|
-
const [firstNode, ...rest] = dom;
|
|
1920
|
-
const extraDom = getScrollToTopVirtualDom();
|
|
1921
|
-
return [{
|
|
1922
|
-
...firstNode,
|
|
1923
|
-
childCount: firstNode.childCount + 1,
|
|
1924
|
-
onClick: HandleReadmeClick,
|
|
1925
|
-
onScroll: HandleReadmeScroll,
|
|
1926
|
-
onSelectionChange: HandleSelectionChange
|
|
1927
|
-
}, ...extraDom, ...rest];
|
|
1852
|
+
class CommandNotFoundError extends Error {
|
|
1853
|
+
constructor(command) {
|
|
1854
|
+
super(`Command not found ${command}`);
|
|
1855
|
+
this.name = 'CommandNotFoundError';
|
|
1928
1856
|
}
|
|
1929
|
-
|
|
1857
|
+
}
|
|
1858
|
+
const commands = Object.create(null);
|
|
1859
|
+
const register = commandMap => {
|
|
1860
|
+
Object.assign(commands, commandMap);
|
|
1930
1861
|
};
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
markdown += `- ${item.label}`;
|
|
1939
|
-
markdown += '\n';
|
|
1940
|
-
}
|
|
1862
|
+
const getCommand = key => {
|
|
1863
|
+
return commands[key];
|
|
1864
|
+
};
|
|
1865
|
+
const execute = (command, ...args) => {
|
|
1866
|
+
const fn = getCommand(command);
|
|
1867
|
+
if (!fn) {
|
|
1868
|
+
throw new CommandNotFoundError(command);
|
|
1941
1869
|
}
|
|
1942
|
-
return
|
|
1870
|
+
return fn(...args);
|
|
1943
1871
|
};
|
|
1944
1872
|
|
|
1945
|
-
const
|
|
1946
|
-
|
|
1947
|
-
|
|
1873
|
+
const Two$1 = '2.0';
|
|
1874
|
+
const callbacks = Object.create(null);
|
|
1875
|
+
const get$3 = id => {
|
|
1876
|
+
return callbacks[id];
|
|
1948
1877
|
};
|
|
1949
|
-
const
|
|
1950
|
-
|
|
1951
|
-
return getThemeItemMarkdown(heading, iconThemes);
|
|
1878
|
+
const remove$1 = id => {
|
|
1879
|
+
delete callbacks[id];
|
|
1952
1880
|
};
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1881
|
+
class JsonRpcError extends Error {
|
|
1882
|
+
constructor(message) {
|
|
1883
|
+
super(message);
|
|
1884
|
+
this.name = 'JsonRpcError';
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
const NewLine = '\n';
|
|
1888
|
+
const DomException = 'DOMException';
|
|
1889
|
+
const ReferenceError$1 = 'ReferenceError';
|
|
1890
|
+
const SyntaxError$1 = 'SyntaxError';
|
|
1891
|
+
const TypeError$1 = 'TypeError';
|
|
1892
|
+
const getErrorConstructor = (message, type) => {
|
|
1893
|
+
if (type) {
|
|
1894
|
+
switch (type) {
|
|
1895
|
+
case DomException:
|
|
1896
|
+
return DOMException;
|
|
1897
|
+
case ReferenceError$1:
|
|
1898
|
+
return ReferenceError;
|
|
1899
|
+
case SyntaxError$1:
|
|
1900
|
+
return SyntaxError;
|
|
1901
|
+
case TypeError$1:
|
|
1902
|
+
return TypeError;
|
|
1903
|
+
default:
|
|
1904
|
+
return Error;
|
|
1905
|
+
}
|
|
1906
|
+
}
|
|
1907
|
+
if (message.startsWith('TypeError: ')) {
|
|
1908
|
+
return TypeError;
|
|
1909
|
+
}
|
|
1910
|
+
if (message.startsWith('SyntaxError: ')) {
|
|
1911
|
+
return SyntaxError;
|
|
1912
|
+
}
|
|
1913
|
+
if (message.startsWith('ReferenceError: ')) {
|
|
1914
|
+
return ReferenceError;
|
|
1915
|
+
}
|
|
1916
|
+
return Error;
|
|
1956
1917
|
};
|
|
1957
|
-
const
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1918
|
+
const constructError = (message, type, name) => {
|
|
1919
|
+
const ErrorConstructor = getErrorConstructor(message, type);
|
|
1920
|
+
if (ErrorConstructor === DOMException && name) {
|
|
1921
|
+
return new ErrorConstructor(message, name);
|
|
1922
|
+
}
|
|
1923
|
+
if (ErrorConstructor === Error) {
|
|
1924
|
+
const error = new Error(message);
|
|
1925
|
+
if (name && name !== 'VError') {
|
|
1926
|
+
error.name = name;
|
|
1927
|
+
}
|
|
1928
|
+
return error;
|
|
1929
|
+
}
|
|
1930
|
+
return new ErrorConstructor(message);
|
|
1963
1931
|
};
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
return bytes.toString(16).padStart(2, '0');
|
|
1932
|
+
const joinLines = lines => {
|
|
1933
|
+
return lines.join(NewLine);
|
|
1967
1934
|
};
|
|
1968
|
-
const
|
|
1969
|
-
|
|
1970
|
-
const digest = await crypto.subtle.digest('SHA-256', sourceBytes);
|
|
1971
|
-
const resultBytes = [...new Uint8Array(digest)];
|
|
1972
|
-
return resultBytes.map(padBytes).join('');
|
|
1935
|
+
const splitLines = lines => {
|
|
1936
|
+
return lines.split(NewLine);
|
|
1973
1937
|
};
|
|
1974
|
-
|
|
1975
|
-
const
|
|
1976
|
-
|
|
1938
|
+
const getCurrentStack = () => {
|
|
1939
|
+
const stackLinesToSkip = 3;
|
|
1940
|
+
const currentStack = joinLines(splitLines(new Error().stack || '').slice(stackLinesToSkip));
|
|
1941
|
+
return currentStack;
|
|
1977
1942
|
};
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
const stringifiedOptions = JSON.stringify(options);
|
|
1981
|
-
const contents = `${markdown}:${stringifiedOptions}:${options.commit}`;
|
|
1982
|
-
return hash(contents);
|
|
1943
|
+
const getNewLineIndex = (string, startIndex = undefined) => {
|
|
1944
|
+
return string.indexOf(NewLine, startIndex);
|
|
1983
1945
|
};
|
|
1984
|
-
const
|
|
1985
|
-
|
|
1986
|
-
if (
|
|
1987
|
-
|
|
1946
|
+
const getParentStack = error => {
|
|
1947
|
+
let parentStack = error.stack || error.data || error.message || '';
|
|
1948
|
+
if (parentStack.startsWith(' at')) {
|
|
1949
|
+
parentStack = error.message + NewLine + parentStack;
|
|
1988
1950
|
}
|
|
1989
|
-
|
|
1990
|
-
return `https://-/markdown/${hash}`;
|
|
1951
|
+
return parentStack;
|
|
1991
1952
|
};
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
const
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
1953
|
+
const MethodNotFound = -32601;
|
|
1954
|
+
const Custom = -32001;
|
|
1955
|
+
const restoreJsonRpcError = error => {
|
|
1956
|
+
const currentStack = getCurrentStack();
|
|
1957
|
+
if (error && error instanceof Error) {
|
|
1958
|
+
if (typeof error.stack === 'string') {
|
|
1959
|
+
error.stack = error.stack + NewLine + currentStack;
|
|
1960
|
+
}
|
|
1961
|
+
return error;
|
|
1962
|
+
}
|
|
1963
|
+
if (error && error.code && error.code === MethodNotFound) {
|
|
1964
|
+
const restoredError = new JsonRpcError(error.message);
|
|
1965
|
+
const parentStack = getParentStack(error);
|
|
1966
|
+
restoredError.stack = parentStack + NewLine + currentStack;
|
|
1967
|
+
return restoredError;
|
|
1968
|
+
}
|
|
1969
|
+
if (error && error.message) {
|
|
1970
|
+
const restoredError = constructError(error.message, error.type, error.name);
|
|
1971
|
+
if (error.data) {
|
|
1972
|
+
if (error.data.stack && error.data.type && error.message) {
|
|
1973
|
+
restoredError.stack = error.data.type + ': ' + error.message + NewLine + error.data.stack + NewLine + currentStack;
|
|
1974
|
+
} else if (error.data.stack) {
|
|
1975
|
+
restoredError.stack = error.data.stack;
|
|
1976
|
+
}
|
|
1977
|
+
if (error.data.codeFrame) {
|
|
1978
|
+
// @ts-ignore
|
|
1979
|
+
restoredError.codeFrame = error.data.codeFrame;
|
|
1980
|
+
}
|
|
1981
|
+
if (error.data.code) {
|
|
1982
|
+
// @ts-ignore
|
|
1983
|
+
restoredError.code = error.data.code;
|
|
1984
|
+
}
|
|
1985
|
+
if (error.data.type) {
|
|
1986
|
+
// @ts-ignore
|
|
1987
|
+
restoredError.name = error.data.type;
|
|
1988
|
+
}
|
|
1989
|
+
} else {
|
|
1990
|
+
if (error.stack) {
|
|
1991
|
+
const lowerStack = restoredError.stack || '';
|
|
1992
|
+
// @ts-ignore
|
|
1993
|
+
const indexNewLine = getNewLineIndex(lowerStack);
|
|
1994
|
+
const parentStack = getParentStack(error);
|
|
1995
|
+
// @ts-ignore
|
|
1996
|
+
restoredError.stack = parentStack + lowerStack.slice(indexNewLine);
|
|
1997
|
+
}
|
|
1998
|
+
if (error.codeFrame) {
|
|
1999
|
+
// @ts-ignore
|
|
2000
|
+
restoredError.codeFrame = error.codeFrame;
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
2003
|
+
return restoredError;
|
|
2004
|
+
}
|
|
2005
|
+
if (typeof error === 'string') {
|
|
2006
|
+
return new Error(`JsonRpc Error: ${error}`);
|
|
2007
|
+
}
|
|
2008
|
+
return new Error(`JsonRpc Error: ${error}`);
|
|
2001
2009
|
};
|
|
2002
|
-
const
|
|
2003
|
-
|
|
2004
|
-
|
|
2010
|
+
const unwrapJsonRpcResult = responseMessage => {
|
|
2011
|
+
if ('error' in responseMessage) {
|
|
2012
|
+
const restoredError = restoreJsonRpcError(responseMessage.error);
|
|
2013
|
+
throw restoredError;
|
|
2014
|
+
}
|
|
2015
|
+
if ('result' in responseMessage) {
|
|
2016
|
+
return responseMessage.result;
|
|
2017
|
+
}
|
|
2018
|
+
throw new JsonRpcError('unexpected response message');
|
|
2005
2019
|
};
|
|
2006
|
-
const
|
|
2007
|
-
|
|
2008
|
-
|
|
2020
|
+
const warn = (...args) => {
|
|
2021
|
+
console.warn(...args);
|
|
2022
|
+
};
|
|
2023
|
+
const resolve = (id, response) => {
|
|
2024
|
+
const fn = get$3(id);
|
|
2025
|
+
if (!fn) {
|
|
2026
|
+
console.log(response);
|
|
2027
|
+
warn(`callback ${id} may already be disposed`);
|
|
2028
|
+
return;
|
|
2029
|
+
}
|
|
2030
|
+
fn(response);
|
|
2031
|
+
remove$1(id);
|
|
2032
|
+
};
|
|
2033
|
+
const E_COMMAND_NOT_FOUND = 'E_COMMAND_NOT_FOUND';
|
|
2034
|
+
const getErrorType = prettyError => {
|
|
2035
|
+
if (prettyError && prettyError.type) {
|
|
2036
|
+
return prettyError.type;
|
|
2037
|
+
}
|
|
2038
|
+
if (prettyError && prettyError.constructor && prettyError.constructor.name) {
|
|
2039
|
+
return prettyError.constructor.name;
|
|
2009
2040
|
}
|
|
2010
|
-
|
|
2011
|
-
// @ts-ignore
|
|
2012
|
-
const bucket = await navigator.storageBuckets.open(bucketName, {
|
|
2013
|
-
expires: Date.now() + twoWeeks,
|
|
2014
|
-
quota: 100 * 1024 * 1024 // 100MB
|
|
2015
|
-
});
|
|
2016
|
-
const cache = await bucket.caches.open(cacheName);
|
|
2017
|
-
return cache;
|
|
2041
|
+
return undefined;
|
|
2018
2042
|
};
|
|
2019
|
-
const
|
|
2020
|
-
|
|
2021
|
-
|
|
2043
|
+
const isAlreadyStack = line => {
|
|
2044
|
+
return line.trim().startsWith('at ');
|
|
2045
|
+
};
|
|
2046
|
+
const getStack = prettyError => {
|
|
2047
|
+
const stackString = prettyError.stack || '';
|
|
2048
|
+
const newLineIndex = stackString.indexOf('\n');
|
|
2049
|
+
if (newLineIndex !== -1 && !isAlreadyStack(stackString.slice(0, newLineIndex))) {
|
|
2050
|
+
return stackString.slice(newLineIndex + 1);
|
|
2022
2051
|
}
|
|
2023
|
-
return
|
|
2052
|
+
return stackString;
|
|
2024
2053
|
};
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2054
|
+
const getErrorProperty = (error, prettyError) => {
|
|
2055
|
+
if (error && error.code === E_COMMAND_NOT_FOUND) {
|
|
2056
|
+
return {
|
|
2057
|
+
code: MethodNotFound,
|
|
2058
|
+
data: error.stack,
|
|
2059
|
+
message: error.message
|
|
2060
|
+
};
|
|
2061
|
+
}
|
|
2062
|
+
return {
|
|
2063
|
+
code: Custom,
|
|
2064
|
+
data: {
|
|
2065
|
+
code: prettyError.code,
|
|
2066
|
+
codeFrame: prettyError.codeFrame,
|
|
2067
|
+
name: prettyError.name,
|
|
2068
|
+
stack: getStack(prettyError),
|
|
2069
|
+
type: getErrorType(prettyError)
|
|
2070
|
+
},
|
|
2071
|
+
message: prettyError.message
|
|
2072
|
+
};
|
|
2032
2073
|
};
|
|
2033
|
-
const
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2074
|
+
const create$1$1 = (id, error) => {
|
|
2075
|
+
return {
|
|
2076
|
+
error,
|
|
2077
|
+
id,
|
|
2078
|
+
jsonrpc: Two$1
|
|
2079
|
+
};
|
|
2038
2080
|
};
|
|
2039
|
-
const
|
|
2040
|
-
const
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
'Content-Type': 'application/markdown'
|
|
2045
|
-
}
|
|
2046
|
-
}));
|
|
2081
|
+
const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
2082
|
+
const prettyError = preparePrettyError(error);
|
|
2083
|
+
logError(error, prettyError);
|
|
2084
|
+
const errorProperty = getErrorProperty(error, prettyError);
|
|
2085
|
+
return create$1$1(id, errorProperty);
|
|
2047
2086
|
};
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
const value = await get$2(cacheKey, bucketName);
|
|
2055
|
-
return value; // TODO validate if it's valid
|
|
2056
|
-
}
|
|
2057
|
-
const html = await render(markdown, options);
|
|
2058
|
-
await set$2(cacheKey, bucketName, html);
|
|
2059
|
-
return html;
|
|
2087
|
+
const create$a = (message, result) => {
|
|
2088
|
+
return {
|
|
2089
|
+
id: message.id,
|
|
2090
|
+
jsonrpc: Two$1,
|
|
2091
|
+
result: result ?? null
|
|
2092
|
+
};
|
|
2060
2093
|
};
|
|
2061
|
-
|
|
2062
|
-
const
|
|
2063
|
-
|
|
2064
|
-
return html;
|
|
2094
|
+
const getSuccessResponse = (message, result) => {
|
|
2095
|
+
const resultProperty = result ?? null;
|
|
2096
|
+
return create$a(message, resultProperty);
|
|
2065
2097
|
};
|
|
2066
|
-
|
|
2067
|
-
const getThemeDetails = async (extension, baseUrl, locationProtocol) => {
|
|
2068
|
-
const {
|
|
2069
|
-
colorThemes,
|
|
2070
|
-
iconThemes,
|
|
2071
|
-
productIconThemes
|
|
2072
|
-
} = extension;
|
|
2073
|
-
const markdown = getThemeMarkdown(colorThemes || [], iconThemes || [], productIconThemes || []);
|
|
2074
|
-
const rendered = await renderMarkdown(markdown, {
|
|
2075
|
-
baseUrl,
|
|
2076
|
-
locationProtocol
|
|
2077
|
-
});
|
|
2078
|
-
const themesMarkdownDom = await getMarkdownVirtualDom(rendered);
|
|
2098
|
+
const getErrorResponseSimple = (id, error) => {
|
|
2079
2099
|
return {
|
|
2080
|
-
|
|
2100
|
+
error: {
|
|
2101
|
+
code: Custom,
|
|
2102
|
+
data: error,
|
|
2103
|
+
// @ts-ignore
|
|
2104
|
+
message: error.message
|
|
2105
|
+
},
|
|
2106
|
+
id,
|
|
2107
|
+
jsonrpc: Two$1
|
|
2081
2108
|
};
|
|
2082
2109
|
};
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
return
|
|
2110
|
+
const getResponse = async (message, ipc, execute, preparePrettyError, logError, requiresSocket) => {
|
|
2111
|
+
try {
|
|
2112
|
+
const result = requiresSocket(message.method) ? await execute(message.method, ipc, ...message.params) : await execute(message.method, ...message.params);
|
|
2113
|
+
return getSuccessResponse(message, result);
|
|
2114
|
+
} catch (error) {
|
|
2115
|
+
if (ipc.canUseSimpleErrorResponse) {
|
|
2116
|
+
return getErrorResponseSimple(message.id, error);
|
|
2117
|
+
}
|
|
2118
|
+
return getErrorResponse(message.id, error, preparePrettyError, logError);
|
|
2087
2119
|
}
|
|
2088
|
-
return Array.isArray(extension.colorThemes);
|
|
2089
2120
|
};
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
if (!hasProperty(extension, 'iconThemes')) {
|
|
2093
|
-
return false;
|
|
2094
|
-
}
|
|
2095
|
-
return Array.isArray(extension.iconThemes);
|
|
2121
|
+
const defaultPreparePrettyError = error => {
|
|
2122
|
+
return error;
|
|
2096
2123
|
};
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
if (!hasProperty(extension, 'productIconThemes')) {
|
|
2100
|
-
return false;
|
|
2101
|
-
}
|
|
2102
|
-
return Array.isArray(extension.productIconThemes);
|
|
2124
|
+
const defaultLogError = () => {
|
|
2125
|
+
// ignore
|
|
2103
2126
|
};
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
return featureColorThemeEnabled(extension) || featureIconThemeEnabled(extension) || featureProductIconThemeEnabled(extension);
|
|
2127
|
+
const defaultRequiresSocket = () => {
|
|
2128
|
+
return false;
|
|
2107
2129
|
};
|
|
2130
|
+
const defaultResolve = resolve;
|
|
2108
2131
|
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2132
|
+
// TODO maybe remove this in v6 or v7, only accept options object to simplify the code
|
|
2133
|
+
const normalizeParams = args => {
|
|
2134
|
+
if (args.length === 1) {
|
|
2135
|
+
const options = args[0];
|
|
2136
|
+
return {
|
|
2137
|
+
execute: options.execute,
|
|
2138
|
+
ipc: options.ipc,
|
|
2139
|
+
logError: options.logError || defaultLogError,
|
|
2140
|
+
message: options.message,
|
|
2141
|
+
preparePrettyError: options.preparePrettyError || defaultPreparePrettyError,
|
|
2142
|
+
requiresSocket: options.requiresSocket || defaultRequiresSocket,
|
|
2143
|
+
resolve: options.resolve || defaultResolve
|
|
2144
|
+
};
|
|
2145
|
+
}
|
|
2146
|
+
return {
|
|
2147
|
+
execute: args[2],
|
|
2148
|
+
ipc: args[0],
|
|
2149
|
+
logError: args[5],
|
|
2150
|
+
message: args[1],
|
|
2151
|
+
preparePrettyError: args[4],
|
|
2152
|
+
requiresSocket: args[6],
|
|
2153
|
+
resolve: args[3]
|
|
2154
|
+
};
|
|
2155
|
+
};
|
|
2156
|
+
const handleJsonRpcMessage = async (...args) => {
|
|
2157
|
+
const options = normalizeParams(args);
|
|
2158
|
+
const {
|
|
2159
|
+
execute,
|
|
2160
|
+
ipc,
|
|
2161
|
+
logError,
|
|
2162
|
+
message,
|
|
2163
|
+
preparePrettyError,
|
|
2164
|
+
requiresSocket,
|
|
2165
|
+
resolve
|
|
2166
|
+
} = options;
|
|
2167
|
+
if ('id' in message) {
|
|
2168
|
+
if ('method' in message) {
|
|
2169
|
+
const response = await getResponse(message, ipc, execute, preparePrettyError, logError, requiresSocket);
|
|
2170
|
+
try {
|
|
2171
|
+
ipc.send(response);
|
|
2172
|
+
} catch (error) {
|
|
2173
|
+
const errorResponse = getErrorResponse(message.id, error, preparePrettyError, logError);
|
|
2174
|
+
ipc.send(errorResponse);
|
|
2175
|
+
}
|
|
2176
|
+
return;
|
|
2116
2177
|
}
|
|
2117
|
-
|
|
2178
|
+
resolve(message.id, message);
|
|
2179
|
+
return;
|
|
2118
2180
|
}
|
|
2119
|
-
|
|
2181
|
+
if ('method' in message) {
|
|
2182
|
+
await getResponse(message, ipc, execute, preparePrettyError, logError, requiresSocket);
|
|
2183
|
+
return;
|
|
2184
|
+
}
|
|
2185
|
+
throw new JsonRpcError('unexpected message');
|
|
2120
2186
|
};
|
|
2121
2187
|
|
|
2122
|
-
const
|
|
2123
|
-
const childCount = getVirtualDomChildCount(themesDom);
|
|
2124
|
-
const heading = theme();
|
|
2125
|
-
return [{
|
|
2126
|
-
childCount: 2,
|
|
2127
|
-
className: FeatureContent,
|
|
2128
|
-
type: Div
|
|
2129
|
-
}, ...getFeatureContentHeadingVirtualDom(heading), {
|
|
2130
|
-
childCount,
|
|
2131
|
-
className: DefaultMarkdown,
|
|
2132
|
-
type: Div
|
|
2133
|
-
}, ...themesDom];
|
|
2134
|
-
};
|
|
2188
|
+
const Two = '2.0';
|
|
2135
2189
|
|
|
2136
|
-
const
|
|
2137
|
-
return
|
|
2190
|
+
const create$9 = (method, params) => {
|
|
2191
|
+
return {
|
|
2192
|
+
jsonrpc: Two,
|
|
2193
|
+
method,
|
|
2194
|
+
params
|
|
2195
|
+
};
|
|
2138
2196
|
};
|
|
2139
2197
|
|
|
2140
|
-
const
|
|
2141
|
-
const {
|
|
2142
|
-
contentSecurityPolicy,
|
|
2143
|
-
elements,
|
|
2144
|
-
id,
|
|
2145
|
-
selector
|
|
2146
|
-
} = rawWebView;
|
|
2147
|
-
return {
|
|
2148
|
-
contentSecurityPolicyString: JSON.stringify(contentSecurityPolicy),
|
|
2149
|
-
elementsString: JSON.stringify(elements, null, 2),
|
|
2198
|
+
const create$8 = (id, method, params) => {
|
|
2199
|
+
const message = {
|
|
2150
2200
|
id,
|
|
2151
|
-
|
|
2201
|
+
jsonrpc: Two,
|
|
2202
|
+
method,
|
|
2203
|
+
params
|
|
2152
2204
|
};
|
|
2205
|
+
return message;
|
|
2153
2206
|
};
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
return
|
|
2207
|
+
|
|
2208
|
+
let id = 0;
|
|
2209
|
+
const create$7 = () => {
|
|
2210
|
+
return ++id;
|
|
2158
2211
|
};
|
|
2159
2212
|
|
|
2160
|
-
const
|
|
2161
|
-
const
|
|
2213
|
+
const registerPromise = map => {
|
|
2214
|
+
const id = create$7();
|
|
2215
|
+
const {
|
|
2216
|
+
promise,
|
|
2217
|
+
resolve
|
|
2218
|
+
} = Promise.withResolvers();
|
|
2219
|
+
map[id] = resolve;
|
|
2162
2220
|
return {
|
|
2163
|
-
|
|
2221
|
+
id,
|
|
2222
|
+
promise
|
|
2164
2223
|
};
|
|
2165
2224
|
};
|
|
2166
2225
|
|
|
2167
|
-
const
|
|
2168
|
-
|
|
2169
|
-
|
|
2226
|
+
const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer) => {
|
|
2227
|
+
const {
|
|
2228
|
+
id,
|
|
2229
|
+
promise
|
|
2230
|
+
} = registerPromise(callbacks);
|
|
2231
|
+
const message = create$8(id, method, params);
|
|
2232
|
+
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
2233
|
+
ipc.sendAndTransfer(message);
|
|
2234
|
+
} else {
|
|
2235
|
+
ipc.send(message);
|
|
2170
2236
|
}
|
|
2171
|
-
|
|
2237
|
+
const responseMessage = await promise;
|
|
2238
|
+
return unwrapJsonRpcResult(responseMessage);
|
|
2239
|
+
};
|
|
2240
|
+
const createRpc$1 = ipc => {
|
|
2241
|
+
const callbacks = Object.create(null);
|
|
2242
|
+
ipc._resolve = (id, response) => {
|
|
2243
|
+
const fn = callbacks[id];
|
|
2244
|
+
if (!fn) {
|
|
2245
|
+
console.warn(`callback ${id} may already be disposed`);
|
|
2246
|
+
return;
|
|
2247
|
+
}
|
|
2248
|
+
fn(response);
|
|
2249
|
+
delete callbacks[id];
|
|
2250
|
+
};
|
|
2251
|
+
const rpc = {
|
|
2252
|
+
async dispose() {
|
|
2253
|
+
await ipc?.dispose();
|
|
2254
|
+
},
|
|
2255
|
+
invoke(method, ...params) {
|
|
2256
|
+
return invokeHelper(callbacks, ipc, method, params, false);
|
|
2257
|
+
},
|
|
2258
|
+
invokeAndTransfer(method, ...params) {
|
|
2259
|
+
return invokeHelper(callbacks, ipc, method, params, true);
|
|
2260
|
+
},
|
|
2261
|
+
// @ts-ignore
|
|
2262
|
+
ipc,
|
|
2263
|
+
/**
|
|
2264
|
+
* @deprecated
|
|
2265
|
+
*/
|
|
2266
|
+
send(method, ...params) {
|
|
2267
|
+
const message = create$9(method, params);
|
|
2268
|
+
ipc.send(message);
|
|
2269
|
+
}
|
|
2270
|
+
};
|
|
2271
|
+
return rpc;
|
|
2172
2272
|
};
|
|
2173
2273
|
|
|
2174
|
-
const
|
|
2175
|
-
|
|
2176
|
-
className: DefinitionListItemHeading,
|
|
2177
|
-
type: H2
|
|
2274
|
+
const requiresSocket = () => {
|
|
2275
|
+
return false;
|
|
2178
2276
|
};
|
|
2179
|
-
const
|
|
2180
|
-
|
|
2181
|
-
className: DefinitionListItemValue,
|
|
2182
|
-
type: Pre
|
|
2277
|
+
const preparePrettyError = error => {
|
|
2278
|
+
return error;
|
|
2183
2279
|
};
|
|
2184
|
-
const
|
|
2185
|
-
|
|
2186
|
-
className: DefinitionListItem,
|
|
2187
|
-
type: Div
|
|
2280
|
+
const logError = () => {
|
|
2281
|
+
// handled by renderer worker
|
|
2188
2282
|
};
|
|
2189
|
-
const
|
|
2190
|
-
const
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
id,
|
|
2194
|
-
selectorString
|
|
2195
|
-
} = webView;
|
|
2196
|
-
const textId = id$1();
|
|
2197
|
-
const textSelector = selector();
|
|
2198
|
-
const textContentSecurityPolicy = contentSecurityPolicy();
|
|
2199
|
-
const textElements = elements();
|
|
2200
|
-
return [{
|
|
2201
|
-
childCount: 4,
|
|
2202
|
-
className: FeatureWebView,
|
|
2203
|
-
type: Div
|
|
2204
|
-
}, item, heading, text(textId), pre, text(id), item, heading, text(textSelector), pre, text(selectorString), item, heading, text(textContentSecurityPolicy), pre, text(contentSecurityPolicyString), item, heading, text(textElements), pre, text(elementsString)];
|
|
2283
|
+
const handleMessage = event => {
|
|
2284
|
+
const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket;
|
|
2285
|
+
const actualExecute = event?.target?.execute || execute;
|
|
2286
|
+
return handleJsonRpcMessage(event.target, event.data, actualExecute, event.target._resolve, preparePrettyError, logError, actualRequiresSocket);
|
|
2205
2287
|
};
|
|
2206
2288
|
|
|
2207
|
-
const
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
}
|
|
2214
|
-
childCount: webViews$1.length,
|
|
2215
|
-
type: Div
|
|
2216
|
-
}, ...webViews$1.flatMap(getWebViewVirtualDom)];
|
|
2289
|
+
const handleIpc = ipc => {
|
|
2290
|
+
if ('addEventListener' in ipc) {
|
|
2291
|
+
ipc.addEventListener('message', handleMessage);
|
|
2292
|
+
} else if ('on' in ipc) {
|
|
2293
|
+
// deprecated
|
|
2294
|
+
ipc.on('message', handleMessage);
|
|
2295
|
+
}
|
|
2217
2296
|
};
|
|
2218
2297
|
|
|
2219
|
-
const
|
|
2220
|
-
|
|
2298
|
+
const listen$1 = async (module, options) => {
|
|
2299
|
+
const rawIpc = await module.listen(options);
|
|
2300
|
+
if (module.signal) {
|
|
2301
|
+
module.signal(rawIpc);
|
|
2302
|
+
}
|
|
2303
|
+
const ipc = module.wrap(rawIpc);
|
|
2304
|
+
return ipc;
|
|
2221
2305
|
};
|
|
2222
2306
|
|
|
2223
|
-
const
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
getLabel: commands$1,
|
|
2234
|
-
getVirtualDom: getCommandsVirtualDom,
|
|
2235
|
-
id: Commands,
|
|
2236
|
-
isEnabled: featureCommandsEnabled
|
|
2237
|
-
});
|
|
2238
|
-
register$1({
|
|
2239
|
-
getDetails: getSettingsDetails,
|
|
2240
|
-
getLabel: settings,
|
|
2241
|
-
getVirtualDom: getSettingsVirtualDom,
|
|
2242
|
-
id: Settings,
|
|
2243
|
-
isEnabled: featureSettingsEnabled
|
|
2244
|
-
});
|
|
2245
|
-
register$1({
|
|
2246
|
-
getDetails: getJsonValidationDetails,
|
|
2247
|
-
getLabel: jsonValidation,
|
|
2248
|
-
getVirtualDom: getJsonValidationVirtualDom,
|
|
2249
|
-
id: JsonValidation,
|
|
2250
|
-
isEnabled: featureJsonValidationEnabled
|
|
2251
|
-
});
|
|
2252
|
-
register$1({
|
|
2253
|
-
getDetails: getFeatureDetailsProgrammingLanguages,
|
|
2254
|
-
getLabel: programmingLanguages,
|
|
2255
|
-
getVirtualDom: getProgrammingLanguagesVirtualDom,
|
|
2256
|
-
id: ProgrammingLanguages,
|
|
2257
|
-
isEnabled: featureProgrammingLanguagesEnabled
|
|
2258
|
-
});
|
|
2259
|
-
register$1({
|
|
2260
|
-
getDetails: getWebViewsDetails,
|
|
2261
|
-
getLabel: webViews,
|
|
2262
|
-
getVirtualDom: getWebViewsVirtualDom,
|
|
2263
|
-
id: WebViews,
|
|
2264
|
-
isEnabled: featureWebViewsEnabled
|
|
2265
|
-
});
|
|
2266
|
-
register$1({
|
|
2267
|
-
getDetails: getActivationEventsDetails,
|
|
2268
|
-
getLabel: activationEvents,
|
|
2269
|
-
getVirtualDom: getActivationEventsVirtualDom,
|
|
2270
|
-
id: ActivationEvents,
|
|
2271
|
-
isEnabled: featureActivationEventsEnabled
|
|
2272
|
-
});
|
|
2273
|
-
register$1({
|
|
2274
|
-
getDetails: getRuntimeStatusDetails,
|
|
2275
|
-
getLabel: runtimeStatus,
|
|
2276
|
-
getVirtualDom: getRuntimeStatusVirtualDom,
|
|
2277
|
-
id: RuntimeStatus,
|
|
2278
|
-
isEnabled: featureRuntimeStatusEnabled
|
|
2307
|
+
const create$6 = async ({
|
|
2308
|
+
commandMap,
|
|
2309
|
+
isMessagePortOpen = true,
|
|
2310
|
+
messagePort
|
|
2311
|
+
}) => {
|
|
2312
|
+
// TODO create a commandMap per rpc instance
|
|
2313
|
+
register(commandMap);
|
|
2314
|
+
const rawIpc = await IpcParentWithMessagePort$1.create({
|
|
2315
|
+
isMessagePortOpen,
|
|
2316
|
+
messagePort
|
|
2279
2317
|
});
|
|
2318
|
+
const ipc = IpcParentWithMessagePort$1.wrap(rawIpc);
|
|
2319
|
+
handleIpc(ipc);
|
|
2320
|
+
const rpc = createRpc$1(ipc);
|
|
2321
|
+
messagePort.start();
|
|
2322
|
+
return rpc;
|
|
2280
2323
|
};
|
|
2281
2324
|
|
|
2282
|
-
const
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
};
|
|
2291
|
-
|
|
2292
|
-
return
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
};
|
|
2297
|
-
const transferrables = [isMessagePort, isMessagePortMain, isOffscreenCanvas, isSocket];
|
|
2298
|
-
const isTransferrable = value => {
|
|
2299
|
-
for (const fn of transferrables) {
|
|
2300
|
-
if (fn(value)) {
|
|
2301
|
-
return true;
|
|
2302
|
-
}
|
|
2303
|
-
}
|
|
2304
|
-
return false;
|
|
2325
|
+
const create$5 = async ({
|
|
2326
|
+
commandMap,
|
|
2327
|
+
isMessagePortOpen,
|
|
2328
|
+
send
|
|
2329
|
+
}) => {
|
|
2330
|
+
const {
|
|
2331
|
+
port1,
|
|
2332
|
+
port2
|
|
2333
|
+
} = new MessageChannel();
|
|
2334
|
+
await send(port1);
|
|
2335
|
+
return create$6({
|
|
2336
|
+
commandMap,
|
|
2337
|
+
isMessagePortOpen,
|
|
2338
|
+
messagePort: port2
|
|
2339
|
+
});
|
|
2305
2340
|
};
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
return;
|
|
2313
|
-
}
|
|
2314
|
-
if (Array.isArray(value)) {
|
|
2315
|
-
for (const item of value) {
|
|
2316
|
-
walkValue(item, transferrables, isTransferrable);
|
|
2341
|
+
|
|
2342
|
+
const createSharedLazyRpc = factory => {
|
|
2343
|
+
let rpcPromise;
|
|
2344
|
+
const getOrCreate = () => {
|
|
2345
|
+
if (!rpcPromise) {
|
|
2346
|
+
rpcPromise = factory();
|
|
2317
2347
|
}
|
|
2318
|
-
return;
|
|
2319
|
-
}
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2348
|
+
return rpcPromise;
|
|
2349
|
+
};
|
|
2350
|
+
return {
|
|
2351
|
+
async dispose() {
|
|
2352
|
+
const rpc = await getOrCreate();
|
|
2353
|
+
await rpc.dispose();
|
|
2354
|
+
},
|
|
2355
|
+
async invoke(method, ...params) {
|
|
2356
|
+
const rpc = await getOrCreate();
|
|
2357
|
+
return rpc.invoke(method, ...params);
|
|
2358
|
+
},
|
|
2359
|
+
async invokeAndTransfer(method, ...params) {
|
|
2360
|
+
const rpc = await getOrCreate();
|
|
2361
|
+
return rpc.invokeAndTransfer(method, ...params);
|
|
2362
|
+
},
|
|
2363
|
+
async send(method, ...params) {
|
|
2364
|
+
const rpc = await getOrCreate();
|
|
2365
|
+
rpc.send(method, ...params);
|
|
2323
2366
|
}
|
|
2324
|
-
|
|
2325
|
-
}
|
|
2367
|
+
};
|
|
2326
2368
|
};
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2369
|
+
|
|
2370
|
+
const create$4 = async ({
|
|
2371
|
+
commandMap,
|
|
2372
|
+
isMessagePortOpen,
|
|
2373
|
+
send
|
|
2374
|
+
}) => {
|
|
2375
|
+
return createSharedLazyRpc(() => {
|
|
2376
|
+
return create$5({
|
|
2377
|
+
commandMap,
|
|
2378
|
+
isMessagePortOpen,
|
|
2379
|
+
send
|
|
2380
|
+
});
|
|
2381
|
+
});
|
|
2331
2382
|
};
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2383
|
+
|
|
2384
|
+
const create$3 = async ({
|
|
2385
|
+
commandMap
|
|
2386
|
+
}) => {
|
|
2387
|
+
// TODO create a commandMap per rpc instance
|
|
2388
|
+
register(commandMap);
|
|
2389
|
+
const ipc = await listen$1(IpcChildWithModuleWorkerAndMessagePort$1);
|
|
2390
|
+
handleIpc(ipc);
|
|
2391
|
+
const rpc = createRpc$1(ipc);
|
|
2392
|
+
return rpc;
|
|
2393
|
+
};
|
|
2394
|
+
|
|
2395
|
+
const createMockRpc = ({
|
|
2396
|
+
commandMap
|
|
2397
|
+
}) => {
|
|
2398
|
+
const invocations = [];
|
|
2399
|
+
const invoke = (method, ...params) => {
|
|
2400
|
+
invocations.push([method, ...params]);
|
|
2401
|
+
const command = commandMap[method];
|
|
2402
|
+
if (!command) {
|
|
2403
|
+
throw new Error(`command ${method} not found`);
|
|
2404
|
+
}
|
|
2405
|
+
return command(...params);
|
|
2338
2406
|
};
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2407
|
+
const mockRpc = {
|
|
2408
|
+
invocations,
|
|
2409
|
+
invoke,
|
|
2410
|
+
invokeAndTransfer: invoke
|
|
2342
2411
|
};
|
|
2343
|
-
|
|
2412
|
+
return mockRpc;
|
|
2344
2413
|
};
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
attachEvents(this);
|
|
2350
|
-
}
|
|
2351
|
-
}
|
|
2352
|
-
const E_INCOMPATIBLE_NATIVE_MODULE = 'E_INCOMPATIBLE_NATIVE_MODULE';
|
|
2353
|
-
const E_MODULES_NOT_SUPPORTED_IN_ELECTRON = 'E_MODULES_NOT_SUPPORTED_IN_ELECTRON';
|
|
2354
|
-
const ERR_MODULE_NOT_FOUND = 'ERR_MODULE_NOT_FOUND';
|
|
2355
|
-
const NewLine$1 = '\n';
|
|
2356
|
-
const joinLines$1 = lines => {
|
|
2357
|
-
return lines.join(NewLine$1);
|
|
2414
|
+
|
|
2415
|
+
const rpcs = Object.create(null);
|
|
2416
|
+
const set$b = (id, rpc) => {
|
|
2417
|
+
rpcs[id] = rpc;
|
|
2358
2418
|
};
|
|
2359
|
-
const
|
|
2360
|
-
|
|
2361
|
-
const isNormalStackLine = line => {
|
|
2362
|
-
return RE_AT.test(line) && !RE_AT_PROMISE_INDEX.test(line);
|
|
2419
|
+
const get$2 = id => {
|
|
2420
|
+
return rpcs[id];
|
|
2363
2421
|
};
|
|
2364
|
-
const
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
};
|
|
2371
|
-
}
|
|
2372
|
-
let lastIndex = index - 1;
|
|
2373
|
-
while (++lastIndex < lines.length) {
|
|
2374
|
-
if (!isNormalStackLine(lines[lastIndex])) {
|
|
2375
|
-
break;
|
|
2376
|
-
}
|
|
2377
|
-
}
|
|
2422
|
+
const remove = id => {
|
|
2423
|
+
delete rpcs[id];
|
|
2424
|
+
};
|
|
2425
|
+
|
|
2426
|
+
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
2427
|
+
const create$2 = rpcId => {
|
|
2378
2428
|
return {
|
|
2379
|
-
|
|
2380
|
-
|
|
2429
|
+
async dispose() {
|
|
2430
|
+
const rpc = get$2(rpcId);
|
|
2431
|
+
await rpc.dispose();
|
|
2432
|
+
},
|
|
2433
|
+
// @ts-ignore
|
|
2434
|
+
invoke(method, ...params) {
|
|
2435
|
+
const rpc = get$2(rpcId);
|
|
2436
|
+
// @ts-ignore
|
|
2437
|
+
return rpc.invoke(method, ...params);
|
|
2438
|
+
},
|
|
2439
|
+
// @ts-ignore
|
|
2440
|
+
invokeAndTransfer(method, ...params) {
|
|
2441
|
+
const rpc = get$2(rpcId);
|
|
2442
|
+
// @ts-ignore
|
|
2443
|
+
return rpc.invokeAndTransfer(method, ...params);
|
|
2444
|
+
},
|
|
2445
|
+
registerMockRpc(commandMap) {
|
|
2446
|
+
const mockRpc = createMockRpc({
|
|
2447
|
+
commandMap
|
|
2448
|
+
});
|
|
2449
|
+
set$b(rpcId, mockRpc);
|
|
2450
|
+
// @ts-ignore
|
|
2451
|
+
mockRpc[Symbol.dispose] = () => {
|
|
2452
|
+
remove(rpcId);
|
|
2453
|
+
};
|
|
2454
|
+
// @ts-ignore
|
|
2455
|
+
return mockRpc;
|
|
2456
|
+
},
|
|
2457
|
+
set(rpc) {
|
|
2458
|
+
set$b(rpcId, rpc);
|
|
2459
|
+
}
|
|
2381
2460
|
};
|
|
2382
2461
|
};
|
|
2383
|
-
|
|
2384
|
-
|
|
2462
|
+
|
|
2463
|
+
const {
|
|
2464
|
+
set: set$a
|
|
2465
|
+
} = create$2(ClipBoardWorker);
|
|
2466
|
+
|
|
2467
|
+
const {
|
|
2468
|
+
invoke: invoke$5,
|
|
2469
|
+
set: set$9
|
|
2470
|
+
} = create$2(ExtensionHostWorker);
|
|
2471
|
+
const getRuntimeStatus$2 = async extensionId => {
|
|
2472
|
+
// @ts-ignore
|
|
2473
|
+
return invoke$5('ExtensionHost.getRuntimeStatus', extensionId);
|
|
2385
2474
|
};
|
|
2386
|
-
|
|
2387
|
-
const
|
|
2388
|
-
|
|
2389
|
-
|
|
2475
|
+
|
|
2476
|
+
const ExtensionHost = {
|
|
2477
|
+
__proto__: null,
|
|
2478
|
+
getRuntimeStatus: getRuntimeStatus$2,
|
|
2479
|
+
invoke: invoke$5,
|
|
2480
|
+
set: set$9
|
|
2390
2481
|
};
|
|
2391
|
-
|
|
2392
|
-
|
|
2482
|
+
|
|
2483
|
+
const {
|
|
2484
|
+
invoke: invoke$4,
|
|
2485
|
+
set: set$8
|
|
2486
|
+
} = create$2(ExtensionManagementWorker);
|
|
2487
|
+
const enable2 = (id, platform) => {
|
|
2488
|
+
return invoke$4(`Extensions.enable2`, id, platform);
|
|
2393
2489
|
};
|
|
2394
|
-
const
|
|
2395
|
-
|
|
2396
|
-
const startIndex = lines.findIndex(isMessageCodeBlockStartIndex);
|
|
2397
|
-
const endIndex = startIndex + lines.slice(startIndex).findIndex(isMessageCodeBlockEndIndex, startIndex);
|
|
2398
|
-
const relevantLines = lines.slice(startIndex, endIndex);
|
|
2399
|
-
const relevantMessage = relevantLines.join(' ').slice('Error: '.length);
|
|
2400
|
-
return relevantMessage;
|
|
2490
|
+
const disable2 = (id, platform) => {
|
|
2491
|
+
return invoke$4(`Extensions.disable2`, id, platform);
|
|
2401
2492
|
};
|
|
2402
|
-
|
|
2403
|
-
|
|
2493
|
+
|
|
2494
|
+
const {
|
|
2495
|
+
invoke: invoke$3,
|
|
2496
|
+
set: set$7
|
|
2497
|
+
} = create$2(FileSystemWorker$1);
|
|
2498
|
+
const readFile$2 = async uri => {
|
|
2499
|
+
return invoke$3('FileSystem.readFile', uri);
|
|
2404
2500
|
};
|
|
2405
|
-
const
|
|
2406
|
-
|
|
2407
|
-
const messageIndex = lines.findIndex(isModuleNotFoundMessage);
|
|
2408
|
-
const message = lines[messageIndex];
|
|
2409
|
-
return {
|
|
2410
|
-
code: ERR_MODULE_NOT_FOUND,
|
|
2411
|
-
message
|
|
2412
|
-
};
|
|
2501
|
+
const exists$1 = async uri => {
|
|
2502
|
+
return invoke$3('FileSystem.exists', uri);
|
|
2413
2503
|
};
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2504
|
+
|
|
2505
|
+
const FileSystemWorker = {
|
|
2506
|
+
__proto__: null,
|
|
2507
|
+
exists: exists$1,
|
|
2508
|
+
invoke: invoke$3,
|
|
2509
|
+
readFile: readFile$2,
|
|
2510
|
+
set: set$7
|
|
2419
2511
|
};
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2512
|
+
|
|
2513
|
+
const {
|
|
2514
|
+
invoke: invoke$2,
|
|
2515
|
+
set: set$6
|
|
2516
|
+
} = create$2(MarkdownWorker$1);
|
|
2517
|
+
const getVirtualDom$1 = async html => {
|
|
2518
|
+
// @ts-ignore
|
|
2519
|
+
return invoke$2('Markdown.getVirtualDom', html);
|
|
2425
2520
|
};
|
|
2426
|
-
const
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
return RE_NATIVE_MODULE_ERROR.test(stderr) && RE_NATIVE_MODULE_ERROR_2.test(stderr);
|
|
2521
|
+
const render$1 = async (markdown, options) => {
|
|
2522
|
+
// @ts-ignore
|
|
2523
|
+
return invoke$2('Markdown.render', markdown, options);
|
|
2430
2524
|
};
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2525
|
+
|
|
2526
|
+
const MarkdownWorker = {
|
|
2527
|
+
__proto__: null,
|
|
2528
|
+
getVirtualDom: getVirtualDom$1,
|
|
2529
|
+
invoke: invoke$2,
|
|
2530
|
+
render: render$1,
|
|
2531
|
+
set: set$6
|
|
2437
2532
|
};
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2533
|
+
|
|
2534
|
+
const {
|
|
2535
|
+
invoke: invoke$1,
|
|
2536
|
+
invokeAndTransfer,
|
|
2537
|
+
set: set$5
|
|
2538
|
+
} = create$2(RendererWorker);
|
|
2539
|
+
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
2540
|
+
number(uid);
|
|
2541
|
+
number(menuId);
|
|
2542
|
+
number(x);
|
|
2543
|
+
number(y);
|
|
2544
|
+
await invoke$1('ContextMenu.show2', uid, menuId, x, y, args);
|
|
2545
|
+
};
|
|
2546
|
+
const setColorTheme$1 = async id => {
|
|
2547
|
+
return invoke$1(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
|
|
2443
2548
|
};
|
|
2444
|
-
const
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
}
|
|
2448
|
-
if (isModulesSyntaxError(stderr)) {
|
|
2449
|
-
return getModuleSyntaxError();
|
|
2450
|
-
}
|
|
2451
|
-
if (isModuleNotFoundError(stderr)) {
|
|
2452
|
-
return getModuleNotFoundError(stderr);
|
|
2453
|
-
}
|
|
2454
|
-
const lines = splitLines$1(stderr);
|
|
2455
|
-
const {
|
|
2456
|
-
actualMessage,
|
|
2457
|
-
rest
|
|
2458
|
-
} = getDetails(lines);
|
|
2459
|
-
return {
|
|
2460
|
-
code: '',
|
|
2461
|
-
message: actualMessage,
|
|
2462
|
-
stack: rest
|
|
2463
|
-
};
|
|
2549
|
+
const sendMessagePortToClipBoardWorker = async (port, rpcId) => {
|
|
2550
|
+
const command = 'ClipBoard.handleMessagePort';
|
|
2551
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToClipBoardWorker', port, command, rpcId);
|
|
2464
2552
|
};
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
if (stdout || stderr) {
|
|
2469
|
-
// @ts-ignore
|
|
2470
|
-
const {
|
|
2471
|
-
code,
|
|
2472
|
-
message,
|
|
2473
|
-
stack
|
|
2474
|
-
} = getHelpfulChildProcessError(stdout, stderr);
|
|
2475
|
-
const cause = new Error(message);
|
|
2476
|
-
// @ts-ignore
|
|
2477
|
-
cause.code = code;
|
|
2478
|
-
cause.stack = stack;
|
|
2479
|
-
super(cause, betterMessage);
|
|
2480
|
-
} else {
|
|
2481
|
-
super(betterMessage);
|
|
2482
|
-
}
|
|
2483
|
-
// @ts-ignore
|
|
2484
|
-
this.name = 'IpcError';
|
|
2485
|
-
// @ts-ignore
|
|
2486
|
-
this.stdout = stdout;
|
|
2487
|
-
// @ts-ignore
|
|
2488
|
-
this.stderr = stderr;
|
|
2489
|
-
}
|
|
2490
|
-
}
|
|
2491
|
-
const readyMessage = 'ready';
|
|
2492
|
-
const getData$2 = event => {
|
|
2493
|
-
return event.data;
|
|
2553
|
+
const sendMessagePortToMarkdownWorker$1 = async (port, rpcId) => {
|
|
2554
|
+
const command = 'Markdown.handleMessagePort';
|
|
2555
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToMarkdownWorker', port, command, rpcId);
|
|
2494
2556
|
};
|
|
2495
|
-
const
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
throw new TypeError('module is not in web worker scope');
|
|
2499
|
-
}
|
|
2500
|
-
return globalThis;
|
|
2557
|
+
const sendMessagePortToFileSystemWorker$1 = async (port, rpcId) => {
|
|
2558
|
+
const command = 'FileSystem.handleMessagePort';
|
|
2559
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
|
|
2501
2560
|
};
|
|
2502
|
-
const
|
|
2503
|
-
|
|
2561
|
+
const sendMessagePortToExtensionHostWorker$1 = async (port, rpcId = 0) => {
|
|
2562
|
+
const command = 'HandleMessagePort.handleMessagePort2';
|
|
2563
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
|
|
2504
2564
|
};
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
}
|
|
2509
|
-
send(message) {
|
|
2510
|
-
// @ts-ignore
|
|
2511
|
-
this._rawIpc.postMessage(message);
|
|
2512
|
-
}
|
|
2513
|
-
sendAndTransfer(message) {
|
|
2514
|
-
const transfer = getTransferrables(message);
|
|
2515
|
-
// @ts-ignore
|
|
2516
|
-
this._rawIpc.postMessage(message, transfer);
|
|
2517
|
-
}
|
|
2518
|
-
dispose() {
|
|
2519
|
-
// ignore
|
|
2520
|
-
}
|
|
2521
|
-
onClose(callback) {
|
|
2522
|
-
// ignore
|
|
2523
|
-
}
|
|
2524
|
-
onMessage(callback) {
|
|
2525
|
-
this._rawIpc.addEventListener('message', callback);
|
|
2526
|
-
}
|
|
2527
|
-
}
|
|
2528
|
-
const wrap$f = global => {
|
|
2529
|
-
return new IpcChildWithModuleWorker(global);
|
|
2565
|
+
const confirm = async (message, options) => {
|
|
2566
|
+
const result = await invoke$1('ConfirmPrompt.prompt', message, options);
|
|
2567
|
+
return result;
|
|
2530
2568
|
};
|
|
2531
|
-
const
|
|
2532
|
-
|
|
2533
|
-
promise,
|
|
2534
|
-
resolve
|
|
2535
|
-
} = Promise.withResolvers();
|
|
2536
|
-
port.addEventListener('message', resolve, {
|
|
2537
|
-
once: true
|
|
2538
|
-
});
|
|
2539
|
-
const event = await promise;
|
|
2540
|
-
// @ts-ignore
|
|
2541
|
-
return event.data;
|
|
2569
|
+
const writeClipBoardText = async text => {
|
|
2570
|
+
await invoke$1('ClipBoard.writeText', /* text */text);
|
|
2542
2571
|
};
|
|
2543
|
-
const
|
|
2544
|
-
|
|
2545
|
-
signal$8(parentIpcRaw);
|
|
2546
|
-
const parentIpc = wrap$f(parentIpcRaw);
|
|
2547
|
-
const firstMessage = await waitForFirstMessage(parentIpc);
|
|
2548
|
-
if (firstMessage.method !== 'initialize') {
|
|
2549
|
-
throw new IpcError('unexpected first message');
|
|
2550
|
-
}
|
|
2551
|
-
const type = firstMessage.params[0];
|
|
2552
|
-
if (type === 'message-port') {
|
|
2553
|
-
parentIpc.send({
|
|
2554
|
-
id: firstMessage.id,
|
|
2555
|
-
jsonrpc: '2.0',
|
|
2556
|
-
result: null
|
|
2557
|
-
});
|
|
2558
|
-
parentIpc.dispose();
|
|
2559
|
-
const port = firstMessage.params[1];
|
|
2560
|
-
return port;
|
|
2561
|
-
}
|
|
2562
|
-
return globalThis;
|
|
2572
|
+
const writeClipBoardImage = async blob => {
|
|
2573
|
+
await invoke$1('ClipBoard.writeImage', /* text */blob);
|
|
2563
2574
|
};
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
}
|
|
2568
|
-
send(message) {
|
|
2569
|
-
this._rawIpc.postMessage(message);
|
|
2570
|
-
}
|
|
2571
|
-
sendAndTransfer(message) {
|
|
2572
|
-
const transfer = getTransferrables(message);
|
|
2573
|
-
this._rawIpc.postMessage(message, transfer);
|
|
2574
|
-
}
|
|
2575
|
-
dispose() {
|
|
2576
|
-
if (this._rawIpc.close) {
|
|
2577
|
-
this._rawIpc.close();
|
|
2578
|
-
}
|
|
2579
|
-
}
|
|
2580
|
-
onClose(callback) {
|
|
2581
|
-
// ignore
|
|
2582
|
-
}
|
|
2583
|
-
onMessage(callback) {
|
|
2584
|
-
this._rawIpc.addEventListener('message', callback);
|
|
2585
|
-
this._rawIpc.start();
|
|
2586
|
-
}
|
|
2587
|
-
}
|
|
2588
|
-
const wrap$e = port => {
|
|
2589
|
-
return new IpcChildWithModuleWorkerAndMessagePort(port);
|
|
2575
|
+
const sendMessagePortToExtensionManagementWorker = async (port, rpcId) => {
|
|
2576
|
+
const command = 'Extensions.handleMessagePort';
|
|
2577
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionManagementWorker', port, command, rpcId);
|
|
2590
2578
|
};
|
|
2591
|
-
const
|
|
2592
|
-
|
|
2593
|
-
listen: listen$6,
|
|
2594
|
-
wrap: wrap$e
|
|
2579
|
+
const getPreference = async key => {
|
|
2580
|
+
return await invoke$1('Preferences.get', key);
|
|
2595
2581
|
};
|
|
2596
|
-
const
|
|
2597
|
-
|
|
2598
|
-
emitter.addEventListener(type, callback);
|
|
2599
|
-
} else {
|
|
2600
|
-
emitter.on(type, callback);
|
|
2601
|
-
}
|
|
2582
|
+
const getAllExtensions$1 = async () => {
|
|
2583
|
+
return invoke$1('ExtensionManagement.getAllExtensions');
|
|
2602
2584
|
};
|
|
2603
|
-
const
|
|
2604
|
-
|
|
2605
|
-
emitter.removeEventListener(type, callback);
|
|
2606
|
-
} else {
|
|
2607
|
-
emitter.off(type, callback);
|
|
2608
|
-
}
|
|
2585
|
+
const getExtension$2 = async id => {
|
|
2586
|
+
return invoke$1('ExtensionManagement.getExtension', id);
|
|
2609
2587
|
};
|
|
2610
|
-
const
|
|
2611
|
-
|
|
2612
|
-
promise,
|
|
2613
|
-
resolve
|
|
2614
|
-
} = Promise.withResolvers();
|
|
2615
|
-
const listenerMap = Object.create(null);
|
|
2616
|
-
const cleanup = value => {
|
|
2617
|
-
for (const event of Object.keys(eventMap)) {
|
|
2618
|
-
removeListener(eventEmitter, event, listenerMap[event]);
|
|
2619
|
-
}
|
|
2620
|
-
resolve(value);
|
|
2621
|
-
};
|
|
2622
|
-
for (const [event, type] of Object.entries(eventMap)) {
|
|
2623
|
-
const listener = event => {
|
|
2624
|
-
cleanup({
|
|
2625
|
-
event,
|
|
2626
|
-
type
|
|
2627
|
-
});
|
|
2628
|
-
};
|
|
2629
|
-
addListener(eventEmitter, event, listener);
|
|
2630
|
-
listenerMap[event] = listener;
|
|
2631
|
-
}
|
|
2632
|
-
return promise;
|
|
2588
|
+
const openNativeFolder = async uri => {
|
|
2589
|
+
await invoke$1('OpenNativeFolder.openNativeFolder', uri);
|
|
2633
2590
|
};
|
|
2634
|
-
const
|
|
2635
|
-
|
|
2636
|
-
isMessagePortOpen,
|
|
2637
|
-
messagePort
|
|
2638
|
-
}) => {
|
|
2639
|
-
if (!isMessagePort(messagePort)) {
|
|
2640
|
-
throw new IpcError('port must be of type MessagePort');
|
|
2641
|
-
}
|
|
2642
|
-
if (isMessagePortOpen) {
|
|
2643
|
-
return messagePort;
|
|
2644
|
-
}
|
|
2645
|
-
const eventPromise = getFirstEvent(messagePort, {
|
|
2646
|
-
message: Message$1
|
|
2647
|
-
});
|
|
2648
|
-
messagePort.start();
|
|
2649
|
-
const {
|
|
2650
|
-
event,
|
|
2651
|
-
type
|
|
2652
|
-
} = await eventPromise;
|
|
2653
|
-
if (type !== Message$1) {
|
|
2654
|
-
throw new IpcError('Failed to wait for ipc message');
|
|
2655
|
-
}
|
|
2656
|
-
if (event.data !== readyMessage) {
|
|
2657
|
-
throw new IpcError('unexpected first message');
|
|
2658
|
-
}
|
|
2659
|
-
return messagePort;
|
|
2591
|
+
const uninstallExtension = async id => {
|
|
2592
|
+
return invoke$1('ExtensionManagement.uninstall', id);
|
|
2660
2593
|
};
|
|
2661
|
-
const
|
|
2662
|
-
|
|
2594
|
+
const openExtensionSearch$1 = async () => {
|
|
2595
|
+
return invoke$1('SideBar.openViewlet', 'Extensions');
|
|
2663
2596
|
};
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
send(message) {
|
|
2667
|
-
this._rawIpc.postMessage(message);
|
|
2668
|
-
}
|
|
2669
|
-
sendAndTransfer(message) {
|
|
2670
|
-
const transfer = getTransferrables(message);
|
|
2671
|
-
this._rawIpc.postMessage(message, transfer);
|
|
2672
|
-
}
|
|
2673
|
-
dispose() {
|
|
2674
|
-
this._rawIpc.close();
|
|
2675
|
-
}
|
|
2676
|
-
onMessage(callback) {
|
|
2677
|
-
this._rawIpc.addEventListener('message', callback);
|
|
2678
|
-
}
|
|
2679
|
-
onClose(callback) {}
|
|
2680
|
-
}
|
|
2681
|
-
const wrap$5 = messagePort => {
|
|
2682
|
-
return new IpcParentWithMessagePort(messagePort);
|
|
2597
|
+
const setExtensionsSearchValue = async searchValue => {
|
|
2598
|
+
return invoke$1('Extensions.handleInput', searchValue, Script$1);
|
|
2683
2599
|
};
|
|
2684
|
-
const
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2600
|
+
const openExternal$1 = async uri => {
|
|
2601
|
+
await invoke$1('Open.openExternal', uri);
|
|
2602
|
+
};
|
|
2603
|
+
const openUrl = async uri => {
|
|
2604
|
+
await invoke$1('Open.openUrl', uri);
|
|
2605
|
+
};
|
|
2606
|
+
const getAllPreferences = async () => {
|
|
2607
|
+
return invoke$1('Preferences.getAll');
|
|
2689
2608
|
};
|
|
2690
2609
|
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
const
|
|
2694
|
-
|
|
2610
|
+
/* eslint-disable unicorn/prefer-export-from */
|
|
2611
|
+
|
|
2612
|
+
const {
|
|
2613
|
+
getRuntimeStatus: getRuntimeStatus$1,
|
|
2614
|
+
set: set$4
|
|
2615
|
+
} = ExtensionHost;
|
|
2616
|
+
|
|
2617
|
+
const getRuntimeStatus = async extensionId => {
|
|
2618
|
+
// @ts-ignore
|
|
2619
|
+
const status = await getRuntimeStatus$1(extensionId);
|
|
2620
|
+
// @ts-ignore
|
|
2621
|
+
return status;
|
|
2695
2622
|
};
|
|
2696
|
-
|
|
2697
|
-
|
|
2623
|
+
|
|
2624
|
+
const getRuntimeStatusDetails = async extension => {
|
|
2625
|
+
const {
|
|
2626
|
+
activationEvent,
|
|
2627
|
+
activationTime,
|
|
2628
|
+
importTime,
|
|
2629
|
+
status
|
|
2630
|
+
} = await getRuntimeStatus(extension.id);
|
|
2631
|
+
return {
|
|
2632
|
+
activationTime,
|
|
2633
|
+
importTime,
|
|
2634
|
+
status,
|
|
2635
|
+
wasActivatedByEvent: activationEvent
|
|
2636
|
+
};
|
|
2698
2637
|
};
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
}
|
|
2704
|
-
}
|
|
2705
|
-
const NewLine = '\n';
|
|
2706
|
-
const DomException = 'DOMException';
|
|
2707
|
-
const ReferenceError$1 = 'ReferenceError';
|
|
2708
|
-
const SyntaxError$1 = 'SyntaxError';
|
|
2709
|
-
const TypeError$1 = 'TypeError';
|
|
2710
|
-
const getErrorConstructor = (message, type) => {
|
|
2711
|
-
if (type) {
|
|
2712
|
-
switch (type) {
|
|
2713
|
-
case DomException:
|
|
2714
|
-
return DOMException;
|
|
2715
|
-
case ReferenceError$1:
|
|
2716
|
-
return ReferenceError;
|
|
2717
|
-
case SyntaxError$1:
|
|
2718
|
-
return SyntaxError;
|
|
2719
|
-
case TypeError$1:
|
|
2720
|
-
return TypeError;
|
|
2721
|
-
default:
|
|
2722
|
-
return Error;
|
|
2723
|
-
}
|
|
2724
|
-
}
|
|
2725
|
-
if (message.startsWith('TypeError: ')) {
|
|
2726
|
-
return TypeError;
|
|
2727
|
-
}
|
|
2728
|
-
if (message.startsWith('SyntaxError: ')) {
|
|
2729
|
-
return SyntaxError;
|
|
2638
|
+
|
|
2639
|
+
const featureRuntimeStatusEnabled = extension => {
|
|
2640
|
+
if (!extension || typeof extension !== 'object') {
|
|
2641
|
+
return false;
|
|
2730
2642
|
}
|
|
2731
|
-
if (
|
|
2732
|
-
return
|
|
2643
|
+
if ('main' in extension || 'browser' in extension) {
|
|
2644
|
+
return true;
|
|
2733
2645
|
}
|
|
2734
|
-
return
|
|
2646
|
+
return false;
|
|
2735
2647
|
};
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
error.name = name;
|
|
2745
|
-
}
|
|
2746
|
-
return error;
|
|
2648
|
+
|
|
2649
|
+
const formatTime = time => {
|
|
2650
|
+
return time.toFixed(2) + 'ms';
|
|
2651
|
+
};
|
|
2652
|
+
|
|
2653
|
+
const getActivationTimeVirtualDom = (importTime$1, activationTime$1) => {
|
|
2654
|
+
if (!activationTime$1 && !importTime$1) {
|
|
2655
|
+
return [];
|
|
2747
2656
|
}
|
|
2748
|
-
|
|
2657
|
+
const formattedImportTime = formatTime(importTime$1);
|
|
2658
|
+
const formattedTime = formatTime(activationTime$1);
|
|
2659
|
+
return [{
|
|
2660
|
+
childCount: 1,
|
|
2661
|
+
type: Dt
|
|
2662
|
+
}, text(importTime()), {
|
|
2663
|
+
childCount: 1,
|
|
2664
|
+
type: Dd
|
|
2665
|
+
}, text(formattedImportTime), {
|
|
2666
|
+
childCount: 1,
|
|
2667
|
+
type: Dt
|
|
2668
|
+
}, text(activationTime()), {
|
|
2669
|
+
childCount: 1,
|
|
2670
|
+
type: Dd
|
|
2671
|
+
}, text(formattedTime)];
|
|
2749
2672
|
};
|
|
2750
|
-
|
|
2751
|
-
|
|
2673
|
+
|
|
2674
|
+
const None$1 = 0;
|
|
2675
|
+
const Importing = 1;
|
|
2676
|
+
const Activating = 2;
|
|
2677
|
+
const Activated = 3;
|
|
2678
|
+
const Error$1 = 4;
|
|
2679
|
+
|
|
2680
|
+
const getStatusMessage = statusType => {
|
|
2681
|
+
switch (statusType) {
|
|
2682
|
+
case Activated:
|
|
2683
|
+
return 'activated';
|
|
2684
|
+
case Activating:
|
|
2685
|
+
return 'Activating';
|
|
2686
|
+
case Error$1:
|
|
2687
|
+
return 'error';
|
|
2688
|
+
case Importing:
|
|
2689
|
+
return 'importing';
|
|
2690
|
+
case None$1:
|
|
2691
|
+
return 'none';
|
|
2692
|
+
default:
|
|
2693
|
+
return 'unknown';
|
|
2694
|
+
}
|
|
2752
2695
|
};
|
|
2753
|
-
|
|
2754
|
-
|
|
2696
|
+
|
|
2697
|
+
const key = {
|
|
2698
|
+
childCount: 1,
|
|
2699
|
+
className: 'RuntimeStatusDefinitionListKey',
|
|
2700
|
+
type: Dt
|
|
2755
2701
|
};
|
|
2756
|
-
const
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2702
|
+
const value = {
|
|
2703
|
+
childCount: 1,
|
|
2704
|
+
className: 'RuntimeStatusDefinitionListValue',
|
|
2705
|
+
type: Dd
|
|
2760
2706
|
};
|
|
2761
|
-
const
|
|
2762
|
-
|
|
2707
|
+
const getStatusVirtualDom = status$1 => {
|
|
2708
|
+
const statusKey = status();
|
|
2709
|
+
const statusValue = getStatusMessage(status$1);
|
|
2710
|
+
return [key, text(`${statusKey}: `), value, text(`${statusValue}`)];
|
|
2763
2711
|
};
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2712
|
+
|
|
2713
|
+
const getChildCount$1 = (status, activationTime, importTime) => {
|
|
2714
|
+
let childCount = 0;
|
|
2715
|
+
childCount += 2; // status
|
|
2716
|
+
if (importTime || activationTime) {
|
|
2717
|
+
childCount += 4;
|
|
2768
2718
|
}
|
|
2769
|
-
return
|
|
2719
|
+
return childCount;
|
|
2770
2720
|
};
|
|
2771
|
-
const
|
|
2772
|
-
const
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
if (error.data.type) {
|
|
2804
|
-
// @ts-ignore
|
|
2805
|
-
restoredError.name = error.data.type;
|
|
2806
|
-
}
|
|
2807
|
-
} else {
|
|
2808
|
-
if (error.stack) {
|
|
2809
|
-
const lowerStack = restoredError.stack || '';
|
|
2810
|
-
// @ts-ignore
|
|
2811
|
-
const indexNewLine = getNewLineIndex(lowerStack);
|
|
2812
|
-
const parentStack = getParentStack(error);
|
|
2813
|
-
// @ts-ignore
|
|
2814
|
-
restoredError.stack = parentStack + lowerStack.slice(indexNewLine);
|
|
2815
|
-
}
|
|
2816
|
-
if (error.codeFrame) {
|
|
2817
|
-
// @ts-ignore
|
|
2818
|
-
restoredError.codeFrame = error.codeFrame;
|
|
2819
|
-
}
|
|
2820
|
-
}
|
|
2821
|
-
return restoredError;
|
|
2822
|
-
}
|
|
2823
|
-
if (typeof error === 'string') {
|
|
2824
|
-
return new Error(`JsonRpc Error: ${error}`);
|
|
2825
|
-
}
|
|
2826
|
-
return new Error(`JsonRpc Error: ${error}`);
|
|
2721
|
+
const getRuntimeStatusVirtualDom = state => {
|
|
2722
|
+
const {
|
|
2723
|
+
activationTime: displayedImportTime,
|
|
2724
|
+
importTime: displayedActivationTime,
|
|
2725
|
+
status
|
|
2726
|
+
} = state;
|
|
2727
|
+
const heading = runtimeStatus();
|
|
2728
|
+
const childCount = getChildCount$1(status, displayedActivationTime, displayedImportTime);
|
|
2729
|
+
return [{
|
|
2730
|
+
childCount: 2,
|
|
2731
|
+
className: FeatureContent,
|
|
2732
|
+
type: Div
|
|
2733
|
+
}, ...getFeatureContentHeadingVirtualDom(heading), {
|
|
2734
|
+
childCount,
|
|
2735
|
+
className: 'RuntimeStatusDefinitionList',
|
|
2736
|
+
type: Dl
|
|
2737
|
+
}, ...getStatusVirtualDom(status), ...getActivationTimeVirtualDom(displayedImportTime, displayedActivationTime)];
|
|
2738
|
+
};
|
|
2739
|
+
|
|
2740
|
+
const getSettingsTableEntry = setting => {
|
|
2741
|
+
const {
|
|
2742
|
+
id,
|
|
2743
|
+
label
|
|
2744
|
+
} = setting;
|
|
2745
|
+
// TODO watch out for null/undefined/number/string/array
|
|
2746
|
+
return [{
|
|
2747
|
+
type: Text,
|
|
2748
|
+
value: id
|
|
2749
|
+
}, {
|
|
2750
|
+
type: Text,
|
|
2751
|
+
value: label
|
|
2752
|
+
}];
|
|
2827
2753
|
};
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2754
|
+
|
|
2755
|
+
const getSettingsDetails = async extension => {
|
|
2756
|
+
const settings = extension.settings || [];
|
|
2757
|
+
const rows = settings.map(getSettingsTableEntry);
|
|
2758
|
+
return {
|
|
2759
|
+
settings: rows
|
|
2760
|
+
};
|
|
2761
|
+
};
|
|
2762
|
+
|
|
2763
|
+
const featureSettingsEnabled = extension => {
|
|
2764
|
+
if (!hasProperty(extension, 'settings')) {
|
|
2765
|
+
return false;
|
|
2835
2766
|
}
|
|
2836
|
-
|
|
2767
|
+
return Array.isArray(extension.settings);
|
|
2837
2768
|
};
|
|
2838
|
-
|
|
2839
|
-
|
|
2769
|
+
|
|
2770
|
+
const getSettingsTableEntries = rows => {
|
|
2771
|
+
const textId = id$1();
|
|
2772
|
+
const textLabel = label();
|
|
2773
|
+
return {
|
|
2774
|
+
headings: [textId, textLabel],
|
|
2775
|
+
rows
|
|
2776
|
+
};
|
|
2840
2777
|
};
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2778
|
+
|
|
2779
|
+
const getFeatureSettingsVirtualDom = rows => {
|
|
2780
|
+
const heading = settings();
|
|
2781
|
+
const tableInfo = getSettingsTableEntries(rows);
|
|
2782
|
+
return [{
|
|
2783
|
+
childCount: 2,
|
|
2784
|
+
className: FeatureContent,
|
|
2785
|
+
type: Div
|
|
2786
|
+
}, ...getFeatureContentHeadingVirtualDom(heading), ...getTableVirtualDom(tableInfo)];
|
|
2850
2787
|
};
|
|
2851
|
-
|
|
2852
|
-
const
|
|
2853
|
-
|
|
2854
|
-
return prettyError.type;
|
|
2855
|
-
}
|
|
2856
|
-
if (prettyError && prettyError.constructor && prettyError.constructor.name) {
|
|
2857
|
-
return prettyError.constructor.name;
|
|
2858
|
-
}
|
|
2859
|
-
return undefined;
|
|
2788
|
+
|
|
2789
|
+
const getSettingsVirtualDom = state => {
|
|
2790
|
+
return getFeatureSettingsVirtualDom(state.settings);
|
|
2860
2791
|
};
|
|
2861
|
-
|
|
2862
|
-
|
|
2792
|
+
|
|
2793
|
+
const HandleClickCategory = 1;
|
|
2794
|
+
const HandleClickDisable = 2;
|
|
2795
|
+
const HandleClickEnable = 3;
|
|
2796
|
+
const HandleClickScrollToTop = 4;
|
|
2797
|
+
const HandleClickSetColorTheme = 5;
|
|
2798
|
+
const HandleClickSettings = 6;
|
|
2799
|
+
const HandleClickSize = 7;
|
|
2800
|
+
const HandleClickUninstall = 8;
|
|
2801
|
+
const HandleFeaturesClick = 9;
|
|
2802
|
+
const HandleIconError = 10;
|
|
2803
|
+
const HandleImageContextMenu = 11;
|
|
2804
|
+
const HandleReadmeContextMenu = 12;
|
|
2805
|
+
const HandleReadmeScroll = 13;
|
|
2806
|
+
const HandleTabsClick = 14;
|
|
2807
|
+
const HandleAdditionalDetailContextMenu = 15;
|
|
2808
|
+
const HandleReadmeClick = 16;
|
|
2809
|
+
const HandleSelectionChange = 17;
|
|
2810
|
+
const HandleTabFocus = 18;
|
|
2811
|
+
const HandleResourceLinkClick = 19;
|
|
2812
|
+
|
|
2813
|
+
const ActivationEvents = 'ActivationEvents';
|
|
2814
|
+
const Changelog = 'Changelog';
|
|
2815
|
+
const Commands = 'Commands';
|
|
2816
|
+
const Details = 'Details';
|
|
2817
|
+
const Enable = 'Enable';
|
|
2818
|
+
const Disable = 'Disable';
|
|
2819
|
+
const Features = 'Features';
|
|
2820
|
+
const JsonValidation = 'JsonValidation';
|
|
2821
|
+
const ProgrammingLanguages = 'ProgrammingLanguages';
|
|
2822
|
+
const RuntimeStatus = 'RuntimeStatus';
|
|
2823
|
+
const ScrollToTop = 'scrolltotop';
|
|
2824
|
+
const SetColorTheme = 'SetColorTheme';
|
|
2825
|
+
const Settings = 'Settings';
|
|
2826
|
+
const Theme = 'Theme';
|
|
2827
|
+
const Uninstall = 'Uninstall';
|
|
2828
|
+
const WebViews = 'WebViews';
|
|
2829
|
+
|
|
2830
|
+
const getScrollToTopVirtualDom = scrollToTopButtonEnabled => {
|
|
2831
|
+
return [{
|
|
2832
|
+
ariaLabel: scrollToTop(),
|
|
2833
|
+
childCount: 1,
|
|
2834
|
+
className: ScrollToTopButton,
|
|
2835
|
+
name: ScrollToTop,
|
|
2836
|
+
onClick: HandleClickScrollToTop,
|
|
2837
|
+
type: Button$1
|
|
2838
|
+
}, {
|
|
2839
|
+
childCount: 0,
|
|
2840
|
+
className: mergeClassNames(MaskIcon, MaskIconChevronUp),
|
|
2841
|
+
role: None$3,
|
|
2842
|
+
type: Div
|
|
2843
|
+
}];
|
|
2863
2844
|
};
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2845
|
+
|
|
2846
|
+
/* eslint-disable unicorn/prefer-export-from */
|
|
2847
|
+
|
|
2848
|
+
const {
|
|
2849
|
+
getVirtualDom,
|
|
2850
|
+
render,
|
|
2851
|
+
set: set$3
|
|
2852
|
+
} = MarkdownWorker;
|
|
2853
|
+
|
|
2854
|
+
const getMarkdownVirtualDom = async (html, options) => {
|
|
2855
|
+
string(html);
|
|
2856
|
+
const dom = await getVirtualDom(html);
|
|
2857
|
+
if (options?.scrollToTopEnabled) {
|
|
2858
|
+
const [firstNode, ...rest] = dom;
|
|
2859
|
+
const extraDom = getScrollToTopVirtualDom();
|
|
2860
|
+
return [{
|
|
2861
|
+
...firstNode,
|
|
2862
|
+
childCount: firstNode.childCount + 1,
|
|
2863
|
+
onClick: HandleReadmeClick,
|
|
2864
|
+
onScroll: HandleReadmeScroll,
|
|
2865
|
+
onSelectionChange: HandleSelectionChange
|
|
2866
|
+
}, ...extraDom, ...rest];
|
|
2869
2867
|
}
|
|
2870
|
-
return
|
|
2868
|
+
return dom;
|
|
2871
2869
|
};
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2870
|
+
|
|
2871
|
+
const getThemeItemMarkdown = (heading, items) => {
|
|
2872
|
+
let markdown = '';
|
|
2873
|
+
if (items.length > 0) {
|
|
2874
|
+
markdown += `### ${heading}`;
|
|
2875
|
+
markdown += '\n\n';
|
|
2876
|
+
for (const item of items) {
|
|
2877
|
+
markdown += `- ${item.label}`;
|
|
2878
|
+
markdown += '\n';
|
|
2879
|
+
}
|
|
2879
2880
|
}
|
|
2880
|
-
return
|
|
2881
|
-
code: Custom,
|
|
2882
|
-
data: {
|
|
2883
|
-
code: prettyError.code,
|
|
2884
|
-
codeFrame: prettyError.codeFrame,
|
|
2885
|
-
name: prettyError.name,
|
|
2886
|
-
stack: getStack(prettyError),
|
|
2887
|
-
type: getErrorType(prettyError)
|
|
2888
|
-
},
|
|
2889
|
-
message: prettyError.message
|
|
2890
|
-
};
|
|
2881
|
+
return markdown;
|
|
2891
2882
|
};
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
jsonrpc: Two$1
|
|
2897
|
-
};
|
|
2883
|
+
|
|
2884
|
+
const getColorThemeMarkdown = themes => {
|
|
2885
|
+
const heading = 'Color Themes';
|
|
2886
|
+
return getThemeItemMarkdown(heading, themes);
|
|
2898
2887
|
};
|
|
2899
|
-
const
|
|
2900
|
-
const
|
|
2901
|
-
|
|
2902
|
-
const errorProperty = getErrorProperty(error, prettyError);
|
|
2903
|
-
return create$1$1(id, errorProperty);
|
|
2888
|
+
const getIconThemeMarkdown = iconThemes => {
|
|
2889
|
+
const heading = 'File Icon Themes';
|
|
2890
|
+
return getThemeItemMarkdown(heading, iconThemes);
|
|
2904
2891
|
};
|
|
2905
|
-
const
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
jsonrpc: Two$1,
|
|
2909
|
-
result: result ?? null
|
|
2910
|
-
};
|
|
2892
|
+
const getProductIconThemeMarkdown = iconThemes => {
|
|
2893
|
+
const heading = 'Product Icon Themes';
|
|
2894
|
+
return getThemeItemMarkdown(heading, iconThemes);
|
|
2911
2895
|
};
|
|
2912
|
-
const
|
|
2913
|
-
|
|
2914
|
-
|
|
2896
|
+
const getThemeMarkdown = (themes, iconThemes, productIconThemes) => {
|
|
2897
|
+
let markdown = '';
|
|
2898
|
+
markdown += getColorThemeMarkdown(themes);
|
|
2899
|
+
markdown += getIconThemeMarkdown(iconThemes);
|
|
2900
|
+
markdown += getProductIconThemeMarkdown(productIconThemes);
|
|
2901
|
+
return markdown;
|
|
2915
2902
|
};
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
code: Custom,
|
|
2920
|
-
data: error,
|
|
2921
|
-
// @ts-ignore
|
|
2922
|
-
message: error.message
|
|
2923
|
-
},
|
|
2924
|
-
id,
|
|
2925
|
-
jsonrpc: Two$1
|
|
2926
|
-
};
|
|
2903
|
+
|
|
2904
|
+
const padBytes = bytes => {
|
|
2905
|
+
return bytes.toString(16).padStart(2, '0');
|
|
2927
2906
|
};
|
|
2928
|
-
const
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2907
|
+
const hash = async content => {
|
|
2908
|
+
const sourceBytes = new TextEncoder().encode(content);
|
|
2909
|
+
const digest = await crypto.subtle.digest('SHA-256', sourceBytes);
|
|
2910
|
+
const resultBytes = [...new Uint8Array(digest)];
|
|
2911
|
+
return resultBytes.map(padBytes).join('');
|
|
2912
|
+
};
|
|
2913
|
+
|
|
2914
|
+
const supportsNormalCacheKey = locationProtocol => {
|
|
2915
|
+
return locationProtocol === 'http:' || locationProtocol === 'https:';
|
|
2916
|
+
};
|
|
2917
|
+
|
|
2918
|
+
const getMarkdownCacheHash = async (markdown, options) => {
|
|
2919
|
+
const stringifiedOptions = JSON.stringify(options);
|
|
2920
|
+
const contents = `${markdown}:${stringifiedOptions}:${options.commit}`;
|
|
2921
|
+
return hash(contents);
|
|
2922
|
+
};
|
|
2923
|
+
const getMarkdownCacheKey = async (markdown, options) => {
|
|
2924
|
+
const hash = await getMarkdownCacheHash(markdown, options);
|
|
2925
|
+
if (supportsNormalCacheKey(options.locationProtocol)) {
|
|
2926
|
+
return `/markdown/${hash}`;
|
|
2937
2927
|
}
|
|
2928
|
+
// workaround for electron bug
|
|
2929
|
+
return `https://-/markdown/${hash}`;
|
|
2930
|
+
};
|
|
2931
|
+
|
|
2932
|
+
// TODO pass application name from renderer worker to not hardcode it
|
|
2933
|
+
|
|
2934
|
+
const cachedCaches = Object.create(null);
|
|
2935
|
+
const noopCache = {
|
|
2936
|
+
async match() {
|
|
2937
|
+
return undefined;
|
|
2938
|
+
},
|
|
2939
|
+
async put() {}
|
|
2938
2940
|
};
|
|
2939
|
-
const
|
|
2940
|
-
|
|
2941
|
+
const supportsStorageBuckets = () => {
|
|
2942
|
+
// @ts-ignore
|
|
2943
|
+
return Boolean(navigator.storageBuckets);
|
|
2941
2944
|
};
|
|
2942
|
-
const
|
|
2943
|
-
|
|
2945
|
+
const getCacheInternal = async (cacheName, bucketName) => {
|
|
2946
|
+
if (!supportsStorageBuckets()) {
|
|
2947
|
+
return noopCache;
|
|
2948
|
+
}
|
|
2949
|
+
const twoWeeks = 14 * 24 * 60 * 60 * 1000;
|
|
2950
|
+
// @ts-ignore
|
|
2951
|
+
const bucket = await navigator.storageBuckets.open(bucketName, {
|
|
2952
|
+
expires: Date.now() + twoWeeks,
|
|
2953
|
+
quota: 100 * 1024 * 1024 // 100MB
|
|
2954
|
+
});
|
|
2955
|
+
const cache = await bucket.caches.open(cacheName);
|
|
2956
|
+
return cache;
|
|
2944
2957
|
};
|
|
2945
|
-
const
|
|
2946
|
-
|
|
2958
|
+
const getCache = (cacheName, bucketName) => {
|
|
2959
|
+
if (!(cacheName in cachedCaches)) {
|
|
2960
|
+
cachedCaches[cacheName] = getCacheInternal(cacheName, bucketName);
|
|
2961
|
+
}
|
|
2962
|
+
return cachedCaches[cacheName];
|
|
2947
2963
|
};
|
|
2948
|
-
const defaultResolve = resolve;
|
|
2949
2964
|
|
|
2950
|
-
// TODO
|
|
2951
|
-
const
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
ipc: options.ipc,
|
|
2957
|
-
logError: options.logError || defaultLogError,
|
|
2958
|
-
message: options.message,
|
|
2959
|
-
preparePrettyError: options.preparePrettyError || defaultPreparePrettyError,
|
|
2960
|
-
requiresSocket: options.requiresSocket || defaultRequiresSocket,
|
|
2961
|
-
resolve: options.resolve || defaultResolve
|
|
2962
|
-
};
|
|
2963
|
-
}
|
|
2964
|
-
return {
|
|
2965
|
-
execute: args[2],
|
|
2966
|
-
ipc: args[0],
|
|
2967
|
-
logError: args[5],
|
|
2968
|
-
message: args[1],
|
|
2969
|
-
preparePrettyError: args[4],
|
|
2970
|
-
requiresSocket: args[6],
|
|
2971
|
-
resolve: args[3]
|
|
2972
|
-
};
|
|
2965
|
+
// TODO pass application name from renderer worker to not hardcode it
|
|
2966
|
+
const cacheName = 'lvce-editor/markdown-cache';
|
|
2967
|
+
const has = async (key, bucketName) => {
|
|
2968
|
+
const cache = await getCache(cacheName, bucketName);
|
|
2969
|
+
const response = await cache.match(key);
|
|
2970
|
+
return Boolean(response);
|
|
2973
2971
|
};
|
|
2974
|
-
const
|
|
2975
|
-
const
|
|
2976
|
-
const
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
if ('method' in message) {
|
|
2987
|
-
const response = await getResponse(message, ipc, execute, preparePrettyError, logError, requiresSocket);
|
|
2988
|
-
try {
|
|
2989
|
-
ipc.send(response);
|
|
2990
|
-
} catch (error) {
|
|
2991
|
-
const errorResponse = getErrorResponse(message.id, error, preparePrettyError, logError);
|
|
2992
|
-
ipc.send(errorResponse);
|
|
2993
|
-
}
|
|
2994
|
-
return;
|
|
2972
|
+
const get$1 = async (key, bucketName) => {
|
|
2973
|
+
const cache = await getCache(cacheName, bucketName);
|
|
2974
|
+
const response = await cache.match(key);
|
|
2975
|
+
const text = await response?.text();
|
|
2976
|
+
return text || '';
|
|
2977
|
+
};
|
|
2978
|
+
const set$2 = async (key, bucketName, value) => {
|
|
2979
|
+
const cache = await getCache(cacheName, bucketName);
|
|
2980
|
+
await cache.put(key, new Response(value, {
|
|
2981
|
+
headers: {
|
|
2982
|
+
'Content-Length': `${value.length}`,
|
|
2983
|
+
'Content-Type': 'application/markdown'
|
|
2995
2984
|
}
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
2985
|
+
}));
|
|
2986
|
+
};
|
|
2987
|
+
|
|
2988
|
+
const renderMarkdownCached = async (markdown, options) => {
|
|
2989
|
+
const cacheKey = await getMarkdownCacheKey(markdown, options);
|
|
2990
|
+
const bucketName = `markdown-cache`;
|
|
2991
|
+
const hasItem = await has(cacheKey, bucketName);
|
|
2992
|
+
if (hasItem) {
|
|
2993
|
+
const value = await get$1(cacheKey, bucketName);
|
|
2994
|
+
return value; // TODO validate if it's valid
|
|
3002
2995
|
}
|
|
3003
|
-
|
|
2996
|
+
const html = await render(markdown, options);
|
|
2997
|
+
await set$2(cacheKey, bucketName, html);
|
|
2998
|
+
return html;
|
|
3004
2999
|
};
|
|
3005
3000
|
|
|
3006
|
-
const
|
|
3001
|
+
const renderMarkdown = async (markdown, options) => {
|
|
3002
|
+
const html = await renderMarkdownCached(markdown, options);
|
|
3003
|
+
return html;
|
|
3004
|
+
};
|
|
3007
3005
|
|
|
3008
|
-
const
|
|
3006
|
+
const getThemeDetails = async (extension, baseUrl, locationProtocol) => {
|
|
3007
|
+
const {
|
|
3008
|
+
colorThemes,
|
|
3009
|
+
iconThemes,
|
|
3010
|
+
productIconThemes
|
|
3011
|
+
} = extension;
|
|
3012
|
+
const markdown = getThemeMarkdown(colorThemes || [], iconThemes || [], productIconThemes || []);
|
|
3013
|
+
const rendered = await renderMarkdown(markdown, {
|
|
3014
|
+
baseUrl,
|
|
3015
|
+
locationProtocol
|
|
3016
|
+
});
|
|
3017
|
+
const themesMarkdownDom = await getMarkdownVirtualDom(rendered);
|
|
3009
3018
|
return {
|
|
3010
|
-
|
|
3011
|
-
method,
|
|
3012
|
-
params
|
|
3019
|
+
themesMarkdownDom
|
|
3013
3020
|
};
|
|
3014
3021
|
};
|
|
3015
3022
|
|
|
3016
|
-
const
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
params
|
|
3022
|
-
};
|
|
3023
|
-
return message;
|
|
3023
|
+
const featureColorThemeEnabled = extension => {
|
|
3024
|
+
if (!hasProperty(extension, 'colorThemes')) {
|
|
3025
|
+
return false;
|
|
3026
|
+
}
|
|
3027
|
+
return Array.isArray(extension.colorThemes);
|
|
3024
3028
|
};
|
|
3025
3029
|
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3030
|
+
const featureIconThemeEnabled = extension => {
|
|
3031
|
+
if (!hasProperty(extension, 'iconThemes')) {
|
|
3032
|
+
return false;
|
|
3033
|
+
}
|
|
3034
|
+
return Array.isArray(extension.iconThemes);
|
|
3029
3035
|
};
|
|
3030
3036
|
|
|
3031
|
-
const
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
} = Promise.withResolvers();
|
|
3037
|
-
map[id] = resolve;
|
|
3038
|
-
return {
|
|
3039
|
-
id,
|
|
3040
|
-
promise
|
|
3041
|
-
};
|
|
3037
|
+
const featureProductIconThemeEnabled = extension => {
|
|
3038
|
+
if (!hasProperty(extension, 'productIconThemes')) {
|
|
3039
|
+
return false;
|
|
3040
|
+
}
|
|
3041
|
+
return Array.isArray(extension.productIconThemes);
|
|
3042
3042
|
};
|
|
3043
3043
|
|
|
3044
|
-
const
|
|
3045
|
-
|
|
3046
|
-
id,
|
|
3047
|
-
promise
|
|
3048
|
-
} = registerPromise(callbacks);
|
|
3049
|
-
const message = create$7(id, method, params);
|
|
3050
|
-
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
3051
|
-
ipc.sendAndTransfer(message);
|
|
3052
|
-
} else {
|
|
3053
|
-
ipc.send(message);
|
|
3054
|
-
}
|
|
3055
|
-
const responseMessage = await promise;
|
|
3056
|
-
return unwrapJsonRpcResult(responseMessage);
|
|
3044
|
+
const featureThemeEnabled = extension => {
|
|
3045
|
+
return featureColorThemeEnabled(extension) || featureIconThemeEnabled(extension) || featureProductIconThemeEnabled(extension);
|
|
3057
3046
|
};
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
fn(response);
|
|
3067
|
-
delete callbacks[id];
|
|
3068
|
-
};
|
|
3069
|
-
const rpc = {
|
|
3070
|
-
async dispose() {
|
|
3071
|
-
await ipc?.dispose();
|
|
3072
|
-
},
|
|
3073
|
-
invoke(method, ...params) {
|
|
3074
|
-
return invokeHelper(callbacks, ipc, method, params, false);
|
|
3075
|
-
},
|
|
3076
|
-
invokeAndTransfer(method, ...params) {
|
|
3077
|
-
return invokeHelper(callbacks, ipc, method, params, true);
|
|
3078
|
-
},
|
|
3079
|
-
// @ts-ignore
|
|
3080
|
-
ipc,
|
|
3081
|
-
/**
|
|
3082
|
-
* @deprecated
|
|
3083
|
-
*/
|
|
3084
|
-
send(method, ...params) {
|
|
3085
|
-
const message = create$8(method, params);
|
|
3086
|
-
ipc.send(message);
|
|
3047
|
+
|
|
3048
|
+
const getVirtualDomChildCount = dom => {
|
|
3049
|
+
const max = dom.length - 1;
|
|
3050
|
+
let stack = [];
|
|
3051
|
+
for (let i = max; i >= 0; i--) {
|
|
3052
|
+
const element = dom[i];
|
|
3053
|
+
if (element.childCount > 0) {
|
|
3054
|
+
stack = stack.slice(element.childCount);
|
|
3087
3055
|
}
|
|
3088
|
-
|
|
3089
|
-
|
|
3056
|
+
stack.unshift(element);
|
|
3057
|
+
}
|
|
3058
|
+
return stack.length;
|
|
3090
3059
|
};
|
|
3091
3060
|
|
|
3092
|
-
const
|
|
3093
|
-
|
|
3061
|
+
const getFeatureThemesVirtualDom = themesDom => {
|
|
3062
|
+
const childCount = getVirtualDomChildCount(themesDom);
|
|
3063
|
+
const heading = theme();
|
|
3064
|
+
return [{
|
|
3065
|
+
childCount: 2,
|
|
3066
|
+
className: FeatureContent,
|
|
3067
|
+
type: Div
|
|
3068
|
+
}, ...getFeatureContentHeadingVirtualDom(heading), {
|
|
3069
|
+
childCount,
|
|
3070
|
+
className: DefaultMarkdown,
|
|
3071
|
+
type: Div
|
|
3072
|
+
}, ...themesDom];
|
|
3094
3073
|
};
|
|
3095
|
-
|
|
3096
|
-
|
|
3074
|
+
|
|
3075
|
+
const getThemeVirtualDom = state => {
|
|
3076
|
+
return getFeatureThemesVirtualDom(state.themesMarkdownDom);
|
|
3097
3077
|
};
|
|
3098
|
-
|
|
3099
|
-
|
|
3078
|
+
|
|
3079
|
+
const toWebView = rawWebView => {
|
|
3080
|
+
const {
|
|
3081
|
+
contentSecurityPolicy,
|
|
3082
|
+
elements,
|
|
3083
|
+
id,
|
|
3084
|
+
selector
|
|
3085
|
+
} = rawWebView;
|
|
3086
|
+
return {
|
|
3087
|
+
contentSecurityPolicyString: JSON.stringify(contentSecurityPolicy),
|
|
3088
|
+
elementsString: JSON.stringify(elements, null, 2),
|
|
3089
|
+
id,
|
|
3090
|
+
selectorString: JSON.stringify(selector)
|
|
3091
|
+
};
|
|
3100
3092
|
};
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
const
|
|
3104
|
-
return
|
|
3093
|
+
|
|
3094
|
+
const getWebViews = extension => {
|
|
3095
|
+
const rawWebViews = extension.webViews || [];
|
|
3096
|
+
return rawWebViews.map(toWebView);
|
|
3105
3097
|
};
|
|
3106
3098
|
|
|
3107
|
-
const
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
ipc.on('message', handleMessage);
|
|
3113
|
-
}
|
|
3099
|
+
const getWebViewsDetails = async extension => {
|
|
3100
|
+
const webViews = getWebViews(extension);
|
|
3101
|
+
return {
|
|
3102
|
+
webViews
|
|
3103
|
+
};
|
|
3114
3104
|
};
|
|
3115
3105
|
|
|
3116
|
-
const
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
module.signal(rawIpc);
|
|
3106
|
+
const featureWebViewsEnabled = extension => {
|
|
3107
|
+
if (!hasProperty(extension, 'webViews')) {
|
|
3108
|
+
return false;
|
|
3120
3109
|
}
|
|
3121
|
-
|
|
3122
|
-
return ipc;
|
|
3110
|
+
return Array.isArray(extension.webViews);
|
|
3123
3111
|
};
|
|
3124
3112
|
|
|
3125
|
-
const
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
}) => {
|
|
3130
|
-
// TODO create a commandMap per rpc instance
|
|
3131
|
-
register(commandMap);
|
|
3132
|
-
const rawIpc = await IpcParentWithMessagePort$1.create({
|
|
3133
|
-
isMessagePortOpen,
|
|
3134
|
-
messagePort
|
|
3135
|
-
});
|
|
3136
|
-
const ipc = IpcParentWithMessagePort$1.wrap(rawIpc);
|
|
3137
|
-
handleIpc(ipc);
|
|
3138
|
-
const rpc = createRpc(ipc);
|
|
3139
|
-
messagePort.start();
|
|
3140
|
-
return rpc;
|
|
3113
|
+
const heading = {
|
|
3114
|
+
childCount: 1,
|
|
3115
|
+
className: DefinitionListItemHeading,
|
|
3116
|
+
type: H2
|
|
3141
3117
|
};
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3118
|
+
const pre = {
|
|
3119
|
+
childCount: 1,
|
|
3120
|
+
className: DefinitionListItemValue,
|
|
3121
|
+
type: Pre
|
|
3122
|
+
};
|
|
3123
|
+
const item = {
|
|
3124
|
+
childCount: 2,
|
|
3125
|
+
className: DefinitionListItem,
|
|
3126
|
+
type: Div
|
|
3127
|
+
};
|
|
3128
|
+
const getWebViewVirtualDom = webView => {
|
|
3148
3129
|
const {
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3130
|
+
contentSecurityPolicyString,
|
|
3131
|
+
elementsString,
|
|
3132
|
+
id,
|
|
3133
|
+
selectorString
|
|
3134
|
+
} = webView;
|
|
3135
|
+
const textId = id$1();
|
|
3136
|
+
const textSelector = selector();
|
|
3137
|
+
const textContentSecurityPolicy = contentSecurityPolicy();
|
|
3138
|
+
const textElements = elements();
|
|
3139
|
+
return [{
|
|
3140
|
+
childCount: 4,
|
|
3141
|
+
className: FeatureWebView,
|
|
3142
|
+
type: Div
|
|
3143
|
+
}, item, heading, text(textId), pre, text(id), item, heading, text(textSelector), pre, text(selectorString), item, heading, text(textContentSecurityPolicy), pre, text(contentSecurityPolicyString), item, heading, text(textElements), pre, text(elementsString)];
|
|
3158
3144
|
};
|
|
3159
3145
|
|
|
3160
|
-
const
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
const rpc = await getOrCreate();
|
|
3171
|
-
await rpc.dispose();
|
|
3172
|
-
},
|
|
3173
|
-
async invoke(method, ...params) {
|
|
3174
|
-
const rpc = await getOrCreate();
|
|
3175
|
-
return rpc.invoke(method, ...params);
|
|
3176
|
-
},
|
|
3177
|
-
async invokeAndTransfer(method, ...params) {
|
|
3178
|
-
const rpc = await getOrCreate();
|
|
3179
|
-
return rpc.invokeAndTransfer(method, ...params);
|
|
3180
|
-
},
|
|
3181
|
-
async send(method, ...params) {
|
|
3182
|
-
const rpc = await getOrCreate();
|
|
3183
|
-
rpc.send(method, ...params);
|
|
3184
|
-
}
|
|
3185
|
-
};
|
|
3146
|
+
const getFeatureWebViewsVirtualDom = webViews$1 => {
|
|
3147
|
+
const heading = webViews();
|
|
3148
|
+
return [{
|
|
3149
|
+
childCount: 2,
|
|
3150
|
+
className: FeatureContent,
|
|
3151
|
+
type: Div
|
|
3152
|
+
}, ...getFeatureContentHeadingVirtualDom(heading), {
|
|
3153
|
+
childCount: webViews$1.length,
|
|
3154
|
+
type: Div
|
|
3155
|
+
}, ...webViews$1.flatMap(getWebViewVirtualDom)];
|
|
3186
3156
|
};
|
|
3187
3157
|
|
|
3188
|
-
const
|
|
3189
|
-
|
|
3190
|
-
isMessagePortOpen,
|
|
3191
|
-
send
|
|
3192
|
-
}) => {
|
|
3193
|
-
return createSharedLazyRpc(() => {
|
|
3194
|
-
return create$4({
|
|
3195
|
-
commandMap,
|
|
3196
|
-
isMessagePortOpen,
|
|
3197
|
-
send
|
|
3198
|
-
});
|
|
3199
|
-
});
|
|
3158
|
+
const getWebViewsVirtualDom = state => {
|
|
3159
|
+
return getFeatureWebViewsVirtualDom(state.webViews);
|
|
3200
3160
|
};
|
|
3201
3161
|
|
|
3202
|
-
const
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3162
|
+
const registerAllFeatures = () => {
|
|
3163
|
+
register$1({
|
|
3164
|
+
getDetails: getThemeDetails,
|
|
3165
|
+
getLabel: theme,
|
|
3166
|
+
getVirtualDom: getThemeVirtualDom,
|
|
3167
|
+
id: Theme,
|
|
3168
|
+
isEnabled: featureThemeEnabled
|
|
3169
|
+
});
|
|
3170
|
+
register$1({
|
|
3171
|
+
getDetails: getCommandsDetails,
|
|
3172
|
+
getLabel: commands$1,
|
|
3173
|
+
getVirtualDom: getCommandsVirtualDom,
|
|
3174
|
+
id: Commands,
|
|
3175
|
+
isEnabled: featureCommandsEnabled
|
|
3176
|
+
});
|
|
3177
|
+
register$1({
|
|
3178
|
+
getDetails: getSettingsDetails,
|
|
3179
|
+
getLabel: settings,
|
|
3180
|
+
getVirtualDom: getSettingsVirtualDom,
|
|
3181
|
+
id: Settings,
|
|
3182
|
+
isEnabled: featureSettingsEnabled
|
|
3183
|
+
});
|
|
3184
|
+
register$1({
|
|
3185
|
+
getDetails: getJsonValidationDetails,
|
|
3186
|
+
getLabel: jsonValidation,
|
|
3187
|
+
getVirtualDom: getJsonValidationVirtualDom,
|
|
3188
|
+
id: JsonValidation,
|
|
3189
|
+
isEnabled: featureJsonValidationEnabled
|
|
3190
|
+
});
|
|
3191
|
+
register$1({
|
|
3192
|
+
getDetails: getFeatureDetailsProgrammingLanguages,
|
|
3193
|
+
getLabel: programmingLanguages,
|
|
3194
|
+
getVirtualDom: getProgrammingLanguagesVirtualDom,
|
|
3195
|
+
id: ProgrammingLanguages,
|
|
3196
|
+
isEnabled: featureProgrammingLanguagesEnabled
|
|
3197
|
+
});
|
|
3198
|
+
register$1({
|
|
3199
|
+
getDetails: getWebViewsDetails,
|
|
3200
|
+
getLabel: webViews,
|
|
3201
|
+
getVirtualDom: getWebViewsVirtualDom,
|
|
3202
|
+
id: WebViews,
|
|
3203
|
+
isEnabled: featureWebViewsEnabled
|
|
3204
|
+
});
|
|
3205
|
+
register$1({
|
|
3206
|
+
getDetails: getActivationEventsDetails,
|
|
3207
|
+
getLabel: activationEvents,
|
|
3208
|
+
getVirtualDom: getActivationEventsVirtualDom,
|
|
3209
|
+
id: ActivationEvents,
|
|
3210
|
+
isEnabled: featureActivationEventsEnabled
|
|
3211
|
+
});
|
|
3212
|
+
register$1({
|
|
3213
|
+
getDetails: getRuntimeStatusDetails,
|
|
3214
|
+
getLabel: runtimeStatus,
|
|
3215
|
+
getVirtualDom: getRuntimeStatusVirtualDom,
|
|
3216
|
+
id: RuntimeStatus,
|
|
3217
|
+
isEnabled: featureRuntimeStatusEnabled
|
|
3218
|
+
});
|
|
3211
3219
|
};
|
|
3212
3220
|
|
|
3213
3221
|
const toCommandId = key => {
|
|
@@ -3416,6 +3424,7 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
|
|
|
3416
3424
|
changelogVirtualDom: [],
|
|
3417
3425
|
commands: [],
|
|
3418
3426
|
commit: '',
|
|
3427
|
+
currentColorThemeId: '',
|
|
3419
3428
|
description: '',
|
|
3420
3429
|
detailsVirtualDom: [],
|
|
3421
3430
|
disabled: false,
|
|
@@ -3754,7 +3763,7 @@ const getExtension$1 = async (id, platform) => {
|
|
|
3754
3763
|
|
|
3755
3764
|
const getExtensionNew = async id => {
|
|
3756
3765
|
try {
|
|
3757
|
-
const rpc = get$
|
|
3766
|
+
const rpc = get$2(ExtensionManagementWorker);
|
|
3758
3767
|
return await rpc.invoke('Extensions.getExtension', id);
|
|
3759
3768
|
} catch {
|
|
3760
3769
|
// ignore
|
|
@@ -3769,12 +3778,28 @@ const getExtension = async (id, platform) => {
|
|
|
3769
3778
|
}
|
|
3770
3779
|
};
|
|
3771
3780
|
|
|
3781
|
+
const getColorThemeId = extension => {
|
|
3782
|
+
if (extension && Array.isArray(extension.colorThemes) && extension.colorThemes.length > 0) {
|
|
3783
|
+
const colorTheme = extension.colorThemes[0];
|
|
3784
|
+
return colorTheme.id || colorTheme.label;
|
|
3785
|
+
}
|
|
3786
|
+
return undefined;
|
|
3787
|
+
};
|
|
3788
|
+
const getColorThemeLabel = extension => {
|
|
3789
|
+
if (extension && Array.isArray(extension.colorThemes) && extension.colorThemes.length > 0) {
|
|
3790
|
+
const colorTheme = extension.colorThemes[0];
|
|
3791
|
+
return colorTheme.label;
|
|
3792
|
+
}
|
|
3793
|
+
return undefined;
|
|
3794
|
+
};
|
|
3795
|
+
|
|
3772
3796
|
const isEnabled$1 = button => {
|
|
3773
3797
|
return button.enabled;
|
|
3774
3798
|
};
|
|
3775
|
-
const getExtensionDetailButtons = (hasColorTheme, isBuiltin, isDisabled) => {
|
|
3799
|
+
const getExtensionDetailButtons = (hasColorTheme, isBuiltin, isDisabled, extensionColorThemeId, extensionColorThemeLabel, currentColorThemeId) => {
|
|
3800
|
+
const isCurrentColorTheme = extensionColorThemeId !== '' && extensionColorThemeId === currentColorThemeId || extensionColorThemeLabel !== '' && extensionColorThemeLabel === currentColorThemeId;
|
|
3776
3801
|
const allActions = [{
|
|
3777
|
-
enabled: hasColorTheme && !isDisabled,
|
|
3802
|
+
enabled: hasColorTheme && !isDisabled && !isCurrentColorTheme,
|
|
3778
3803
|
label: setColorTheme$2(),
|
|
3779
3804
|
name: SetColorTheme,
|
|
3780
3805
|
onClick: HandleClickSetColorTheme
|
|
@@ -3800,6 +3825,7 @@ const getExtensionDetailButtons = (hasColorTheme, isBuiltin, isDisabled) => {
|
|
|
3800
3825
|
|
|
3801
3826
|
const updateExtensionStatus = async (state, updateFunction) => {
|
|
3802
3827
|
const {
|
|
3828
|
+
currentColorThemeId,
|
|
3803
3829
|
extensionId,
|
|
3804
3830
|
hasColorTheme,
|
|
3805
3831
|
platform
|
|
@@ -3810,7 +3836,10 @@ const updateExtensionStatus = async (state, updateFunction) => {
|
|
|
3810
3836
|
}
|
|
3811
3837
|
const extension = await getExtension(extensionId, platform);
|
|
3812
3838
|
const disabled = extension?.disabled;
|
|
3813
|
-
const
|
|
3839
|
+
const extensionColorThemeId = getColorThemeId(extension) || '';
|
|
3840
|
+
const extensionColorThemeLabel = getColorThemeLabel(extension) || '';
|
|
3841
|
+
const isBuiltin = extension?.isBuiltin || extension?.builtin || false;
|
|
3842
|
+
const buttons = getExtensionDetailButtons(hasColorTheme, isBuiltin, disabled, extensionColorThemeId, extensionColorThemeLabel, currentColorThemeId);
|
|
3814
3843
|
return {
|
|
3815
3844
|
...state,
|
|
3816
3845
|
buttons,
|
|
@@ -3879,14 +3908,6 @@ const handleClickScrollToTop = state => {
|
|
|
3879
3908
|
};
|
|
3880
3909
|
};
|
|
3881
3910
|
|
|
3882
|
-
const getColorThemeId = extension => {
|
|
3883
|
-
if (extension && Array.isArray(extension.colorThemes) && extension.colorThemes.length > 0) {
|
|
3884
|
-
const colorTheme = extension.colorThemes[0];
|
|
3885
|
-
return colorTheme.id || colorTheme.label;
|
|
3886
|
-
}
|
|
3887
|
-
return undefined;
|
|
3888
|
-
};
|
|
3889
|
-
|
|
3890
3911
|
const setColorTheme = id => {
|
|
3891
3912
|
return setColorTheme$1(id);
|
|
3892
3913
|
};
|
|
@@ -3901,6 +3922,14 @@ const handleClickSetColorTheme = async state => {
|
|
|
3901
3922
|
if (error) {
|
|
3902
3923
|
await confirm(`${error}`);
|
|
3903
3924
|
}
|
|
3925
|
+
const isBuiltin = extension?.isBuiltin || extension?.builtin || false;
|
|
3926
|
+
const colorThemeLabel = getColorThemeLabel(extension) || '';
|
|
3927
|
+
const buttons = getExtensionDetailButtons(state.hasColorTheme, isBuiltin, state.disabled, colorThemeId, colorThemeLabel, colorThemeId);
|
|
3928
|
+
return {
|
|
3929
|
+
...state,
|
|
3930
|
+
buttons,
|
|
3931
|
+
currentColorThemeId: colorThemeId
|
|
3932
|
+
};
|
|
3904
3933
|
}
|
|
3905
3934
|
return state;
|
|
3906
3935
|
};
|
|
@@ -3965,6 +3994,41 @@ const getCommit = async () => {
|
|
|
3965
3994
|
}
|
|
3966
3995
|
};
|
|
3967
3996
|
|
|
3997
|
+
const getThemeFromPreferences = preferences => {
|
|
3998
|
+
if (!preferences || typeof preferences !== 'object') {
|
|
3999
|
+
return '';
|
|
4000
|
+
}
|
|
4001
|
+
const workbenchTheme = preferences['workbench.colorTheme'];
|
|
4002
|
+
if (typeof workbenchTheme === 'string') {
|
|
4003
|
+
return workbenchTheme;
|
|
4004
|
+
}
|
|
4005
|
+
const legacyTheme = preferences['workbnech.colorTheme'];
|
|
4006
|
+
if (typeof legacyTheme === 'string') {
|
|
4007
|
+
return legacyTheme;
|
|
4008
|
+
}
|
|
4009
|
+
return '';
|
|
4010
|
+
};
|
|
4011
|
+
const getCurrentColorTheme = async () => {
|
|
4012
|
+
const setting = await getPreference('workbench.colorTheme');
|
|
4013
|
+
if (typeof setting === 'string' && setting) {
|
|
4014
|
+
return setting;
|
|
4015
|
+
}
|
|
4016
|
+
try {
|
|
4017
|
+
const preferences = await getAllPreferences();
|
|
4018
|
+
const theme = getThemeFromPreferences(preferences);
|
|
4019
|
+
if (theme) {
|
|
4020
|
+
return theme;
|
|
4021
|
+
}
|
|
4022
|
+
} catch {
|
|
4023
|
+
// ignore and fall back to legacy key lookup
|
|
4024
|
+
}
|
|
4025
|
+
const legacySetting = await getPreference('workbnech.colorTheme');
|
|
4026
|
+
if (typeof legacySetting === 'string') {
|
|
4027
|
+
return legacySetting;
|
|
4028
|
+
}
|
|
4029
|
+
return '';
|
|
4030
|
+
};
|
|
4031
|
+
|
|
3968
4032
|
const getExtensionIdFromUri = uri => {
|
|
3969
4033
|
const id = uri.slice('extension-detail://'.length);
|
|
3970
4034
|
return id;
|
|
@@ -4342,10 +4406,7 @@ const getDisplaySize = size => {
|
|
|
4342
4406
|
};
|
|
4343
4407
|
|
|
4344
4408
|
const supportsFileSize = uri => {
|
|
4345
|
-
|
|
4346
|
-
return false;
|
|
4347
|
-
}
|
|
4348
|
-
return true;
|
|
4409
|
+
return !uri.startsWith('http:') && !uri.startsWith('https://');
|
|
4349
4410
|
};
|
|
4350
4411
|
|
|
4351
4412
|
const getFolderSize = async uri => {
|
|
@@ -4613,6 +4674,7 @@ const loadContent = async (state, platform, savedState, isTest = false) => {
|
|
|
4613
4674
|
if (!extension) {
|
|
4614
4675
|
throw new ExtensionNotFoundError(id);
|
|
4615
4676
|
}
|
|
4677
|
+
const currentColorThemeId = await getCurrentColorTheme();
|
|
4616
4678
|
const commit = await getCommit();
|
|
4617
4679
|
const headerData = loadHeaderContent(state, platform, extension);
|
|
4618
4680
|
const {
|
|
@@ -4646,7 +4708,9 @@ const loadContent = async (state, platform, savedState, isTest = false) => {
|
|
|
4646
4708
|
});
|
|
4647
4709
|
const isBuiltin = extension?.isBuiltin;
|
|
4648
4710
|
const disabled = extension?.disabled;
|
|
4649
|
-
const
|
|
4711
|
+
const extensionColorThemeId = getColorThemeId(extension) || '';
|
|
4712
|
+
const extensionColorThemeLabel = getColorThemeLabel(extension) || '';
|
|
4713
|
+
const buttons = getExtensionDetailButtons(hasColorTheme, isBuiltin, disabled, extensionColorThemeId, extensionColorThemeLabel, currentColorThemeId);
|
|
4650
4714
|
const size = getViewletSize(width);
|
|
4651
4715
|
const {
|
|
4652
4716
|
changelogScrollTop,
|
|
@@ -4681,6 +4745,7 @@ const loadContent = async (state, platform, savedState, isTest = false) => {
|
|
|
4681
4745
|
categories,
|
|
4682
4746
|
changelogScrollTop,
|
|
4683
4747
|
commit,
|
|
4748
|
+
currentColorThemeId,
|
|
4684
4749
|
description,
|
|
4685
4750
|
detailsVirtualDom,
|
|
4686
4751
|
disabled,
|
|
@@ -4791,7 +4856,6 @@ const handleReadmeLinkClick = async (linkProtectionEnabled, platform, href) => {
|
|
|
4791
4856
|
}
|
|
4792
4857
|
}
|
|
4793
4858
|
await openExternal(href, platform);
|
|
4794
|
-
return;
|
|
4795
4859
|
};
|
|
4796
4860
|
|
|
4797
4861
|
const isExternalLink$1 = href => {
|
|
@@ -5029,13 +5093,27 @@ const hideSizeLink = state => {
|
|
|
5029
5093
|
};
|
|
5030
5094
|
};
|
|
5031
5095
|
|
|
5096
|
+
const createRpc = async () => {
|
|
5097
|
+
const rpc = await create$4({
|
|
5098
|
+
commandMap: {},
|
|
5099
|
+
send: async port => {
|
|
5100
|
+
await sendMessagePortToClipBoardWorker(port, 0);
|
|
5101
|
+
}
|
|
5102
|
+
});
|
|
5103
|
+
return rpc;
|
|
5104
|
+
};
|
|
5105
|
+
const initializeClipBoardWorker = async () => {
|
|
5106
|
+
const rpc = await createRpc();
|
|
5107
|
+
set$a(rpc);
|
|
5108
|
+
};
|
|
5109
|
+
|
|
5032
5110
|
const sendMessagePortToExtensionHostWorker = async port => {
|
|
5033
5111
|
await sendMessagePortToExtensionHostWorker$1(port, 0);
|
|
5034
5112
|
};
|
|
5035
5113
|
|
|
5036
5114
|
const createExtensionHostWorkerRpc = async () => {
|
|
5037
5115
|
try {
|
|
5038
|
-
const rpc = await create$
|
|
5116
|
+
const rpc = await create$5({
|
|
5039
5117
|
commandMap: {},
|
|
5040
5118
|
send: sendMessagePortToExtensionHostWorker
|
|
5041
5119
|
});
|
|
@@ -5052,7 +5130,7 @@ const initializeExtensionHostWorker = async () => {
|
|
|
5052
5130
|
|
|
5053
5131
|
const createExtensionManagementWorkerRpc = async () => {
|
|
5054
5132
|
try {
|
|
5055
|
-
const rpc = await create$
|
|
5133
|
+
const rpc = await create$5({
|
|
5056
5134
|
commandMap: {},
|
|
5057
5135
|
send: port => sendMessagePortToExtensionManagementWorker(port, 0)
|
|
5058
5136
|
});
|
|
@@ -5077,7 +5155,7 @@ const sendMessagePortToFileSystemWorker = async port => {
|
|
|
5077
5155
|
|
|
5078
5156
|
const createFileSystemWorkerRpc = async () => {
|
|
5079
5157
|
try {
|
|
5080
|
-
const rpc = await create$
|
|
5158
|
+
const rpc = await create$5({
|
|
5081
5159
|
commandMap: {},
|
|
5082
5160
|
send: sendMessagePortToFileSystemWorker
|
|
5083
5161
|
});
|
|
@@ -5098,7 +5176,7 @@ const sendMessagePortToMarkdownWorker = async port => {
|
|
|
5098
5176
|
|
|
5099
5177
|
const createMarkdownWorkerRpc = async () => {
|
|
5100
5178
|
try {
|
|
5101
|
-
const rpc = await create$
|
|
5179
|
+
const rpc = await create$4({
|
|
5102
5180
|
commandMap: {},
|
|
5103
5181
|
send: sendMessagePortToMarkdownWorker
|
|
5104
5182
|
});
|
|
@@ -5115,7 +5193,7 @@ const initializeMarkdownWorker = async () => {
|
|
|
5115
5193
|
|
|
5116
5194
|
const initialize = async () => {
|
|
5117
5195
|
// TODO load markdown worker only when needed
|
|
5118
|
-
await Promise.all([initializeMarkdownWorker(), initializeFileSystemWorker(), initializeExtensionHostWorker(), initializeExtensionManagementWorker()]);
|
|
5196
|
+
await Promise.all([initializeMarkdownWorker(), initializeFileSystemWorker(), initializeExtensionHostWorker(), initializeExtensionManagementWorker(), initializeClipBoardWorker()]);
|
|
5119
5197
|
};
|
|
5120
5198
|
|
|
5121
5199
|
const loadContent2 = async (state, savedState, isTest = false) => {
|
|
@@ -5922,7 +6000,7 @@ const commandMap = {
|
|
|
5922
6000
|
|
|
5923
6001
|
const listen = async () => {
|
|
5924
6002
|
registerCommands(commandMap);
|
|
5925
|
-
const rpc = await create$
|
|
6003
|
+
const rpc = await create$3({
|
|
5926
6004
|
commandMap: commandMap
|
|
5927
6005
|
});
|
|
5928
6006
|
set$5(rpc);
|