Compare commits

...

2 Commits

Author SHA1 Message Date
CrescentLeaf
d76abcf512 正式回归 Node.js! 2025-12-06 10:17:27 +08:00
CrescentLeaf
6ca9946499 和deno斗争 2025-12-06 01:39:47 +08:00
15 changed files with 102 additions and 137 deletions

7
.gitignore vendored
View File

@@ -2,9 +2,6 @@
thewhitesilk_config.json
# **默认**数据目录
thewhitesilk_data/
deno.lock
node_modules/
#npm
# Node.js
package-lock.json
node_modules/

8
.vscode/launch.json vendored
View File

@@ -5,10 +5,10 @@
"version": "0.2.0",
"configurations": [
{
"command": "deno task build-and-run-server",
"name": "Run debug",
"command": "npm run build-client-and-server",
"name": "Debug",
"request": "launch",
"type": "node-terminal",
},
"type": "node-terminal"
}
]
}

View File

@@ -1,7 +1,7 @@
{
"deno.enable": true,
"deno.enable": false,
"deno.disablePaths": [
"./thewhitesilk_data",
"./client/mdui_patched"
"./mdui_patched"
]
}

View File

@@ -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

View File

@@ -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"
}
}

25
client-protocol/main.ts Normal file
View File

@@ -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 }

View File

@@ -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"
}
}

View File

@@ -1,43 +0,0 @@
{
"tasks": {
"build": "deno run --allow-run --allow-env --allow-read checkIsAndroidAndBuild.ts npm:vite build",
"build-watch": "deno run --allow-run --allow-env --allow-read checkIsAndroidAndBuild.ts npm:vite --watch build"
},
"compilerOptions": {
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"jsx": "react-jsx",
"jsxImportSource": "react",
"jsxImportSourceTypes": "@types/react"
},
"nodeModulesDir": "auto",
"links": [
"../mdui_patched"
],
"imports": {
"@deno/vite-plugin": "npm:@deno/vite-plugin@1.0.5",
"@types/react": "npm:@types/react@18.3.1",
"@types/react-dom": "npm:@types/react-dom@18.3.1",
"@vitejs/plugin-react": "npm:@vitejs/plugin-react@4.7.0",
"lightningcss": "npm:lightningcss@^1.30.2",
"react": "npm:react@18.3.1",
"react-dom": "npm:react-dom@18.3.1",
"terser": "npm:terser@^5.44.1",
"vite": "npm:vite@7.0.6",
"rollup": "npm:@rollup/wasm-node@4.48.0",
"chalk": "npm:chalk@5.4.1",
"mdui": "npm:mdui@2.1.4",
"split.js": "npm:split.js@1.3.2",
"crypto-js": "npm:crypto-js@4.2.0",
"socket.io-client": "npm:socket.io-client@4.8.1",
"marked": "npm:marked@16.3.0",
"dompurify": "npm:dompurify@3.2.7",
"pinch-zoom-element": "npm:pinch-zoom-element@1.1.1",
"ua-parser-js": "npm:ua-parser-js@2.0.6",
"lingchair-internal-shared": "../internal-shared/mod.ts",
"lingchair-client-protocol": "../mod.ts"
}
}

29
client/package.json Normal file
View File

@@ -0,0 +1,29 @@
{
"name": "lingchair-client",
"type": "module",
"scripts": {
"build": "npx vite build",
"build-watch": "npx vite --watch build"
},
"dependencies": {
"react": "18.3.1",
"react-dom": "18.3.1",
"mdui": "2.1.4",
"split.js": "1.3.2",
"crypto-js": "4.2.0",
"socket.io-client": "4.8.1",
"marked": "16.3.0",
"dompurify": "3.2.7",
"pinch-zoom-element": "1.1.1",
"ua-parser-js": "2.0.6",
"lingchair-internal-shared": "*"
},
"devDependencies": {
"@types/react": "18.3.1",
"@types/react-dom": "18.3.1",
"@vitejs/plugin-react": "4.7.0",
"vite": "7.0.6",
"@rollup/wasm-node": "4.48.0",
"chalk": "5.4.1"
}
}

View File

@@ -1,40 +1,12 @@
import { defineConfig } from 'vite'
import deno from '@deno/vite-plugin'
import react from '@vitejs/plugin-react'
import config from '../server/config.ts'
// https://vite.dev/config/
export default defineConfig({
plugins: [react(), deno()],
plugins: [react()],
build: {
sourcemap: true,
outDir: "." + config.data_path + '/page_compiled',
minify: 'terser',
cssMinify: 'lightningcss',
rollupOptions: {
output: {
manualChunks(id) {
if (id.includes('node_modules')) {
if (id.includes('mdui')) {
return 'mdui'
}
if (id.includes('crypto-js')) {
return 'cryptojs'
}
if (id.includes('split.js')) {
return 'splitjs'
}
if (id.includes('marked')) {
return 'marked'
}
return 'vendor'
}
return 'main'
},
}
}
},
optimizeDeps: {
include: ['socket.io-client']
}
})

View File

@@ -1,18 +0,0 @@
{
"tasks": {
"server": "deno run --allow-read --allow-write --allow-env --allow-net --allow-sys --allow-run=deno ./server/main.ts",
"build-and-run-server": "deno task build && deno run --watch --allow-read --allow-write --allow-env --allow-net --allow-sys --allow-run=deno ./server/main.ts",
"build": "cd ./client && deno task build"
},
"imports": {
"chalk": "npm:chalk@5.4.1",
"file-type": "npm:file-type@21.0.0",
"express": "npm:express@5.1.0",
"socket.io": "npm:socket.io@4.8.1",
"cookie-parser": "npm:cookie-parser@1.4.7",
"express-fileupload": "npm:express-fileupload@1.5.2",
"lingchair-internal-shared": "./internal-shared/mod.ts",
"socket.io-client": "npm:socket.io-client@4.8.1"
}
}

View File

@@ -0,0 +1,5 @@
{
"name": "lingchair-internal-shared",
"type": "module",
"main": "./main.ts"
}

6
mod.ts
View File

@@ -1,6 +0,0 @@
import LingChairClient from './client-protocol/LingChairClient.ts'
export * from './client-protocol/LingChairClient.ts'
export {
LingChairClient
}

24
package.json Normal file
View File

@@ -0,0 +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",
"cookie-parser": "1.4.7",
"express": "5.1.0",
"express-fileupload": "1.5.2",
"file-type": "21.0.0",
"socket.io": "4.8.1",
"lingchair-internal-shared": "*"
}
}