@lvce-editor/extension-management-worker 4.30.3 → 4.30.4
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.
|
@@ -1597,6 +1597,7 @@ const invokeAndTransfer = (method, ...params) => {
|
|
|
1597
1597
|
return invokeAndTransfer$1(method, ...params);
|
|
1598
1598
|
};
|
|
1599
1599
|
|
|
1600
|
+
const pendingRpcs = Object.create(null);
|
|
1600
1601
|
const createIsolatedExtensionHostWorker = async (extensionId, absolutePath, workerName, createRpc, invokeAndTransfer) => {
|
|
1601
1602
|
return createRpc({
|
|
1602
1603
|
commandMap: commandMapRef,
|
|
@@ -1606,14 +1607,30 @@ const createIsolatedExtensionHostWorker = async (extensionId, absolutePath, work
|
|
|
1606
1607
|
}
|
|
1607
1608
|
});
|
|
1608
1609
|
};
|
|
1609
|
-
const
|
|
1610
|
+
const createWorker = (extensionId, absolutePath, workerName) => {
|
|
1611
|
+
return createIsolatedExtensionHostWorker(extensionId, absolutePath, workerName, create$7, invokeAndTransfer);
|
|
1612
|
+
};
|
|
1613
|
+
const createAndStoreRpc = async (extensionId, absolutePath, workerName, create) => {
|
|
1614
|
+
const rpc = await create(extensionId, absolutePath, workerName);
|
|
1615
|
+
set$2(extensionId, rpc);
|
|
1616
|
+
return rpc;
|
|
1617
|
+
};
|
|
1618
|
+
const getOrCreateIsolatedExtensionHostWorker = async (extensionId, absolutePath, workerName = '', create = createWorker) => {
|
|
1610
1619
|
const existingRpc = get$3(extensionId);
|
|
1611
1620
|
if (existingRpc) {
|
|
1612
1621
|
return existingRpc;
|
|
1613
1622
|
}
|
|
1614
|
-
const
|
|
1615
|
-
|
|
1616
|
-
|
|
1623
|
+
const pendingRpc = pendingRpcs[extensionId];
|
|
1624
|
+
if (pendingRpc !== undefined) {
|
|
1625
|
+
return pendingRpc;
|
|
1626
|
+
}
|
|
1627
|
+
const newRpc = createAndStoreRpc(extensionId, absolutePath, workerName, create);
|
|
1628
|
+
pendingRpcs[extensionId] = newRpc;
|
|
1629
|
+
try {
|
|
1630
|
+
return await newRpc;
|
|
1631
|
+
} finally {
|
|
1632
|
+
delete pendingRpcs[extensionId];
|
|
1633
|
+
}
|
|
1617
1634
|
};
|
|
1618
1635
|
|
|
1619
1636
|
const activateIsolatedExtension = async (extensionId, absolutePath, workerName, activationEvent, getOrCreate = getOrCreateIsolatedExtensionHostWorker) => {
|