@applift/core 0.3.0 → 0.4.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/dist/index.d.mts CHANGED
@@ -321,6 +321,7 @@ export declare class AgcHarmonyChannel implements Channel {
321
321
  "1003": string;
322
322
  "204144702": string;
323
323
  "204144677": string;
324
+ "204144692": string;
324
325
  };
325
326
  private authHeaders;
326
327
  /** appId 缺省时按 bundleName 查(v1 全链路 step 0,可选) */
package/dist/index.mjs CHANGED
@@ -3,6 +3,7 @@ import fs from "node:fs";
3
3
  import path from "node:path";
4
4
  import os from "node:os";
5
5
  import { parse } from "smol-toml";
6
+ import { fileURLToPath } from "node:url";
6
7
  import { loadConfig } from "c12";
7
8
  import { createJiti } from "jiti";
8
9
  import crypto, { X509Certificate, constants, createHash, createHmac, createSign, publicEncrypt } from "node:crypto";
@@ -211,11 +212,33 @@ function saveCredentials(data, filePath = CREDENTIALS_PATH) {
211
212
  * 项目配置装载:c12(社区主流)加载 applift.config.ts。
212
213
  * c12 负责:TS 配置文件执行、缺省值、多源合并 —— 非自研。
213
214
  */
215
+ /**
216
+ * 裸工程兼容:applift.config.ts 里的 `@applift/core` / `@applift/cli` 导入按目标工程解析会
217
+ * 找不到包(工程未安装依赖)——jiti 别名统一指到 CLI 进程自带的那份 core 入口,
218
+ * 使 `import { defineConfig } from "@applift/cli"`(或 @applift/core)在任何工程可用。
219
+ */
220
+ function appliftAlias() {
221
+ try {
222
+ const distEntry = fileURLToPath(import.meta.resolve("@applift/core"));
223
+ const coreEntry = fs.existsSync(distEntry) ? distEntry : path.join(path.dirname(path.dirname(distEntry)), "src", "index.ts");
224
+ if (!fs.existsSync(coreEntry)) return {};
225
+ return {
226
+ "@applift/core": coreEntry,
227
+ "@applift/cli": coreEntry
228
+ };
229
+ } catch {
230
+ return {};
231
+ }
232
+ }
214
233
  async function loadProjectConfig(cwd) {
215
234
  const cfgPath = findUp(cwd, "applift.config.ts");
216
235
  const cfgDir = cfgPath ? path.dirname(cfgPath) : cwd;
217
236
  const bunRuntime = globalThis.Bun;
218
- const jitiInstance = bunRuntime ? createJiti(import.meta.url, { transform: (opts) => ({ code: new bunRuntime.Transpiler({ loader: "ts" }).transformSync(opts.source) }) }) : void 0;
237
+ const alias = appliftAlias();
238
+ const jitiInstance = bunRuntime ? createJiti(import.meta.url, {
239
+ alias,
240
+ transform: (opts) => ({ code: new bunRuntime.Transpiler({ loader: "ts" }).transformSync(opts.source) })
241
+ }) : Object.keys(alias).length ? createJiti(import.meta.url, { alias }) : void 0;
219
242
  const result = await loadConfig({
220
243
  name: "applift",
221
244
  cwd: cfgDir,
@@ -2335,7 +2358,8 @@ var AgcHarmonyChannel = class {
2335
2358
  "204144660": "提交失败,包可能仍在解析(稍后重试或到控制台查看)",
2336
2359
  "1003": "client_id/client_secret 无效(AGC → 项目设置 → 常规 → API Client 重新获取)",
2337
2360
  "204144702": "签名/证书不匹配:检查签名证书指纹(SHA256)与 AGC 后台登记是否一致",
2338
- "204144677": "bundleName 与应用不匹配:确认 appId 对应的应用包名"
2361
+ "204144677": "bundleName 与应用不匹配:确认 appId 对应的应用包名",
2362
+ "204144692": "应用未登记隐私政策协议:AGC 控制台「更多服务 → 协议服务」新建隐私政策并提交(一次性前置,API 无法代办)"
2339
2363
  };
2340
2364
  async authHeaders(ctx) {
2341
2365
  const clientId = required$1(ctx, "AGC_CLIENT_ID");
@@ -3750,7 +3774,10 @@ const nativeHarmonyAdapter = {
3750
3774
  return [
3751
3775
  "entry/build/default/outputs/**/entry-*-signed.hap",
3752
3776
  "entry/build/default/outputs/**/entry-*.app",
3753
- "harmony/entry/build/default/outputs/**/*-signed.hap"
3777
+ "harmony/entry/build/default/outputs/**/*-signed.hap",
3778
+ "build/outputs/**/*.app",
3779
+ "harmony/build/outputs/**/*.app",
3780
+ "ohos/build/outputs/**/*.app"
3754
3781
  ];
3755
3782
  },
3756
3783
  buildCommand() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applift/core",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/hcg1023/applift.git",