@lvce-editor/extension-management-worker 4.52.5 → 4.53.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.
|
@@ -1662,6 +1662,12 @@ const getRegisteredExtensionIds = () => {
|
|
|
1662
1662
|
return [...extensionIds];
|
|
1663
1663
|
};
|
|
1664
1664
|
|
|
1665
|
+
const prefix = '[Extension] Uncaught Error: ';
|
|
1666
|
+
const handleUncaughtExtensionError = async error => {
|
|
1667
|
+
const prettyError = await invoke$5('Errors.prepare', error);
|
|
1668
|
+
await invoke$5('Errors.print', prettyError, prefix);
|
|
1669
|
+
};
|
|
1670
|
+
|
|
1665
1671
|
const rpcs$2 = new Map();
|
|
1666
1672
|
const state = {
|
|
1667
1673
|
nextId: 0
|
|
@@ -1748,6 +1754,7 @@ class CommandNotFoundError extends Error {
|
|
|
1748
1754
|
}
|
|
1749
1755
|
}
|
|
1750
1756
|
const allowedElectronPortCommand = 'HandleMessagePortForEmbedsProcess.handleMessagePortForEmbedsProcess';
|
|
1757
|
+
const workspaceSetUriCommand = 'Workspace.setUri';
|
|
1751
1758
|
const privilegedCommandPrefixes = ['ElectronNet.', 'ClipBoard.', 'DebugSharedProcess.', 'Developer.', 'Electron', 'Exec.', 'ExtensionNodeRpc.', 'FileSystem', 'FileWatcher.', 'IpcParent.', 'PlatformPaths.', 'PersistentFileHandle.', 'Process.', 'RebuildNodePty.', 'SearchProcess.', 'SendMessagePort', 'SharedProcess.', 'TerminalProcess.', 'Transferrable.', 'WebSocketCapability.', 'WebView.compat'];
|
|
1752
1759
|
const invokeGlobalCommand = (method, ...params) => {
|
|
1753
1760
|
const command = commandMapRef[method];
|
|
@@ -1756,10 +1763,23 @@ const invokeGlobalCommand = (method, ...params) => {
|
|
|
1756
1763
|
}
|
|
1757
1764
|
return command(...params);
|
|
1758
1765
|
};
|
|
1766
|
+
const executeDeferredCommand = async (id, args) => {
|
|
1767
|
+
try {
|
|
1768
|
+
await invokeGlobalCommand('Extensions.executeCommand', id, ...args);
|
|
1769
|
+
} catch (error) {
|
|
1770
|
+
await handleUncaughtExtensionError(error);
|
|
1771
|
+
}
|
|
1772
|
+
};
|
|
1759
1773
|
const executeCommand$1 = (id, ...args) => {
|
|
1760
1774
|
if (privilegedCommandPrefixes.some(prefix => id.startsWith(prefix))) {
|
|
1761
1775
|
throw new Error(`Isolated extensions cannot execute privileged command ${id}`);
|
|
1762
1776
|
}
|
|
1777
|
+
if (id === workspaceSetUriCommand) {
|
|
1778
|
+
setTimeout(() => {
|
|
1779
|
+
void executeDeferredCommand(id, args).catch(() => {});
|
|
1780
|
+
}, 0);
|
|
1781
|
+
return undefined;
|
|
1782
|
+
}
|
|
1763
1783
|
return invokeGlobalCommand('Extensions.executeCommand', id, ...args);
|
|
1764
1784
|
};
|
|
1765
1785
|
const createExtensionCommandMap = extensionId => {
|
|
@@ -4168,12 +4188,6 @@ const handleMessagePort = async (port, rpcId) => {
|
|
|
4168
4188
|
});
|
|
4169
4189
|
};
|
|
4170
4190
|
|
|
4171
|
-
const prefix = '[Extension] Uncaught Error: ';
|
|
4172
|
-
const handleUncaughtExtensionError = async error => {
|
|
4173
|
-
const prettyError = await invoke$5('Errors.prepare', error);
|
|
4174
|
-
await invoke$5('Errors.print', prettyError, prefix);
|
|
4175
|
-
};
|
|
4176
|
-
|
|
4177
4191
|
const handleViewContextChange = async (uid, viewId, context) => {
|
|
4178
4192
|
await invoke$3('ExtensionManagement.handleViewContextChange', uid, viewId, context);
|
|
4179
4193
|
};
|