figma-console-mcp 1.6.2 → 1.6.3

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.
@@ -891,13 +891,37 @@ figma.ui.onmessage = async (msg) => {
891
891
  // Load all pages first (required before accessing children)
892
892
  console.log('🌉 [Desktop Bridge] Loading all pages...');
893
893
  await figma.loadAllPagesAsync();
894
- console.log('🌉 [Desktop Bridge] All pages loaded, searching for components...');
895
894
 
896
- // Search through all pages
895
+ // Process pages in batches with event loop yields to prevent UI freeze
896
+ // This is critical for large design systems that could otherwise crash
897
897
  var pages = figma.root.children;
898
- pages.forEach(function(page) {
899
- findComponents(page);
900
- });
898
+ var PAGE_BATCH_SIZE = 3; // Process 3 pages at a time
899
+ var totalPages = pages.length;
900
+
901
+ console.log('🌉 [Desktop Bridge] Processing ' + totalPages + ' pages in batches of ' + PAGE_BATCH_SIZE + '...');
902
+
903
+ for (var pageIndex = 0; pageIndex < totalPages; pageIndex += PAGE_BATCH_SIZE) {
904
+ var batchEnd = Math.min(pageIndex + PAGE_BATCH_SIZE, totalPages);
905
+ var batchPages = [];
906
+ for (var j = pageIndex; j < batchEnd; j++) {
907
+ batchPages.push(pages[j]);
908
+ }
909
+
910
+ // Process this batch of pages
911
+ batchPages.forEach(function(page) {
912
+ findComponents(page);
913
+ });
914
+
915
+ // Log progress for large files
916
+ if (totalPages > PAGE_BATCH_SIZE) {
917
+ console.log('🌉 [Desktop Bridge] Processed pages ' + (pageIndex + 1) + '-' + batchEnd + ' of ' + totalPages + ' (found ' + components.length + ' components so far)');
918
+ }
919
+
920
+ // Yield to event loop between batches to prevent UI freeze and allow cancellation
921
+ if (batchEnd < totalPages) {
922
+ await new Promise(function(resolve) { setTimeout(resolve, 0); });
923
+ }
924
+ }
901
925
 
902
926
  console.log('🌉 [Desktop Bridge] Found ' + components.length + ' components and ' + componentSets.length + ' component sets');
903
927
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "figma-console-mcp",
3
- "version": "1.6.2",
3
+ "version": "1.6.3",
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",