diff --git a/.gitignore b/.gitignore index 4e41a30..b1e24a0 100644 --- a/.gitignore +++ b/.gitignore @@ -2,9 +2,6 @@ thewhitesilk_config.json # **默认**数据目录 thewhitesilk_data/ - -deno.lock +# Node.js +package-lock.json node_modules/ - -#npm -package-lock.json \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index bcbb5a3..0000000 --- a/.vscode/launch.json +++ /dev/null @@ -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", - }, - ] -} \ No newline at end of file diff --git a/client-protocol/deno.lock b/client-protocol/deno.lock new file mode 100644 index 0000000..8a5cab6 --- /dev/null +++ b/client-protocol/deno.lock @@ -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" + ] + } +} diff --git a/client/deno.jsonc b/client/deno.jsonc deleted file mode 100644 index a0dc39b..0000000 --- a/client/deno.jsonc +++ /dev/null @@ -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" - } -} diff --git a/client/package.json b/client/package.json new file mode 100644 index 0000000..ac191dd --- /dev/null +++ b/client/package.json @@ -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" + } +} \ No newline at end of file diff --git a/client/vite.config.ts b/client/vite.config.ts index 94fc57b..d481303 100644 --- a/client/vite.config.ts +++ b/client/vite.config.ts @@ -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'] } }) diff --git a/deno.jsonc b/deno.jsonc deleted file mode 100644 index 38f7092..0000000 --- a/deno.jsonc +++ /dev/null @@ -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" - } -} \ No newline at end of file diff --git a/mod.ts b/mod.ts deleted file mode 100644 index db4415a..0000000 --- a/mod.ts +++ /dev/null @@ -1,6 +0,0 @@ -import LingChairClient from './client-protocol/LingChairClient.ts' - -export * from './client-protocol/LingChairClient.ts' -export { - LingChairClient -} diff --git a/package.json b/package.json new file mode 100644 index 0000000..f796483 --- /dev/null +++ b/package.json @@ -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" + } +} \ No newline at end of file