Files
router/package.json
abearxiong a6a7e74559 feat: Refactor server implementation to support Bun and Node environments
- Introduced `ServerNode` and `BunServer` classes to handle server logic for Node and Bun respectively.
- Updated `App` class to initialize the appropriate server based on the runtime environment.
- Enhanced `parseBody` function to handle request body parsing for both environments.
- Modified WebSocket handling to support Bun's WebSocket upgrade mechanism.
- Improved error handling and response structure across the server implementation.
- Added support for custom middleware in the server's request handling.
- Refactored server base functionality into `ServerBase` for better code organization.
- Updated type definitions to reflect changes in server options and listener handling.
- Added a new demo for testing the server functionality with various request types.
2025-12-20 05:11:51 +08:00

103 lines
2.6 KiB
JSON

{
"$schema": "https://json.schemastore.org/package",
"name": "@kevisual/router",
"version": "0.0.42",
"description": "",
"type": "module",
"main": "./dist/router.js",
"types": "./dist/router.d.ts",
"scripts": {
"build": "npm run clean && rollup -c",
"build:app": "npm run build && rsync dist/*browser* ../deploy/dist",
"watch": "rollup -c -w",
"clean": "rm -rf dist"
},
"files": [
"dist",
"src",
"mod.ts"
],
"keywords": [],
"author": "abearxiong",
"license": "MIT",
"packageManager": "pnpm@10.26.0",
"devDependencies": {
"@kevisual/local-proxy": "^0.0.8",
"@kevisual/query": "^0.0.32",
"@rollup/plugin-alias": "^6.0.0",
"@rollup/plugin-commonjs": "29.0.0",
"@rollup/plugin-node-resolve": "^16.0.3",
"@rollup/plugin-typescript": "^12.3.0",
"@types/bun": "^1.3.5",
"@types/node": "^25.0.3",
"@types/send": "^1.2.1",
"@types/ws": "^8.18.1",
"@types/xml2js": "^0.4.14",
"cookie": "^1.1.1",
"nanoid": "^5.1.6",
"rollup": "^4.53.5",
"rollup-plugin-dts": "^6.3.0",
"ts-loader": "^9.5.4",
"ts-node": "^10.9.2",
"tslib": "^2.8.1",
"tsx": "^4.21.0",
"typescript": "^5.9.3",
"ws": "npm:@kevisual/ws",
"xml2js": "^0.6.2",
"zod": "^4.2.1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/abearxiong/kevisual-router.git"
},
"dependencies": {
"path-to-regexp": "^8.3.0",
"selfsigned": "^5.2.0",
"send": "^1.2.1"
},
"publishConfig": {
"access": "public"
},
"exports": {
".": {
"import": "./dist/router.js",
"require": "./dist/router.js",
"types": "./dist/router.d.ts"
},
"./browser": {
"import": "./dist/router-browser.js",
"require": "./dist/router-browser.js",
"types": "./dist/router-browser.d.ts"
},
"./sign": {
"import": "./dist/router-sign.js",
"require": "./dist/router-sign.js",
"types": "./dist/router-sign.d.ts"
},
"./simple": {
"import": "./dist/router-simple.js",
"require": "./dist/router-simple.js",
"types": "./dist/router-simple.d.ts"
},
"./define": {
"import": "./dist/router-define.js",
"require": "./dist/router-define.js",
"types": "./dist/router-define.d.ts"
},
"./simple-lib": {
"import": "./dist/router-simple-lib.js",
"require": "./dist/router-simple-lib.js",
"types": "./dist/router-simple-lib.d.ts"
},
"./mod.ts": {
"import": "./mod.ts",
"require": "./mod.ts",
"types": "./mod.d.ts"
},
"./src/*": {
"import": "./src/*",
"require": "./src/*"
}
}
}