From 7ce872237a2f89f2fddccfd5d08b84a1851ec338 Mon Sep 17 00:00:00 2001 From: zhaoyingbo Date: Mon, 17 Mar 2025 12:11:35 +0000 Subject: [PATCH] =?UTF-8?q?feat(net-tool):=20=E5=BC=95=E5=85=A5=20bun-type?= =?UTF-8?q?s=EF=BC=8C=E6=9B=B4=E6=96=B0=E7=B1=BB=E5=9E=8B=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E5=92=8C=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 37 ++++++++++++++++++++------ package.json | 2 +- packages/net-tool/src/netTool/base.ts | 1 + packages/net-tool/src/netTool/index.ts | 2 ++ tsconfig.json | 5 +++- 5 files changed, 37 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index d055b4e..d69e4d8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,7 +23,7 @@ "@eslint/js": "9.9.0", "@lerna/conventional-commits": "6.4.1", "@types/lodash": "^4.17.10", - "@types/node": "22.4.0", + "bun-types": "^1.2.4", "eslint": "9.9.0", "eslint-plugin-simple-import-sort": "12.1.1", "globals": "15.9.0", @@ -2388,13 +2388,13 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.4.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.4.0.tgz", - "integrity": "sha512-49AbMDwYUz7EXxKU/r7mXOsxwFr4BYbvB7tWYxVuLdb2ibd30ijjXINSMAHiEEZk5PCRBmW1gUeisn2VMKt3cQ==", + "version": "22.13.9", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.9.tgz", + "integrity": "sha512-acBjXdRJ3A6Pb3tqnw9HZmyR3Fiol3aGxRCK1x3d+6CDAMjl7I649wpSd+yNURCjbOUGu9tqtLKnTGxmK6CyGw==", "dev": true, "license": "MIT", "dependencies": { - "undici-types": "~6.19.2" + "undici-types": "~6.20.0" } }, "node_modules/@types/normalize-package-data": { @@ -2410,6 +2410,16 @@ "integrity": "sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw==", "license": "MIT" }, + "node_modules/@types/ws": { + "version": "8.5.14", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.14.tgz", + "integrity": "sha512-bd/YFLW+URhBzMXurx7lWByOu+xzU9+kb3RboOteXYDfW+tr+JZa99OyNmPINEGB/ahzKrEuc8rcv4gnpJmxTw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@typescript-eslint/eslint-plugin": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.1.0.tgz", @@ -3064,6 +3074,17 @@ "dev": true, "license": "MIT" }, + "node_modules/bun-types": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/bun-types/-/bun-types-1.2.4.tgz", + "integrity": "sha512-nDPymR207ZZEoWD4AavvEaa/KZe/qlrbMSchqpQwovPZCKc7pwMoENjEtHgMKaAjJhy+x6vfqSBA1QU3bJgs0Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "@types/ws": "~8.5.10" + } + }, "node_modules/byte-size": { "version": "8.1.1", "resolved": "https://registry.npmjs.org/byte-size/-/byte-size-8.1.1.tgz", @@ -11784,9 +11805,9 @@ } }, "node_modules/undici-types": { - "version": "6.19.8", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", - "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", + "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", "dev": true, "license": "MIT" }, diff --git a/package.json b/package.json index 9d08f3d..968e63a 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "@eslint/js": "9.9.0", "@lerna/conventional-commits": "6.4.1", "@types/lodash": "^4.17.10", - "@types/node": "22.4.0", + "bun-types": "^1.2.4", "eslint": "9.9.0", "eslint-plugin-simple-import-sort": "12.1.1", "globals": "15.9.0", diff --git a/packages/net-tool/src/netTool/base.ts b/packages/net-tool/src/netTool/base.ts index de25ea1..8dbd7f0 100644 --- a/packages/net-tool/src/netTool/base.ts +++ b/packages/net-tool/src/netTool/base.ts @@ -1,4 +1,5 @@ import logger from "@egg/logger" +import { Response } from "bun-types/fetch" import { Logger } from "winston" import { NetErrorDetail, NetRequestParams } from "../types" diff --git a/packages/net-tool/src/netTool/index.ts b/packages/net-tool/src/netTool/index.ts index 4212b4a..fd81065 100644 --- a/packages/net-tool/src/netTool/index.ts +++ b/packages/net-tool/src/netTool/index.ts @@ -1,3 +1,5 @@ +import { Response } from "bun-types/fetch" + import { NetRequestParams } from "../types" import NetToolBase from "./base" diff --git a/tsconfig.json b/tsconfig.json index ef54b43..08f07d2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -18,7 +18,10 @@ "declaration": true, "sourceMap": true, "rootDir": "./packages", - "outDir": "./dist" + "outDir": "./dist", + "types": [ + "bun-types" // add Bun global + ] }, "include": ["./packages/**/*"], "exclude": ["node_modules", "**/*.test.ts"]