@aomex/response-time 3.30.8-alpha.62.sha-92b25bb → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,20 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [4.0.0](https://github.com/aomex/aomex/compare/v3.30.7...v4.0.0) (2026-11-17)
7
+
8
+ * chore!: 升级至 TypeScript 7 并将构建工具迁移到 tsdown ([a111409](https://github.com/aomex/aomex/commit/a111409021e2ee81ee5fb20ccc75480c9b5fa4c0))
9
+
10
+ ### Bug Fixes
11
+
12
+ * **trace-async,response-time:** 函数指定返回类型防止打包后内联import ([13a28e5](https://github.com/aomex/aomex/commit/13a28e5cf6e1cf67499182677fb1f43af62dc803))
13
+
14
+ ### BREAKING CHANGES
15
+
16
+ * Node.js 最低版本提升至 `>=24.0.0`。
17
+ * 最低 TypeScript 版本为 7。
18
+
19
+
6
20
  ## [3.30.7](https://github.com/aomex/aomex/compare/v3.30.6...v3.30.7) (2026-11-01)
7
21
 
8
22
  **Note:** Version bump only for package @aomex/response-time
package/dist/index.d.ts CHANGED
@@ -1 +1,2 @@
1
- export declare const responseTime: () => import("@aomex/web").WebMiddleware<object>;
1
+ import { WebMiddleware } from "@aomex/web";
2
+ export declare const responseTime: () => WebMiddleware;
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { middleware } from "@aomex/common";
2
+ import "@aomex/web";
2
3
  // src/index.ts
3
4
  const getDelta = (start) => {
4
5
  const deltas = process.hrtime(start);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { middleware } from '@aomex/common';\nimport type { HttpError } from '@aomex/web';\n\nconst getDelta = (start: [number, number]) => {\n const deltas = process.hrtime(start);\n return deltas[0] * 1_000 + deltas[1] / 1_000_000 + 'ms';\n};\n\nexport const responseTime = () => {\n return middleware.web((ctx, next) => {\n const start = process.hrtime();\n return next()\n .then(() => {\n ctx.response.setHeader('x-response-time', getDelta(start));\n })\n .catch((err: HttpError) => {\n err.headers = {\n ...err.headers,\n 'x-response-time': getDelta(start),\n };\n return Promise.reject(err);\n });\n });\n};\n"],"mappings":";;AAGA,MAAM,YAAY,UAA4B;CAC5C,MAAM,SAAS,QAAQ,OAAO,KAAK;CACnC,OAAO,OAAO,KAAK,MAAQ,OAAO,KAAK,MAAY;AACrD;AAEA,MAAa,qBAAqB;CAChC,OAAO,WAAW,KAAK,KAAK,SAAS;EACnC,MAAM,QAAQ,QAAQ,OAAO;EAC7B,OAAO,KAAK,CAAC,CACV,WAAW;GACV,IAAI,SAAS,UAAU,mBAAmB,SAAS,KAAK,CAAC;EAC3D,CAAC,CAAC,CACD,OAAO,QAAmB;GACzB,IAAI,UAAU;IACZ,GAAG,IAAI;IACP,mBAAmB,SAAS,KAAK;GACnC;GACA,OAAO,QAAQ,OAAO,GAAG;EAC3B,CAAC;CACL,CAAC;AACH"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { middleware } from '@aomex/common';\nimport { type HttpError, type WebMiddleware } from '@aomex/web';\n\nconst getDelta = (start: [number, number]) => {\n const deltas = process.hrtime(start);\n return deltas[0] * 1_000 + deltas[1] / 1_000_000 + 'ms';\n};\n\n// 显式返回 WebMiddleware:避免 .d.ts 写成 import(\"@aomex/web\").WebMiddleware\nexport const responseTime = (): WebMiddleware => {\n return middleware.web((ctx, next) => {\n const start = process.hrtime();\n return next()\n .then(() => {\n ctx.response.setHeader('x-response-time', getDelta(start));\n })\n .catch((err: HttpError) => {\n err.headers = {\n ...err.headers,\n 'x-response-time': getDelta(start),\n };\n return Promise.reject(err);\n });\n });\n};\n"],"mappings":";;;AAGA,MAAM,YAAY,UAA4B;CAC5C,MAAM,SAAS,QAAQ,OAAO,KAAK;CACnC,OAAO,OAAO,KAAK,MAAQ,OAAO,KAAK,MAAY;AACrD;AAGA,MAAa,qBAAoC;CAC/C,OAAO,WAAW,KAAK,KAAK,SAAS;EACnC,MAAM,QAAQ,QAAQ,OAAO;EAC7B,OAAO,KAAK,CAAC,CACV,WAAW;GACV,IAAI,SAAS,UAAU,mBAAmB,SAAS,KAAK,CAAC;EAC3D,CAAC,CAAC,CACD,OAAO,QAAmB;GACzB,IAAI,UAAU;IACZ,GAAG,IAAI;IACP,mBAAmB,SAAS,KAAK;GACnC;GACA,OAAO,QAAQ,OAAO,GAAG;EAC3B,CAAC;CACL,CAAC;AACH"}
package/package.json CHANGED
@@ -1,18 +1,24 @@
1
1
  {
2
2
  "name": "@aomex/response-time",
3
- "version": "3.30.8-alpha.62.sha-92b25bb",
3
+ "version": "4.0.0",
4
4
  "description": "计算请求接口所用时间",
5
5
  "keywords": [],
6
- "repository": "git@github.com:aomex/aomex.git",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git@github.com:aomex/aomex.git"
9
+ },
7
10
  "homepage": "https://aomex.js.org",
8
11
  "license": "MIT",
9
12
  "type": "module",
10
13
  "sideEffects": false,
11
- "scripts": {
12
- "prepublishOnly": "tsdown"
14
+ "types": "dist/index.d.ts",
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.ts",
18
+ "import": "./dist/index.js"
19
+ },
20
+ "./package.json": "./package.json"
13
21
  },
14
- "types": "src/index.ts",
15
- "exports": "./src/index.ts",
16
22
  "files": [
17
23
  "dist",
18
24
  "LICENSE",
@@ -21,14 +27,6 @@
21
27
  "CHANGELOG.md"
22
28
  ],
23
29
  "publishConfig": {
24
- "types": "dist/index.d.ts",
25
- "exports": {
26
- ".": {
27
- "types": "./dist/index.d.ts",
28
- "import": "./dist/index.js"
29
- },
30
- "./package.json": "./package.json"
31
- },
32
30
  "access": "public"
33
31
  },
34
32
  "peerDependencies": {
@@ -36,8 +34,8 @@
36
34
  "@aomex/web": "^4.0.0"
37
35
  },
38
36
  "devDependencies": {
39
- "@aomex/common": "3.30.8-alpha.62.sha-92b25bb",
40
- "@aomex/web": "3.30.8-alpha.62.sha-92b25bb"
37
+ "@aomex/common": "4.0.0",
38
+ "@aomex/web": "4.0.0"
41
39
  },
42
- "gitHead": "92b25bbcd6c3ae28160316117a74c88619b5bc8d"
43
- }
40
+ "scripts": {}
41
+ }