@maiyunnet/kebab 9.21.1 → 9.22.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/doc/kebab-rag.md CHANGED
@@ -1717,7 +1717,7 @@ index/variables/VER.md
1717
1717
 
1718
1718
  # Variable: VER
1719
1719
 
1720
- > `const` **VER**: `"9.21.1"` = `'9.21.1'`
1720
+ > `const` **VER**: `"9.22.0"` = `'9.22.0'`
1721
1721
 
1722
1722
  Defined in: [index.ts:10](https://github.com/maiyunnet/kebab/blob/master/index.ts#L10)
1723
1723
 
@@ -120680,6 +120680,37 @@ Defined in: [lib/lan.ts:63](https://github.com/maiyunnet/kebab/blob/master/lib/l
120680
120680
 
120681
120681
  `Promise`\<`object`[]\>
120682
120682
 
120683
+ lib/lang/functions/getAcceptByCode.md
120684
+ ---
120685
+
120686
+ [**Documents for @maiyunnet/kebab**](../../../index.md)
120687
+
120688
+ ***
120689
+
120690
+ [Documents for @maiyunnet/kebab](../../../index.md) / [lib/lang](../index.md) / getAcceptByCode
120691
+
120692
+ # Function: getAcceptByCode()
120693
+
120694
+ > **getAcceptByCode**(`code?`): `string`
120695
+
120696
+ Defined in: [lib/lang.ts:55](https://github.com/maiyunnet/kebab/blob/master/lib/lang.ts#L55)
120697
+
120698
+ 根据框架语言 code 获取浏览器标准语言标识,可用于 HTML lang 和 Intl
120699
+
120700
+ ## Parameters
120701
+
120702
+ ### code?
120703
+
120704
+ `string`
120705
+
120706
+ 框架语言 code,不区分大小写;未传或不支持时回退 en
120707
+
120708
+ ## Returns
120709
+
120710
+ `string`
120711
+
120712
+ sc 返回 zh-CN,tc 返回 zh-TW,其余支持的语言返回原 code
120713
+
120683
120714
  lib/lang/functions/getCodeByAccept.md
120684
120715
  ---
120685
120716
 
@@ -120728,6 +120759,7 @@ lib/lang/index.md
120728
120759
 
120729
120760
  ## Functions
120730
120761
 
120762
+ - [getAcceptByCode](functions/getAcceptByCode.md)
120731
120763
  - [getCodeByAccept](functions/getCodeByAccept.md)
120732
120764
 
120733
120765
  lib/lang/variables/codes.md
package/index.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * --- 本文件用来定义每个目录实体地址的常量 ---
6
6
  */
7
7
  /** --- 当前系统版本号 --- */
8
- export declare const VER = "9.21.1";
8
+ export declare const VER = "9.22.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.21.1';
9
+ export const VER = '9.22.0';
10
10
  // --- 服务端用的路径 ---
11
11
  const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
12
12
  /** --- /xxx/xxx --- */
package/lib/core.js CHANGED
@@ -830,7 +830,7 @@ export async function sendNpm(path, hosts) {
830
830
  'time': time,
831
831
  'path': path
832
832
  }), globalConfig.rpcSecret), {
833
- 'timeout': 300,
833
+ 'timeout': 330,
834
834
  });
835
835
  const content = await res.getContent();
836
836
  if (!content) {
@@ -938,7 +938,7 @@ export async function updateCode(sourcePath, path, hosts, config = true, strict
938
938
  'action': 'code',
939
939
  'time': lTime.stamp()
940
940
  }), globalConfig.rpcSecret), fd, {
941
- 'timeout': 60,
941
+ 'timeout': 180,
942
942
  });
943
943
  const content = await res.getContent();
944
944
  if (!content) {
package/lib/lang.d.ts CHANGED
@@ -8,3 +8,9 @@ export declare const map: Record<string, string>;
8
8
  * @param accept 常用字符串,如 zh-cn,或包含 zh-cn 的字符串
9
9
  */
10
10
  export declare function getCodeByAccept(accept?: string): string;
11
+ /**
12
+ * --- 根据框架语言 code 获取浏览器标准语言标识,可用于 HTML lang 和 Intl ---
13
+ * @param code 框架语言 code,不区分大小写;未传或不支持时回退 en
14
+ * @returns sc 返回 zh-CN,tc 返回 zh-TW,其余支持的语言返回原 code
15
+ */
16
+ export declare function getAcceptByCode(code?: string): string;
package/lib/lang.js CHANGED
@@ -43,3 +43,18 @@ export function getCodeByAccept(accept) {
43
43
  }
44
44
  return 'en';
45
45
  }
46
+ /**
47
+ * --- 根据框架语言 code 获取浏览器标准语言标识,可用于 HTML lang 和 Intl ---
48
+ * @param code 框架语言 code,不区分大小写;未传或不支持时回退 en
49
+ * @returns sc 返回 zh-CN,tc 返回 zh-TW,其余支持的语言返回原 code
50
+ */
51
+ export function getAcceptByCode(code) {
52
+ const lang = code?.toLowerCase() ?? 'en';
53
+ if (lang === 'sc') {
54
+ return 'zh-CN';
55
+ }
56
+ if (lang === 'tc') {
57
+ return 'zh-TW';
58
+ }
59
+ return codes.includes(lang) ? lang : 'en';
60
+ }
@@ -31,7 +31,7 @@ export declare class Response {
31
31
  /**
32
32
  * --- 获取响应读取流对象 ---
33
33
  */
34
- getStream(): (import("undici/types/readable").default & undici.Dispatcher.BodyMixin) | zlib.Gunzip | zlib.Inflate | zlib.BrotliDecompress | null;
34
+ getStream(): zlib.BrotliDecompress | zlib.Gunzip | zlib.Inflate | (import("undici/types/readable").default & undici.Dispatcher.BodyMixin) | null;
35
35
  /**
36
36
  * --- 获取原生响应读取流对象 ---
37
37
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maiyunnet/kebab",
3
- "version": "9.21.1",
3
+ "version": "9.22.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": [