和deno斗争

This commit is contained in:
CrescentLeaf
2025-12-06 01:39:47 +08:00
parent a549773eb2
commit 6ca9946499
9 changed files with 105 additions and 115 deletions

7
.gitignore vendored
View File

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

14
.vscode/launch.json vendored
View File

@@ -1,14 +0,0 @@
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"command": "deno task build-and-run-server",
"name": "Run debug",
"request": "launch",
"type": "node-terminal",
},
]
}

60
client-protocol/deno.lock generated Normal file
View File

@@ -0,0 +1,60 @@
{
"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"
]
}
}

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

27
client/package.json Normal file
View File

@@ -0,0 +1,27 @@
{
"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"
},
"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 { defineConfig } from 'vite'
import deno from '@deno/vite-plugin'
import react from '@vitejs/plugin-react' import react from '@vitejs/plugin-react'
import config from '../server/config.ts' import config from '../server/config.ts'
// https://vite.dev/config/ // https://vite.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [react(), deno()], plugins: [react()],
build: { build: {
sourcemap: true, sourcemap: true,
outDir: "." + config.data_path + '/page_compiled', 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"
}
}

6
mod.ts
View File

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

15
package.json Normal file
View File

@@ -0,0 +1,15 @@
{
"type": "module",
"scripts": {
"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"
}
}