@lvce-editor/extension-host-worker 3.20.0 → 4.0.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.
@@ -1556,7 +1556,8 @@ class IpcParentWithMessagePort extends Ipc {
1556
1556
  this._rawIpc.postMessage(message);
1557
1557
  }
1558
1558
  sendAndTransfer(message) {
1559
- throw new Error('not implemented');
1559
+ const transfer = getTransferrables(message);
1560
+ this._rawIpc.postMessage(message, transfer);
1560
1561
  }
1561
1562
  dispose() {
1562
1563
  this._rawIpc.close();
@@ -3642,52 +3643,24 @@ const getAssetDir = () => {
3642
3643
  };
3643
3644
  const assetDir = getAssetDir();
3644
3645
 
3645
- const webExtensionsUrl = `${assetDir}/config/webExtensions.json`;
3646
+ const extensionsUrl = `${assetDir}/config/extensions.json`;
3646
3647
 
3647
- const getSharedProcessExtensions$1 = () => {
3648
- return invoke$2(/* ExtensionManagement.getExtensions */'ExtensionManagement.getExtensions');
3649
- };
3650
- const getStaticWebExtensions = () => {
3651
- return getJson(webExtensionsUrl);
3652
- };
3653
- const getWebExtensionsWeb = async () => {
3654
- const staticWebExtensions = await getStaticWebExtensions();
3655
- return [...staticWebExtensions, ...state$5.webExtensions];
3656
- };
3657
- const isWebExtension = extension => {
3658
- return extension && typeof extension.browser === 'string';
3659
- };
3660
- const getWebExtensionsDefault = async () => {
3661
- const staticWebExtensions = await getStaticWebExtensions();
3662
- const sharedProcessExtensions = await getSharedProcessExtensions$1();
3663
- const sharedProcessWebExtensions = sharedProcessExtensions.filter(isWebExtension);
3664
- return [...staticWebExtensions, sharedProcessWebExtensions, ...state$5.webExtensions];
3665
- };
3666
3648
  const getWebExtensions = async () => {
3667
- try {
3668
- switch (platform) {
3669
- case Web:
3670
- return await getWebExtensionsWeb();
3671
- default:
3672
- return await getWebExtensionsDefault();
3673
- }
3674
- } catch {
3675
- return state$5.webExtensions;
3676
- }
3649
+ return getJson(extensionsUrl);
3677
3650
  };
3678
3651
 
3679
3652
  const getSharedProcessExtensions = () => {
3680
3653
  return invoke$2(/* ExtensionManagement.getExtensions */'ExtensionManagement.getExtensions');
3681
3654
  };
3682
3655
  const doGetExtensions = async () => {
3656
+ const meta = state$5.webExtensions;
3683
3657
  if (platform === Web) {
3684
3658
  const webExtensions = await getWebExtensions();
3685
- return webExtensions;
3659
+ return [...webExtensions, ...meta];
3686
3660
  }
3687
3661
  if (platform === Remote) {
3688
- const webExtensions = await getWebExtensions();
3689
3662
  const sharedProcessExtensions = await getSharedProcessExtensions();
3690
- return [...sharedProcessExtensions, ...webExtensions];
3663
+ return [...sharedProcessExtensions(), ...meta];
3691
3664
  }
3692
3665
  const extensions = await getSharedProcessExtensions();
3693
3666
  return extensions;
@@ -4710,6 +4683,26 @@ const getFiles = () => {
4710
4683
  return state$2.files;
4711
4684
  };
4712
4685
 
4686
+ const getExtensionColorThemeNames = extension => {
4687
+ return extension.colorThemes || [];
4688
+ };
4689
+ const getColorThemeId = colorTheme => {
4690
+ return colorTheme.id;
4691
+ };
4692
+
4693
+ // TODO should send names to renderer worker or names with ids?
4694
+ const getColorThemeNamesFromExtensions = async extensions => {
4695
+ const colorThemes = extensions.flatMap(getExtensionColorThemeNames);
4696
+ const colorThemeNames = colorThemes.map(getColorThemeId);
4697
+ return colorThemeNames;
4698
+ };
4699
+
4700
+ const getColorThemeNames = async () => {
4701
+ const extensions = await getExtensions();
4702
+ const colorThemeNames = getColorThemeNamesFromExtensions(extensions);
4703
+ return colorThemeNames;
4704
+ };
4705
+
4713
4706
  const findMatchingIconThemeExtension = (extensions, iconThemeId) => {
4714
4707
  for (const extension of extensions) {
4715
4708
  if (extension && extension.iconThemes) {
@@ -4730,7 +4723,7 @@ const getIconThemeUrl = iconThemeId => {
4730
4723
  return `${assetDir}/extensions/builtin.${iconThemeId}/icon-theme.json`;
4731
4724
  };
4732
4725
 
4733
- const getIconThemeJson = async iconThemeId => {
4726
+ const getIconThemeJson$1 = async iconThemeId => {
4734
4727
  if (platform === Web) {
4735
4728
  const url = getIconThemeUrl(iconThemeId);
4736
4729
  const json = await getJson(url);
@@ -4765,6 +4758,10 @@ const getIconThemeJson = async iconThemeId => {
4765
4758
  };
4766
4759
  };
4767
4760
 
4761
+ const getIconThemeJson = async iconThemeId => {
4762
+ return getIconThemeJson$1(iconThemeId);
4763
+ };
4764
+
4768
4765
  const getRpcInfo = rpcId => {
4769
4766
  const info = get$7(rpcId);
4770
4767
  if (!info) {
@@ -5357,6 +5354,7 @@ const commandMap = {
5357
5354
  'BulkReplacement.applyBulkReplacement': applyBulkReplacement,
5358
5355
  'ColorTheme.getColorThemeCssFromJson': getColorThemeCssFromJson,
5359
5356
  'ColorTheme.getColorThemeJson': getColorThemeJson,
5357
+ 'ColorTheme.getColorThemeNames': getColorThemeNames,
5360
5358
  'ColorTheme.hydrate': hydrate$1,
5361
5359
  'ExtensionHost.launchIframeWorker': launchIframeWorker,
5362
5360
  'ExtensionHostRename.executeprepareRenameProvider': executeprepareRenameProvider,
@@ -5465,11 +5463,21 @@ const listen = async () => {
5465
5463
  };
5466
5464
 
5467
5465
  const main = async () => {
5466
+ const start = performance.timeOrigin;
5467
+ const a = performance.now();
5468
5468
  setup({
5469
5469
  errorConstructor: Error,
5470
5470
  global: globalThis
5471
5471
  });
5472
5472
  await listen();
5473
+ const e = performance.now();
5474
+ console.log({
5475
+ times: {
5476
+ start,
5477
+ a,
5478
+ e
5479
+ }
5480
+ });
5473
5481
  };
5474
5482
 
5475
5483
  main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-host-worker",
3
- "version": "3.20.0",
3
+ "version": "4.0.0",
4
4
  "description": "Webworker for the extension host functionality in Lvce Editor.",
5
5
  "main": "dist/extensionHostWorkerMain.js",
6
6
  "type": "module",