figma-console-mcp 1.12.1 → 1.12.2

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.
@@ -781,12 +781,13 @@ figma.ui.onmessage = async (msg) => {
781
781
  componentPropertyDefinitions: (node.type === 'COMPONENT_SET' || (node.type === 'COMPONENT' && !isVariant))
782
782
  ? node.componentPropertyDefinitions
783
783
  : undefined,
784
- // Get children info (lightweight)
785
- children: node.children ? node.children.map(child => ({
786
- id: child.id,
787
- name: child.name,
788
- type: child.type
789
- })) : undefined
784
+ // Get children info (lightweight) — skip unresolvable slot sublayers
785
+ children: node.children ? node.children.reduce((acc, child) => {
786
+ try {
787
+ acc.push({ id: child.id, name: child.name, type: child.type });
788
+ } catch (e) { /* slot sublayer or table cell — skip */ }
789
+ return acc;
790
+ }, []) : undefined
790
791
  }
791
792
  };
792
793
 
@@ -856,40 +857,42 @@ figma.ui.onmessage = async (msg) => {
856
857
  var variantAxes = {};
857
858
  var variants = [];
858
859
 
859
- // Parse variant properties from children names
860
+ // Parse variant properties from children names — skip unresolvable slot sublayers
860
861
  if (node.children) {
861
862
  node.children.forEach(function(child) {
862
- if (child.type === 'COMPONENT') {
863
- // Parse variant name (e.g., "Size=md, State=default")
864
- var variantProps = {};
865
- var parts = child.name.split(',').map(function(p) { return p.trim(); });
866
- parts.forEach(function(part) {
867
- var kv = part.split('=');
868
- if (kv.length === 2) {
869
- var key = kv[0].trim();
870
- var value = kv[1].trim();
871
- variantProps[key] = value;
872
-
873
- // Track all values for each axis
874
- if (!variantAxes[key]) {
875
- variantAxes[key] = [];
876
- }
877
- if (variantAxes[key].indexOf(value) === -1) {
878
- variantAxes[key].push(value);
863
+ try {
864
+ if (child.type === 'COMPONENT') {
865
+ // Parse variant name (e.g., "Size=md, State=default")
866
+ var variantProps = {};
867
+ var parts = child.name.split(',').map(function(p) { return p.trim(); });
868
+ parts.forEach(function(part) {
869
+ var kv = part.split('=');
870
+ if (kv.length === 2) {
871
+ var key = kv[0].trim();
872
+ var value = kv[1].trim();
873
+ variantProps[key] = value;
874
+
875
+ // Track all values for each axis
876
+ if (!variantAxes[key]) {
877
+ variantAxes[key] = [];
878
+ }
879
+ if (variantAxes[key].indexOf(value) === -1) {
880
+ variantAxes[key].push(value);
881
+ }
879
882
  }
880
- }
881
- });
882
-
883
- variants.push({
884
- key: child.key,
885
- nodeId: child.id,
886
- name: child.name,
887
- description: child.description || null,
888
- variantProperties: variantProps,
889
- width: child.width,
890
- height: child.height
891
- });
892
- }
883
+ });
884
+
885
+ variants.push({
886
+ key: child.key,
887
+ nodeId: child.id,
888
+ name: child.name,
889
+ description: child.description || null,
890
+ variantProperties: variantProps,
891
+ width: child.width,
892
+ height: child.height
893
+ });
894
+ }
895
+ } catch (e) { /* slot sublayer — skip */ }
893
896
  });
894
897
  }
895
898
 
@@ -937,10 +940,10 @@ figma.ui.onmessage = async (msg) => {
937
940
  }
938
941
  }
939
942
 
940
- // Recurse into children
943
+ // Recurse into children — skip unresolvable slot sublayers
941
944
  if (node.children) {
942
945
  node.children.forEach(function(child) {
943
- findComponents(child);
946
+ try { findComponents(child); } catch (e) { /* slot sublayer — skip */ }
944
947
  });
945
948
  }
946
949
  }
@@ -2236,14 +2239,20 @@ figma.loadAllPagesAsync().then(function() {
2236
2239
  var selection = figma.currentPage.selection;
2237
2240
  var selectedNodes = [];
2238
2241
  for (var i = 0; i < Math.min(selection.length, 50); i++) {
2239
- var node = selection[i];
2240
- selectedNodes.push({
2241
- id: node.id,
2242
- name: node.name,
2243
- type: node.type,
2244
- width: node.width,
2245
- height: node.height
2246
- });
2242
+ try {
2243
+ var node = selection[i];
2244
+ selectedNodes.push({
2245
+ id: node.id,
2246
+ name: node.name,
2247
+ type: node.type,
2248
+ width: node.width,
2249
+ height: node.height
2250
+ });
2251
+ } catch (e) {
2252
+ // Slot sublayers and table cells may not be fully resolvable —
2253
+ // accessing .name throws "does not exist" for these node types.
2254
+ // Skip silently rather than crashing the plugin.
2255
+ }
2247
2256
  }
2248
2257
  figma.ui.postMessage({
2249
2258
  type: 'SELECTION_CHANGE',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "figma-console-mcp",
3
- "version": "1.12.1",
3
+ "version": "1.12.2",
4
4
  "description": "MCP server for accessing Figma plugin console logs and screenshots via Cloudflare Workers or local mode",
5
5
  "type": "module",
6
6
  "main": "dist/local.js",