@ject-5-fe/figma-plugin 0.0.7 → 0.1.1

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.
@@ -4,6 +4,10 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
7
11
  var __copyProps = (to, from, except, desc) => {
8
12
  if (from && typeof from === "object" || typeof from === "function") {
9
13
  for (let key of __getOwnPropNames(from))
@@ -20,12 +24,19 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
28
 
24
29
  // src/server.ts
30
+ var server_exports = {};
31
+ __export(server_exports, {
32
+ compressData: () => compressData
33
+ });
34
+ module.exports = __toCommonJS(server_exports);
25
35
  var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
26
36
  var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
27
37
  var import_uuid = require("uuid");
28
38
  var import_ws = __toESM(require("ws"), 1);
39
+ var import_zlib = require("zlib");
29
40
  var import_zod = require("zod");
30
41
  var logger = {
31
42
  info: (message) => process.stderr.write(`[INFO] ${message}
@@ -39,6 +50,16 @@ var logger = {
39
50
  log: (message) => process.stderr.write(`[LOG] ${message}
40
51
  `)
41
52
  };
53
+ function compressData(data) {
54
+ const jsonString = JSON.stringify(data);
55
+ const compressed = (0, import_zlib.gzipSync)(jsonString);
56
+ const base64 = compressed.toString("base64");
57
+ const originalBytes = Buffer.byteLength(jsonString, "utf8");
58
+ console.info(
59
+ `Compression: ${originalBytes} bytes -> ${compressed.length} bytes (ratio ${(compressed.length / originalBytes * 100).toFixed(1)}%)`
60
+ );
61
+ return base64;
62
+ }
42
63
  var ws = null;
43
64
  var pendingRequests = /* @__PURE__ */ new Map();
44
65
  var server = new import_mcp.McpServer({
@@ -78,22 +99,19 @@ server.tool(
78
99
  );
79
100
  server.tool(
80
101
  "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 }) => {
102
+ "Get information about the current selection in Figma",
103
+ {},
104
+ async () => {
86
105
  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
- );
106
+ const result = await sendCommandToFigma("get_selection");
107
+ const compressed = compressData(result);
92
108
  return {
93
109
  content: [
94
110
  {
95
111
  type: "text",
96
- text: JSON.stringify(result)
112
+ text: `IMPORTANT: \uC774 \uB370\uC774\uD130\uB97C \uC989\uC2DC /Users/jh/JECT-5-FE/shared/figma-plugin/temp-figma-data.txt \uD30C\uC77C\uC5D0 \uC800\uC7A5\uD558\uC138\uC694. \uC808\uB300\uB85C \uB514\uCF54\uB529\uC744 \uC2DC\uB3C4\uD558\uC9C0 \uB9C8\uC138\uC694.
113
+
114
+ [GZIP_BASE64]${compressed}`
97
115
  }
98
116
  ]
99
117
  };
@@ -111,7 +129,7 @@ server.tool(
111
129
  );
112
130
  server.tool(
113
131
  "get_node_info",
114
- "Get raw Figma node info for a specific node (not for codegen)",
132
+ "Get detailed information about a specific node in Figma",
115
133
  {
116
134
  nodeId: import_zod.z.string().describe("The ID of the node to get information about")
117
135
  },
@@ -313,3 +331,7 @@ main().catch((error) => {
313
331
  );
314
332
  process.exit(1);
315
333
  });
334
+ // Annotate the CommonJS export names for ESM import in node:
335
+ 0 && (module.exports = {
336
+ compressData
337
+ });
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.1",
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
  }