@heybox/hb-sdk 0.7.4 → 0.8.0-alpha

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.
Files changed (54) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/README.md +14 -14
  3. package/dist/cli-chunks/{build-CVPqGQY3.cjs → build-DJWFSM1B.cjs} +6 -5
  4. package/dist/cli-chunks/{context-C1nTGr-R.cjs → context-DV2UK1Nz.cjs} +2 -2
  5. package/dist/cli-chunks/{create-C5qrLLvv.cjs → create-2HfoB48V.cjs} +1 -1
  6. package/dist/cli-chunks/{dev-U5BlN4ei.cjs → dev-Dgt2zS9k.cjs} +8 -8
  7. package/dist/cli-chunks/{doctor-DxqHMTbm.cjs → doctor-C95gIao_.cjs} +1 -1
  8. package/dist/cli-chunks/{index-BfR6OZeU.cjs → index-BjoSXl8C.cjs} +2 -2
  9. package/dist/cli-chunks/{index-DLrcC_ij.cjs → index-D62ANeBv.cjs} +14 -14
  10. package/dist/cli-chunks/{index.esm-DbbyeU1z.cjs → index.esm-CigcxJ2B.cjs} +6 -6
  11. package/dist/cli-chunks/{login-DQkArK14.cjs → login-Cumknwdx.cjs} +2 -2
  12. package/dist/cli-chunks/{project-vite-c13CKUUl.cjs → project-vite-CcE-HMmd.cjs} +1 -1
  13. package/dist/cli-chunks/{remote-816SyJyA.cjs → remote-DDdP3xcE.cjs} +10 -8
  14. package/dist/cli-chunks/{runtime-gate-CtV7rWyX.cjs → runtime-gate-DFjw66kF.cjs} +20 -1
  15. package/dist/cli-chunks/{runtime-permission-env-D-8_jPG3.cjs → runtime-permission-env-CjsCe5bp.cjs} +13 -13
  16. package/dist/cli-chunks/{session-ySUU0fVq.cjs → session-BDi_AZSv.cjs} +1 -1
  17. package/dist/cli.cjs +1 -1
  18. package/dist/devtools/browser-dev-host/main.js +654 -472
  19. package/dist/index.cjs.js +714 -639
  20. package/dist/index.esm.js +714 -639
  21. package/dist/miniapp-publish.cjs.js +13 -13
  22. package/dist/miniapp-publish.esm.js +13 -13
  23. package/dist/templates/vue3-vite-ts/README.md.ejs +2 -0
  24. package/dist/templates/vue3-vite-ts/vite.config.ts +1 -1
  25. package/dist/vite.cjs.js +31 -4
  26. package/dist/vite.esm.js +31 -5
  27. package/package.json +11 -8
  28. package/skill/references/api-protocol.md +14 -2
  29. package/skill/references/api-root.md +42 -21
  30. package/skill/references/examples.md +1 -1
  31. package/skill/references/safety-boundaries.md +1 -1
  32. package/skill/scripts/sync-references.mjs +3 -1
  33. package/skill/skill.json +4 -4
  34. package/types/core/errors.d.ts +5 -5
  35. package/types/core/sdk.d.ts +5 -5
  36. package/types/core/singleton.d.ts +56 -6
  37. package/types/miniapp-manifest/schema.d.ts +5 -0
  38. package/types/miniapp-publish/index.d.ts +8 -8
  39. package/types/modules/auth/index.d.ts +15 -1
  40. package/types/modules/cloud/index.d.ts +75 -5
  41. package/types/modules/device/index.d.ts +31 -3
  42. package/types/modules/navigation/index.d.ts +46 -4
  43. package/types/modules/network/index.d.ts +22 -11
  44. package/types/modules/share/copy-link.d.ts +3 -3
  45. package/types/modules/share/index.d.ts +61 -5
  46. package/types/modules/share/screenshot.d.ts +3 -3
  47. package/types/modules/share/show-share-menu.d.ts +3 -3
  48. package/types/modules/storage/index.d.ts +38 -10
  49. package/types/modules/ui/index.d.ts +46 -4
  50. package/types/modules/user/get-info.d.ts +1 -1
  51. package/types/modules/user/index.d.ts +46 -4
  52. package/types/modules/user/steam-game-list.d.ts +2 -2
  53. package/types/modules/viewport/index.d.ts +36 -8
  54. package/types/vite/index.d.ts +15 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,66 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.8.0-alpha
4
+
5
+ ### Breaking Changes
6
+
7
+ - `miniappManifest({ platforms })` 要求新构建的本地小程序产物显式声明目标平台;通过 `--from-version` 复用的历史产物允许缺失并保持“平台声明未分类”。
8
+
9
+ ### SDK
10
+
11
+ - 公开运行时 API 使用严格 TSDoc 记录加入版本、支持平台、最低客户端版本、稳定性和废弃信息。
12
+
13
+ ### Docs / Agent Skill
14
+
15
+ - API Reference 按模块和调用路径生成独立方法页、可跳转类型、反向引用、兼容性矩阵及统一搜索数据。
16
+ - 新项目模板显式预填 `android`、`ios`、`ohos` 三个平台;该初始值不是 Runtime fallback 或真机验收证明。
17
+ - canonical Docs 增加独立阻断 CI 门禁,校验 TSDoc、Manifest、API 图、生成物 freshness、链接和桌面/移动端阅读体验。
18
+
19
+ ## 0.7.6-alpha.0
20
+
21
+ ### Runtime
22
+
23
+ - 修复完整文档返回合法页面后误报 `UNEXPECTED_DOCUMENT_LOAD`;Host 发起 history traversal 时在遍历前隐藏 iframe,并在同一 2 秒截止时间内支持晚到 SDK 重发 probe。
24
+ - 修复 v2 bridge ready 早于首个 iframe load 时吞掉真实导航的问题,并保持普通 heartbeat、hide/show 与终态清理语义。
25
+ - 锁定 v2 handshake 后的 envelope 版本,继续校验精确 origin、nonce、SDK 版本和当前 Mini-program/version 路径。
26
+
27
+ ### Tooling
28
+
29
+ - Android、iOS 与 OHOS Host 支持按弹层、iframe history、关闭 Mini-program 的顺序返回;Android 保留 `only_capture=1`。
30
+ - 修复结构化协议失败、关闭与卸载竞态、动态 Playwright 端口,并为用户小程序 Host 增加阻塞双浏览器回归。
31
+
32
+ ## 0.7.5
33
+
34
+ ### SDK
35
+
36
+ - 修复分享编码的旧浏览器兼容 (@heybox/hb-sdk).
37
+ - 增加渐进式本地调试双栈 (@heybox/hb-sdk).
38
+ - 支持分享扩展数据与链接复制 (@heybox/hb-sdk).
39
+ - 恢复无网络用户全量 scope (hb-sdk).
40
+ - 修复小程序宿主存储对象读取.
41
+
42
+ ### Runtime
43
+
44
+ - 本地读取无网络用户身份 (@heybox/hb-sdk-runtime).
45
+ - 补齐授权弹窗展示资料 (@heybox/hb-sdk-runtime).
46
+ - 兼容旧版 iOS 用户手势判断 (@heybox/hb-sdk-runtime).
47
+ - 完成 Runtime Host 分层硬切 (@heybox/hb-sdk-runtime).
48
+
49
+ ### Tooling
50
+
51
+ - 发布 0.7.4 正式版 (@heybox/hb-sdk).
52
+ - 发布 0.7.3 正式版 (@heybox/hb-sdk).
53
+
54
+ ## 0.7.5-alpha.0
55
+
56
+ ### SDK / Runtime
57
+
58
+ - 将 `@msgpack/msgpack` 精确锁定到 `2.8.0`,保持分享 `extra` 编码兼容,同时避免用户小程序 Host 产物引入旧版浏览器不支持的 BigInt 能力。
59
+
60
+ ### Tooling
61
+
62
+ - SDK release family 变化时增加用户小程序详情 Host 的无副作用生产构建,提前拦截最终浏览器产物兼容性回归。
63
+
3
64
  ## 0.7.4
4
65
 
5
66
  ### Breaking Changes
package/README.md CHANGED
@@ -78,7 +78,7 @@ import { defineConfig } from 'vite';
78
78
 
79
79
  export default defineConfig({
80
80
  base: './',
81
- plugins: [miniappManifest()],
81
+ plugins: [miniappManifest({ platforms: ['android', 'ios', 'ohos'] })],
82
82
  });
83
83
  ```
84
84
 
@@ -106,18 +106,18 @@ window.addEventListener('unload', stopHandshakeState, { once: true });
106
106
 
107
107
  SDK 还提供 `getHandshakeState()` / `onHandshakeStateChange()` 管理持久握手状态,并通过 `on()` / `off()` 处理前后台、登录态等生命周期事件。
108
108
 
109
- | 模块 | 用途 |
110
- | ------------ | ------------------------------------------------------------ |
111
- | `auth` | 获取交给开发者服务端交换的短期授权码 |
112
- | `user` | 读取 Host 当前用户资料、隔离身份或撤销授权 |
113
- | `share` | 打开分享、复制链接或截图分享流程 |
114
- | `ui` | 展示 Toast 和 Loading |
115
- | `device` | 调用振动和剪贴板能力 |
116
- | `navigation` | 关闭、刷新页面或打开小黑盒页面 |
117
- | `viewport` | 读取窗口信息和设置导航栏样式 |
118
- | `storage` | 读写当前小程序的隔离存储 |
119
- | `cloud` | 使用小程序云端排行榜 |
120
- | `network` | 发起经过平台授权的网络请求 |
109
+ | 模块 | 用途 |
110
+ | ------------ | ------------------------------------------ |
111
+ | `auth` | 获取交给开发者服务端交换的短期授权码 |
112
+ | `user` | 读取 Host 当前用户资料、隔离身份或撤销授权 |
113
+ | `share` | 打开分享、复制链接或截图分享流程 |
114
+ | `ui` | 展示 Toast 和 Loading |
115
+ | `device` | 调用振动和剪贴板能力 |
116
+ | `navigation` | 关闭、刷新页面或打开小黑盒页面 |
117
+ | `viewport` | 读取窗口信息和设置导航栏样式 |
118
+ | `storage` | 读写当前小程序的隔离存储 |
119
+ | `cloud` | 使用小程序云端排行榜 |
120
+ | `network` | 发起经过平台授权的网络请求 |
121
121
 
122
122
  具体方法、参数和返回值以 [API Reference](https://docs.xiaoheihe.cn/hb_sdk/reference/) 为准,常见组合写法见 [Recipes](https://docs.xiaoheihe.cn/hb_sdk/recipes/)。
123
123
 
@@ -137,7 +137,7 @@ SDK 还提供 `getHandshakeState()` / `onHandshakeStateChange()` 管理持久握
137
137
  - `network.request()` 不能访问平台保留的 runtime auth 与 OpenAPI 内部路径;页面不得持有或交换服务端应用凭据。
138
138
  - `network.request` 不支持 `multipart/form-data`;App Host 仅支持 form(`application/x-www-form-urlencoded`)与 JSON。表单请用 `URLSearchParams#toString()` 作为 `data`,文件上传请走专用上传能力。
139
139
  - 仅当远端已启用 `network.request` 时,`hb-sdk dev` 与 `hb-sdk remote deploy` 构建才会跳过平台 CSP;其他构建继续注入平台 CSP。`useOfficialDomain` 不参与 CSP 跳过判定。
140
- - 构建必须启用 `miniappManifest()`,推荐统一使用 `hb-sdk build`。
140
+ - 构建必须启用 `miniappManifest({ platforms })` 并显式声明实际承诺适配的平台,推荐统一使用 `hb-sdk build`。新项目模板中的 `['android', 'ios', 'ohos']` 只是初始配置,不代表已经完成真机验收。
141
141
 
142
142
  ## 分享扩展数据
143
143
 
@@ -3,10 +3,10 @@
3
3
  var fs$1 = require('node:fs');
4
4
  var fs = require('node:fs/promises');
5
5
  var path = require('node:path');
6
- var runtimePermissionEnv = require('./runtime-permission-env-D-8_jPG3.cjs');
7
- var runtimeGate = require('./runtime-gate-CtV7rWyX.cjs');
8
- var index = require('./index-DLrcC_ij.cjs');
9
- var projectVite = require('./project-vite-c13CKUUl.cjs');
6
+ var runtimePermissionEnv = require('./runtime-permission-env-CjsCe5bp.cjs');
7
+ var runtimeGate = require('./runtime-gate-DFjw66kF.cjs');
8
+ var index = require('./index-D62ANeBv.cjs');
9
+ var projectVite = require('./project-vite-CcE-HMmd.cjs');
10
10
  require('node:async_hooks');
11
11
  require('node:module');
12
12
  require('path');
@@ -91,7 +91,7 @@ async function validateBuildOutput(projectRoot, logger) {
91
91
  if (hadBom) {
92
92
  logger.warn('dist/manifest.json 包含 BOM,已自动剥离');
93
93
  }
94
- const { sdkVersion, version } = runtimeGate.validateMiniappManifestForDeploy(manifest);
94
+ const { platforms, sdkVersion, version } = runtimeGate.validateMiniappManifestForDeploy(manifest);
95
95
  const allFiles = await walkDistFiles(distDir);
96
96
  const uploadFiles = allFiles.filter((file) => runtimePermissionEnv.shouldUploadDistFile(file.relativePath));
97
97
  const sizeError = runtimePermissionEnv.validateUploadTotalSize(uploadFiles);
@@ -102,6 +102,7 @@ async function validateBuildOutput(projectRoot, logger) {
102
102
  distDir,
103
103
  fileCount: uploadFiles.length,
104
104
  sdkVersion,
105
+ platforms,
105
106
  totalBytes: uploadFiles.reduce((total, file) => total + file.size, 0),
106
107
  version,
107
108
  };
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var session = require('./session-ySUU0fVq.cjs');
4
- var runtimePermissionEnv = require('./runtime-permission-env-D-8_jPG3.cjs');
3
+ var session = require('./session-BDi_AZSv.cjs');
4
+ var runtimePermissionEnv = require('./runtime-permission-env-CjsCe5bp.cjs');
5
5
  var fs$1 = require('node:fs');
6
6
  var fs = require('node:fs/promises');
7
7
  var path = require('node:path');
@@ -5,7 +5,7 @@ var fs = require('node:fs/promises');
5
5
  var path = require('node:path');
6
6
  var require$$0 = require('fs');
7
7
  var require$$1 = require('path');
8
- var index = require('./index-DLrcC_ij.cjs');
8
+ var index = require('./index-D62ANeBv.cjs');
9
9
  require('node:module');
10
10
  require('os');
11
11
  require('readline');
@@ -8,16 +8,16 @@ var node_crypto = require('node:crypto');
8
8
  var promises = require('node:dns/promises');
9
9
  var node_http = require('node:http');
10
10
  var node_module = require('node:module');
11
- var context = require('./context-C1nTGr-R.cjs');
11
+ var context = require('./context-DV2UK1Nz.cjs');
12
12
  var undici = require('undici');
13
13
  var fs$1 = require('node:fs/promises');
14
- var index = require('./index-DLrcC_ij.cjs');
14
+ var index = require('./index-D62ANeBv.cjs');
15
15
  var require$$0$1 = require('crypto');
16
16
  var require$$0 = require('buffer');
17
- var session = require('./session-ySUU0fVq.cjs');
17
+ var session = require('./session-BDi_AZSv.cjs');
18
18
  var browser = require('./browser-RAy8e8cV.cjs');
19
- var projectVite = require('./project-vite-c13CKUUl.cjs');
20
- var runtimePermissionEnv = require('./runtime-permission-env-D-8_jPG3.cjs');
19
+ var projectVite = require('./project-vite-CcE-HMmd.cjs');
20
+ var runtimePermissionEnv = require('./runtime-permission-env-CjsCe5bp.cjs');
21
21
 
22
22
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
23
23
  class Locked extends Error {
@@ -1741,7 +1741,7 @@ const DEFAULT_CHANNEL_TRANSPORT = {
1741
1741
  };
1742
1742
  const IPV4_LOOPBACK_ADDRESSES = new net.BlockList();
1743
1743
  IPV4_LOOPBACK_ADDRESSES.addSubnet('127.0.0.0', 8, 'ipv4');
1744
- const { WebSocket, WebSocketServer } = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/dev-U5BlN4ei.cjs', document.baseURI).href)))('ws');
1744
+ const { WebSocket, WebSocketServer } = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/dev-Dgt2zS9k.cjs', document.baseURI).href)))('ws');
1745
1745
  const BROWSER_DEV_HOST_ROOT_CANDIDATES = [
1746
1746
  path.resolve(__dirname, 'devtools/browser-dev-host'),
1747
1747
  path.resolve(__dirname, '../devtools/browser-dev-host'),
@@ -10741,7 +10741,7 @@ function assertNodeRuntimeCapabilities(ctx, settings) {
10741
10741
  function createNodeRealtimeDriverRegistry() {
10742
10742
  const registry = createRuntimeRealtimeDriverRegistry();
10743
10743
  registry.registerLazy('node-websocket', async () => {
10744
- const mod = await Promise.resolve().then(function () { return require('./index.esm-DbbyeU1z.cjs'); });
10744
+ const mod = await Promise.resolve().then(function () { return require('./index.esm-CigcxJ2B.cjs'); });
10745
10745
  return mod.createNodeWebSocketRuntimeDriver();
10746
10746
  });
10747
10747
  return registry;
@@ -14908,7 +14908,7 @@ function writeLaunchResponse(response, status, body) {
14908
14908
  /** 构建时替换为当前发布包的实际版本。 */
14909
14909
  const HB_SDK_VERSION = typeof undefined === 'string'
14910
14910
  ? undefined
14911
- : '0.7.4';
14911
+ : '0.8.0-alpha';
14912
14912
 
14913
14913
  class DevPermissionOverrideStoreError extends Error {
14914
14914
  code;
@@ -4,7 +4,7 @@ var fs$1 = require('node:fs');
4
4
  var fs = require('node:fs/promises');
5
5
  var os = require('node:os');
6
6
  var path = require('node:path');
7
- var index = require('./index-DLrcC_ij.cjs');
7
+ var index = require('./index-D62ANeBv.cjs');
8
8
  require('node:module');
9
9
  require('path');
10
10
  require('os');
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var index$2 = require('./index-DLrcC_ij.cjs');
3
+ var index$2 = require('./index-D62ANeBv.cjs');
4
4
  var require$$0$3 = require('fs');
5
5
  var require$$0$2 = require('crypto');
6
6
  var require$$1$2 = require('path');
7
7
  var require$$0$5 = require('assert');
8
8
  var require$$0$4 = require('events');
9
9
  var require$$1$1 = require('util');
10
- var runtimePermissionEnv = require('./runtime-permission-env-D-8_jPG3.cjs');
10
+ var runtimePermissionEnv = require('./runtime-permission-env-CjsCe5bp.cjs');
11
11
  var require$$0$7 = require('net');
12
12
  var require$$0$6 = require('url');
13
13
  var require$$2$1 = require('http');
@@ -234,19 +234,19 @@ function requireArgument () {
234
234
 
235
235
  var command = {};
236
236
 
237
- const require$5 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-DLrcC_ij.cjs', document.baseURI).href)));
237
+ const require$5 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-D62ANeBv.cjs', document.baseURI).href)));
238
238
  function __require$4() { return require$5("node:events"); }
239
239
 
240
- const require$4 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-DLrcC_ij.cjs', document.baseURI).href)));
240
+ const require$4 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-D62ANeBv.cjs', document.baseURI).href)));
241
241
  function __require$3() { return require$4("node:child_process"); }
242
242
 
243
- const require$3 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-DLrcC_ij.cjs', document.baseURI).href)));
243
+ const require$3 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-D62ANeBv.cjs', document.baseURI).href)));
244
244
  function __require$2() { return require$3("node:path"); }
245
245
 
246
- const require$2 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-DLrcC_ij.cjs', document.baseURI).href)));
246
+ const require$2 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-D62ANeBv.cjs', document.baseURI).href)));
247
247
  function __require$1() { return require$2("node:fs"); }
248
248
 
249
- const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-DLrcC_ij.cjs', document.baseURI).href)));
249
+ const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-D62ANeBv.cjs', document.baseURI).href)));
250
250
  function __require() { return require$1("node:process"); }
251
251
 
252
252
  var help = {};
@@ -13347,7 +13347,7 @@ function getPathname(pathWithQuery) {
13347
13347
  }
13348
13348
 
13349
13349
  const CLI_VERSION_PLACEHOLDER = ['__HB', 'SDK', 'CLI', 'VERSION__'].join('_');
13350
- const BUILT_CLI_VERSION = '0.7.4';
13350
+ const BUILT_CLI_VERSION = '0.8.0-alpha';
13351
13351
  const PACKAGE_JSON_CANDIDATES = [
13352
13352
  path.resolve(__dirname, '..', '..', 'package.json'),
13353
13353
  path.resolve(__dirname, '..', 'package.json'),
@@ -13682,35 +13682,35 @@ function createCommandLoggerResolver(options) {
13682
13682
  };
13683
13683
  }
13684
13684
  const defaultClearLoginStatus = async (...args) => {
13685
- const { clearLoginStatus } = await Promise.resolve().then(function () { return require('./login-DQkArK14.cjs'); });
13685
+ const { clearLoginStatus } = await Promise.resolve().then(function () { return require('./login-Cumknwdx.cjs'); });
13686
13686
  return clearLoginStatus(...args);
13687
13687
  };
13688
13688
  const defaultLoginToHeybox = async (...args) => {
13689
- const { loginToHeybox } = await Promise.resolve().then(function () { return require('./login-DQkArK14.cjs'); });
13689
+ const { loginToHeybox } = await Promise.resolve().then(function () { return require('./login-Cumknwdx.cjs'); });
13690
13690
  return loginToHeybox(...args);
13691
13691
  };
13692
13692
  const defaultPrintLoginStatus = async (...args) => {
13693
- const { printLoginStatus } = await Promise.resolve().then(function () { return require('./login-DQkArK14.cjs'); });
13693
+ const { printLoginStatus } = await Promise.resolve().then(function () { return require('./login-Cumknwdx.cjs'); });
13694
13694
  return printLoginStatus(...args);
13695
13695
  };
13696
13696
  const defaultRunBuildCommand = async (...args) => {
13697
- const { runBuildCommand } = await Promise.resolve().then(function () { return require('./build-CVPqGQY3.cjs'); });
13697
+ const { runBuildCommand } = await Promise.resolve().then(function () { return require('./build-DJWFSM1B.cjs'); });
13698
13698
  return runBuildCommand(...args);
13699
13699
  };
13700
13700
  const defaultRunCreateCommand = async (...args) => {
13701
- const { runCreateCommand } = await Promise.resolve().then(function () { return require('./create-C5qrLLvv.cjs'); });
13701
+ const { runCreateCommand } = await Promise.resolve().then(function () { return require('./create-2HfoB48V.cjs'); });
13702
13702
  return runCreateCommand(...args);
13703
13703
  };
13704
13704
  const defaultRunDevCommand = async (...args) => {
13705
- const { runDevCommand } = await Promise.resolve().then(function () { return require('./dev-U5BlN4ei.cjs'); }).then(function (n) { return n.dev; });
13705
+ const { runDevCommand } = await Promise.resolve().then(function () { return require('./dev-Dgt2zS9k.cjs'); }).then(function (n) { return n.dev; });
13706
13706
  return runDevCommand(...args);
13707
13707
  };
13708
13708
  const defaultRunDoctorCommand = async (...args) => {
13709
- const { runDoctorCommand } = await Promise.resolve().then(function () { return require('./doctor-DxqHMTbm.cjs'); });
13709
+ const { runDoctorCommand } = await Promise.resolve().then(function () { return require('./doctor-C95gIao_.cjs'); });
13710
13710
  return runDoctorCommand(...args);
13711
13711
  };
13712
13712
  const defaultRunRemoteCommand = async (...args) => {
13713
- const { runRemoteCommand } = await Promise.resolve().then(function () { return require('./remote-816SyJyA.cjs'); });
13713
+ const { runRemoteCommand } = await Promise.resolve().then(function () { return require('./remote-DDdP3xcE.cjs'); });
13714
13714
  return runRemoteCommand(...args);
13715
13715
  };
13716
13716
  function resolveStandaloneLogger(options, verbose) {
@@ -11,8 +11,8 @@ var require$$0$4 = require('url');
11
11
  var require$$0 = require('zlib');
12
12
  var require$$0$1 = require('buffer');
13
13
  var require$$1 = require('util');
14
- var index = require('./index-DLrcC_ij.cjs');
15
- var dev = require('./dev-U5BlN4ei.cjs');
14
+ var index = require('./index-D62ANeBv.cjs');
15
+ var dev = require('./dev-Dgt2zS9k.cjs');
16
16
  require('node:module');
17
17
  require('node:fs');
18
18
  require('node:fs/promises');
@@ -27,11 +27,11 @@ require('node:net');
27
27
  require('node:crypto');
28
28
  require('node:dns/promises');
29
29
  require('node:http');
30
- require('./context-C1nTGr-R.cjs');
31
- require('./session-ySUU0fVq.cjs');
30
+ require('./context-DV2UK1Nz.cjs');
31
+ require('./session-BDi_AZSv.cjs');
32
32
  require('fs');
33
33
  require('constants');
34
- require('./runtime-permission-env-D-8_jPG3.cjs');
34
+ require('./runtime-permission-env-CjsCe5bp.cjs');
35
35
  require('node:async_hooks');
36
36
  require('undici');
37
37
  require('./browser-RAy8e8cV.cjs');
@@ -40,7 +40,7 @@ require('node:buffer');
40
40
  require('node:url');
41
41
  require('node:util');
42
42
  require('node:child_process');
43
- require('./project-vite-c13CKUUl.cjs');
43
+ require('./project-vite-CcE-HMmd.cjs');
44
44
 
45
45
  var bufferUtil = {exports: {}};
46
46
 
@@ -3,9 +3,9 @@
3
3
  var promises = require('node:readline/promises');
4
4
  var node_crypto = require('node:crypto');
5
5
  var node_http = require('node:http');
6
- var session = require('./session-ySUU0fVq.cjs');
6
+ var session = require('./session-BDi_AZSv.cjs');
7
7
  var browser = require('./browser-RAy8e8cV.cjs');
8
- var index = require('./index-DLrcC_ij.cjs');
8
+ var index = require('./index-D62ANeBv.cjs');
9
9
  require('node:path');
10
10
  require('fs');
11
11
  require('constants');
@@ -5,7 +5,7 @@ var fs$1 = require('node:fs/promises');
5
5
  var node_module = require('node:module');
6
6
  var path = require('node:path');
7
7
  var node_url = require('node:url');
8
- var index = require('./index-DLrcC_ij.cjs');
8
+ var index = require('./index-D62ANeBv.cjs');
9
9
 
10
10
  function findProjectRoot(startDir) {
11
11
  let current = path.resolve(startDir);
@@ -1,16 +1,16 @@
1
1
  'use strict';
2
2
 
3
3
  var promises = require('node:readline/promises');
4
- var index = require('./index-DLrcC_ij.cjs');
5
- var session = require('./session-ySUU0fVq.cjs');
4
+ var index = require('./index-D62ANeBv.cjs');
5
+ var session = require('./session-BDi_AZSv.cjs');
6
6
  var childProcess = require('node:child_process');
7
7
  var fs = require('node:fs');
8
8
  var fs$1 = require('node:fs/promises');
9
9
  var path = require('node:path');
10
- var runtimePermissionEnv = require('./runtime-permission-env-D-8_jPG3.cjs');
11
- var runtimeGate = require('./runtime-gate-CtV7rWyX.cjs');
10
+ var runtimePermissionEnv = require('./runtime-permission-env-CjsCe5bp.cjs');
11
+ var runtimeGate = require('./runtime-gate-DFjw66kF.cjs');
12
12
  var node_crypto = require('node:crypto');
13
- var context = require('./context-C1nTGr-R.cjs');
13
+ var context = require('./context-DV2UK1Nz.cjs');
14
14
  require('node:module');
15
15
  require('path');
16
16
  require('os');
@@ -271,7 +271,7 @@ function createDefaultCosClient(uploadToken, COS) {
271
271
  };
272
272
  }
273
273
  async function loadCosConstructor() {
274
- const cosModule = await Promise.resolve().then(function () { return require('./index-BfR6OZeU.cjs'); }).then(function (n) { return n.index; });
274
+ const cosModule = await Promise.resolve().then(function () { return require('./index-BjoSXl8C.cjs'); }).then(function (n) { return n.index; });
275
275
  return cosModule.default;
276
276
  }
277
277
  function formatSize(bytes) {
@@ -677,6 +677,7 @@ async function runDeployCommand(options, runtime = {}) {
677
677
  };
678
678
  };
679
679
  if (fromVersion) {
680
+ logger.info('平台声明:未分类(复用历史产物)');
680
681
  return deploy();
681
682
  }
682
683
  return (runtime.withDeployLock ?? withDeployLock)({ apiBaseUrl, miniProgramId, version: uploadVersion }, deploy);
@@ -735,9 +736,10 @@ async function readDeployManifest(projectRoot, logger) {
735
736
  }
736
737
  const validated = runtimeGate.validateMiniappManifestForDeploy(manifest);
737
738
  return {
738
- manifest,
739
+ manifest: { ...manifest, platforms: validated.platforms },
739
740
  sdkVersion: validated.sdkVersion,
740
741
  version: validated.version,
742
+ platforms: validated.platforms,
741
743
  };
742
744
  }
743
745
  function validateVersionForDeploy(version, sourceLabel) {
@@ -877,7 +879,7 @@ function inferMimeType(fileName) {
877
879
  }
878
880
  async function assertDeployUploadFilesStillMatchSignature(options) {
879
881
  const currentFiles = runtimePermissionEnv.prepareMiniappArtifactFiles((await walkDistFiles(options.distDir)).filter((entry) => runtimePermissionEnv.shouldUploadDistFile(entry.relativePath)));
880
- const currentByPath = new Map(currentFiles.map(file => [file.relativePath, file]));
882
+ const currentByPath = new Map(currentFiles.map((file) => [file.relativePath, file]));
881
883
  if (currentFiles.length !== options.expectedFiles.length) {
882
884
  throw new Error('dist 构建产物在签名后发生变化,请重新执行 deploy');
883
885
  }
@@ -1,7 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var runtimePermissionEnv = require('./runtime-permission-env-D-8_jPG3.cjs');
3
+ var runtimePermissionEnv = require('./runtime-permission-env-CjsCe5bp.cjs');
4
4
 
5
+ const MINIAPP_PLATFORM_VALUES = ['android', 'ios', 'ohos', 'windows', 'macos', 'linux'];
5
6
  function isValidMiniappManifestVersion(version) {
6
7
  return getMiniappManifestVersionError(version) === undefined;
7
8
  }
@@ -34,8 +35,26 @@ function validateMiniappManifestForDeploy(manifest) {
34
35
  return {
35
36
  version: validateMiniappManifestVersion(manifest.version, 'manifest.version'),
36
37
  sdkVersion: validateSdkVersion(manifest.sdkVersion, 'manifest.sdkVersion'),
38
+ platforms: validateMiniappPlatforms(manifest.platforms, 'manifest.platforms'),
37
39
  };
38
40
  }
41
+ function validateMiniappPlatforms(platforms, sourceLabel = 'platforms') {
42
+ if (!Array.isArray(platforms) || platforms.length === 0) {
43
+ throw new Error(`${sourceLabel} 必须是非空平台数组`);
44
+ }
45
+ const allowedPlatforms = new Set(MINIAPP_PLATFORM_VALUES);
46
+ const seen = new Set();
47
+ for (const platform of platforms) {
48
+ if (typeof platform !== 'string' || !allowedPlatforms.has(platform)) {
49
+ throw new Error(`${sourceLabel} 包含不支持的平台:${String(platform)}`);
50
+ }
51
+ if (seen.has(platform)) {
52
+ throw new Error(`${sourceLabel} 包含重复平台:${platform}`);
53
+ }
54
+ seen.add(platform);
55
+ }
56
+ return Object.freeze(MINIAPP_PLATFORM_VALUES.filter((platform) => seen.has(platform)));
57
+ }
39
58
  function validateSdkVersion(version, sourceLabel = 'sdkVersion') {
40
59
  if (typeof version !== 'string' || version.trim() === '') {
41
60
  throw new Error(`${sourceLabel} 必须是合法 SemVer:${String(version)}`);
@@ -2869,7 +2869,7 @@ function shouldUploadDistFile(relativePath) {
2869
2869
  /**
2870
2870
  * 校验构建产物路径和大小,并按路径 UTF-8 字节序排序。
2871
2871
  *
2872
- * @param files 待处理的构建产物文件。
2872
+ * @param files - 待处理的构建产物文件。
2873
2873
  * @returns 保留输入附加字段的有序文件列表。
2874
2874
  * @throws 路径不规范、路径重复或文件大小非法时抛出错误。
2875
2875
  */
@@ -2878,7 +2878,7 @@ function prepareMiniappArtifactFiles(files) {
2878
2878
  throw new Error('构建产物文件数量超出签名协议上限');
2879
2879
  }
2880
2880
  const usedPaths = new Set();
2881
- const prepared = files.map(file => {
2881
+ const prepared = files.map((file) => {
2882
2882
  const relativePath = normalizeMiniappArtifactRelativePath(file.relativePath);
2883
2883
  if (usedPaths.has(relativePath)) {
2884
2884
  throw new Error(`构建产物包含重复文件路径:${relativePath}`);
@@ -2892,15 +2892,15 @@ function prepareMiniappArtifactFiles(files) {
2892
2892
  /**
2893
2893
  * 按服务端 session key 前缀校验最终上传路径的 UTF-8 字节长度。
2894
2894
  *
2895
- * @param files 待上传的构建产物文件。
2896
- * @param options 小程序和长度限制配置。
2895
+ * @param files - 待上传的构建产物文件。
2896
+ * @param options - 小程序和长度限制配置。
2897
2897
  * @returns 第一个超长路径的错误提示;全部合法时返回 `undefined`。
2898
2898
  */
2899
2899
  function validateMiniappUploadPathLengths(files, options) {
2900
2900
  const maxLength = options.maxLength ?? ACTIVITY_UPLOAD_KEY_MAX_LENGTH;
2901
2901
  const prefix = `/u/${getMiniProgramUploadAlias(options.miniProgramId)}/${'x'.repeat(MINIAPP_UPLOAD_SESSION_REF_LENGTH)}/`;
2902
2902
  const prefixLength = textEncoder.encode(prefix).length;
2903
- const tooLongFile = files.find(file => {
2903
+ const tooLongFile = files.find((file) => {
2904
2904
  const relativePath = normalizeMiniappArtifactRelativePath(file.relativePath);
2905
2905
  return prefixLength + textEncoder.encode(relativePath).length > maxLength;
2906
2906
  });
@@ -2909,7 +2909,7 @@ function validateMiniappUploadPathLengths(files, options) {
2909
2909
  /**
2910
2910
  * 创建 v1 整包签名头。
2911
2911
  *
2912
- * @param fileCount 参与签名的文件数量。
2912
+ * @param fileCount - 参与签名的文件数量。
2913
2913
  * @returns 包含协议标识和文件数量的字节数组。
2914
2914
  * @throws 文件数量超出协议范围时抛出错误。
2915
2915
  */
@@ -2922,7 +2922,7 @@ function createMiniappArtifactSignatureHeader(fileCount) {
2922
2922
  /**
2923
2923
  * 创建单个文件的 v1 framing header。
2924
2924
  *
2925
- * @param file 已规范化或待校验的构建产物文件。
2925
+ * @param file - 已规范化或待校验的构建产物文件。
2926
2926
  * @returns 包含路径长度、路径和文件大小的字节数组。
2927
2927
  * @throws 文件路径或大小非法时抛出错误。
2928
2928
  */
@@ -2935,9 +2935,9 @@ function createMiniappArtifactFileHeader(file) {
2935
2935
  /**
2936
2936
  * 校验服务端 session 文件映射,并计算仍需上传的文件。
2937
2937
  *
2938
- * @param localFiles 本地构建产物文件。
2939
- * @param serverFiles 服务端签发的文件映射。
2940
- * @param uploadedKeys 服务端已确认上传成功的 key。
2938
+ * @param localFiles - 本地构建产物文件。
2939
+ * @param serverFiles - 服务端签发的文件映射。
2940
+ * @param uploadedKeys - 服务端已确认上传成功的 key。
2941
2941
  * @returns 完整映射、待上传文件和已确认 key。
2942
2942
  * @throws 服务端映射与本地产物不一致时抛出错误。
2943
2943
  */
@@ -2969,7 +2969,7 @@ function resolveMiniappUploadSessionFiles(localFiles, serverFiles, uploadedKeys)
2969
2969
  serverSizes.set(relativePath, size);
2970
2970
  knownKeys.add(key);
2971
2971
  }
2972
- const files = preparedFiles.map(file => {
2972
+ const files = preparedFiles.map((file) => {
2973
2973
  const key = mappings.get(file.relativePath);
2974
2974
  if (!key) {
2975
2975
  throw new Error(`上传会话缺少文件映射:${file.relativePath}`);
@@ -2989,7 +2989,7 @@ function resolveMiniappUploadSessionFiles(localFiles, serverFiles, uploadedKeys)
2989
2989
  }
2990
2990
  return {
2991
2991
  files,
2992
- missingFiles: files.filter(file => !completed.has(file.key)),
2992
+ missingFiles: files.filter((file) => !completed.has(file.key)),
2993
2993
  uploadedKeys: [...completed],
2994
2994
  };
2995
2995
  }
@@ -3007,7 +3007,7 @@ function normalizeMiniappArtifactRelativePath(relativePath) {
3007
3007
  if (containsControlCharacter(value) || UNPAIRED_SURROGATE_PATTERN.test(value)) {
3008
3008
  throw new Error(`构建产物路径包含非法字符:${value}`);
3009
3009
  }
3010
- if (value.split('/').some(segment => !segment || segment === '.' || segment === '..')) {
3010
+ if (value.split('/').some((segment) => !segment || segment === '.' || segment === '..')) {
3011
3011
  throw new Error(`构建产物路径包含非法目录段:${value}`);
3012
3012
  }
3013
3013
  if (value.includes(',')) {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DLrcC_ij.cjs');
3
+ var index = require('./index-D62ANeBv.cjs');
4
4
  var node_crypto = require('node:crypto');
5
5
  var path = require('node:path');
6
6
  var require$$0$2 = require('fs');
package/dist/cli.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./cli-chunks/index-DLrcC_ij.cjs');
3
+ var index = require('./cli-chunks/index-D62ANeBv.cjs');
4
4
  require('node:module');
5
5
  require('node:fs');
6
6
  require('node:fs/promises');