@ject-5-fe/figma-plugin 0.0.7 → 0.1.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.
@@ -27,6 +27,7 @@ var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
27
27
  var import_uuid = require("uuid");
28
28
  var import_ws = __toESM(require("ws"), 1);
29
29
  var import_zod = require("zod");
30
+ var import_zlib = require("zlib");
30
31
  var logger = {
31
32
  info: (message) => process.stderr.write(`[INFO] ${message}
32
33
  `),
@@ -39,6 +40,13 @@ var logger = {
39
40
  log: (message) => process.stderr.write(`[LOG] ${message}
40
41
  `)
41
42
  };
43
+ function compressData(data) {
44
+ const jsonString = JSON.stringify(data, null, 0);
45
+ const compressed = (0, import_zlib.gzipSync)(jsonString);
46
+ const base64 = compressed.toString("base64");
47
+ logger.info(`Compression: ${jsonString.length} bytes -> ${base64.length} bytes (${Math.round(base64.length / jsonString.length * 100)}%)`);
48
+ return base64;
49
+ }
42
50
  var ws = null;
43
51
  var pendingRequests = /* @__PURE__ */ new Map();
44
52
  var server = new import_mcp.McpServer({
@@ -78,22 +86,17 @@ server.tool(
78
86
  );
79
87
  server.tool(
80
88
  "get_selection",
81
- "Get codegen snapshot (AST/reactNodes/tokens) for current selection or a specific node (optional nodeId)",
82
- {
83
- nodeId: import_zod.z.string().nullable().optional().describe("Optional: scope snapshot to a specific node ID")
84
- },
85
- async ({ nodeId }) => {
89
+ "Get information about the current selection in Figma",
90
+ {},
91
+ async () => {
86
92
  try {
87
- const normalizedNodeId = typeof nodeId === "string" && nodeId.length > 0 ? nodeId : void 0;
88
- const result = await sendCommandToFigma(
89
- "get_selection",
90
- normalizedNodeId ? { nodeId: normalizedNodeId } : {}
91
- );
93
+ const result = await sendCommandToFigma("get_selection");
94
+ const compressed = compressData(result);
92
95
  return {
93
96
  content: [
94
97
  {
95
98
  type: "text",
96
- text: JSON.stringify(result)
99
+ text: `[GZIP_BASE64]${compressed}`
97
100
  }
98
101
  ]
99
102
  };
@@ -111,7 +114,7 @@ server.tool(
111
114
  );
112
115
  server.tool(
113
116
  "get_node_info",
114
- "Get raw Figma node info for a specific node (not for codegen)",
117
+ "Get detailed information about a specific node in Figma",
115
118
  {
116
119
  nodeId: import_zod.z.string().describe("The ID of the node to get information about")
117
120
  },
package/package.json CHANGED
@@ -1,16 +1,13 @@
1
1
  {
2
2
  "name": "@ject-5-fe/figma-plugin",
3
- "version": "0.0.7",
3
+ "version": "0.1.0",
4
4
  "type": "module",
5
- "publishConfig": {
6
- "access": "public"
7
- },
5
+ "private": "false",
8
6
  "scripts": {
9
7
  "dev": "plugma dev",
10
8
  "socket": "tsx src/socket.ts",
11
9
  "start": "concurrently \"yarn run socket\" \"yarn run dev\" --names \"SOCKET,MCP\" --prefix-colors \"blue,green\"",
12
- "build:server": "tsup",
13
- "type-check": "yarn run -T -B tsc --noEmit"
10
+ "build:server": "tsup"
14
11
  },
15
12
  "bin": "dist/server/server.cjs",
16
13
  "files": [
@@ -18,13 +15,13 @@
18
15
  ],
19
16
  "dependencies": {
20
17
  "@modelcontextprotocol/sdk": "^1",
21
- "es-toolkit": "^1.39.10",
18
+ "es-toolkit": "^1.41.0",
22
19
  "react": "^18.3.1",
23
20
  "react-dom": "^18.3.1",
24
21
  "uuid": "^11",
25
22
  "ws": "^8",
26
23
  "xml-js": "^1.6.11",
27
- "zod": "^3"
24
+ "zod": "^4"
28
25
  },
29
26
  "devDependencies": {
30
27
  "@figma/plugin-typings": "^1.100.2",
@@ -61,7 +58,7 @@
61
58
  ],
62
59
  "devAllowedDomains": [
63
60
  "http://localhost:*",
64
- "ws://localhost:3000"
61
+ "ws://localhost:9001"
65
62
  ]
66
63
  }
67
64
  }