@aomex/response-time 0.0.4 → 0.0.5

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
@@ -1,35 +1,9 @@
1
1
  # @aomex/response-time
2
2
 
3
- ## 0.0.4
3
+ ## 0.0.5
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - Updated dependencies [[`d3a2757`](https://github.com/aomex/aomex/commit/d3a2757b38391ad70a206d95eac09520c64e9b85), [`07c8575`](https://github.com/aomex/aomex/commit/07c857565ede4eca7e88de4e8c5e5f244f9d16cb), [`e80844a`](https://github.com/aomex/aomex/commit/e80844a6808fd0f3b9d613ec3163b06357316cae), [`146b6b5`](https://github.com/aomex/aomex/commit/146b6b5f09d4b9f557c1771686f3585bebf4cfc9), [`56f65c8`](https://github.com/aomex/aomex/commit/56f65c8509b40679272ed58f63e12d98e1818503), [`c6df4de`](https://github.com/aomex/aomex/commit/c6df4de61fc28f452f8a202c9a485e1a061b3eb6), [`79e19c1`](https://github.com/aomex/aomex/commit/79e19c1ae2a35b38580a4d2a27b6dde634345126), [`9adefaa`](https://github.com/aomex/aomex/commit/9adefaa8baaaafb7be610c7a98920c9830d10a3c), [`a8bb601`](https://github.com/aomex/aomex/commit/a8bb601acaf1e1d580511ae886a4ae99bf19f699), [`902597b`](https://github.com/aomex/aomex/commit/902597b2f98fda7e63f7419a5ef62ab2acb7c863), [`e8dee7c`](https://github.com/aomex/aomex/commit/e8dee7c3f064587cd2afb9cb95ab3341f63ccd27)]:
8
- - @aomex/web@0.0.6
9
- - @aomex/core@0.0.5
10
-
11
- ## 0.0.3
12
-
13
- ### Patch Changes
14
-
15
- - Updated dependencies [[`d8debb9`](https://github.com/aomex/aomex/commit/d8debb9b6319d30e48cb77d97103b5559c57789c), [`64c10e1`](https://github.com/aomex/aomex/commit/64c10e17ff92251bb2d9f45e0bddde5cba8a3b20), [`6a57463`](https://github.com/aomex/aomex/commit/6a57463c1107c38a8b8cf5fa00ff3289bf629c0a), [`8857115`](https://github.com/aomex/aomex/commit/88571153b7e84ec6d66d37970c3ef7b4e1924a03), [`68b1365`](https://github.com/aomex/aomex/commit/68b13655922a0714bcdd2101ce659da382d44e8b), [`b51a81a`](https://github.com/aomex/aomex/commit/b51a81a65313073dff5307b310b6656da2ad5186), [`ee021e3`](https://github.com/aomex/aomex/commit/ee021e342814f12777e538c06a19971e1020f201), [`b5aaec5`](https://github.com/aomex/aomex/commit/b5aaec540e3d732868a270a969a94ccd6ff9ac6a), [`fd6ae40`](https://github.com/aomex/aomex/commit/fd6ae40577bd9a62c211d4615483fc5dd58f5865)]:
16
- - @aomex/web@0.0.5
17
- - @aomex/core@0.0.4
18
-
19
- ## 0.0.2
20
-
21
- ### Patch Changes
22
-
23
- - Updated dependencies [[`121253a`](https://github.com/aomex/aomex/commit/121253a6fc203e427bfd25e82d713bec6ac13b38), [`59dc183`](https://github.com/aomex/aomex/commit/59dc183bcec9b7221c18865563b38cba5d82869b), [`8cb74fd`](https://github.com/aomex/aomex/commit/8cb74fdd27626037aa9bc80cb2930e4f0d67f8e6), [`d834392`](https://github.com/aomex/aomex/commit/d834392b1e0f6333d66d11378d9f4ceb813a58a9), [`91feda4`](https://github.com/aomex/aomex/commit/91feda457dfa8bd8dd2c8f38bfaaf4f7f2f7702f)]:
24
- - @aomex/web@0.0.4
25
- - @aomex/core@0.0.3
26
-
27
- ## 0.0.1
28
-
29
- ### Patch Changes
30
-
31
- - [`c6be50a`](https://github.com/aomex/aomex/commit/c6be50a1908e93ed34a32c87cb75242b77e2f887) Thanks [@geekact](https://github.com/geekact)! - 增加 web 插件 response-time
32
-
33
- - Updated dependencies [[`4735157`](https://github.com/aomex/aomex/commit/4735157c52d0abecc41d6c7f416280ebfd6ee696), [`d6ac7b5`](https://github.com/aomex/aomex/commit/d6ac7b5403334b51fa15dbe82dd6b5b6d048f661), [`9254754`](https://github.com/aomex/aomex/commit/9254754d234fc0062eb5d600284ee8453825306c), [`d1ce4e2`](https://github.com/aomex/aomex/commit/d1ce4e2276f93c44e67ea06666d048917fa94e53), [`6056f55`](https://github.com/aomex/aomex/commit/6056f556577865220d6b5be2a4eafad9e4dbf8d4), [`1c67399`](https://github.com/aomex/aomex/commit/1c673992c4b313c2accb4cbc1fc66537a9886c29), [`352642a`](https://github.com/aomex/aomex/commit/352642abf2ccb3fe97e2d83a691d8428ccfc9758)]:
34
- - @aomex/web@0.0.3
35
- - @aomex/core@0.0.2
7
+ - Updated dependencies [[`bbc8dda`](https://github.com/aomex/aomex/commit/bbc8dda9f0876c3402608133085350cc693def6f), [`ceb2d82`](https://github.com/aomex/aomex/commit/ceb2d8269755dca3f79b755224259b8a99bc65d0)]:
8
+ - @aomex/core@0.0.6
9
+ - @aomex/web@0.0.7
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { WebMiddleware } from '@aomex/web';
2
2
 
3
3
  interface ResponseTimeOptions {
4
4
  /**
5
- * `true` 则使用微妙,`false` 则使用毫秒(默认:true)
5
+ * Includes microseconds. Defaults `true`
6
6
  */
7
7
  hrtime?: boolean;
8
8
  }
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { middleware } from '@aomex/core';\nimport type { WebMiddleware } from '@aomex/web';\n\nexport interface ResponseTimeOptions {\n /**\n * `true` 则使用微妙,`false` 则使用毫秒(默认:true)\n */\n hrtime?: boolean;\n}\n\nexport const responseTime = (\n options: ResponseTimeOptions = {},\n): WebMiddleware => {\n const { hrtime = true } = options;\n\n return middleware.web(async (ctx, next) => {\n const start = process.hrtime();\n\n try {\n await next();\n } finally {\n const deltas = process.hrtime(start);\n let delta = deltas[0] * 1000 + deltas[1] / 1000000;\n\n if (!hrtime) {\n delta = Math.round(delta);\n }\n\n ctx.response.setHeader('X-Response-Time', delta + 'ms');\n }\n });\n};\n"],"mappings":";AAAA,SAAS,kBAAkB;AAUpB,IAAM,eAAe,CAC1B,UAA+B,CAAC,MACd;AAClB,QAAM,EAAE,SAAS,KAAK,IAAI;AAE1B,SAAO,WAAW,IAAI,OAAO,KAAK,SAAS;AACzC,UAAM,QAAQ,QAAQ,OAAO;AAE7B,QAAI;AACF,YAAM,KAAK;AAAA,IACb,UAAE;AACA,YAAM,SAAS,QAAQ,OAAO,KAAK;AACnC,UAAI,QAAQ,OAAO,CAAC,IAAI,MAAO,OAAO,CAAC,IAAI;AAE3C,UAAI,CAAC,QAAQ;AACX,gBAAQ,KAAK,MAAM,KAAK;AAAA,MAC1B;AAEA,UAAI,SAAS,UAAU,mBAAmB,QAAQ,IAAI;AAAA,IACxD;AAAA,EACF,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { middleware } from '@aomex/core';\nimport type { WebMiddleware } from '@aomex/web';\n\nexport interface ResponseTimeOptions {\n /**\n * Includes microseconds. Defaults `true`\n */\n hrtime?: boolean;\n}\n\nexport const responseTime = (\n options: ResponseTimeOptions = {},\n): WebMiddleware => {\n const { hrtime = true } = options;\n\n return middleware.web(async (ctx, next) => {\n const start = process.hrtime();\n\n try {\n await next();\n } finally {\n const deltas = process.hrtime(start);\n let delta = deltas[0] * 1000 + deltas[1] / 1000000;\n\n if (!hrtime) {\n delta = Math.round(delta);\n }\n\n ctx.response.setHeader('X-Response-Time', delta + 'ms');\n }\n });\n};\n"],"mappings":";AAAA,SAAS,kBAAkB;AAUpB,IAAM,eAAe,CAC1B,UAA+B,CAAC,MACd;AAClB,QAAM,EAAE,SAAS,KAAK,IAAI;AAE1B,SAAO,WAAW,IAAI,OAAO,KAAK,SAAS;AACzC,UAAM,QAAQ,QAAQ,OAAO;AAE7B,QAAI;AACF,YAAM,KAAK;AAAA,IACb,UAAE;AACA,YAAM,SAAS,QAAQ,OAAO,KAAK;AACnC,UAAI,QAAQ,OAAO,CAAC,IAAI,MAAO,OAAO,CAAC,IAAI;AAE3C,UAAI,CAAC,QAAQ;AACX,gBAAQ,KAAK,MAAM,KAAK;AAAA,MAC1B;AAEA,UAAI,SAAS,UAAU,mBAAmB,QAAQ,IAAI;AAAA,IACxD;AAAA,EACF,CAAC;AACH;","names":[]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aomex/response-time",
3
- "version": "0.0.4",
4
- "description": "在headers里查看请求花费的时间",
3
+ "version": "0.0.5",
4
+ "description": "X-Response-Time header",
5
5
  "keywords": [],
6
6
  "repository": "git@github.com:aomex/aomex.git",
7
7
  "homepage": "https://aomex.js.org",
@@ -27,12 +27,12 @@
27
27
  "access": "public"
28
28
  },
29
29
  "peerDependencies": {
30
- "@aomex/core": "^0.0.5",
31
- "@aomex/web": "^0.0.6"
30
+ "@aomex/core": "^0.0.6",
31
+ "@aomex/web": "^0.0.7"
32
32
  },
33
33
  "devDependencies": {
34
- "@aomex/core": "^0.0.5",
35
- "@aomex/web": "^0.0.6"
34
+ "@aomex/core": "^0.0.6",
35
+ "@aomex/web": "^0.0.7"
36
36
  },
37
37
  "scripts": {}
38
38
  }