From d76abcf51203194ff486c60fbc598c82cb0a6376 Mon Sep 17 00:00:00 2001 From: CrescentLeaf Date: Sat, 6 Dec 2025 10:17:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AD=A3=E5=BC=8F=E5=9B=9E=E5=BD=92=20Node.js?= =?UTF-8?q?=EF=BC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/launch.json | 14 +++++++ .vscode/settings.json | 4 +- client-protocol/LingChairClient.ts | 23 ----------- client-protocol/deno.jsonc | 7 ---- client-protocol/deno.lock | 60 ----------------------------- client-protocol/main.ts | 25 ++++++++++++ client-protocol/package.json | 10 +++++ client/package.json | 4 +- internal-shared/{mod.ts => main.ts} | 0 internal-shared/package.json | 5 +++ package.json | 19 ++++++--- 11 files changed, 73 insertions(+), 98 deletions(-) create mode 100644 .vscode/launch.json delete mode 100644 client-protocol/deno.jsonc delete mode 100644 client-protocol/deno.lock create mode 100644 client-protocol/main.ts create mode 100644 client-protocol/package.json rename internal-shared/{mod.ts => main.ts} (100%) create mode 100644 internal-shared/package.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..663f719 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,14 @@ +{ + // 使用 IntelliSense 了解相关属性。 + // 悬停以查看现有属性的描述。 + // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "command": "npm run build-client-and-server", + "name": "Debug", + "request": "launch", + "type": "node-terminal" + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 53f8e57..acb8129 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,7 @@ { - "deno.enable": true, + "deno.enable": false, "deno.disablePaths": [ "./thewhitesilk_data", - "./client/mdui_patched" + "./mdui_patched" ] } \ No newline at end of file diff --git a/client-protocol/LingChairClient.ts b/client-protocol/LingChairClient.ts index 69fac7c..ab143e3 100644 --- a/client-protocol/LingChairClient.ts +++ b/client-protocol/LingChairClient.ts @@ -8,29 +8,6 @@ import CallbackError from "./CallbackError.ts" import Message from "./Message.ts" -import Chat from "./Chat.ts" -import User from "./User.ts" -import UserMySelf from "./UserMySelf.ts" -import UserBean from "./bean/UserBean.ts" -import ChatBean from "./bean/ChatBean.ts" -import GroupSettingsBean from "./bean/GroupSettingsBean.ts" -import JoinRequestBean from "./bean/JoinRequestBean.ts" -import MessageBean from "./bean/MessageBean.ts" -import RecentChatBean from "./bean/RecentChatBean.ts" - -export { - Chat, - User, - UserMySelf, - - UserBean, - ChatBean, - MessageBean, - RecentChatBean, - JoinRequestBean, -} -export type { GroupSettingsBean } - export default class LingChairClient { declare client: Socket declare access_token: string diff --git a/client-protocol/deno.jsonc b/client-protocol/deno.jsonc deleted file mode 100644 index 7b07fb4..0000000 --- a/client-protocol/deno.jsonc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "imports": { - "socket.io-client": "npm:socket.io-client@4.8.1", - "lingchair-internal-shared": "../internal-shared/mod.ts", - "marked": "npm:marked@16.3.0" - } -} \ No newline at end of file diff --git a/client-protocol/deno.lock b/client-protocol/deno.lock deleted file mode 100644 index 8a5cab6..0000000 --- a/client-protocol/deno.lock +++ /dev/null @@ -1,60 +0,0 @@ -{ - "version": "5", - "specifiers": { - "npm:socket.io-client@4.8.1": "4.8.1" - }, - "npm": { - "@socket.io/component-emitter@3.1.2": { - "integrity": "sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA==" - }, - "debug@4.3.7": { - "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", - "dependencies": [ - "ms" - ] - }, - "engine.io-client@6.6.3": { - "integrity": "sha512-T0iLjnyNWahNyv/lcjS2y4oE358tVS/SYQNxYXGAJ9/GLgH4VCvOQ/mhTjqU88mLZCQgiG8RIegFHYCdVC+j5w==", - "dependencies": [ - "@socket.io/component-emitter", - "debug", - "engine.io-parser", - "ws", - "xmlhttprequest-ssl" - ] - }, - "engine.io-parser@5.2.3": { - "integrity": "sha512-HqD3yTBfnBxIrbnM1DoD6Pcq8NECnh8d4As1Qgh0z5Gg3jRRIqijury0CL3ghu/edArpUYiYqQiDUQBIs4np3Q==" - }, - "ms@2.1.3": { - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" - }, - "socket.io-client@4.8.1": { - "integrity": "sha512-hJVXfu3E28NmzGk8o1sHhN3om52tRvwYeidbj7xKy2eIIse5IoKX3USlS6Tqt3BHAtflLIkCQBkzVrEEfWUyYQ==", - "dependencies": [ - "@socket.io/component-emitter", - "debug", - "engine.io-client", - "socket.io-parser" - ] - }, - "socket.io-parser@4.2.4": { - "integrity": "sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==", - "dependencies": [ - "@socket.io/component-emitter", - "debug" - ] - }, - "ws@8.17.1": { - "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==" - }, - "xmlhttprequest-ssl@2.1.2": { - "integrity": "sha512-TEU+nJVUUnA4CYJFLvK5X9AOeH4KvDvhIfm0vV1GaQRtchnG0hgK5p8hw/xjv8cunWYCsiPCSDzObPyhEwq3KQ==" - } - }, - "workspace": { - "dependencies": [ - "npm:socket.io-client@4.8.1" - ] - } -} diff --git a/client-protocol/main.ts b/client-protocol/main.ts new file mode 100644 index 0000000..e1f6088 --- /dev/null +++ b/client-protocol/main.ts @@ -0,0 +1,25 @@ +import Chat from "./Chat.ts" +import User from "./User.ts" +import UserMySelf from "./UserMySelf.ts" +import UserBean from "./bean/UserBean.ts" +import ChatBean from "./bean/ChatBean.ts" +import GroupSettingsBean from "./bean/GroupSettingsBean.ts" +import JoinRequestBean from "./bean/JoinRequestBean.ts" +import MessageBean from "./bean/MessageBean.ts" +import RecentChatBean from "./bean/RecentChatBean.ts" +import LingChairClient from "./LingChairClient.ts" + +export { + LingChairClient, + + Chat, + User, + UserMySelf, + + UserBean, + ChatBean, + MessageBean, + RecentChatBean, + JoinRequestBean, +} +export type { GroupSettingsBean } diff --git a/client-protocol/package.json b/client-protocol/package.json new file mode 100644 index 0000000..af5aedd --- /dev/null +++ b/client-protocol/package.json @@ -0,0 +1,10 @@ +{ + "name": "lingchair-client-protocol", + "type": "module", + "main": "./main.ts", + "dependencies": { + "lingchair-internal-shared": "*", + "marked": "16.3.0", + "socket.io-client": "4.8.1" + } +} diff --git a/client/package.json b/client/package.json index ac191dd..0566c74 100644 --- a/client/package.json +++ b/client/package.json @@ -1,4 +1,5 @@ { + "name": "lingchair-client", "type": "module", "scripts": { "build": "npx vite build", @@ -14,7 +15,8 @@ "marked": "16.3.0", "dompurify": "3.2.7", "pinch-zoom-element": "1.1.1", - "ua-parser-js": "2.0.6" + "ua-parser-js": "2.0.6", + "lingchair-internal-shared": "*" }, "devDependencies": { "@types/react": "18.3.1", diff --git a/internal-shared/mod.ts b/internal-shared/main.ts similarity index 100% rename from internal-shared/mod.ts rename to internal-shared/main.ts diff --git a/internal-shared/package.json b/internal-shared/package.json new file mode 100644 index 0000000..30955d0 --- /dev/null +++ b/internal-shared/package.json @@ -0,0 +1,5 @@ +{ + "name": "lingchair-internal-shared", + "type": "module", + "main": "./main.ts" +} \ No newline at end of file diff --git a/package.json b/package.json index f796483..be17400 100644 --- a/package.json +++ b/package.json @@ -1,15 +1,24 @@ { + "name": "lingchair", "type": "module", + "workspaces": [ + "./mdui_patched", + "./client-protocol", + "./internal-shared", + "./client" + ], "scripts": { + "build-client-and-server": "npm run build-client && npm run server", "server": "npx tsx ./server/main.ts", "build-client": "cd client && npm run build" }, "dependencies": { "chalk": "5.4.1", - "file-type": "21.0.0", - "express": "5.1.0", - "socket.io": "4.8.1", "cookie-parser": "1.4.7", - "express-fileupload": "1.5.2" + "express": "5.1.0", + "express-fileupload": "1.5.2", + "file-type": "21.0.0", + "socket.io": "4.8.1", + "lingchair-internal-shared": "*" } -} \ No newline at end of file +}