@heybox/hb-sdk 0.7.5-alpha.0 → 0.8.0-alpha.2

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 (76) hide show
  1. package/CHANGELOG.md +86 -0
  2. package/README.md +69 -16
  3. package/THIRD_PARTY_NOTICES.md +1755 -0
  4. package/dist/cli-chunks/{build-V1YBdpzY.cjs → build-CCLWgXyA.cjs} +6 -5
  5. package/dist/cli-chunks/{context-Ba1Je-wT.cjs → context-Brh56h56.cjs} +2 -27
  6. package/dist/cli-chunks/{create-CKGjqo9E.cjs → create-BZ-hi2s1.cjs} +1 -1
  7. package/dist/cli-chunks/{dev-XopYKLYZ.cjs → dev-CoSXtEYa.cjs} +336 -517
  8. package/dist/cli-chunks/{doctor-BHbrYQqT.cjs → doctor-EsCYJGhV.cjs} +1 -1
  9. package/dist/cli-chunks/{index-C9mpajVG.cjs → index-BL5eEPap.cjs} +14 -14
  10. package/dist/cli-chunks/{index-DKWfX6Ut.cjs → index-CS6Q0o5C.cjs} +2 -2
  11. package/dist/cli-chunks/{index.esm-SXAQ3WVR.cjs → index.esm-BoBHPfpq.cjs} +6 -6
  12. package/dist/cli-chunks/{login-BVWicWqe.cjs → login-CILLxGuf.cjs} +2 -2
  13. package/dist/cli-chunks/{project-vite-CBb38HJ3.cjs → project-vite-Qu6Xe9Dn.cjs} +1 -1
  14. package/dist/cli-chunks/{remote-BG1u0NKT.cjs → remote-DRuTQ51u.cjs} +10 -8
  15. package/dist/cli-chunks/{runtime-gate-CtV7rWyX.cjs → runtime-gate-DFjw66kF.cjs} +20 -1
  16. package/dist/cli-chunks/{runtime-permission-env-D-8_jPG3.cjs → runtime-permission-env-CjsCe5bp.cjs} +13 -13
  17. package/dist/cli-chunks/{session-CJS_SEp9.cjs → session-D-_N3WVL.cjs} +1 -1
  18. package/dist/cli.cjs +1 -1
  19. package/dist/devtools/browser-dev-host/assets/browser-dev-host-uq-Wac6k.js +97 -0
  20. package/dist/devtools/browser-dev-host/assets/heybox-logo-CogNENsk.svg +6 -0
  21. package/dist/devtools/browser-dev-host/assets/index-CeP6SLB3.js +567 -0
  22. package/dist/devtools/browser-dev-host/assets/index-KD2f3Jdz.css +1 -0
  23. package/dist/devtools/browser-dev-host/assets/workbench-state-D-1U0JRq.js +5 -0
  24. package/dist/devtools/browser-dev-host/index.html +6 -435
  25. package/dist/index.cjs.js +1036 -90
  26. package/dist/index.esm.js +1036 -91
  27. package/dist/miniapp-publish.cjs.js +13 -13
  28. package/dist/miniapp-publish.esm.js +13 -13
  29. package/dist/protocol.cjs.js +208 -6
  30. package/dist/protocol.esm.js +182 -7
  31. package/dist/templates/vue3-vite-ts/README.md.ejs +2 -0
  32. package/dist/templates/vue3-vite-ts/vite.config.ts +1 -1
  33. package/dist/vite.cjs.js +31 -4
  34. package/dist/vite.esm.js +31 -5
  35. package/package.json +28 -11
  36. package/skill/SKILL.md +9 -5
  37. package/skill/references/api-protocol.md +111 -3
  38. package/skill/references/api-root.md +170 -22
  39. package/skill/references/cli.md +21 -17
  40. package/skill/references/examples.md +30 -1
  41. package/skill/references/recipes.md +105 -1
  42. package/skill/references/safety-boundaries.md +12 -1
  43. package/skill/scripts/sync-references.mjs +37 -3
  44. package/skill/skill.json +4 -4
  45. package/types/core/client.d.ts +17 -1
  46. package/types/core/errors.d.ts +5 -5
  47. package/types/core/sdk.d.ts +8 -5
  48. package/types/core/singleton.d.ts +59 -6
  49. package/types/index.d.ts +4 -2
  50. package/types/miniapp-manifest/schema.d.ts +5 -0
  51. package/types/miniapp-publish/index.d.ts +8 -8
  52. package/types/modules/auth/index.d.ts +15 -1
  53. package/types/modules/cloud/index.d.ts +75 -5
  54. package/types/modules/device/index.d.ts +31 -3
  55. package/types/modules/files/index.d.ts +5 -0
  56. package/types/modules/files/registry.d.ts +35 -0
  57. package/types/modules/files/types.d.ts +159 -0
  58. package/types/modules/navigation/index.d.ts +46 -4
  59. package/types/modules/network/index.d.ts +72 -14
  60. package/types/modules/share/copy-link.d.ts +3 -3
  61. package/types/modules/share/index.d.ts +61 -5
  62. package/types/modules/share/screenshot.d.ts +3 -3
  63. package/types/modules/share/show-share-menu.d.ts +3 -3
  64. package/types/modules/storage/index.d.ts +38 -10
  65. package/types/modules/ui/index.d.ts +46 -4
  66. package/types/modules/user/get-info.d.ts +1 -1
  67. package/types/modules/user/index.d.ts +46 -4
  68. package/types/modules/user/steam-game-list.d.ts +2 -2
  69. package/types/modules/viewport/index.d.ts +36 -8
  70. package/types/protocol/capabilities.d.ts +2 -2
  71. package/types/protocol/constants.d.ts +1 -1
  72. package/types/protocol/guards.d.ts +1 -1
  73. package/types/protocol/types.d.ts +1 -1
  74. package/types/protocol.d.ts +4 -3
  75. package/types/vite/index.d.ts +15 -7
  76. package/dist/devtools/browser-dev-host/main.js +0 -12158
@@ -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-C9mpajVG.cjs');
7
+ var index = require('./index-BL5eEPap.cjs');
8
8
  require('node:module');
9
9
  require('path');
10
10
  require('os');
@@ -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-C9mpajVG.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-BL5eEPap.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-C9mpajVG.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-BL5eEPap.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-C9mpajVG.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-BL5eEPap.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-C9mpajVG.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-BL5eEPap.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-C9mpajVG.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-BL5eEPap.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.5-alpha.0';
13350
+ const BUILT_CLI_VERSION = '0.8.0-alpha.2';
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-BVWicWqe.cjs'); });
13685
+ const { clearLoginStatus } = await Promise.resolve().then(function () { return require('./login-CILLxGuf.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-BVWicWqe.cjs'); });
13689
+ const { loginToHeybox } = await Promise.resolve().then(function () { return require('./login-CILLxGuf.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-BVWicWqe.cjs'); });
13693
+ const { printLoginStatus } = await Promise.resolve().then(function () { return require('./login-CILLxGuf.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-V1YBdpzY.cjs'); });
13697
+ const { runBuildCommand } = await Promise.resolve().then(function () { return require('./build-CCLWgXyA.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-CKGjqo9E.cjs'); });
13701
+ const { runCreateCommand } = await Promise.resolve().then(function () { return require('./create-BZ-hi2s1.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-XopYKLYZ.cjs'); }).then(function (n) { return n.dev; });
13705
+ const { runDevCommand } = await Promise.resolve().then(function () { return require('./dev-CoSXtEYa.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-BHbrYQqT.cjs'); });
13709
+ const { runDoctorCommand } = await Promise.resolve().then(function () { return require('./doctor-EsCYJGhV.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-BG1u0NKT.cjs'); });
13713
+ const { runRemoteCommand } = await Promise.resolve().then(function () { return require('./remote-DRuTQ51u.cjs'); });
13714
13714
  return runRemoteCommand(...args);
13715
13715
  };
13716
13716
  function resolveStandaloneLogger(options, verbose) {
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var index$2 = require('./index-C9mpajVG.cjs');
3
+ var index$2 = require('./index-BL5eEPap.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');
@@ -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-C9mpajVG.cjs');
15
- var dev = require('./dev-XopYKLYZ.cjs');
14
+ var index = require('./index-BL5eEPap.cjs');
15
+ var dev = require('./dev-CoSXtEYa.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-Ba1Je-wT.cjs');
31
- require('./session-CJS_SEp9.cjs');
30
+ require('./context-Brh56h56.cjs');
31
+ require('./session-D-_N3WVL.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-CBb38HJ3.cjs');
43
+ require('./project-vite-Qu6Xe9Dn.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-CJS_SEp9.cjs');
6
+ var session = require('./session-D-_N3WVL.cjs');
7
7
  var browser = require('./browser-RAy8e8cV.cjs');
8
- var index = require('./index-C9mpajVG.cjs');
8
+ var index = require('./index-BL5eEPap.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-C9mpajVG.cjs');
8
+ var index = require('./index-BL5eEPap.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-C9mpajVG.cjs');
5
- var session = require('./session-CJS_SEp9.cjs');
4
+ var index = require('./index-BL5eEPap.cjs');
5
+ var session = require('./session-D-_N3WVL.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-Ba1Je-wT.cjs');
13
+ var context = require('./context-Brh56h56.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-DKWfX6Ut.cjs'); }).then(function (n) { return n.index; });
274
+ const cosModule = await Promise.resolve().then(function () { return require('./index-CS6Q0o5C.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-C9mpajVG.cjs');
3
+ var index = require('./index-BL5eEPap.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-C9mpajVG.cjs');
3
+ var index = require('./cli-chunks/index-BL5eEPap.cjs');
4
4
  require('node:module');
5
5
  require('node:fs');
6
6
  require('node:fs/promises');