@maiyunnet/kebab 9.21.2 → 9.22.1

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.2"` = `'9.21.2'`
1720
+ > `const` **VER**: `"9.22.1"` = `'9.22.1'`
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.2";
8
+ export declare const VER = "9.22.1";
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.2';
9
+ export const VER = '9.22.1';
10
10
  // --- 服务端用的路径 ---
11
11
  const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
12
12
  /** --- /xxx/xxx --- */
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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maiyunnet/kebab",
3
- "version": "9.21.2",
3
+ "version": "9.22.1",
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": [
package/sys/master.js CHANGED
@@ -508,7 +508,7 @@ function createRpcListener() {
508
508
  }
509
509
  }
510
510
  /** --- kebab 子项目中仅允许部署的子文件夹名集合 --- */
511
- const KEBAB_ALLOWED_DIRS = new Set(['ctr', 'data', 'stc', 'view', 'lib']);
511
+ const KEBAB_ALLOWED_DIRS = new Set(['ctr', 'data', 'stc', 'view', 'lib', 'abox']);
512
512
  /** --- 常见开发、依赖、缓存、构建产物目录不参与部署 --- */
513
513
  const DEPLOY_EXCLUDE_DIRS = new Set([
514
514
  '.git',
@@ -539,10 +539,15 @@ function createRpcListener() {
539
539
  const pat = fpath.slice(1, lio + 1);
540
540
  /** --- 纯文件名,例如 "api.js" --- */
541
541
  const fname = fpath.slice(lio + 1);
542
- if (fpath.slice(1).split('/').slice(0, -1).some(seg => DEPLOY_EXCLUDE_DIRS.has(seg))) {
542
+ const dirs = fpath.slice(1).split('/').slice(0, -1);
543
+ if (dirs.some(seg => DEPLOY_EXCLUDE_DIRS.has(seg))) {
543
544
  // --- 开发、依赖、缓存、构建产物目录不覆盖 ---
544
545
  continue;
545
546
  }
547
+ if (dirs.some((seg, index) => seg === 'abox' && ['test', 'tests'].includes(dirs[index + 1]))) {
548
+ // --- abox 运行代码参与部署,测试目录不进入线上目录 ---
549
+ continue;
550
+ }
546
551
  if (fname === 'kebab.json' && hasSensitiveConfig(ls[archivePath])) {
547
552
  // --- 包含密码或密钥的 kebab.json 不覆盖,避免部署包覆盖现有敏感配置 ---
548
553
  continue;
@@ -576,7 +581,7 @@ function createRpcListener() {
576
581
  continue;
577
582
  }
578
583
  }
579
- // --- 规则 2:kebab 子项目目录中,仅允许部署 ctr/data/stc/view/lib 子文件夹内的内容 ---
584
+ // --- 规则 2:kebab 子项目目录中,仅允许部署 ctr/data/stc/view/lib/abox 子文件夹内的内容 ---
580
585
  // --- 快速跳过:zip 中没有 kebab.json 时整个规则无需执行 ---
581
586
  if (kebabProjectDirs.size > 0) {
582
587
  // --- 找最浅(最外层)匹配的 kebab 项目目录 ---