@applift/core 0.4.0 → 0.6.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.
@@ -46,16 +46,6 @@ interface BundleIds {
46
46
  declare function detectBundleIds(cwd: string): BundleIds;
47
47
  //#endregion
48
48
  //#region src/channel.d.ts
49
- /**
50
- * 渠道适配器统一接口 —— applift 可扩展性的核心。
51
- *
52
- * 每个渠道(六商店/AGC/ASC/蒲公英…)实现本接口并注册到 registry;
53
- * 编排引擎(pipeline)只面对本接口,不感知任何渠道细节。
54
- *
55
- * 两段式安全模型:
56
- * stage = 只把包送到渠道草稿区,不动线上(iOS 上传构建≈只进 TestFlight)
57
- * submit = 提审;除 iOS(默认 manual 发布)外,审核通过即自动上架 —— 不可逆,需计划确认
58
- */
59
49
  /** 渠道能力声明(编排与确认界面据此渲染/拦截) */
60
50
  interface ChannelCapabilities {
61
51
  /** 支持只传包不提审(小米 push 一体 → false,submit 即上传) */
@@ -145,8 +135,12 @@ interface Channel {
145
135
  plan(ctx: ChannelContext): Promise<ReleasePlanEntry>;
146
136
  /** 传包到草稿(capabilities.stage=false 的渠道返回明确错误) */
147
137
  stage(ctx: ChannelContext): Promise<StageResult>;
148
- /** 提审(=审核通过自动上架,L3 不可逆操作) */
149
- submit(ctx: ChannelContext): Promise<SubmitResult>;
138
+ /**
139
+ * 提审(=审核通过自动上架,L3 不可逆操作)。
140
+ * stagedRef = 同渠道 stage 成功返回的 ref(如 googleplay 的 `editId:versionCode`),
141
+ * 供实现复用 stage 已上传的草稿、避免重复上传;实现方可忽略。
142
+ */
143
+ submit(ctx: ChannelContext, stagedRef?: string): Promise<SubmitResult>;
150
144
  /** 查询审核状态(capabilities.status=false 时抛 NotSupported) */
151
145
  status(ctx: Pick<ChannelContext, "credentials" | "target">): Promise<ReviewStatus>;
152
146
  }
@@ -167,13 +161,7 @@ type CredentialsFile = z.infer<typeof CredentialsFileSchema>;
167
161
  /** 单渠道配置(appId、pkgName 等渠道侧键) */
168
162
  declare const StoreConfigSchema: z.ZodRecord<z.ZodString, z.ZodString>;
169
163
  type StoreConfig = z.infer<typeof StoreConfigSchema>;
170
- /**
171
- * stores 三种等价写法,统一规范化为 record:
172
- * ① 对象:{ huawei: { appId: 'x' } }(原有写法,原样保留)
173
- * ② 数组:['oppo', 'vivo'] → { oppo: {}, vivo: {} }(无配置渠道)
174
- * ③ 字符串值:{ huawei: '10xxx' } → { huawei: { appId: '10xxx' } }(appId 简写)
175
- */
176
- declare const StoresSchema: z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodString>, z.ZodString]>>, z.ZodArray<z.ZodString>]>, z.ZodTransform<Record<string, Record<string, string>>, string[] | Record<string, string | Record<string, string>>>>>;
164
+ declare const StoresSchema: z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodString>, z.ZodString]>>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>]>, z.ZodTransform<Record<string, Record<string, string>>, (string | Record<string, string>)[] | Record<string, string | Record<string, string>>>>>;
177
165
  type Stores = z.infer<typeof StoresSchema>;
178
166
  /** 项目级配置(applift.config.ts 的形状);beta 段见上方 BetaConfigSchema */
179
167
  /**
@@ -183,6 +171,7 @@ type Stores = z.infer<typeof StoresSchema>;
183
171
  * - testflight: App Store Connect 上传(ipa 进 TestFlight)
184
172
  */
185
173
  declare const BetaConfigSchema: z.ZodObject<{
174
+ bump: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
186
175
  pgyer: z.ZodOptional<z.ZodObject<{
187
176
  platforms: z.ZodDefault<z.ZodArray<z.ZodEnum<{
188
177
  android: "android";
@@ -200,19 +189,37 @@ declare const BetaConfigSchema: z.ZodObject<{
200
189
  note: z.ZodOptional<z.ZodString>;
201
190
  }, z.core.$strip>>;
202
191
  }, z.core.$strip>;
192
+ /** versionCode 策略:"increment"(默认 +1) | 公式(可限定平台) */
193
+ declare const VersionCodeConfigSchema: z.ZodUnion<readonly [z.ZodLiteral<"increment">, z.ZodObject<{
194
+ formula: z.ZodString;
195
+ platforms: z.ZodOptional<z.ZodArray<z.ZodString>>;
196
+ }, z.core.$strip>]>;
197
+ type VersionCodeConfig = z.infer<typeof VersionCodeConfigSchema>;
198
+ declare const VersionConfigSchema: z.ZodObject<{
199
+ versionCode: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"increment">, z.ZodObject<{
200
+ formula: z.ZodString;
201
+ platforms: z.ZodOptional<z.ZodArray<z.ZodString>>;
202
+ }, z.core.$strip>]>>;
203
+ }, z.core.$strip>;
204
+ type VersionConfig = z.infer<typeof VersionConfigSchema>;
205
+ /** 正式发版段的自动 version 开关(语义同 beta.bump) */
206
+ declare const ReleaseConfigSchema: z.ZodObject<{
207
+ bump: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
208
+ }, z.core.$strip>;
209
+ type ReleaseConfig = z.infer<typeof ReleaseConfigSchema>;
203
210
  declare const ProjectConfigSchema: z.ZodObject<{
204
211
  name: z.ZodOptional<z.ZodString>;
205
212
  profile: z.ZodDefault<z.ZodString>;
206
213
  android: z.ZodOptional<z.ZodObject<{
207
- pkgName: z.ZodString;
208
- stores: z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodString>, z.ZodString]>>, z.ZodArray<z.ZodString>]>, z.ZodTransform<Record<string, Record<string, string>>, string[] | Record<string, string | Record<string, string>>>>>;
214
+ pkgName: z.ZodOptional<z.ZodString>;
215
+ stores: z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodString>, z.ZodString]>>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>]>, z.ZodTransform<Record<string, Record<string, string>>, (string | Record<string, string>)[] | Record<string, string | Record<string, string>>>>>;
209
216
  }, z.core.$strip>>;
210
217
  harmony: z.ZodOptional<z.ZodObject<{
211
- bundleName: z.ZodString;
218
+ bundleName: z.ZodOptional<z.ZodString>;
212
219
  appId: z.ZodOptional<z.ZodString>;
213
220
  }, z.core.$strip>>;
214
221
  ios: z.ZodOptional<z.ZodObject<{
215
- scheme: z.ZodString;
222
+ scheme: z.ZodOptional<z.ZodString>;
216
223
  workspace: z.ZodOptional<z.ZodString>;
217
224
  bundleId: z.ZodOptional<z.ZodString>;
218
225
  }, z.core.$strip>>;
@@ -230,7 +237,17 @@ declare const ProjectConfigSchema: z.ZodObject<{
230
237
  macos: z.ZodOptional<z.ZodArray<z.ZodString>>;
231
238
  linux: z.ZodOptional<z.ZodArray<z.ZodString>>;
232
239
  }, z.core.$catchall<z.ZodOptional<z.ZodArray<z.ZodString>>>>>;
240
+ version: z.ZodOptional<z.ZodObject<{
241
+ versionCode: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"increment">, z.ZodObject<{
242
+ formula: z.ZodString;
243
+ platforms: z.ZodOptional<z.ZodArray<z.ZodString>>;
244
+ }, z.core.$strip>]>>;
245
+ }, z.core.$strip>>;
246
+ release: z.ZodOptional<z.ZodObject<{
247
+ bump: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
248
+ }, z.core.$strip>>;
233
249
  beta: z.ZodOptional<z.ZodObject<{
250
+ bump: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
234
251
  pgyer: z.ZodOptional<z.ZodObject<{
235
252
  platforms: z.ZodDefault<z.ZodArray<z.ZodEnum<{
236
253
  android: "android";
@@ -330,7 +347,7 @@ interface HookContext {
330
347
  /** 项目根目录 */
331
348
  cwd: string;
332
349
  }
333
- interface QypubPlugin {
350
+ interface AppliftPlugin {
334
351
  name: string;
335
352
  "config:resolved"?(config: ProjectConfig, ctx: HookContext): Promise<ProjectConfig | void> | ProjectConfig | void;
336
353
  "channel:register"?(registry: ChannelRegistry, ctx: HookContext): Promise<void> | void;
@@ -348,12 +365,14 @@ interface QypubPlugin {
348
365
  "submit:after"?(summary: PipelineSummary, ctx: HookContext): Promise<void> | void;
349
366
  notify?(summary: PipelineSummary, ctx: HookContext): Promise<void> | void;
350
367
  }
351
- type PluginHookName = Exclude<keyof QypubPlugin, "name">;
368
+ type PluginHookName = Exclude<keyof AppliftPlugin, "name">;
352
369
  declare class PluginHost {
353
370
  private readonly plugins;
354
- constructor(plugins: QypubPlugin[]);
371
+ constructor(plugins: AppliftPlugin[]);
355
372
  /**
356
373
  * 顺序执行某钩子;支持「链式替换」(返回对象则替换后继续传给下一插件)与「拦截」(返回 false 立即中止)。
374
+ * 信任边界:返回值按 T 强转、不做形状校验(vite 同款取舍)——插件作者自负其责,
375
+ * 坏形状会在后续消费点显式抛错,宿主不代为静默兜底。
357
376
  * @returns {[被拦截?, 最终值]} false 表示被某插件拦截
358
377
  */
359
378
  apply<T>(hook: PluginHookName, value: T, ctx: HookContext): Promise<{
@@ -367,11 +386,11 @@ declare class PluginHost {
367
386
  * defineConfig —— vite 同款体验:applift.config.ts 导出时提供类型提示。
368
387
  * plugins 中允许嵌套工厂函数(如 dingtalkNotify({...}) 直接返回插件对象)。
369
388
  */
370
- interface QypubUserConfig extends Partial<ProjectConfig> {
371
- plugins?: Array<QypubPlugin | (() => QypubPlugin)>;
389
+ interface AppliftUserConfig extends Partial<ProjectConfig> {
390
+ plugins?: Array<AppliftPlugin | (() => AppliftPlugin)>;
372
391
  }
373
- declare function defineConfig(config: QypubUserConfig): QypubUserConfig;
392
+ declare function defineConfig(config: AppliftUserConfig): AppliftUserConfig;
374
393
  /** 解析用户配置中的插件(工厂惰性求值),供 PluginHost 构造 */
375
- declare function resolvePlugins(userConfig: QypubUserConfig): QypubPlugin[];
394
+ declare function resolvePlugins(userConfig: AppliftUserConfig): AppliftPlugin[];
376
395
  //#endregion
377
- export { rnAdapter as $, StoreConfigSchema as A, StageResult as B, CredentialsProfile as C, ProjectConfig as D, GlobalConfigSchema as E, ChannelContext as F, detectBundleIds as G, BundleIds as H, ChannelEvent as I, findArtifacts as J, detectFramework as K, ChannelRegistry as L, StoresSchema as M, Channel as N, ProjectConfigSchema as O, ChannelCapabilities as P, nativeIosAdapter as Q, ReleasePlanEntry as R, CredentialsFileSchema as S, GlobalConfig as T, FrameworkAdapter as U, SubmitResult as V, Platform as W, nativeAndroidAdapter as X, flutterAdapter as Y, nativeHarmonyAdapter as Z, appendEntry as _, QypubUserConfig as a, BetaConfigSchema as b, PipelineInput as c, runStage as d, tauriAdapter as et, runSubmit as f, HistoryQuery as g, HistoryEvent as h, QypubPlugin as i, Stores as j, StoreConfig as k, PipelineSummary as l, HistoryEntry as m, PluginHookName as n, defineConfig as o, HISTORY_PATH as p, electronAdapter as q, PluginHost as r, resolvePlugins as s, HookContext as t, PipelineSummaryEntry as u, readEntries as v, CredentialsProfileSchema as w, CredentialsFile as x, BetaConfig as y, ReviewStatus as z };
396
+ export { electronAdapter as $, ReleaseConfigSchema as A, ChannelCapabilities as B, CredentialsProfile as C, ProjectConfig as D, GlobalConfigSchema as E, VersionCodeConfig as F, ReviewStatus as G, ChannelEvent as H, VersionCodeConfigSchema as I, BundleIds as J, StageResult as K, VersionConfig as L, StoreConfigSchema as M, Stores as N, ProjectConfigSchema as O, StoresSchema as P, detectFramework as Q, VersionConfigSchema as R, CredentialsFileSchema as S, GlobalConfig as T, ChannelRegistry as U, ChannelContext as V, ReleasePlanEntry as W, Platform as X, FrameworkAdapter as Y, detectBundleIds as Z, appendEntry as _, PluginHost as a, rnAdapter as at, BetaConfigSchema as b, PipelineInput as c, runStage as d, findArtifacts as et, runSubmit as f, HistoryQuery as g, HistoryEvent as h, PluginHookName as i, nativeIosAdapter as it, StoreConfig as j, ReleaseConfig as k, PipelineSummary as l, HistoryEntry as m, AppliftUserConfig as n, nativeAndroidAdapter as nt, defineConfig as o, tauriAdapter as ot, HISTORY_PATH as p, SubmitResult as q, HookContext as r, nativeHarmonyAdapter as rt, resolvePlugins as s, AppliftPlugin as t, flutterAdapter as tt, PipelineSummaryEntry as u, readEntries as v, CredentialsProfileSchema as w, CredentialsFile as x, BetaConfig as y, Channel as z };
@@ -1,4 +1,4 @@
1
- import { i as QypubPlugin } from "../plugin-DzhwzVfu.mjs";
1
+ import { t as AppliftPlugin } from "../plugin-B2GGlI_2.mjs";
2
2
  //#region src/plugins/dingtalk-notify.d.ts
3
3
  interface DingtalkNotifyOptions {
4
4
  webhook: string;
@@ -6,6 +6,6 @@ interface DingtalkNotifyOptions {
6
6
  secret?: string;
7
7
  atMobiles?: string[];
8
8
  }
9
- export declare function dingtalkNotify(options: DingtalkNotifyOptions): QypubPlugin;
9
+ export declare function dingtalkNotify(options: DingtalkNotifyOptions): AppliftPlugin;
10
10
  //#endregion
11
11
  export type { DingtalkNotifyOptions };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applift/core",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/hcg1023/applift.git",
@@ -24,11 +24,14 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "c12": "^3.3.4",
27
+ "conventional-commits-parser": "^7.1.3",
27
28
  "jiti": "^2.7.0",
29
+ "semver": "^7.8.5",
28
30
  "smol-toml": "^1.9.1",
29
31
  "zod": "^4.6.7"
30
32
  },
31
33
  "devDependencies": {
34
+ "@types/semver": "^7.8.0",
32
35
  "tsdown": "^0.23.1"
33
36
  },
34
37
  "scripts": {