diff --git a/.gitignore b/.gitignore index a547bf3..e9859e6 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,8 @@ dist-ssr *.njsproj *.sln *.sw? + +# C 编译器运行服务 - 编译器二进制文件 +server/bin/ +server/*.ps1 +tmp/ diff --git a/package-lock.json b/package-lock.json index 7c0b240..2790cc4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,8 @@ "name": "suanfa", "version": "0.0.0", "dependencies": { + "cors": "^2.8.6", + "express": "^5.2.1", "vue": "^3.5.34", "vue-router": "^4.6.4" }, @@ -994,6 +996,19 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, + "node_modules/accepts": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/accepts/-/accepts-2.0.0.tgz", + "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", + "license": "MIT", + "dependencies": { + "mime-types": "^3.0.0", + "negotiator": "^1.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/ansi-regex": { "version": "6.2.2", "resolved": "https://registry.npmmirror.com/ansi-regex/-/ansi-regex-6.2.2.tgz", @@ -1047,6 +1062,30 @@ "require-from-string": "^2.0.2" } }, + "node_modules/body-parser": { + "version": "2.2.2", + "resolved": "https://registry.npmmirror.com/body-parser/-/body-parser-2.2.2.tgz", + "integrity": "sha512-oP5VkATKlNwcgvxi0vM0p/D3n2C3EReYVX+DNYs5TjZFn/oQt2j+4sVJtSMr18pdRr8wjTcBl6LoV+FUwzPmNA==", + "license": "MIT", + "dependencies": { + "bytes": "^3.1.2", + "content-type": "^1.0.5", + "debug": "^4.4.3", + "http-errors": "^2.0.0", + "iconv-lite": "^0.7.0", + "on-finished": "^2.4.1", + "qs": "^6.14.1", + "raw-body": "^3.0.1", + "type-is": "^2.0.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, "node_modules/brace-expansion": { "version": "2.1.1", "resolved": "https://registry.npmmirror.com/brace-expansion/-/brace-expansion-2.1.1.tgz", @@ -1057,6 +1096,44 @@ "balanced-match": "^1.0.0" } }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmmirror.com/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmmirror.com/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/chai": { "version": "6.2.2", "resolved": "https://registry.npmmirror.com/chai/-/chai-6.2.2.tgz", @@ -1108,6 +1185,28 @@ "proto-list": "~1.2.1" } }, + "node_modules/content-disposition": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/content-disposition/-/content-disposition-1.1.0.tgz", + "integrity": "sha512-5jRCH9Z/+DRP7rkvY83B+yGIGX96OYdJmzngqnw2SBSxqCFPd0w2km3s5iawpGX8krnwSGmF0FW5Nhr0Hfai3g==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmmirror.com/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/convert-source-map": { "version": "2.0.0", "resolved": "https://registry.npmmirror.com/convert-source-map/-/convert-source-map-2.0.0.tgz", @@ -1115,6 +1214,41 @@ "dev": true, "license": "MIT" }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmmirror.com/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.2.2", + "resolved": "https://registry.npmmirror.com/cookie-signature/-/cookie-signature-1.2.2.tgz", + "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", + "license": "MIT", + "engines": { + "node": ">=6.6.0" + } + }, + "node_modules/cors": { + "version": "2.8.6", + "resolved": "https://registry.npmmirror.com/cors/-/cors-2.8.6.tgz", + "integrity": "sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==", + "license": "MIT", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, "node_modules/cross-spawn": { "version": "7.0.6", "resolved": "https://registry.npmmirror.com/cross-spawn/-/cross-spawn-7.0.6.tgz", @@ -1164,6 +1298,23 @@ "node": "^20.19.0 || ^22.12.0 || >=24.0.0" } }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmmirror.com/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, "node_modules/decimal.js": { "version": "10.6.0", "resolved": "https://registry.npmmirror.com/decimal.js/-/decimal.js-10.6.0.tgz", @@ -1171,6 +1322,15 @@ "dev": true, "license": "MIT" }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/detect-libc": { "version": "2.1.2", "resolved": "https://registry.npmmirror.com/detect-libc/-/detect-libc-2.1.2.tgz", @@ -1181,6 +1341,20 @@ "node": ">=8" } }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmmirror.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz", @@ -1207,6 +1381,12 @@ "node": ">=14" } }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmmirror.com/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" + }, "node_modules/emoji-regex": { "version": "9.2.2", "resolved": "https://registry.npmmirror.com/emoji-regex/-/emoji-regex-9.2.2.tgz", @@ -1214,6 +1394,15 @@ "dev": true, "license": "MIT" }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/entities": { "version": "7.0.1", "resolved": "https://registry.npmmirror.com/entities/-/entities-7.0.1.tgz", @@ -1226,6 +1415,24 @@ "url": "https://github.com/fb55/entities?sponsor=1" } }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmmirror.com/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, "node_modules/es-module-lexer": { "version": "2.1.0", "resolved": "https://registry.npmmirror.com/es-module-lexer/-/es-module-lexer-2.1.0.tgz", @@ -1233,12 +1440,39 @@ "dev": true, "license": "MIT" }, + "node_modules/es-object-atoms": { + "version": "1.1.2", + "resolved": "https://registry.npmmirror.com/es-object-atoms/-/es-object-atoms-1.1.2.tgz", + "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" + }, "node_modules/estree-walker": { "version": "2.0.2", "resolved": "https://registry.npmmirror.com/estree-walker/-/estree-walker-2.0.2.tgz", "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", "license": "MIT" }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmmirror.com/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/expect-type": { "version": "1.3.0", "resolved": "https://registry.npmmirror.com/expect-type/-/expect-type-1.3.0.tgz", @@ -1249,6 +1483,49 @@ "node": ">=12.0.0" } }, + "node_modules/express": { + "version": "5.2.1", + "resolved": "https://registry.npmmirror.com/express/-/express-5.2.1.tgz", + "integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==", + "license": "MIT", + "dependencies": { + "accepts": "^2.0.0", + "body-parser": "^2.2.1", + "content-disposition": "^1.0.0", + "content-type": "^1.0.5", + "cookie": "^0.7.1", + "cookie-signature": "^1.2.1", + "debug": "^4.4.0", + "depd": "^2.0.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "finalhandler": "^2.1.0", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "merge-descriptors": "^2.0.0", + "mime-types": "^3.0.0", + "on-finished": "^2.4.1", + "once": "^1.4.0", + "parseurl": "^1.3.3", + "proxy-addr": "^2.0.7", + "qs": "^6.14.0", + "range-parser": "^1.2.1", + "router": "^2.2.0", + "send": "^1.1.0", + "serve-static": "^2.2.0", + "statuses": "^2.0.1", + "type-is": "^2.0.1", + "vary": "^1.1.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, "node_modules/fdir": { "version": "6.5.0", "resolved": "https://registry.npmmirror.com/fdir/-/fdir-6.5.0.tgz", @@ -1267,6 +1544,27 @@ } } }, + "node_modules/finalhandler": { + "version": "2.1.1", + "resolved": "https://registry.npmmirror.com/finalhandler/-/finalhandler-2.1.1.tgz", + "integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "on-finished": "^2.4.1", + "parseurl": "^1.3.3", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, "node_modules/foreground-child": { "version": "3.3.1", "resolved": "https://registry.npmmirror.com/foreground-child/-/foreground-child-3.3.1.tgz", @@ -1284,6 +1582,24 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmmirror.com/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/fresh/-/fresh-2.0.0.tgz", + "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/fsevents": { "version": "2.3.3", "resolved": "https://registry.npmmirror.com/fsevents/-/fsevents-2.3.3.tgz", @@ -1299,6 +1615,52 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmmirror.com/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmmirror.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/glob": { "version": "10.4.5", "resolved": "https://registry.npmmirror.com/glob/-/glob-10.4.5.tgz", @@ -1320,6 +1682,42 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmmirror.com/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.4", + "resolved": "https://registry.npmmirror.com/hasown/-/hasown-2.0.4.tgz", + "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/html-encoding-sniffer": { "version": "6.0.0", "resolved": "https://registry.npmmirror.com/html-encoding-sniffer/-/html-encoding-sniffer-6.0.0.tgz", @@ -1333,6 +1731,48 @@ "node": "^20.19.0 || ^22.12.0 || >=24.0.0" } }, + "node_modules/http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", + "license": "MIT", + "dependencies": { + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/iconv-lite": { + "version": "0.7.2", + "resolved": "https://registry.npmmirror.com/iconv-lite/-/iconv-lite-0.7.2.tgz", + "integrity": "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmmirror.com/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, "node_modules/ini": { "version": "1.3.8", "resolved": "https://registry.npmmirror.com/ini/-/ini-1.3.8.tgz", @@ -1340,6 +1780,15 @@ "dev": true, "license": "ISC" }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmmirror.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, "node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmmirror.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", @@ -1357,6 +1806,12 @@ "dev": true, "license": "MIT" }, + "node_modules/is-promise": { + "version": "4.0.0", + "resolved": "https://registry.npmmirror.com/is-promise/-/is-promise-4.0.0.tgz", + "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", + "license": "MIT" + }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmmirror.com/isexe/-/isexe-2.0.0.tgz", @@ -1742,6 +2197,15 @@ "@jridgewell/sourcemap-codec": "^1.5.5" } }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, "node_modules/mdn-data": { "version": "2.27.1", "resolved": "https://registry.npmmirror.com/mdn-data/-/mdn-data-2.27.1.tgz", @@ -1749,6 +2213,52 @@ "dev": true, "license": "CC0-1.0" }, + "node_modules/media-typer": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/media-typer/-/media-typer-1.1.0.tgz", + "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/merge-descriptors": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/merge-descriptors/-/merge-descriptors-2.0.0.tgz", + "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmmirror.com/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "3.0.2", + "resolved": "https://registry.npmmirror.com/mime-types/-/mime-types-3.0.2.tgz", + "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", + "license": "MIT", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, "node_modules/minimatch": { "version": "9.0.9", "resolved": "https://registry.npmmirror.com/minimatch/-/minimatch-9.0.9.tgz", @@ -1775,6 +2285,12 @@ "node": ">=16 || 14 >=14.17" } }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmmirror.com/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, "node_modules/nanoid": { "version": "3.3.12", "resolved": "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.12.tgz", @@ -1793,6 +2309,15 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, + "node_modules/negotiator": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/negotiator/-/negotiator-1.0.0.tgz", + "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/nopt": { "version": "7.2.1", "resolved": "https://registry.npmmirror.com/nopt/-/nopt-7.2.1.tgz", @@ -1809,6 +2334,27 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmmirror.com/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmmirror.com/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/obug": { "version": "2.1.3", "resolved": "https://registry.npmmirror.com/obug/-/obug-2.1.3.tgz", @@ -1823,6 +2369,27 @@ "node": ">=12.20.0" } }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmmirror.com/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmmirror.com/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, "node_modules/package-json-from-dist": { "version": "1.0.1", "resolved": "https://registry.npmmirror.com/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", @@ -1856,6 +2423,15 @@ "url": "https://github.com/fb55/entities?sponsor=1" } }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmmirror.com/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/path-key": { "version": "3.1.1", "resolved": "https://registry.npmmirror.com/path-key/-/path-key-3.1.1.tgz", @@ -1890,6 +2466,16 @@ "dev": true, "license": "ISC" }, + "node_modules/path-to-regexp": { + "version": "8.4.2", + "resolved": "https://registry.npmmirror.com/path-to-regexp/-/path-to-regexp-8.4.2.tgz", + "integrity": "sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, "node_modules/pathe": { "version": "2.0.3", "resolved": "https://registry.npmmirror.com/pathe/-/pathe-2.0.3.tgz", @@ -1951,6 +2537,19 @@ "dev": true, "license": "ISC" }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmmirror.com/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, "node_modules/punycode": { "version": "2.3.1", "resolved": "https://registry.npmmirror.com/punycode/-/punycode-2.3.1.tgz", @@ -1961,6 +2560,45 @@ "node": ">=6" } }, + "node_modules/qs": { + "version": "6.15.2", + "resolved": "https://registry.npmmirror.com/qs/-/qs-6.15.2.tgz", + "integrity": "sha512-Rzq0KEyX/w/tEybncDgdkZrJgVUsUMk3xjh3t5bv3S1HTAtg+uOYt72+ZfwiQwKdysThkTBdL/rTi6HDmX9Ddw==", + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmmirror.com/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "3.0.2", + "resolved": "https://registry.npmmirror.com/raw-body/-/raw-body-3.0.2.tgz", + "integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==", + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.7.0", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, "node_modules/require-from-string": { "version": "2.0.2", "resolved": "https://registry.npmmirror.com/require-from-string/-/require-from-string-2.0.2.tgz", @@ -2005,6 +2643,28 @@ "@rolldown/binding-win32-x64-msvc": "1.0.3" } }, + "node_modules/router": { + "version": "2.2.0", + "resolved": "https://registry.npmmirror.com/router/-/router-2.2.0.tgz", + "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "depd": "^2.0.0", + "is-promise": "^4.0.0", + "parseurl": "^1.3.3", + "path-to-regexp": "^8.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmmirror.com/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, "node_modules/saxes": { "version": "6.0.0", "resolved": "https://registry.npmmirror.com/saxes/-/saxes-6.0.0.tgz", @@ -2031,6 +2691,57 @@ "node": ">=10" } }, + "node_modules/send": { + "version": "1.2.1", + "resolved": "https://registry.npmmirror.com/send/-/send-1.2.1.tgz", + "integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.3", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "fresh": "^2.0.0", + "http-errors": "^2.0.1", + "mime-types": "^3.0.2", + "ms": "^2.1.3", + "on-finished": "^2.4.1", + "range-parser": "^1.2.1", + "statuses": "^2.0.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/serve-static": { + "version": "2.2.1", + "resolved": "https://registry.npmmirror.com/serve-static/-/serve-static-2.2.1.tgz", + "integrity": "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==", + "license": "MIT", + "dependencies": { + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "parseurl": "^1.3.3", + "send": "^1.2.0" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmmirror.com/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" + }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmmirror.com/shebang-command/-/shebang-command-2.0.0.tgz", @@ -2054,6 +2765,78 @@ "node": ">=8" } }, + "node_modules/side-channel": { + "version": "1.1.1", + "resolved": "https://registry.npmmirror.com/side-channel/-/side-channel-1.1.1.tgz", + "integrity": "sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4", + "side-channel-list": "^1.0.1", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/side-channel-list/-/side-channel-list-1.0.1.tgz", + "integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/siginfo": { "version": "2.0.0", "resolved": "https://registry.npmmirror.com/siginfo/-/siginfo-2.0.0.tgz", @@ -2090,6 +2873,15 @@ "dev": true, "license": "MIT" }, + "node_modules/statuses": { + "version": "2.0.2", + "resolved": "https://registry.npmmirror.com/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/std-env": { "version": "4.1.0", "resolved": "https://registry.npmmirror.com/std-env/-/std-env-4.1.0.tgz", @@ -2272,6 +3064,15 @@ "dev": true, "license": "MIT" }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, "node_modules/tough-cookie": { "version": "6.0.1", "resolved": "https://registry.npmmirror.com/tough-cookie/-/tough-cookie-6.0.1.tgz", @@ -2306,6 +3107,37 @@ "license": "0BSD", "optional": true }, + "node_modules/type-is": { + "version": "2.1.0", + "resolved": "https://registry.npmmirror.com/type-is/-/type-is-2.1.0.tgz", + "integrity": "sha512-faYHw0anBbc/kWF3zFTEnxSFOAGUX9GFbOBthvDdLsIlEoWOFOtS0zgCiQYwIskL9iGXZL3kAXD8OoZ4GmMATA==", + "license": "MIT", + "dependencies": { + "content-type": "^2.0.0", + "media-typer": "^1.1.0", + "mime-types": "^3.0.0" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/type-is/node_modules/content-type": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/content-type/-/content-type-2.0.0.tgz", + "integrity": "sha512-j/O/d7GcZCyNl7/hwZAb606rzqkyvaDctLmckbxLzHvFBzTJHuGEdodATcP3yIRoDrLHkIATJuvzbFlp/ki2cQ==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, "node_modules/undici": { "version": "7.27.2", "resolved": "https://registry.npmmirror.com/undici/-/undici-7.27.2.tgz", @@ -2316,6 +3148,24 @@ "node": ">=20.18.1" } }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmmirror.com/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/vite": { "version": "8.0.16", "resolved": "https://registry.npmmirror.com/vite/-/vite-8.0.16.tgz", @@ -2706,6 +3556,12 @@ "node": ">=8" } }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" + }, "node_modules/xml-name-validator": { "version": "5.0.0", "resolved": "https://registry.npmmirror.com/xml-name-validator/-/xml-name-validator-5.0.0.tgz", diff --git a/package.json b/package.json index 776bbe1..10a390c 100644 --- a/package.json +++ b/package.json @@ -5,12 +5,16 @@ "type": "module", "scripts": { "dev": "vite", + "server": "node server/server.cjs", + "start": "node server/server.js & vite", "build": "vite build", "preview": "vite preview", "test": "vitest run", "test:watch": "vitest" }, "dependencies": { + "cors": "^2.8.6", + "express": "^5.2.1", "vue": "^3.5.34", "vue-router": "^4.6.4" }, diff --git a/server/server.cjs b/server/server.cjs new file mode 100644 index 0000000..0200067 --- /dev/null +++ b/server/server.cjs @@ -0,0 +1,219 @@ +/** + * C 代码编译运行后端服务 + * 接收 C 代码 → 编译 → 运行 → 返回输出 + */ +const express = require('express') +const cors = require('cors') +const { execSync } = require('child_process') +const path = require('path') +const fs = require('fs') + +const app = express() +const PORT = 3001 + +app.use(cors()) +app.use(express.json({ limit: '1mb' })) + +// 查找可用的 C 编译器 +// w64devkit GCC 路径 +const W64DEVKIT_DIR = path.join(__dirname, 'bin', 'w64devkit', 'w64devkit') +const W64DEVKIT_GCC = path.join(W64DEVKIT_DIR, 'bin', 'gcc.exe') +const W64DEVKIT_PREFIX = path.join(W64DEVKIT_DIR, 'lib', 'gcc') + +function findCompiler() { + const candidates = [ + // MinGW / MSYS2 (PATH) + 'gcc.exe', + 'x86_64-w64-mingw32-gcc.exe', + 'i686-w64-mingw32-gcc.exe', + // TCC (Tiny C Compiler) + 'tcc.exe', + // Clang + 'clang.exe', + // MSVC + 'cl.exe', + // 本项目的便携编译器 + path.join(__dirname, 'bin', 'tcc.exe'), + path.join(__dirname, 'bin', 'gcc.exe'), + path.join(__dirname, '..', 'tools', 'tcc', 'tcc.exe'), + ] + + // 先在 PATH 中查找 + for (const name of ['gcc.exe', 'tcc.exe', 'clang.exe', 'cl.exe']) { + try { + execSync(`where ${name}`, { stdio: 'pipe', timeout: 3000 }) + return { path: name, name } + } catch {} + } + + // 检查 w64devkit GCC(需设置 GCC_EXEC_PREFIX) + if (fs.existsSync(W64DEVKIT_GCC)) { + return { path: W64DEVKIT_GCC, name: 'gcc.exe', execPrefix: W64DEVKIT_PREFIX } + } + + // 再检查其他具体路径 + for (const candidate of candidates) { + try { + const absPath = path.resolve(candidate) + if (fs.existsSync(absPath)) { + return { path: absPath, name: path.basename(absPath) } + } + } catch {} + } + + // 搜索 Visual Studio MSVC 安装目录 + try { + const vsPaths = [ + 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC', + 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Professional\\VC\\Tools\\MSVC', + 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\MSVC', + 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC', + 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC', + ] + for (const vsPath of vsPaths) { + if (fs.existsSync(vsPath)) { + const versions = fs.readdirSync(vsPath).sort().reverse() + for (const ver of versions) { + const clPath = path.join(vsPath, ver, 'bin', 'Hostx64', 'x64', 'cl.exe') + if (fs.existsSync(clPath)) { + return { path: clPath, name: 'cl.exe' } + } + } + } + } + } catch {} + + return null +} + +// 编译并运行 C 代码 +app.post('/api/run-c', (req, res) => { + const { code } = req.body + if (!code) { + return res.status(400).json({ error: '请提供 C 代码' }) + } + + const compiler = findCompiler() + if (!compiler) { + return res.status(400).json({ + error: '未找到 C 编译器', + hint: '请安装 MinGW-w64 GCC 编译器', + installGuide: [ + '--- 安装 MinGW-w64 ---', + '方法一(推荐):下载 MinGW-w64 GCC', + ' 1. 访问 https://winlibs.com/ 下载 GCC (MinGW-w64)', + ' 2. 解压并将 bin/ 目录添加到系统 PATH 环境变量', + ' 3. 重启终端后即可使用', + '', + '方法二(轻量):下载 TCC (Tiny C Compiler)', + ' 将 tcc.exe 放入 server/bin/ 目录', + '', + '安装后重新启动: npm run server', + ].join('\n') + }) + } + + const tmpDir = path.join(__dirname, '..', 'tmp') + if (!fs.existsSync(tmpDir)) { + fs.mkdirSync(tmpDir, { recursive: true }) + } + + const srcFile = path.join(tmpDir, `code_${Date.now()}.c`) + const outFile = path.join(tmpDir, `code_${Date.now()}.exe`) + + try { + // 写入源码 + fs.writeFileSync(srcFile, code, 'utf-8') + + let compileCmd + const execOptions = { + timeout: 15000, + cwd: tmpDir, + encoding: 'utf-8', + env: { ...process.env } + } + + if (compiler.name.includes('tcc')) { + // TCC: 编译并运行一步到位(支持 -run) + compileCmd = `"${compiler.path}" -run "${srcFile}"` + } else if (compiler.execPrefix) { + // w64devkit GCC: 需要设置 GCC_EXEC_PREFIX 并加入 PATH + const w64binDir = path.dirname(compiler.path) + execOptions.env.GCC_EXEC_PREFIX = compiler.execPrefix + path.sep + execOptions.env.PATH = w64binDir + path.delimiter + (execOptions.env.PATH || '') + compileCmd = `"${compiler.path}" "${srcFile}" -o "${outFile}" -Wall -std=c99` + } else { + // GCC/Clang: 先编译再运行 + compileCmd = `"${compiler.path}" "${srcFile}" -o "${outFile}" -Wall -std=c99 2>&1` + } + + // 编译 + const compileOutput = execSync(compileCmd, execOptions) + + let runOutput = compileOutput + + // GCC/Clang: 编译后还需运行 exe + if (!compiler.name.includes('tcc') && fs.existsSync(outFile)) { + try { + runOutput = execSync(`"${outFile}"`, { + timeout: 10000, + cwd: tmpDir, + encoding: 'utf-8', + env: execOptions.env + }) + } catch (runErr) { + runOutput = runErr.stdout || runErr.message + } + } + + // 清理临时文件 + try { + if (fs.existsSync(srcFile)) fs.unlinkSync(srcFile) + if (fs.existsSync(outFile)) fs.unlinkSync(outFile) + } catch {} + + res.json({ output: runOutput }) + } catch (compileErr) { + // 编译错误 + res.json({ + output: compileErr.stdout || compileErr.message, + isError: true + }) + } finally { + // 确保清理 + try { + if (fs.existsSync(srcFile)) fs.unlinkSync(srcFile) + if (fs.existsSync(outFile)) fs.unlinkSync(outFile) + } catch {} + } +}) + +// 健康检查 +app.get('/api/status', (req, res) => { + const compiler = findCompiler() + res.json({ + status: 'ok', + compiler: compiler ? `${compiler.name} (${compiler.path})` : '未安装' + }) +}) + +// 下载 TCC 脚本 +app.get('/api/setup-compiler', (req, res) => { + res.json({ + message: '请手动下载 TCC:', + url: 'https://raw.githubusercontent.com/FooBarWidget/tinycc/master/tcc.exe', + instructions: `将 tcc.exe 放入 ${path.join(__dirname, 'bin')} 目录` + }) +}) + +app.listen(PORT, () => { + console.log(`✅ C 代码运行服务已启动: http://localhost:${PORT}`) + const compiler = findCompiler() + if (compiler) { + console.log(` 检测到编译器: ${compiler.name}`) + } else { + console.log(` ⚠️ 未检测到 C 编译器,请安装后使用`) + console.log(` 下载 TCC: https://raw.githubusercontent.com/FooBarWidget/tinycc/master/tcc.exe`) + console.log(` 放置路径: ${path.join(__dirname, 'bin', 'tcc.exe')}`) + } +}) diff --git a/src/__tests__/codeUtils.test.js b/src/__tests__/codeUtils.test.js new file mode 100644 index 0000000..6f807df --- /dev/null +++ b/src/__tests__/codeUtils.test.js @@ -0,0 +1,89 @@ +import { describe, it, expect } from 'vitest' +import { highlightC } from '../utils/codeUtils.js' + +describe('highlightC', () => { + it('should highlight keywords', () => { + const result = highlightC('int main()') + expect(result).toContain('int') + expect(result).toContain('main') + }) + + it('should highlight single-line comments', () => { + const result = highlightC('// this is a comment') + expect(result).toContain('') + expect(result).toContain('// this is a comment') + }) + + it('should highlight multi-line comments', () => { + const result = highlightC('/* multi\nline */') + expect(result).toContain('') + expect(result).toContain('/* multi') + expect(result).toContain('line */') + }) + + it('should highlight string literals', () => { + const result = highlightC('printf("hello world");') + expect(result).toContain('') + expect(result).toContain('"hello world"') + }) + + it('should highlight char literals', () => { + const result = highlightC("char c = 'A';") + expect(result).toContain("'A'") + }) + + it('should highlight numbers', () => { + const result = highlightC('int x = 42;') + expect(result).toContain('42') + }) + + it('should highlight float numbers', () => { + const result = highlightC('float f = 3.14;') + expect(result).toContain('3.14') + }) + + it('should highlight preprocessor directives', () => { + const result = highlightC('#include ') + expect(result).toContain('') + expect(result).toContain('#include <stdio.h>') + }) + + it('should NOT produce nested broken HTML tags', () => { + const result = highlightC('#include \nint main() {\n printf("hello");\n}') + // Should not contain any raw ']+>/g, '') + expect(stripped).not.toContain('hl-keyword') + expect(stripped).not.toContain('hl-comment') + expect(stripped).not.toContain('hl-string') + expect(stripped).not.toContain('hl-number') + }) + + it('should escape HTML in code content', () => { + const result = highlightC('int x = a < b && b > c;') + expect(result).toContain('<') + expect(result).toContain('>') + expect(result).not.toContain(' < ') + expect(result).not.toContain(' > ') + }) + + it('should handle empty string', () => { + expect(highlightC('')).toBe('') + }) + + it('should handle code with mixed content', () => { + const code = `#include +// main function +int main() { + printf("Hello, World!\\n"); + return 0; +}` + const result = highlightC(code) + expect(result).toContain('hl-preprocessor') + expect(result).toContain('hl-comment') + expect(result).toContain('hl-keyword') + expect(result).toContain('hl-string') + expect(result).toContain('hl-number') + }) +}) diff --git a/src/components/CodeViewer.vue b/src/components/CodeViewer.vue index 614ed04..e36211b 100644 --- a/src/components/CodeViewer.vue +++ b/src/components/CodeViewer.vue @@ -1,5 +1,5 @@ @@ -40,12 +79,22 @@ const codeContent = ref('') const loading = ref(false) const error = ref('') const copied = ref(false) +const fontSize = ref(13) +const isFullscreen = ref(false) +const viewerRef = ref(null) +const codeRef = ref(null) + +const MIN_FONT = 10 +const MAX_FONT = 36 +const FONT_STEP = 2 const highlightedCode = computed(() => { if (!codeContent.value) return '' return highlightC(codeContent.value) }) +const lineHeight = computed(() => Math.max(22, fontSize.value * 1.5)) + async function loadCode() { if (!props.filePath) return loading.value = true @@ -62,13 +111,90 @@ async function loadCode() { watch(() => props.filePath, loadCode, { immediate: true }) +// 字号控制 +function fontSizeUp() { + fontSize.value = Math.min(fontSize.value + FONT_STEP, MAX_FONT) +} +function fontSizeDown() { + fontSize.value = Math.max(fontSize.value - FONT_STEP, MIN_FONT) +} +function fontSizeReset() { + fontSize.value = 13 +} + +// Ctrl+滚轮缩放 +function onWheel(e) { + if (e.ctrlKey || e.metaKey) { + e.preventDefault() + if (e.deltaY < 0) fontSizeUp() + else fontSizeDown() + } +} + +// 全屏 +async function toggleFullscreen() { + if (!viewerRef.value) return + if (isFullscreen.value) { + try { + await document.exitFullscreen() + } catch {} + isFullscreen.value = false + } else { + try { + await viewerRef.value.requestFullscreen() + isFullscreen.value = true + } catch {} + } +} + +function onFullscreenChange() { + isFullscreen.value = !!document.fullscreenElement +} + +// 监听全屏变化 +if (typeof document !== 'undefined') { + document.addEventListener('fullscreenchange', onFullscreenChange) +} + +const running = ref(false) +const runOutput = ref(null) // { text: string, isError: boolean } +const outputCollapsed = ref(false) + +async function runCode() { + if (!codeContent.value) return + running.value = true + runOutput.value = null + outputCollapsed.value = false + + try { + const res = await fetch('/api/run-c', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ code: codeContent.value }) + }) + const data = await res.json() + runOutput.value = { + text: data.error || data.hint + ? `⚠️ ${data.error || '未知错误'}\n${data.hint || ''}\n${data.installGuide || ''}` + : data.output, + isError: data.isError || !!data.error + } + } catch (e) { + runOutput.value = { + text: `❌ 无法连接到运行服务\n请确认后端服务已启动 (npm run server)`, + isError: true + } + } finally { + running.value = false + } +} + async function copyCode() { try { await navigator.clipboard.writeText(codeContent.value) copied.value = true setTimeout(() => { copied.value = false }, 2000) } catch { - // fallback const textarea = document.createElement('textarea') textarea.value = codeContent.value document.body.appendChild(textarea) @@ -127,7 +253,7 @@ async function copyCode() { .toolbar-actions { display: flex; align-items: center; - gap: 8px; + gap: 6px; } .file-desc-tip { @@ -135,36 +261,176 @@ async function copyCode() { font-size: 16px; } -.copy-btn { +/* 字型控制 */ +.font-size-control { + display: flex; + align-items: center; + gap: 4px; + padding: 0 6px; + border-right: 1px solid var(--border-color); + border-left: 1px solid var(--border-color); + margin: 0 4px; +} + +.font-size-value { + font-size: 11px; + font-family: var(--mono); + color: var(--text-tertiary); + min-width: 28px; + text-align: center; +} + +/* 通用工具栏按钮 */ +.tool-btn { background: var(--hover-bg); border: 1px solid var(--border-color); - padding: 4px 10px; + padding: 4px 8px; border-radius: 6px; cursor: pointer; - font-size: 14px; - transition: all 0.2s; + font-size: 13px; + transition: all 0.15s; + line-height: 1; + color: var(--text-secondary); + white-space: nowrap; } -.copy-btn:hover { +.tool-btn:hover { background: var(--active-bg); + color: var(--text-primary); + border-color: var(--primary-color); } +.reset-btn { + font-size: 14px; + padding: 4px 6px; +} + +/* 代码内容区域 */ .code-content { position: relative; - overflow-x: auto; + overflow: auto; } .code-content pre { - padding: 16px; + padding: 16px 20px; margin: 0; font-family: 'Fira Code', 'JetBrains Mono', 'Consolas', monospace; font-size: 13px; - line-height: 1.6; + line-height: 22px; color: var(--code-text); + text-align: left; + white-space: pre; + tab-size: 4; } .code-content code { font-family: inherit; + font-size: inherit; +} + +/* 全屏模式 */ +.code-viewer.fullscreen { + position: fixed; + inset: 0; + z-index: 9999; + border-radius: 0; + background: var(--code-bg); + display: flex; + flex-direction: column; +} + +.code-viewer.fullscreen .code-content { + flex: 1; + overflow: auto; +} + +.code-viewer.fullscreen .code-content pre { + min-height: 100%; +} + +/* 运行按钮 */ +.run-btn { + background: #22c55e; + color: white; + border-color: #22c55e; + font-weight: 600; + padding: 4px 12px; +} + +.run-btn:hover:not(:disabled) { + background: #16a34a; + border-color: #16a34a; + color: white; +} + +.run-btn:disabled { + opacity: 0.6; + cursor: wait; +} + +/* 运行输出面板 */ +.run-output { + border-top: 1px solid var(--border-color); + background: #1a1a2e; + transition: all 0.2s; +} + +.run-output.collapsed .output-body { + display: none; +} + +.output-header { + display: flex; + align-items: center; + gap: 8px; + padding: 8px 16px; + cursor: pointer; + user-select: none; + background: rgba(255,255,255,0.03); +} + +.output-title { + flex: 1; + font-size: 13px; + font-weight: 600; + color: #e2e8f0; +} + +.output-toggle { + font-size: 11px; + color: #94a3b8; +} + +.close-btn { + background: transparent; + border: none; + color: #94a3b8; + padding: 2px 6px; + font-size: 14px; +} +.close-btn:hover { + color: #ef4444; + background: transparent; +} + +.output-body { + max-height: 300px; + overflow: auto; +} + +.output-body pre { + margin: 0; + padding: 12px 16px; + font-family: 'Fira Code', 'Consolas', monospace; + font-size: 13px; + line-height: 1.5; + color: #e2e8f0; + white-space: pre-wrap; + word-break: break-all; +} + +.output-body pre.error-text { + color: #fca5a5; } .loading-overlay, diff --git a/src/utils/codeUtils.js b/src/utils/codeUtils.js index 1d8f58e..e555dc1 100644 --- a/src/utils/codeUtils.js +++ b/src/utils/codeUtils.js @@ -16,40 +16,149 @@ export async function loadCodeFile(path) { } /** - * C语言关键字高亮 + * C语言关键字高亮(基于 Token 的稳健实现) + * 逐字符解析,避免正则误匹配已插入的 HTML 标签 */ export function highlightC(code) { - const keywords = [ + const keywords = new Set([ 'auto', 'break', 'case', 'char', 'const', 'continue', 'default', 'do', 'double', 'else', 'enum', 'extern', 'float', 'for', 'goto', 'if', 'int', 'long', 'register', 'return', 'short', 'signed', 'sizeof', 'static', 'struct', 'switch', 'typedef', 'union', 'unsigned', 'void', 'volatile', 'while', 'include', 'define', 'ifdef', 'ifndef', 'endif', 'main', 'printf', 'scanf' - ] + ]) - // 先转义 HTML - let escaped = code + let result = '' + let i = 0 + const len = code.length + + while (i < len) { + // 预处理指令(行首 #) + if (code[i] === '#' && (i === 0 || code[i - 1] === '\n')) { + let end = i + 1 + while (end < len && code[end] !== '\n') end++ + const line = code.slice(i, end) + result += '' + escapeHtml(line) + '' + i = end + continue + } + + // 单行注释 // + if (code[i] === '/' && i + 1 < len && code[i + 1] === '/') { + let end = i + 2 + while (end < len && code[end] !== '\n') end++ + result += '' + escapeHtml(code.slice(i, end)) + '' + i = end + continue + } + + // 多行注释 /* */ + if (code[i] === '/' && i + 1 < len && code[i + 1] === '*') { + let end = i + 2 + while (end + 1 < len && !(code[end] === '*' && code[end + 1] === '/')) end++ + if (end + 1 < len) end += 2 + result += '' + escapeHtml(code.slice(i, end)) + '' + i = end + continue + } + + // 双引号字符串 "..." + if (code[i] === '"') { + let end = i + 1 + while (end < len && code[end] !== '"') { + if (code[end] === '\\') end++ // 跳过转义字符 + end++ + } + if (end < len) end++ // 包含结束引号 + result += '' + escapeHtml(code.slice(i, end)) + '' + i = end + continue + } + + // 单引号字符 '...' + if (code[i] === "'") { + let end = i + 1 + while (end < len && code[end] !== "'") { + if (code[end] === '\\') end++ + end++ + } + if (end < len) end++ + result += '' + escapeHtml(code.slice(i, end)) + '' + i = end + continue + } + + // 数字(整数/浮点数) + if (isDigit(code[i]) || (code[i] === '.' && i + 1 < len && isDigit(code[i + 1]))) { + let start = i + if (code[i] === '0' && i + 1 < len && (code[i + 1] === 'x' || code[i + 1] === 'X')) { + // 十六进制 + i += 2 + while (i < len && isHexDigit(code[i])) i++ + } else { + while (i < len && isDigit(code[i])) i++ + if (i < len && code[i] === '.') { + i++ + while (i < len && isDigit(code[i])) i++ + } + if (i < len && (code[i] === 'e' || code[i] === 'E')) { + i++ + if (i < len && (code[i] === '+' || code[i] === '-')) i++ + while (i < len && isDigit(code[i])) i++ + } + } + // 确保不是标识符的一部分 + if (i < len && isWordChar(code[i])) { + // 回退,按普通文本处理 + i = start + result += escapeHtml(code[i]) + i++ + } else { + result += '' + escapeHtml(code.slice(start, i)) + '' + } + continue + } + + // 标识符/关键字 + if (isWordStart(code[i])) { + let start = i + while (i < len && isWordChar(code[i])) i++ + const word = code.slice(start, i) + if (keywords.has(word)) { + result += '' + escapeHtml(word) + '' + } else { + result += escapeHtml(word) + } + continue + } + + // 其他字符 + result += escapeHtml(code[i]) + i++ + } + + return result +} + +function escapeHtml(str) { + return str .replace(/&/g, '&') .replace(//g, '>') - - // 关键字高亮 - const keywordPattern = new RegExp(`\\b(${keywords.join('|')})\\b`, 'g') - escaped = escaped.replace(keywordPattern, '$1') - - // 注释高亮 (// 和 /* */) - escaped = escaped.replace(/(\/\/.*)/g, '$1') - escaped = escaped.replace(/(\/\*[\s\S]*?\*\/)/g, '$1') - - // 字符串高亮 - escaped = escaped.replace(/"([^"\\]*(\\.[^"\\]*)*)"/g, '"$1"') - escaped = escaped.replace(/'([^'\\]*(\\.[^'\\]*)*)'/g, '\'$1\'') - - // 数字高亮 - escaped = escaped.replace(/\b(\d+\.?\d*)\b/g, '$1') - - // 预处理指令高亮 - escaped = escaped.replace(/(^#\s*\w+.*)/gm, '$1') - - return escaped +} + +function isDigit(c) { + return c >= '0' && c <= '9' +} + +function isHexDigit(c) { + return isDigit(c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F') +} + +function isWordStart(c) { + return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c === '_' +} + +function isWordChar(c) { + return isWordStart(c) || isDigit(c) } diff --git a/vite.config.js b/vite.config.js index 3995e34..a5e5b75 100644 --- a/vite.config.js +++ b/vite.config.js @@ -4,6 +4,14 @@ import vue from '@vitejs/plugin-vue' // https://vite.dev/config/ export default defineConfig({ plugins: [vue()], + server: { + proxy: { + '/api': { + target: 'http://localhost:3001', + changeOrigin: true, + }, + }, + }, test: { environment: 'jsdom', globals: true,