@lvce-editor/extension-search-view 7.25.0 → 7.27.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.
@@ -651,6 +651,9 @@ const restoreExistingError = (error, currentStack) => {
651
651
  };
652
652
  const restoreMethodNotFoundError = (error, currentStack) => {
653
653
  const restoredError = new JsonRpcError(error.message);
654
+ Object.assign(restoredError, {
655
+ code: error.code
656
+ });
654
657
  const parentStack = getParentStack(error);
655
658
  setStack(restoredError, `${parentStack}${NewLine}${currentStack}`);
656
659
  return restoredError;
@@ -670,9 +673,13 @@ const applyDataProperties = (restoredError, error) => {
670
673
  // @ts-ignore
671
674
  restoredError.codeFrame = error.data.codeFrame;
672
675
  }
673
- if (error.data.code) {
676
+ if (typeof error.data.code === 'string' || typeof error.data.code === 'number') {
674
677
  // @ts-ignore
675
- restoredError.code = error.data.code;
678
+ Object.defineProperty(restoredError, 'code', {
679
+ configurable: true,
680
+ value: error.data.code,
681
+ writable: true
682
+ });
676
683
  }
677
684
  if (error.data.type) {
678
685
  // @ts-ignore
@@ -694,6 +701,13 @@ const applyDirectProperties = (restoredError, error) => {
694
701
  };
695
702
  const restoreMessageError = (error, _currentStack) => {
696
703
  const restoredError = constructError(error.message, error.type, error.name);
704
+ if (typeof error.code === 'string' || typeof error.code === 'number') {
705
+ Object.defineProperty(restoredError, 'code', {
706
+ configurable: true,
707
+ value: error.code,
708
+ writable: true
709
+ });
710
+ }
697
711
  if (error.data) {
698
712
  applyDataProperties(restoredError, error);
699
713
  } else {
@@ -772,7 +786,7 @@ const getErrorProperty = (error, prettyError) => {
772
786
  return {
773
787
  code: Custom,
774
788
  data: {
775
- code: prettyError.code,
789
+ code: prettyError.code ?? error?.code,
776
790
  codeFrame: prettyError.codeFrame,
777
791
  name: prettyError.name,
778
792
  stack: getStack(prettyError),
@@ -809,7 +823,12 @@ const getErrorResponseSimple = (id, error) => {
809
823
  return {
810
824
  error: {
811
825
  code: Custom,
812
- data: error,
826
+ data: error instanceof Error ? {
827
+ ...error,
828
+ code: 'code' in error ? error.code : undefined,
829
+ stack: error.stack,
830
+ type: error.name
831
+ } : error,
813
832
  // @ts-ignore
814
833
  message: error.message
815
834
  },
@@ -1383,6 +1402,12 @@ const disableWorkspace$2 = id => {
1383
1402
  const uninstall$2 = id => {
1384
1403
  return invoke$3(`Extensions.uninstall`, id);
1385
1404
  };
1405
+ const enableWorkspace$2 = id => {
1406
+ return invoke$3('Extensions.enableWorkspace', id);
1407
+ };
1408
+ const getAllExtensions$1 = (assetDir, platform) => {
1409
+ return invoke$3('Extensions.getAllExtensions', assetDir, platform);
1410
+ };
1386
1411
 
1387
1412
  const {
1388
1413
  invoke: invoke$2,
@@ -1789,7 +1814,6 @@ const Downloads = 'Downloads';
1789
1814
  const Version = 'Version';
1790
1815
  const Publisher = 'Publisher';
1791
1816
  const Rating = 'Rating';
1792
- const MarketplaceLink = 'Marketplace Link';
1793
1817
  const Category$1 = 'Category';
1794
1818
  const Disabled$3 = 'Disabled';
1795
1819
  const Featured$1 = 'Featured';
@@ -1829,9 +1853,6 @@ const publisher = () => {
1829
1853
  const rating = () => {
1830
1854
  return i18nString(Rating);
1831
1855
  };
1832
- const marketplaceLink = () => {
1833
- return i18nString(MarketplaceLink);
1834
- };
1835
1856
  const filter = () => {
1836
1857
  return i18nString(Filter$1);
1837
1858
  };
@@ -2144,11 +2165,11 @@ const matchesCategory = (extension, category) => {
2144
2165
  });
2145
2166
  };
2146
2167
  const matchesParsedValue = (extension, parsedValue) => {
2147
- const extensionIsDisabled = isExtensionDisabled(extension.disabled === true, extension.status);
2168
+ const extensionIsDisabled = isExtensionDisabled(extension.disabled, extension.status);
2148
2169
  if (parsedValue.disabled && !extensionIsDisabled || parsedValue.enabled && extensionIsDisabled) {
2149
2170
  return false;
2150
2171
  }
2151
- if (parsedValue.linked && extension.linked !== true) {
2172
+ if (parsedValue.linked && !extension.linked) {
2152
2173
  return false;
2153
2174
  }
2154
2175
  if (parsedValue.id && extension.id) {
@@ -2467,7 +2488,6 @@ const getExtensionInfoText = extension => {
2467
2488
  publisher: publisher$1
2468
2489
  } = extension;
2469
2490
  const version$1 = ''; // TODO
2470
- const marketplaceLink$1 = ''; // TODO
2471
2491
  const rows = [{
2472
2492
  key: name(),
2473
2493
  value: name$1
@@ -2483,10 +2503,7 @@ const getExtensionInfoText = extension => {
2483
2503
  }, {
2484
2504
  key: publisher(),
2485
2505
  value: publisher$1
2486
- }, {
2487
- key: marketplaceLink(),
2488
- value: marketplaceLink$1
2489
- }];
2506
+ }, ...([])];
2490
2507
  const infoRows = rows.map(stringifyRow);
2491
2508
  const infoText = infoRows.join('\n');
2492
2509
  return infoText;
@@ -2664,7 +2681,7 @@ const enableWorkspace = async state => {
2664
2681
  if (!item) {
2665
2682
  return state;
2666
2683
  }
2667
- await invoke$3('Extensions.enableWorkspace', item.id);
2684
+ await enableWorkspace$2(item.id);
2668
2685
  return setExtensionStatus(state, item.id, Enabled);
2669
2686
  };
2670
2687
 
@@ -3876,7 +3893,7 @@ const getEnablementFlags = (disabled, status) => {
3876
3893
  enable: Disabled
3877
3894
  };
3878
3895
  }
3879
- const isDisabled = status === Disabled$1 || status === undefined && disabled;
3896
+ const isDisabled = status === Disabled$1 || !status && disabled;
3880
3897
  return {
3881
3898
  disable: isDisabled ? Disabled : None,
3882
3899
  enable: isDisabled ? None : Disabled
@@ -4187,8 +4204,8 @@ const handleContextMenu = async (state, button, eventX, eventY) => {
4187
4204
  }
4188
4205
  const item = items[index];
4189
4206
  await show2(uid, ManageExtension, eventX, eventY, {
4190
- builtin: item.builtin === true,
4191
- disabled: item.disabled === true,
4207
+ builtin: item.builtin,
4208
+ disabled: item.disabled,
4192
4209
  menuId: ManageExtension,
4193
4210
  status: item.status
4194
4211
  });
@@ -4210,9 +4227,9 @@ const Web = 1;
4210
4227
  const Electron = 2;
4211
4228
  const Remote = 3;
4212
4229
 
4213
- const getAllExtensions$1 = async (assetDir, platform) => {
4230
+ const getAllExtensions = async (assetDir, platform) => {
4214
4231
  try {
4215
- return await invoke$3('Extensions.getAllExtensions', assetDir, platform);
4232
+ return await getAllExtensions$1(assetDir, platform);
4216
4233
  } catch (error) {
4217
4234
  if (platform === Web) {
4218
4235
  return [];
@@ -4221,10 +4238,6 @@ const getAllExtensions$1 = async (assetDir, platform) => {
4221
4238
  }
4222
4239
  };
4223
4240
 
4224
- const getAllExtensions = (assetDir, platform) => {
4225
- return getAllExtensions$1(assetDir, platform);
4226
- };
4227
-
4228
4241
  const getBuiltin = extension => {
4229
4242
  if (extension === null || typeof extension !== 'object') {
4230
4243
  return false;
@@ -4400,9 +4413,9 @@ const getSize = extension => {
4400
4413
 
4401
4414
  const getStatus = extension => {
4402
4415
  if (extension === null || typeof extension !== 'object' || !('status' in extension)) {
4403
- return undefined;
4416
+ return '';
4404
4417
  }
4405
- return typeof extension.status === 'string' ? extension.status : undefined;
4418
+ return typeof extension.status === 'string' ? extension.status : '';
4406
4419
  };
4407
4420
 
4408
4421
  const getUpdatedDate = extension => {
@@ -4662,8 +4675,8 @@ const handleSettingsButtonClick = async (state, index) => {
4662
4675
  const menuY = itemY + itemHeight - 10; // Position at the bottom of the extension item
4663
4676
 
4664
4677
  await show2(uid, ManageExtension, menuX, menuY, {
4665
- builtin: items[actualIndex].builtin === true,
4666
- disabled: items[actualIndex].disabled === true,
4678
+ builtin: items[actualIndex].builtin,
4679
+ disabled: items[actualIndex].disabled,
4667
4680
  menuId: ManageExtension,
4668
4681
  status: items[actualIndex].status
4669
4682
  });
@@ -4711,10 +4724,6 @@ const initializeExtensionManagementWorker = async () => {
4711
4724
  }
4712
4725
  };
4713
4726
 
4714
- const initialize = async () => {
4715
- await initializeExtensionManagementWorker();
4716
- };
4717
-
4718
4727
  const installAnotherVersion = async state => {
4719
4728
  await invoke$4('ConfirmPrompt.prompt', 'not implemented', undefined);
4720
4729
  return state;
@@ -5150,8 +5159,10 @@ const render3 = async (uid, diffResult) => {
5150
5159
  newState,
5151
5160
  oldState
5152
5161
  } = get(uid);
5162
+ // Commands can update state while the renderer worker is sending the diff back.
5163
+ const currentDiffResult = [...new Set([...diff2(uid), ...diffResult])];
5153
5164
  set$1(uid, newState, newState);
5154
- const commands = applyRender(oldState, newState, diffResult);
5165
+ const commands = applyRender(oldState, newState, currentDiffResult);
5155
5166
  if (!isConnected()) {
5156
5167
  return commands;
5157
5168
  }
@@ -5462,7 +5473,7 @@ const commandMap = {
5462
5473
  'SearchExtensions.handleSettingsButtonClick': wrapCommand(handleSettingsButtonClick),
5463
5474
  'SearchExtensions.handleUninstall': wrapCommand(handleUninstall),
5464
5475
  'SearchExtensions.handleWheel': wrapCommand(handleWheel),
5465
- 'SearchExtensions.initialize': initialize,
5476
+ 'SearchExtensions.initialize': initializeExtensionManagementWorker,
5466
5477
  'SearchExtensions.installAnotherVersion': wrapCommand(installAnotherVersion),
5467
5478
  'SearchExtensions.loadContent': wrapAsyncCommand(loadContentWithContext),
5468
5479
  'SearchExtensions.openSuggest': wrapCommand(openSuggest),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-search-view",
3
- "version": "7.25.0",
3
+ "version": "7.27.0",
4
4
  "description": "Extension Search View Worker",
5
5
  "repository": {
6
6
  "type": "git",