@ject-5-fe/figma-plugin 0.1.0 → 0.1.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.
@@ -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,14 +24,20 @@ 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);
29
- var import_zod = require("zod");
30
39
  var import_zlib = require("zlib");
40
+ var import_zod = require("zod");
31
41
  var logger = {
32
42
  info: (message) => process.stderr.write(`[INFO] ${message}
33
43
  `),
@@ -41,10 +51,13 @@ var logger = {
41
51
  `)
42
52
  };
43
53
  function compressData(data) {
44
- const jsonString = JSON.stringify(data, null, 0);
54
+ const jsonString = JSON.stringify(data);
45
55
  const compressed = (0, import_zlib.gzipSync)(jsonString);
46
56
  const base64 = compressed.toString("base64");
47
- logger.info(`Compression: ${jsonString.length} bytes -> ${base64.length} bytes (${Math.round(base64.length / jsonString.length * 100)}%)`);
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
+ );
48
61
  return base64;
49
62
  }
50
63
  var ws = null;
@@ -91,12 +104,11 @@ server.tool(
91
104
  async () => {
92
105
  try {
93
106
  const result = await sendCommandToFigma("get_selection");
94
- const compressed = compressData(result);
95
107
  return {
96
108
  content: [
97
109
  {
98
110
  type: "text",
99
- text: `[GZIP_BASE64]${compressed}`
111
+ text: JSON.stringify(result)
100
112
  }
101
113
  ]
102
114
  };
@@ -316,3 +328,7 @@ main().catch((error) => {
316
328
  );
317
329
  process.exit(1);
318
330
  });
331
+ // Annotate the CommonJS export names for ESM import in node:
332
+ 0 && (module.exports = {
333
+ compressData
334
+ });
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@ject-5-fe/figma-plugin",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
- "private": "false",
6
5
  "scripts": {
7
6
  "dev": "plugma dev",
8
7
  "socket": "tsx src/socket.ts",