@lvce-editor/extension-management-worker 4.5.0 → 4.7.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.
@@ -7,7 +7,7 @@ class AssertionError extends Error {
7
7
  const Object$1 = 1;
8
8
  const Number = 2;
9
9
  const Array$1 = 3;
10
- const String = 4;
10
+ const String$1 = 4;
11
11
  const Boolean$1 = 5;
12
12
  const Function = 6;
13
13
  const Null = 7;
@@ -19,7 +19,7 @@ const getType = value => {
19
19
  case 'function':
20
20
  return Function;
21
21
  case 'string':
22
- return String;
22
+ return String$1;
23
23
  case 'object':
24
24
  if (value === null) {
25
25
  return Null;
@@ -48,7 +48,7 @@ const number = value => {
48
48
  };
49
49
  const string = value => {
50
50
  const type = getType(value);
51
- if (type !== String) {
51
+ if (type !== String$1) {
52
52
  throw new AssertionError('expected value to be of type string');
53
53
  }
54
54
  };
@@ -604,10 +604,10 @@ const execute = (command, ...args) => {
604
604
 
605
605
  const Two$1 = '2.0';
606
606
  const callbacks = Object.create(null);
607
- const get$5 = id => {
607
+ const get$6 = id => {
608
608
  return callbacks[id];
609
609
  };
610
- const remove$1 = id => {
610
+ const remove$2 = id => {
611
611
  delete callbacks[id];
612
612
  };
613
613
  class JsonRpcError extends Error {
@@ -753,14 +753,14 @@ const warn$1 = (...args) => {
753
753
  console.warn(...args);
754
754
  };
755
755
  const resolve = (id, response) => {
756
- const fn = get$5(id);
756
+ const fn = get$6(id);
757
757
  if (!fn) {
758
758
  console.log(response);
759
759
  warn$1(`callback ${id} may already be disposed`);
760
760
  return;
761
761
  }
762
762
  fn(response);
763
- remove$1(id);
763
+ remove$2(id);
764
764
  };
765
765
  const E_COMMAND_NOT_FOUND = 'E_COMMAND_NOT_FOUND';
766
766
  const getErrorType = prettyError => {
@@ -1212,13 +1212,13 @@ const createMockRpc = ({
1212
1212
  };
1213
1213
 
1214
1214
  const rpcs$2 = Object.create(null);
1215
- const set$8 = (id, rpc) => {
1215
+ const set$9 = (id, rpc) => {
1216
1216
  rpcs$2[id] = rpc;
1217
1217
  };
1218
- const get$4 = id => {
1218
+ const get$5 = id => {
1219
1219
  return rpcs$2[id];
1220
1220
  };
1221
- const remove = id => {
1221
+ const remove$1 = id => {
1222
1222
  delete rpcs$2[id];
1223
1223
  };
1224
1224
 
@@ -1226,18 +1226,18 @@ const remove = id => {
1226
1226
  const create$1 = rpcId => {
1227
1227
  return {
1228
1228
  async dispose() {
1229
- const rpc = get$4(rpcId);
1229
+ const rpc = get$5(rpcId);
1230
1230
  await rpc.dispose();
1231
1231
  },
1232
1232
  // @ts-ignore
1233
1233
  invoke(method, ...params) {
1234
- const rpc = get$4(rpcId);
1234
+ const rpc = get$5(rpcId);
1235
1235
  // @ts-ignore
1236
1236
  return rpc.invoke(method, ...params);
1237
1237
  },
1238
1238
  // @ts-ignore
1239
1239
  invokeAndTransfer(method, ...params) {
1240
- const rpc = get$4(rpcId);
1240
+ const rpc = get$5(rpcId);
1241
1241
  // @ts-ignore
1242
1242
  return rpc.invokeAndTransfer(method, ...params);
1243
1243
  },
@@ -1245,16 +1245,16 @@ const create$1 = rpcId => {
1245
1245
  const mockRpc = createMockRpc({
1246
1246
  commandMap
1247
1247
  });
1248
- set$8(rpcId, mockRpc);
1248
+ set$9(rpcId, mockRpc);
1249
1249
  // @ts-ignore
1250
1250
  mockRpc[Symbol.dispose] = () => {
1251
- remove(rpcId);
1251
+ remove$1(rpcId);
1252
1252
  };
1253
1253
  // @ts-ignore
1254
1254
  return mockRpc;
1255
1255
  },
1256
1256
  set(rpc) {
1257
- set$8(rpcId, rpc);
1257
+ set$9(rpcId, rpc);
1258
1258
  }
1259
1259
  };
1260
1260
  };
@@ -1274,7 +1274,7 @@ const {
1274
1274
  invoke: invoke$5,
1275
1275
  invokeAndTransfer: invokeAndTransfer$2,
1276
1276
  registerMockRpc,
1277
- set: set$7
1277
+ set: set$8
1278
1278
  } = create$1(ExtensionHostWorker);
1279
1279
  const executeReferenceProvider = async (id, offset) => {
1280
1280
  // @ts-ignore
@@ -1303,12 +1303,12 @@ const ExtensionHost = {
1303
1303
  invoke: invoke$5,
1304
1304
  invokeAndTransfer: invokeAndTransfer$2,
1305
1305
  registerMockRpc,
1306
- set: set$7
1306
+ set: set$8
1307
1307
  };
1308
1308
 
1309
1309
  const {
1310
1310
  invoke: invoke$4,
1311
- set: set$6
1311
+ set: set$7
1312
1312
  } = create$1(FileSystemWorker);
1313
1313
  const readFile = async uri => {
1314
1314
  return invoke$4('FileSystem.readFile', uri);
@@ -1323,7 +1323,7 @@ const exists = async uri => {
1323
1323
  const {
1324
1324
  invoke: invoke$3,
1325
1325
  invokeAndTransfer: invokeAndTransfer$1,
1326
- set: set$5
1326
+ set: set$6
1327
1327
  } = create$1(RendererWorker);
1328
1328
  const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
1329
1329
  const command = 'IconTheme.handleMessagePort';
@@ -1344,7 +1344,7 @@ const sendMessagePortToSharedProcess = async port => {
1344
1344
 
1345
1345
  const {
1346
1346
  invoke: invoke$2,
1347
- set: set$4
1347
+ set: set$5
1348
1348
  } = create$1(SharedProcess);
1349
1349
 
1350
1350
  const create = () => {
@@ -1391,16 +1391,18 @@ const createEmptyRuntimeStatus = id => {
1391
1391
  status: None
1392
1392
  };
1393
1393
  };
1394
- let extensionsState = createInitialState();
1395
- const get$3 = () => {
1396
- return extensionsState;
1394
+ const state$1 = {
1395
+ extensionsState: createInitialState()
1397
1396
  };
1398
- const set$3 = newState => {
1399
- extensionsState = newState;
1397
+ const get$4 = () => {
1398
+ return state$1.extensionsState;
1399
+ };
1400
+ const set$4 = newState => {
1401
+ state$1.extensionsState = newState;
1400
1402
  };
1401
1403
  const update = newState => {
1402
- set$3({
1403
- ...extensionsState,
1404
+ set$4({
1405
+ ...state$1.extensionsState,
1404
1406
  ...newState
1405
1407
  });
1406
1408
  };
@@ -1410,11 +1412,11 @@ const setPlatform = platform => {
1410
1412
  });
1411
1413
  };
1412
1414
  const hasWebExtensionUri = uri => {
1413
- return extensionsState.webExtensions.some(extension => extension.uri === uri);
1415
+ return state$1.extensionsState.webExtensions.some(extension => extension.uri === uri);
1414
1416
  };
1415
1417
  const addWebExtension$1 = extension => {
1416
1418
  update({
1417
- webExtensions: [...extensionsState.webExtensions, extension]
1419
+ webExtensions: [...state$1.extensionsState.webExtensions, extension]
1418
1420
  });
1419
1421
  };
1420
1422
  const clearCachedExtensions = () => {
@@ -1425,7 +1427,7 @@ const clearCachedExtensions = () => {
1425
1427
  const setRuntimeStatus = status => {
1426
1428
  update({
1427
1429
  runtimeStatuses: {
1428
- ...extensionsState.runtimeStatuses,
1430
+ ...state$1.extensionsState.runtimeStatuses,
1429
1431
  [status.id]: {
1430
1432
  ...status
1431
1433
  }
@@ -1433,7 +1435,7 @@ const setRuntimeStatus = status => {
1433
1435
  });
1434
1436
  };
1435
1437
  const updateRuntimeStatus = (id, statusUpdate) => {
1436
- const previousStatus = extensionsState.runtimeStatuses[id] || createEmptyRuntimeStatus(id);
1438
+ const previousStatus = state$1.extensionsState.runtimeStatuses[id] || createEmptyRuntimeStatus(id);
1437
1439
  setRuntimeStatus({
1438
1440
  ...previousStatus,
1439
1441
  ...statusUpdate,
@@ -1441,7 +1443,7 @@ const updateRuntimeStatus = (id, statusUpdate) => {
1441
1443
  });
1442
1444
  };
1443
1445
  const getRuntimeStatus$1 = extensionId => {
1444
- return extensionsState.runtimeStatuses[extensionId];
1446
+ return state$1.extensionsState.runtimeStatuses[extensionId];
1445
1447
  };
1446
1448
 
1447
1449
  const baseName = path => {
@@ -1555,13 +1557,13 @@ const activateExtension2 = async (extensionId, extension, absolutePath, extensio
1555
1557
  const commandMapRef = {};
1556
1558
 
1557
1559
  const rpcs$1 = Object.create(null);
1558
- const get$2 = extensionId => {
1560
+ const get$3 = extensionId => {
1559
1561
  return rpcs$1[extensionId];
1560
1562
  };
1561
1563
  const getAll = () => {
1562
1564
  return Object.values(rpcs$1);
1563
1565
  };
1564
- const set$2 = (extensionId, rpc) => {
1566
+ const set$3 = (extensionId, rpc) => {
1565
1567
  rpcs$1[extensionId] = rpc;
1566
1568
  };
1567
1569
 
@@ -1583,12 +1585,12 @@ const createIsolatedExtensionHostWorker = async (extensionId, absolutePath, crea
1583
1585
  });
1584
1586
  };
1585
1587
  const getOrCreateIsolatedExtensionHostWorker = async (extensionId, absolutePath) => {
1586
- const existingRpc = get$2(extensionId);
1588
+ const existingRpc = get$3(extensionId);
1587
1589
  if (existingRpc) {
1588
1590
  return existingRpc;
1589
1591
  }
1590
1592
  const rpc = await createIsolatedExtensionHostWorker(extensionId, absolutePath, create$7, invokeAndTransfer);
1591
- set$2(extensionId, rpc);
1593
+ set$3(extensionId, rpc);
1592
1594
  return rpc;
1593
1595
  };
1594
1596
 
@@ -1596,7 +1598,7 @@ const rpcs = Object.create(null);
1596
1598
  const add = (id, rpc) => {
1597
1599
  rpcs[id] = rpc;
1598
1600
  };
1599
- const get$1 = id => {
1601
+ const get$2 = id => {
1600
1602
  return rpcs[id];
1601
1603
  };
1602
1604
 
@@ -1619,13 +1621,13 @@ const handleRpcInfos = (extension, platform) => {
1619
1621
  return;
1620
1622
  }
1621
1623
  const rpcs = extension.rpc;
1622
- const urlPrefix = getUrlPrefix(platform, extension.path);
1623
1624
  if (!rpcs) {
1624
1625
  return;
1625
1626
  }
1626
1627
  if (!Array.isArray(rpcs)) {
1627
1628
  return;
1628
1629
  }
1630
+ const urlPrefix = getUrlPrefix(platform, extension.path);
1629
1631
  for (const rpc of rpcs) {
1630
1632
  rpc.url = `${urlPrefix}/${rpc.url}`;
1631
1633
  add(rpc.id, rpc);
@@ -1701,9 +1703,9 @@ const activateExtension3 = async (extension, absolutePath, activationEvent, plat
1701
1703
  const getExtensionAbsolutePath = (id, isWeb, isBuiltin, path, relativePath, origin, platform, assetDir) => {
1702
1704
  if (path.startsWith('http')) {
1703
1705
  if (path.endsWith('/')) {
1704
- return new URL(relativePath, path).toString();
1706
+ return new URL(relativePath, path).href;
1705
1707
  }
1706
- return new URL(relativePath, path + '/').toString();
1708
+ return new URL(relativePath, path + '/').href;
1707
1709
  }
1708
1710
  if (!path.startsWith('/')) {
1709
1711
  path = '/' + path;
@@ -1717,7 +1719,7 @@ const getExtensionAbsolutePath = (id, isWeb, isBuiltin, path, relativePath, orig
1717
1719
  if (isBuiltin) {
1718
1720
  return `${assetDir}/extensions/${id}/${relativePath}`;
1719
1721
  }
1720
- return new URL('/remote' + path + '/' + relativePath, origin).toString();
1722
+ return new URL('/remote' + path + '/' + relativePath, origin).href;
1721
1723
  };
1722
1724
 
1723
1725
  const getJson$1 = async url => {
@@ -1766,7 +1768,7 @@ const getAllExtensionsWithState = async (extensionsState, assetDir, platform) =>
1766
1768
  };
1767
1769
 
1768
1770
  const getAllExtensions = async (assetDir, platform) => {
1769
- return getAllExtensionsWithState(get$3(), assetDir, platform);
1771
+ return getAllExtensionsWithState(get$4(), assetDir, platform);
1770
1772
  };
1771
1773
 
1772
1774
  const activatingExtensions = Object.create(null);
@@ -1780,6 +1782,15 @@ const getExtensionId$2 = extension => {
1780
1782
  const getAbsolutePath$1 = (extension, assetDir, platform) => {
1781
1783
  return getExtensionAbsolutePath(extension.id, extension.isWeb, extension.builtin, extension.path || extension.uri, extension.browser, globalThis.location.origin, platform, assetDir);
1782
1784
  };
1785
+ const doActivateExtension = async (extension, absolutePath, event, platform) => {
1786
+ const extensionId = getExtensionId$2(extension);
1787
+ try {
1788
+ await activateExtension3(extension, absolutePath, event, platform);
1789
+ runningExtensions[extensionId] = true;
1790
+ } finally {
1791
+ delete activatingExtensions[extensionId];
1792
+ }
1793
+ };
1783
1794
  const activateExtension = async (extension, event, assetDir, platform) => {
1784
1795
  const extensionId = getExtensionId$2(extension);
1785
1796
  if (runningExtensions[extensionId]) {
@@ -1787,11 +1798,7 @@ const activateExtension = async (extension, event, assetDir, platform) => {
1787
1798
  }
1788
1799
  if (!Object.hasOwn(activatingExtensions, extensionId)) {
1789
1800
  const absolutePath = getAbsolutePath$1(extension, assetDir, platform);
1790
- activatingExtensions[extensionId] = activateExtension3(extension, absolutePath, event, platform).then(() => {
1791
- runningExtensions[extensionId] = true;
1792
- }).finally(() => {
1793
- delete activatingExtensions[extensionId];
1794
- });
1801
+ activatingExtensions[extensionId] = doActivateExtension(extension, absolutePath, event, platform);
1795
1802
  }
1796
1803
  await activatingExtensions[extensionId];
1797
1804
  };
@@ -1826,15 +1833,17 @@ const getWebManifestPath = path => {
1826
1833
  return manifestPath;
1827
1834
  };
1828
1835
 
1829
- let rpc;
1830
- const set$1 = value => {
1831
- rpc = value;
1836
+ const state = {
1837
+ rpc: undefined
1838
+ };
1839
+ const set$2 = value => {
1840
+ state.rpc = value;
1832
1841
  };
1833
1842
  const invoke = async (method, ...params) => {
1834
- if (!rpc) {
1843
+ if (!state.rpc) {
1835
1844
  return undefined;
1836
1845
  }
1837
- return rpc.invoke(method, ...params);
1846
+ return state.rpc.invoke(method, ...params);
1838
1847
  };
1839
1848
 
1840
1849
  const handleChange = async id => {
@@ -1879,7 +1888,7 @@ const createWebViewWorkerRpc2 = async (rpcInfo, port) => {
1879
1888
  };
1880
1889
 
1881
1890
  const getExtensionHostSubWorkerUrl = () => {
1882
- return new URL('../../../../extension-host-sub-worker/src/extensionHostSubWorkerMain.js', import.meta.url).toString();
1891
+ return new URL('../../../../extension-host-sub-worker/src/extensionHostSubWorkerMain.js', import.meta.url).href;
1883
1892
  };
1884
1893
  const extensionHostSubWorkerUrl = getExtensionHostSubWorkerUrl();
1885
1894
 
@@ -1915,7 +1924,7 @@ const createResponseFromData = data => {
1915
1924
  const responseString = JSON.stringify(data);
1916
1925
  const response = new Response(responseString, {
1917
1926
  headers: {
1918
- [ContentLength]: `${responseString.length}`,
1927
+ [ContentLength]: String(responseString.length),
1919
1928
  [ContentType]: 'application/json'
1920
1929
  }
1921
1930
  });
@@ -1949,13 +1958,13 @@ const disabledExtensionsCacheKey = '/cache/disabledExtensions.json';
1949
1958
  const disableExtension2$1 = async (id, platform) => {
1950
1959
  const isTest = platform === Test;
1951
1960
  const isWeb = platform === Web;
1952
- const oldState = get$3(); // TODO maybe pass in an application id? Would allow multiple editors with different extensions.
1961
+ const oldState = get$4(); // TODO maybe pass in an application id? Would allow multiple editors with different extensions.
1953
1962
  if (isTest) {
1954
1963
  const newState = {
1955
1964
  ...oldState,
1956
1965
  disabledIds: [...oldState.disabledIds, id]
1957
1966
  };
1958
- set$3(newState);
1967
+ set$4(newState);
1959
1968
  } else if (isWeb) {
1960
1969
  const cached = await getJson(disabledExtensionsCacheKey);
1961
1970
  const oldDisabled = cached?.disabledExtensions || [];
@@ -1971,13 +1980,13 @@ const disableExtension2$1 = async (id, platform) => {
1971
1980
  const enableExtension2$1 = async (id, platform) => {
1972
1981
  const isTest = platform === Test;
1973
1982
  const isWeb = platform === Web;
1974
- const oldState = get$3();
1983
+ const oldState = get$4();
1975
1984
  if (isTest) {
1976
1985
  const newState = {
1977
1986
  ...oldState,
1978
1987
  disabledIds: oldState.disabledIds.filter(existing => existing !== id)
1979
1988
  };
1980
- set$3(newState);
1989
+ set$4(newState);
1981
1990
  } else if (isWeb) {
1982
1991
  const cached = await getJson(disabledExtensionsCacheKey);
1983
1992
  const oldDisabled = cached?.disabledExtensions || [];
@@ -2006,7 +2015,7 @@ const disableExtension2 = async (id, platform) => {
2006
2015
  };
2007
2016
 
2008
2017
  const disableExtension = async (id, isTest) => {
2009
- const oldState = get$3();
2018
+ const oldState = get$4();
2010
2019
  return disableExtension2(id, oldState.platform);
2011
2020
  };
2012
2021
 
@@ -2033,7 +2042,7 @@ const enableExtension2 = async (id, platform) => {
2033
2042
  };
2034
2043
 
2035
2044
  const enableExtension = async (id, isTest) => {
2036
- const oldState = get$3();
2045
+ const oldState = get$4();
2037
2046
  return enableExtension2(id, oldState.platform);
2038
2047
  };
2039
2048
 
@@ -2055,12 +2064,12 @@ const getRpcForCommand = async (extensionsState, id, platform) => {
2055
2064
  return undefined;
2056
2065
  }
2057
2066
  const extensionId = getExtensionId$1(extension);
2058
- const existingRpc = get$2(extensionId);
2067
+ const existingRpc = get$3(extensionId);
2059
2068
  if (existingRpc) {
2060
2069
  return existingRpc;
2061
2070
  }
2062
2071
  await activateByEvent(`onCommand:${id}`, '', platform);
2063
- return get$2(extensionId);
2072
+ return get$3(extensionId);
2064
2073
  };
2065
2074
  const executeRendererCommand = (id, args) => {
2066
2075
  return invoke$3(id, ...args);
@@ -2088,7 +2097,7 @@ const getAbsolutePath = (extension, assetDir, platform) => {
2088
2097
  };
2089
2098
  const getRpc$1 = async (extension, assetDir, platform) => {
2090
2099
  const extensionId = getExtensionId(extension);
2091
- const existingRpc = get$2(extensionId);
2100
+ const existingRpc = get$3(extensionId);
2092
2101
  if (existingRpc) {
2093
2102
  return existingRpc;
2094
2103
  }
@@ -2201,6 +2210,67 @@ const executeHoverProvider = async (extensionsState, textDocument, ...args) => {
2201
2210
  return results[0];
2202
2211
  };
2203
2212
 
2213
+ const instances = Object.create(null);
2214
+ const set$1 = (uid, instance) => {
2215
+ instances[uid] = instance;
2216
+ };
2217
+ const get$1 = uid => {
2218
+ return instances[uid];
2219
+ };
2220
+ const remove = uid => {
2221
+ delete instances[uid];
2222
+ };
2223
+
2224
+ const hasView = (extension, viewId) => {
2225
+ return Array.isArray(extension.views) && extension.views.some(view => view.id === viewId);
2226
+ };
2227
+ const getExtensionForView = async (viewId, assetDir, platform) => {
2228
+ const extensions = await getAllExtensions(assetDir, platform);
2229
+ const extension = extensions.find(extension => isExtensionIsolated(extension) && hasView(extension, viewId));
2230
+ if (!extension) {
2231
+ throw new Error(`view ${viewId} not found`);
2232
+ }
2233
+ return extension;
2234
+ };
2235
+ const getRpcForView = async (viewId, assetDir, platform) => {
2236
+ const extension = await getExtensionForView(viewId, assetDir, platform);
2237
+ const existingRpc = get$3(getExtensionId(extension));
2238
+ if (existingRpc) {
2239
+ return existingRpc;
2240
+ }
2241
+ await activateByEvent(`onView:${viewId}`, assetDir, platform);
2242
+ return getRpc$1(extension, assetDir, platform);
2243
+ };
2244
+ const getRpcForInstance = async (viewId, uid, assetDir, platform) => {
2245
+ const instance = get$1(uid);
2246
+ if (instance) {
2247
+ return instance.rpc;
2248
+ }
2249
+ return getRpcForView(viewId, assetDir, platform);
2250
+ };
2251
+ const createViewInstance = async (viewId, uid, context, assetDir, platform) => {
2252
+ const rpc = await getRpcForView(viewId, assetDir, platform);
2253
+ const result = await rpc.invoke('ExtensionApi.createViewInstance', viewId, uid, context);
2254
+ set$1(uid, {
2255
+ rpc,
2256
+ viewId
2257
+ });
2258
+ return result;
2259
+ };
2260
+ const dispatchViewEvent = async (viewId, uid, event, assetDir, platform) => {
2261
+ const rpc = await getRpcForInstance(viewId, uid, assetDir, platform);
2262
+ return rpc.invoke('ExtensionApi.dispatchViewEvent', uid, event);
2263
+ };
2264
+ const disposeViewInstance = async (viewId, uid, assetDir, platform) => {
2265
+ const rpc = await getRpcForInstance(viewId, uid, assetDir, platform);
2266
+ await rpc.invoke('ExtensionApi.disposeViewInstance', uid);
2267
+ remove(uid);
2268
+ };
2269
+ const saveViewInstanceState = async (viewId, uid, assetDir, platform) => {
2270
+ const rpc = await getRpcForInstance(viewId, uid, assetDir, platform);
2271
+ return rpc.invoke('ExtensionApi.saveViewInstanceState', uid);
2272
+ };
2273
+
2204
2274
  /* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
2205
2275
  const warn = (...args) => {
2206
2276
  console.warn(...args);
@@ -2349,16 +2419,21 @@ const join = (pathSeparator, ...parts) => {
2349
2419
  return parts.join(pathSeparator);
2350
2420
  };
2351
2421
 
2422
+ const getColorThemeUriFromExtension = (extension, colorThemeId) => {
2423
+ if (!extension.colorThemes) {
2424
+ return '';
2425
+ }
2426
+ for (const colorTheme of extension.colorThemes) {
2427
+ if (colorTheme.id === colorThemeId) {
2428
+ return join('/', extension.uri, colorTheme.path);
2429
+ }
2430
+ }
2431
+ return '';
2432
+ };
2352
2433
  const getColorThemeUri = (extensions, colorThemeId) => {
2353
2434
  for (const extension of extensions) {
2354
- if (!extension.colorThemes) {
2355
- continue;
2356
- }
2357
- for (const colorTheme of extension.colorThemes) {
2358
- if (colorTheme.id !== colorThemeId) {
2359
- continue;
2360
- }
2361
- const absolutePath = join('/', extension.uri, colorTheme.path);
2435
+ const absolutePath = getColorThemeUriFromExtension(extension, colorThemeId);
2436
+ if (absolutePath) {
2362
2437
  return absolutePath;
2363
2438
  }
2364
2439
  }
@@ -2428,7 +2503,7 @@ const getColorThemeNames = async (assetDir, platform) => {
2428
2503
  };
2429
2504
 
2430
2505
  const getDynamicWebExtensions = () => {
2431
- return get$3().webExtensions;
2506
+ return get$4().webExtensions;
2432
2507
  };
2433
2508
 
2434
2509
  const getExtension = async (id, assetDir, platform) => {
@@ -2498,7 +2573,7 @@ const getRemoteUrlForWebView = async (uri, options = {}) => {
2498
2573
  };
2499
2574
 
2500
2575
  const getRpcInfo = rpcId => {
2501
- const info = get$1(rpcId);
2576
+ const info = get$2(rpcId);
2502
2577
  if (!info) {
2503
2578
  throw new Error(`Rpc not found ${rpcId}`);
2504
2579
  }
@@ -2558,6 +2633,7 @@ const toView = (extension, registeredView, assetDir, platform) => {
2558
2633
  icon: registeredView.icon || manifestView?.icon || '',
2559
2634
  id,
2560
2635
  iframe: getIframe(extension, manifestView, assetDir, platform),
2636
+ kind: registeredView.kind || manifestView?.kind || '',
2561
2637
  title: registeredView.title || manifestView?.title || id
2562
2638
  };
2563
2639
  };
@@ -2590,7 +2666,7 @@ const handleMessagePort = async (port, rpcId) => {
2590
2666
  messagePort: port
2591
2667
  });
2592
2668
  if (rpcId === StatusBarWorker) {
2593
- set$1(rpc);
2669
+ set$2(rpc);
2594
2670
  }
2595
2671
  };
2596
2672
 
@@ -2623,7 +2699,7 @@ const getRpc = async platform => {
2623
2699
  const initializeSharedProcess = async platform => {
2624
2700
  const rpc = await getRpc(platform);
2625
2701
  if (rpc) {
2626
- set$4(rpc);
2702
+ set$5(rpc);
2627
2703
  }
2628
2704
  };
2629
2705
 
@@ -2700,7 +2776,7 @@ const uninstallExtension = async () => {
2700
2776
 
2701
2777
  const wrapCommand = command => {
2702
2778
  return (...args) => {
2703
- return command(get$3(), ...args);
2779
+ return command(get$4(), ...args);
2704
2780
  };
2705
2781
  };
2706
2782
  const commandMap = {
@@ -2708,10 +2784,13 @@ const commandMap = {
2708
2784
  'Extensions.activate3': activateExtension3,
2709
2785
  'Extensions.activateByEvent': activateByEvent,
2710
2786
  'Extensions.addWebExtension': addWebExtension,
2787
+ 'Extensions.createViewInstance': createViewInstance,
2711
2788
  'Extensions.createWebViewWorkerRpc': createWebViewWorkerRpc,
2712
2789
  'Extensions.createWebViewWorkerRpc2': createWebViewWorkerRpc2,
2713
2790
  'Extensions.disable': disableExtension,
2714
2791
  'Extensions.disable2': disableExtension2,
2792
+ 'Extensions.dispatchViewEvent': dispatchViewEvent,
2793
+ 'Extensions.disposeViewInstance': disposeViewInstance,
2715
2794
  'Extensions.enable': enableExtension,
2716
2795
  'Extensions.enable2': enableExtension2,
2717
2796
  'Extensions.executeCommand': wrapCommand(executeCommand),
@@ -2738,6 +2817,7 @@ const commandMap = {
2738
2817
  'Extensions.initialize': initialize,
2739
2818
  'Extensions.install': installExtension,
2740
2819
  'Extensions.invalidateExtensionsCache': invalidateExtensionsCache,
2820
+ 'Extensions.saveViewInstanceState': saveViewInstanceState,
2741
2821
  'Extensions.uninstall': uninstallExtension,
2742
2822
  'StatusBar.handleChange': handleChange
2743
2823
  };
@@ -2749,7 +2829,7 @@ const initializeExtensionHostWorker = async () => {
2749
2829
  await sendMessagePortToExtensionHostWorker(port, 0);
2750
2830
  }
2751
2831
  });
2752
- set$7(rpc);
2832
+ set$8(rpc);
2753
2833
  };
2754
2834
 
2755
2835
  const initializeFileSystemWorker = async () => {
@@ -2759,7 +2839,7 @@ const initializeFileSystemWorker = async () => {
2759
2839
  await sendMessagePortToFileSystemWorker(port, 0);
2760
2840
  }
2761
2841
  });
2762
- set$6(rpc);
2842
+ set$7(rpc);
2763
2843
  };
2764
2844
 
2765
2845
  const initializeIframeWorker = async () => {
@@ -2776,7 +2856,7 @@ const initializeRendererWorker = async () => {
2776
2856
  const rpc = await create$2({
2777
2857
  commandMap: commandMap
2778
2858
  });
2779
- set$5(rpc);
2859
+ set$6(rpc);
2780
2860
  };
2781
2861
 
2782
2862
  const listen = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-management-worker",
3
- "version": "4.5.0",
3
+ "version": "4.7.0",
4
4
  "description": "Webworker for the Extension Management functionality in Lvce Editor.",
5
5
  "keywords": [
6
6
  "web-worker"