@sns-parse/core 0.2.0-alpha.1 → 0.3.0-alpha.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/lib/platform.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { type ConfigContribution } from './config';
1
2
  /**
2
3
  * 平台定义契约:每个平台的自描述单元,是「每平台一个包」的基础。
3
4
  *
@@ -18,6 +19,13 @@ export interface PlatformDefinition {
18
19
  };
19
20
  /** 是否默认优先专属 API(可被 config.platformDedicatedFirst 覆盖) */
20
21
  dedicatedFirst?: boolean;
22
+ /** 中文名(用于配置项描述与界面展示) */
23
+ label?: string;
21
24
  /** 解析失败时的平台特定引导提示 */
22
25
  hints?: string[];
23
26
  }
27
+ /**
28
+ * 由平台定义聚合出「平台相关配置」(平台开关 / 专属 API 优先)。
29
+ * koishi / cli 兼容层据此动态生成配置,无需硬编码平台列表。
30
+ */
31
+ export declare function platformConfigContributions(defs: PlatformDefinition[]): ConfigContribution[];
package/lib/platform.js CHANGED
@@ -1,2 +1,31 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.platformConfigContributions = platformConfigContributions;
4
+ const config_1 = require("./config");
5
+ /**
6
+ * 由平台定义聚合出「平台相关配置」(平台开关 / 专属 API 优先)。
7
+ * koishi / cli 兼容层据此动态生成配置,无需硬编码平台列表。
8
+ */
9
+ function platformConfigContributions(defs) {
10
+ return [
11
+ (0, config_1.defineConfig)({
12
+ group: '平台开关',
13
+ fields: [
14
+ {
15
+ key: 'platformEnabled', type: 'object', description: '各平台解析开关',
16
+ fields: defs.map(d => ({ key: d.type, type: 'boolean', default: true, description: d.label || d.type })),
17
+ },
18
+ ],
19
+ }),
20
+ (0, config_1.defineConfig)({
21
+ group: 'API 与平台',
22
+ description: '优先使用专属 API',
23
+ fields: [
24
+ {
25
+ key: 'platformDedicatedFirst', type: 'object', description: '优先使用专属 API',
26
+ fields: defs.map(d => ({ key: d.type, type: 'boolean', default: d.dedicatedFirst ?? false, description: d.label || d.type })),
27
+ },
28
+ ],
29
+ }),
30
+ ];
31
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sns-parse/core",
3
- "version": "0.2.0-alpha.1+upstream.1.6.7",
3
+ "version": "0.3.0-alpha.1+upstream.1.6.7",
4
4
  "description": "sns-parse 核心契约与宿主抽象:类型、可注入日志、Host、发送层契约、平台定义",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",