@maiyunnet/kebab 3.1.0 → 3.1.2
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/bin/kebab.js +1 -1
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/db.js +1 -1
- package/lib/lang.d.ts +10 -0
- package/lib/lang.js +45 -0
- package/package.json +4 -4
package/bin/kebab.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import '../main';
|
|
2
|
+
import '../main.js';
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* ------------------------
|
|
9
9
|
*/
|
|
10
10
|
/** --- 当前系统版本号 --- */
|
|
11
|
-
export const VER = '3.1.
|
|
11
|
+
export const VER = '3.1.2';
|
|
12
12
|
// --- 服务端用的路径 ---
|
|
13
13
|
const imu = import.meta.url.replace('file://', '').replace(/^\/(\w:)/, '$1').replace(/\\/g, '/');
|
|
14
14
|
/** --- /xxx/xxx --- */
|
package/lib/db.js
CHANGED
|
@@ -171,7 +171,7 @@ export class Pool {
|
|
|
171
171
|
link.on('error', function (err) {
|
|
172
172
|
c.setLost();
|
|
173
173
|
if (err.code !== 'PROTOCOL_CONNECTION_LOST') {
|
|
174
|
-
lCore.debug('[DB][_getConnection]', err);
|
|
174
|
+
lCore.debug('[DB][_getConnection][error]', err);
|
|
175
175
|
}
|
|
176
176
|
}).on('end', () => {
|
|
177
177
|
// lCore.debug('[DB][_getConnection] connection end.');
|
package/lib/lang.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** --- 支持的语言缩写列表 --- */
|
|
2
|
+
export declare const codes: string[];
|
|
3
|
+
export declare const names: string[];
|
|
4
|
+
/** --- 浏览器常用映射为本语言 --- */
|
|
5
|
+
export declare const map: Record<string, string>;
|
|
6
|
+
/**
|
|
7
|
+
* --- 根据常用语言字符串获取语言 code ---
|
|
8
|
+
* @param accept 常用字符串,如 zh-cn,或包含 zh-cn 的字符串
|
|
9
|
+
*/
|
|
10
|
+
export declare function getCodeByAccept(accept?: string): string;
|
package/lib/lang.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** --- 支持的语言缩写列表 --- */
|
|
2
|
+
export const codes = [
|
|
3
|
+
'sc', 'tc', 'ja', 'ko', 'en', 'es', 'th', 'vi',
|
|
4
|
+
'de', 'fr', 'pt', 'ru', 'ar', 'id', 'it', 'tr',
|
|
5
|
+
];
|
|
6
|
+
export const names = [
|
|
7
|
+
'简体中文', '繁體中文', '日本語', '한국어', 'English', 'Español', 'ไทย', 'Tiếng việt',
|
|
8
|
+
'Deutsch', 'Français', 'Português', 'Русский', 'العربية', 'Bahasa Indonesia', 'Italiano', 'Türkçe',
|
|
9
|
+
];
|
|
10
|
+
/** --- 浏览器常用映射为本语言 --- */
|
|
11
|
+
export const map = {
|
|
12
|
+
'cn': 'sc',
|
|
13
|
+
'zh': 'tc',
|
|
14
|
+
'ja': 'ja',
|
|
15
|
+
'ko': 'ko',
|
|
16
|
+
'en': 'en',
|
|
17
|
+
'es': 'es',
|
|
18
|
+
'th': 'th',
|
|
19
|
+
'vi': 'vi',
|
|
20
|
+
'de': 'de',
|
|
21
|
+
'fr': 'fr',
|
|
22
|
+
'pt': 'pt',
|
|
23
|
+
'ru': 'ru',
|
|
24
|
+
'ar': 'ar',
|
|
25
|
+
'id': 'id',
|
|
26
|
+
'it': 'it',
|
|
27
|
+
'tr': 'tr',
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* --- 根据常用语言字符串获取语言 code ---
|
|
31
|
+
* @param accept 常用字符串,如 zh-cn,或包含 zh-cn 的字符串
|
|
32
|
+
*/
|
|
33
|
+
export function getCodeByAccept(accept) {
|
|
34
|
+
if (accept === '*') {
|
|
35
|
+
return 'sc';
|
|
36
|
+
}
|
|
37
|
+
const ulang = accept?.toLowerCase() ?? 'en';
|
|
38
|
+
for (const l in map) {
|
|
39
|
+
if (!ulang.includes(l)) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
return map[l];
|
|
43
|
+
}
|
|
44
|
+
return 'en';
|
|
45
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maiyunnet/kebab",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2",
|
|
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": [
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"#*": "./*"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@aws-sdk/client-s3": "^3.
|
|
22
|
-
"@aws-sdk/lib-storage": "^3.
|
|
21
|
+
"@aws-sdk/client-s3": "^3.893.0",
|
|
22
|
+
"@aws-sdk/lib-storage": "^3.893.0",
|
|
23
23
|
"@litert/http-client": "^1.1.2",
|
|
24
24
|
"@litert/mime": "^0.1.3",
|
|
25
25
|
"@litert/redis": "^3.0.5",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"mysql2": "^3.15.0",
|
|
31
31
|
"ssh2": "^1.17.0",
|
|
32
32
|
"svg-captcha": "^1.4.0",
|
|
33
|
-
"tencentcloud-sdk-nodejs": "^4.1.
|
|
33
|
+
"tencentcloud-sdk-nodejs": "^4.1.119"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@litert/eslint-plugin-rules": "^0.3.1",
|