@lvce-editor/extension-host-worker 5.30.0 → 5.31.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.
@@ -426,6 +426,9 @@ const getPreview = item => {
426
426
  }
427
427
  };
428
428
  const validate = (item, schema) => {
429
+ if (typeof schema === 'function') {
430
+ return schema(item);
431
+ }
429
432
  const actualType = getType(item);
430
433
  const expectedType = schema.type;
431
434
  if (actualType !== expectedType) {
@@ -2670,15 +2673,41 @@ const executeReferenceProvider2 = (uri, languageId, offset, position) => {
2670
2673
  });
2671
2674
  };
2672
2675
 
2676
+ const validateResult = renameResult => {
2677
+ if (renameResult === null || renameResult === undefined) {
2678
+ return '';
2679
+ }
2680
+ if (typeof renameResult !== 'object') {
2681
+ return 'rename result must be of type object';
2682
+ }
2683
+ if (typeof renameResult.canRename !== 'boolean') {
2684
+ return `renameResult.canRename must be of type boolean`;
2685
+ }
2686
+ if (!Array.isArray(renameResult.edits)) {
2687
+ return `renameResult.edits must be of type array`;
2688
+ }
2689
+ for (const item of renameResult.edits) {
2690
+ if (!item) {
2691
+ return `renameResult item must be defined`;
2692
+ }
2693
+ if (typeof item !== 'object') {
2694
+ return `renameResult item must be of type object`;
2695
+ }
2696
+ if (typeof item.uri !== 'string') {
2697
+ return `renameResult item uri must be of type string`;
2698
+ }
2699
+ if (!Array.isArray(item.edits)) {
2700
+ return `renameResult item edits must be of type array`;
2701
+ }
2702
+ }
2703
+ return '';
2704
+ };
2673
2705
  const {
2674
2706
  registerRenameProvider,
2675
2707
  executeRenameProvider,
2676
2708
  executeprepareRenameProvider} = create$b({
2677
2709
  name: 'Rename',
2678
- resultShape: {
2679
- type: Object$1,
2680
- allowUndefined: true
2681
- },
2710
+ resultShape: validateResult,
2682
2711
  additionalMethodNames: [
2683
2712
  // @ts-ignore
2684
2713
  {
@@ -4620,6 +4649,9 @@ const getColorThemeUri = (extensions, colorThemeId) => {
4620
4649
  const getColorThemeJson$2 = async colorThemeId => {
4621
4650
  const extensions = await getExtensions();
4622
4651
  const colorThemeUri = getColorThemeUri(extensions, colorThemeId);
4652
+ if (!colorThemeUri) {
4653
+ return {};
4654
+ }
4623
4655
  const json = await readJson(colorThemeUri);
4624
4656
  return json;
4625
4657
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-host-worker",
3
- "version": "5.30.0",
3
+ "version": "5.31.0",
4
4
  "description": "Webworker for the extension host functionality in Lvce Editor.",
5
5
  "keywords": [
6
6
  "web-worker"