@lvce-editor/extension-management-worker 3.2.0 → 3.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.
@@ -1,3 +1,7 @@
1
+ const activateByEvent = async () => {
2
+ // TODO
3
+ };
4
+
1
5
  class AssertionError extends Error {
2
6
  constructor(message) {
3
7
  super(message);
@@ -1293,6 +1297,10 @@ const {
1293
1297
  invokeAndTransfer: invokeAndTransfer$1,
1294
1298
  set: set$4
1295
1299
  } = create$1(RendererWorker);
1300
+ const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
1301
+ const command = 'IconTheme.handleMessagePort';
1302
+ await invokeAndTransfer$1('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
1303
+ };
1296
1304
  const sendMessagePortToFileSystemWorker = async (port, rpcId) => {
1297
1305
  const command = 'FileSystem.handleMessagePort';
1298
1306
  await invokeAndTransfer$1('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
@@ -1555,10 +1563,15 @@ const state$1 = {
1555
1563
  const push = extension => {
1556
1564
  state$1.webExtensions.push(extension);
1557
1565
  };
1566
+ const hasUri = uri => {
1567
+ return state$1.webExtensions.some(extension => extension.uri === uri);
1568
+ };
1558
1569
  const get$2 = () => {
1559
1570
  return state$1.webExtensions;
1560
1571
  };
1561
1572
 
1573
+ // TODO store one kind of ui state for whole extension management worker
1574
+
1562
1575
  const cache = Object.create(null);
1563
1576
  const id = 1;
1564
1577
  const clear = () => {
@@ -1598,6 +1611,9 @@ const getWebManifestPath = path => {
1598
1611
  };
1599
1612
 
1600
1613
  const addWebExtension = async path => {
1614
+ if (hasUri(path)) {
1615
+ return undefined;
1616
+ }
1601
1617
  const manifestPath = getWebManifestPath(path);
1602
1618
  const manifest = await getWebExtensionManifest(path, manifestPath);
1603
1619
  // TODO avoid mutation if possible
@@ -2173,26 +2189,6 @@ const handleMessagePort = async port => {
2173
2189
  });
2174
2190
  };
2175
2191
 
2176
- const initializeExtensionHostWorker = async () => {
2177
- const rpc = await create$6({
2178
- commandMap: commandMapRef,
2179
- async send(port) {
2180
- await sendMessagePortToExtensionHostWorker(port, 0);
2181
- }
2182
- });
2183
- set$6(rpc);
2184
- };
2185
-
2186
- const initializeFileSystemWorker = async () => {
2187
- const rpc = await create$6({
2188
- commandMap: commandMapRef,
2189
- async send(port) {
2190
- await sendMessagePortToFileSystemWorker(port, 0);
2191
- }
2192
- });
2193
- set$5(rpc);
2194
- };
2195
-
2196
2192
  const getRpcRemote = async () => {
2197
2193
  const rpc = await create$4({
2198
2194
  commandMap: commandMapRef,
@@ -2230,7 +2226,7 @@ const initialize = async platform => {
2230
2226
  update({
2231
2227
  platform
2232
2228
  });
2233
- await Promise.all([initializeFileSystemWorker(), initializeSharedProcess(platform), initializeExtensionHostWorker()]);
2229
+ await initializeSharedProcess(platform);
2234
2230
  };
2235
2231
 
2236
2232
  const installExtension = async () => {
@@ -2297,6 +2293,7 @@ const uninstallExtension = async () => {
2297
2293
  const commandMap = {
2298
2294
  'Extensions.activate2': activateExtension2,
2299
2295
  'Extensions.activate3': activateExtension3,
2296
+ 'Extensions.activateByEvent': activateByEvent,
2300
2297
  'Extensions.addWebExtension': addWebExtension,
2301
2298
  'Extensions.createWebViewWorkerRpc': createWebViewWorkerRpc,
2302
2299
  'Extensions.createWebViewWorkerRpc2': createWebViewWorkerRpc2,
@@ -2323,6 +2320,36 @@ const commandMap = {
2323
2320
  'Extensions.uninstall': uninstallExtension
2324
2321
  };
2325
2322
 
2323
+ const initializeExtensionHostWorker = async () => {
2324
+ const rpc = await create$6({
2325
+ commandMap: commandMapRef,
2326
+ async send(port) {
2327
+ await sendMessagePortToExtensionHostWorker(port, 0);
2328
+ }
2329
+ });
2330
+ set$6(rpc);
2331
+ };
2332
+
2333
+ const initializeFileSystemWorker = async () => {
2334
+ const rpc = await create$6({
2335
+ commandMap: commandMapRef,
2336
+ async send(port) {
2337
+ await sendMessagePortToFileSystemWorker(port, 0);
2338
+ }
2339
+ });
2340
+ set$5(rpc);
2341
+ };
2342
+
2343
+ const initializeIframeWorker = async () => {
2344
+ const rpc = await create$6({
2345
+ commandMap: {},
2346
+ async send(port) {
2347
+ await sendMessagePortToIconThemeWorker(port, 0);
2348
+ }
2349
+ });
2350
+ return rpc;
2351
+ };
2352
+
2326
2353
  const initializeRendererWorker = async () => {
2327
2354
  const rpc = await create$2({
2328
2355
  commandMap: commandMap
@@ -2332,7 +2359,7 @@ const initializeRendererWorker = async () => {
2332
2359
 
2333
2360
  const listen = async () => {
2334
2361
  Object.assign(commandMapRef, commandMap);
2335
- await initializeRendererWorker();
2362
+ await Promise.all([initializeRendererWorker(), initializeFileSystemWorker(), initializeIframeWorker(), initializeExtensionHostWorker()]);
2336
2363
  };
2337
2364
 
2338
2365
  const main = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-management-worker",
3
- "version": "3.2.0",
3
+ "version": "3.3.0",
4
4
  "description": "Webworker for the Extension Management functionality in Lvce Editor.",
5
5
  "keywords": [
6
6
  "web-worker"