@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
@@ -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-C9mpajVG.cjs');
9
- var projectVite = require('./project-vite-CBb38HJ3.cjs');
6
+ var runtimePermissionEnv = require('./runtime-permission-env-CjsCe5bp.cjs');
7
+ var runtimeGate = require('./runtime-gate-DFjw66kF.cjs');
8
+ var index = require('./index-BL5eEPap.cjs');
9
+ var projectVite = require('./project-vite-Qu6Xe9Dn.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-CJS_SEp9.cjs');
4
- var runtimePermissionEnv = require('./runtime-permission-env-D-8_jPG3.cjs');
3
+ var session = require('./session-D-_N3WVL.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');
@@ -45,23 +45,6 @@ function isRecord(value) {
45
45
  return typeof value === 'object' && value !== null && !Array.isArray(value);
46
46
  }
47
47
 
48
- function parseBrowserDevPermissionState(value) {
49
- if (!isPlainRecord(value) || !hasExactKeys(value, ['networkRequest']))
50
- return undefined;
51
- const networkRequest = value.networkRequest;
52
- if (!isPlainRecord(networkRequest) || !hasExactKeys(networkRequest, ['status', 'useOfficialDomain']))
53
- return undefined;
54
- if (networkRequest.status !== 'enabled' && networkRequest.status !== 'disabled')
55
- return undefined;
56
- if (typeof networkRequest.useOfficialDomain !== 'boolean')
57
- return undefined;
58
- return {
59
- networkRequest: {
60
- status: networkRequest.status,
61
- useOfficialDomain: networkRequest.useOfficialDomain,
62
- },
63
- };
64
- }
65
48
  function shouldSkipMiniappPlatformCsp(runtimePermissions) {
66
49
  const parsed = parseMiniProgramRuntimePermissions(runtimePermissions);
67
50
  const networkRequest = parsed.permissions['network.request'];
@@ -104,13 +87,6 @@ function cloneDefaultPermissionState() {
104
87
  networkRequest: { ...DEFAULT_PERMISSION_STATE.networkRequest },
105
88
  };
106
89
  }
107
- function isPlainRecord(value) {
108
- return typeof value === 'object' && value !== null && !Array.isArray(value) && Object.getPrototypeOf(value) === Object.prototype;
109
- }
110
- function hasExactKeys(value, keys) {
111
- const actualKeys = Object.keys(value);
112
- return actualKeys.length === keys.length && keys.every((key) => Object.hasOwn(value, key));
113
- }
114
90
 
115
91
  function createRemoteApiClient(options) {
116
92
  return {
@@ -425,7 +401,6 @@ exports.createBrowserDevRuntimePermissions = createBrowserDevRuntimePermissions;
425
401
  exports.createLocalDevLaunchToken = createLocalDevLaunchToken;
426
402
  exports.createRemoteApiClientForEnvironment = createRemoteApiClientForEnvironment;
427
403
  exports.getBoundMiniProgram = getBoundMiniProgram;
428
- exports.parseBrowserDevPermissionState = parseBrowserDevPermissionState;
429
404
  exports.parseMiniProgramRuntimePermissions = parseMiniProgramRuntimePermissions;
430
405
  exports.readBoundMiniProgramId = readBoundMiniProgramId;
431
406
  exports.readBoundMiniProgramIdFromPackageJson = readBoundMiniProgramIdFromPackageJson;
@@ -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-C9mpajVG.cjs');
8
+ var index = require('./index-BL5eEPap.cjs');
9
9
  require('node:module');
10
10
  require('os');
11
11
  require('readline');