@maiyunnet/kebab 9.11.9 → 9.12.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/index.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * --- 本文件用来定义每个目录实体地址的常量 ---
6
6
  */
7
7
  /** --- 当前系统版本号 --- */
8
- export declare const VER = "9.11.9";
8
+ export declare const VER = "9.12.0";
9
9
  /** --- 框架根目录,以 / 结尾 --- */
10
10
  export declare const ROOT_PATH: string;
11
11
  /** --- 框架的 LIB,以 / 结尾 --- */
package/index.js CHANGED
@@ -6,7 +6,7 @@
6
6
  * --- 本文件用来定义每个目录实体地址的常量 ---
7
7
  */
8
8
  /** --- 当前系统版本号 --- */
9
- export const VER = '9.11.9';
9
+ export const VER = '9.12.0';
10
10
  // --- 服务端用的路径 ---
11
11
  const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
12
12
  /** --- /xxx/xxx --- */
package/lib/undici.js CHANGED
@@ -6,6 +6,7 @@ import * as lText from '#kebab/lib/text.js';
6
6
  import * as lCrypto from '#kebab/lib/crypto.js';
7
7
  import * as lCore from '#kebab/lib/core.js';
8
8
  import * as lCookie from '#kebab/lib/cookie.js';
9
+ import * as lZlib from '#kebab/lib/zlib.js';
9
10
  // --- 自己 ---
10
11
  import * as lFd from './undici/formdata.js';
11
12
  import * as lRequest from './undici/request.js';
@@ -620,11 +621,23 @@ export async function rproxy(ctr, route, opt = {}) {
620
621
  if (rres.headers) {
621
622
  filterHeaders(rres.headers, res, opt.filter);
622
623
  }
624
+ /** --- 当前的压缩对象 --- */
625
+ const compress = lZlib.createCompress(req.headers['accept-encoding'] ?? '');
626
+ if (compress) {
627
+ res.setHeader('content-encoding', compress.type);
628
+ }
623
629
  lCore.writeHead(res, rres.headers?.['http-code'] ?? 200);
624
630
  await new Promise((resolve) => {
625
- stream.pipe(res).on('finish', () => {
626
- resolve();
627
- });
631
+ if (compress) {
632
+ stream.pipe(compress.compress).pipe(res).on('finish', () => {
633
+ resolve();
634
+ });
635
+ }
636
+ else {
637
+ stream.pipe(res).on('finish', () => {
638
+ resolve();
639
+ });
640
+ }
628
641
  });
629
642
  return true;
630
643
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maiyunnet/kebab",
3
- "version": "9.11.9",
3
+ "version": "9.12.0",
4
4
  "description": "Simple, easy-to-use, and fully-featured Node.js framework that is ready-to-use out of the box.",
5
5
  "type": "module",
6
6
  "keywords": [