@jay-framework/editor-server 0.10.0 → 0.12.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.
Files changed (2) hide show
  1. package/dist/index.js +8 -5
  2. package/package.json +6 -5
package/dist/index.js CHANGED
@@ -7,6 +7,7 @@ var __publicField = (obj, key, value) => {
7
7
  import { Server } from "socket.io";
8
8
  import { createServer } from "http";
9
9
  import getPort from "get-port";
10
+ import { getLogger } from "@jay-framework/logger";
10
11
  import { createProtocolResponse } from "@jay-framework/editor-protocol";
11
12
  const ALLOWED_ORIGINS = [
12
13
  "https://www.figma.com",
@@ -46,7 +47,7 @@ class EditorServer {
46
47
  );
47
48
  res.setHeader("Access-Control-Allow-Credentials", "true");
48
49
  if (!this.isLocalhost(clientIP)) {
49
- console.warn(`Rejected connection from non-localhost IP: ${clientIP}`);
50
+ getLogger().warn(`Rejected connection from non-localhost IP: ${clientIP}`);
50
51
  res.writeHead(403, { "Content-Type": "application/json" });
51
52
  res.end(
52
53
  JSON.stringify({
@@ -74,7 +75,7 @@ class EditorServer {
74
75
  this.setupSocketHandlers();
75
76
  return new Promise((resolve, reject) => {
76
77
  this.httpServer.listen(this.port, () => {
77
- console.log(`Editor server started on port ${this.port}`);
78
+ getLogger().info(`Editor server started on port ${this.port}`);
78
79
  resolve({ port: this.port, editorId: this.editorId || "init" });
79
80
  });
80
81
  this.httpServer.on("error", reject);
@@ -127,11 +128,13 @@ class EditorServer {
127
128
  this.io.on("connection", (socket) => {
128
129
  const clientIP = socket.handshake.address;
129
130
  if (!this.isLocalhost(clientIP)) {
130
- console.warn(`Rejected WebSocket connection from non-localhost IP: ${clientIP}`);
131
+ getLogger().warn(
132
+ `Rejected WebSocket connection from non-localhost IP: ${clientIP}`
133
+ );
131
134
  socket.disconnect(true);
132
135
  return;
133
136
  }
134
- console.log(`Editor Socket connected: ${socket.id} from ${clientIP}`);
137
+ getLogger().info(`Editor Socket connected: ${socket.id} from ${clientIP}`);
135
138
  socket.on("protocol-message", async (message) => {
136
139
  try {
137
140
  const response = await this.handleProtocolMessage(message);
@@ -147,7 +150,7 @@ class EditorServer {
147
150
  }
148
151
  });
149
152
  socket.on("disconnect", () => {
150
- console.log(`Editor Socket disconnected: ${socket.id}`);
153
+ getLogger().info(`Editor Socket disconnected: ${socket.id}`);
151
154
  });
152
155
  });
153
156
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jay-framework/editor-server",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/index.js",
@@ -20,16 +20,17 @@
20
20
  "test:watch": "vitest"
21
21
  },
22
22
  "dependencies": {
23
- "@jay-framework/editor-protocol": "^0.10.0",
23
+ "@jay-framework/editor-protocol": "^0.12.0",
24
+ "@jay-framework/logger": "^0.12.0",
24
25
  "get-port": "^7.0.0",
25
26
  "socket.io": "^4.7.4",
26
27
  "uuid": "^9.0.1",
27
28
  "yaml": "^2.3.4"
28
29
  },
29
30
  "devDependencies": {
30
- "@jay-framework/dev-environment": "^0.10.0",
31
- "@jay-framework/editor-client": "^0.10.0",
32
- "@jay-framework/jay-cli": "^0.10.0",
31
+ "@jay-framework/dev-environment": "^0.12.0",
32
+ "@jay-framework/editor-client": "^0.12.0",
33
+ "@jay-framework/jay-cli": "^0.12.0",
33
34
  "@types/express": "^5.0.2",
34
35
  "@types/node": "^22.15.21",
35
36
  "@types/uuid": "^9.0.7",