@heybox/hb-sdk 0.8.0-alpha.3 → 0.8.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/CHANGELOG.md +136 -422
- package/README.md +28 -18
- package/dist/cli-chunks/{build-qWzAbpS7.cjs → build-PYCNacya.cjs} +8 -5
- package/dist/cli-chunks/{context-CtS2Thp0.cjs → context-m2W2XbL0.cjs} +42 -59
- package/dist/cli-chunks/{create-PV5ua977.cjs → create-BdAg3WGA.cjs} +2 -2
- package/dist/cli-chunks/{dev-CwKbAm_H.cjs → dev-CyZuw7Yn.cjs} +76 -64
- package/dist/cli-chunks/{doctor-tJUGOYrm.cjs → doctor-DU8rCfUF.cjs} +1 -1
- package/dist/cli-chunks/{index-DVuD75Hr.cjs → index-DATObqzK.cjs} +2 -2
- package/dist/cli-chunks/{index-De687C6-.cjs → index-MMW2ibQm.cjs} +32 -21
- package/dist/cli-chunks/{index.esm-B-4yrLNm.cjs → index.esm-BiAaAUFC.cjs} +8 -8
- package/dist/cli-chunks/{login-DolpqD8K.cjs → login-B3TThMss.cjs} +2 -2
- package/dist/cli-chunks/{project-vite-1rvkK-M8.cjs → project-vite-BQj8YLI4.cjs} +1 -1
- package/dist/cli-chunks/{remote-rIAQE_G2.cjs → remote-DNvI7tHH.cjs} +57 -25
- package/dist/cli-chunks/{runtime-gate-DFjw66kF.cjs → runtime-gate-BEFp1w_s.cjs} +11 -3
- package/dist/cli-chunks/{runtime-permission-env-CjsCe5bp.cjs → runtime-permission-env-CtL8rsjB.cjs} +351 -0
- package/dist/cli-chunks/{session-CzaM2Cq3.cjs → session-DjBkjaF8.cjs} +1 -1
- package/dist/cli-chunks/{skill-CM40_9WH.cjs → skill-cR_wnaw2.cjs} +2 -2
- package/dist/cli-chunks/{version-Bz-AfXQU.cjs → version-yEn1E2Bg.cjs} +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/devtools/browser-dev-host/assets/browser-dev-host-TzYf9L6C.js +99 -0
- package/dist/devtools/browser-dev-host/assets/{index-CeP6SLB3.js → index-C5MZZDa5.js} +4 -4
- package/dist/devtools/browser-dev-host/assets/index-P-ra4m1y.css +1 -0
- package/dist/devtools/browser-dev-host/assets/workbench-state-BwV7bm4n.js +5 -0
- package/dist/devtools/browser-dev-host/index.html +3 -3
- package/dist/index.cjs.js +100 -2
- package/dist/index.esm.js +100 -2
- package/dist/protocol.cjs.js +189 -47
- package/dist/protocol.esm.js +189 -47
- package/dist/templates/{vue3-vite-ts → vanilla-vite-js}/.gitignore.ejs +0 -1
- package/dist/templates/vanilla-vite-js/README.md.ejs +14 -0
- package/dist/templates/vanilla-vite-js/index.html.ejs +20 -0
- package/dist/templates/vanilla-vite-js/package.json.ejs +22 -0
- package/dist/templates/vanilla-vite-js/src/assets/heybox-logo.svg +8 -0
- package/dist/templates/vanilla-vite-js/src/main.js +39 -0
- package/dist/templates/vanilla-vite-js/src/styles.css +155 -0
- package/dist/templates/{vue3-vite-ts/vite.config.ts → vanilla-vite-js/vite.config.js} +1 -2
- package/dist/vite.cjs.js +281 -13
- package/dist/vite.esm.js +281 -13
- package/package.json +13 -9
- package/skill/SKILL.md +8 -9
- package/skill/references/api-protocol.md +1 -3
- package/skill/references/api-root.md +65 -21
- package/skill/references/cli.md +17 -5
- package/skill/references/examples.md +3 -3
- package/skill/references/recipes.md +40 -41
- package/skill/references/safety-boundaries.md +9 -5
- package/skill/skill.json +5 -5
- package/types/core/mini-dev-console.d.ts +36 -0
- package/types/miniapp-manifest/index.d.ts +1 -0
- package/types/miniapp-manifest/node.d.ts +3 -0
- package/types/miniapp-manifest/permissions.d.ts +37 -0
- package/types/miniapp-manifest/schema.d.ts +5 -0
- package/types/modules/share/index.d.ts +1 -1
- package/types/modules/share/show-share-menu.d.ts +1 -1
- package/types/modules/share/types.d.ts +2 -4
- package/types/vite/index.d.ts +3 -1
- package/dist/devtools/browser-dev-host/assets/browser-dev-host-uq-Wac6k.js +0 -97
- package/dist/devtools/browser-dev-host/assets/index-KD2f3Jdz.css +0 -1
- package/dist/devtools/browser-dev-host/assets/workbench-state-D-1U0JRq.js +0 -5
- package/dist/templates/vue3-vite-ts/README.md.ejs +0 -47
- package/dist/templates/vue3-vite-ts/index.html.ejs +0 -12
- package/dist/templates/vue3-vite-ts/package.json.ejs +0 -33
- package/dist/templates/vue3-vite-ts/src/App.vue +0 -78
- package/dist/templates/vue3-vite-ts/src/__tests__/App.spec.ts +0 -148
- package/dist/templates/vue3-vite-ts/src/auth-handoff.ts +0 -46
- package/dist/templates/vue3-vite-ts/src/main.ts +0 -5
- package/dist/templates/vue3-vite-ts/src/styles.css +0 -60
- package/dist/templates/vue3-vite-ts/src/vite-env.d.ts +0 -1
- package/dist/templates/vue3-vite-ts/tsconfig.app.json +0 -17
- package/dist/templates/vue3-vite-ts/tsconfig.json +0 -11
- package/dist/templates/vue3-vite-ts/tsconfig.node.json +0 -11
- package/dist/templates/vue3-vite-ts/vitest.config.ts +0 -10
|
@@ -1 +1,4 @@
|
|
|
1
|
+
import { type ParsedMiniappPermissions } from './permissions';
|
|
1
2
|
export declare function readMiniappVersionFromPackageJson(root: string): string;
|
|
3
|
+
export declare function readMiniappPermissionsFromPackageJson(root: string, sdkVersion: string): ParsedMiniappPermissions;
|
|
4
|
+
export declare function resolveMiniappSdkVersion(): string;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type MiniProgramPermissionKey, type MiniProgramRuntimePermissionsSnapshot } from '@heybox/hb-sdk-protocol';
|
|
2
|
+
export declare const MINIAPP_PERMISSION_KEYS: readonly ["userInfo", "steamLibrary", "share", "storage", "filesystem", "clipboard", "leaderboard", "network"];
|
|
3
|
+
export type MiniappPermissionKey = MiniProgramPermissionKey;
|
|
4
|
+
export interface SimpleMiniappPermissionDeclaration {
|
|
5
|
+
enabled: true;
|
|
6
|
+
}
|
|
7
|
+
export interface NetworkMiniappPermissionDeclaration extends SimpleMiniappPermissionDeclaration {
|
|
8
|
+
useOfficialDomain: boolean;
|
|
9
|
+
}
|
|
10
|
+
export type MiniappPermissionDeclarations = Partial<Record<Exclude<MiniappPermissionKey, 'network'>, SimpleMiniappPermissionDeclaration> & {
|
|
11
|
+
network: NetworkMiniappPermissionDeclaration;
|
|
12
|
+
}>;
|
|
13
|
+
export interface ParsedMiniappPermissions {
|
|
14
|
+
declared: boolean;
|
|
15
|
+
permissions?: MiniappPermissionDeclarations;
|
|
16
|
+
}
|
|
17
|
+
export interface MiniappPermissionView {
|
|
18
|
+
key: MiniappPermissionKey;
|
|
19
|
+
access: 'declaration' | 'platform-approval';
|
|
20
|
+
declared: boolean;
|
|
21
|
+
approved: boolean | null;
|
|
22
|
+
requestedConfig?: Record<string, boolean>;
|
|
23
|
+
approvedConfig?: Record<string, boolean>;
|
|
24
|
+
effective: boolean;
|
|
25
|
+
effectiveConfig?: Record<string, boolean>;
|
|
26
|
+
}
|
|
27
|
+
export declare function parseMiniappPermissions(value: unknown, options: {
|
|
28
|
+
present: boolean;
|
|
29
|
+
sdkVersion: string;
|
|
30
|
+
sourceLabel?: string;
|
|
31
|
+
}): ParsedMiniappPermissions;
|
|
32
|
+
export declare function requiresExplicitPermissions(sdkVersion: string): boolean;
|
|
33
|
+
export declare function getMissingPermissionsWarning(sourceLabel?: string): string;
|
|
34
|
+
export declare function composeMiniappRuntimePermissions(local: ParsedMiniappPermissions, approvals: unknown): {
|
|
35
|
+
runtimePermissions: MiniProgramRuntimePermissionsSnapshot;
|
|
36
|
+
views: MiniappPermissionView[];
|
|
37
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type MiniappPermissionDeclarations } from './permissions';
|
|
1
2
|
export declare const MINIAPP_TEMPLATE_VERSION = "0.0.0";
|
|
2
3
|
export declare const MINIAPP_PLATFORM_VALUES: readonly ["android", "ios", "ohos", "windows", "macos", "linux"];
|
|
3
4
|
export type MiniappPlatform = (typeof MINIAPP_PLATFORM_VALUES)[number];
|
|
@@ -6,6 +7,7 @@ export interface MiniappManifest {
|
|
|
6
7
|
sdkVersion: string;
|
|
7
8
|
version: string;
|
|
8
9
|
platforms: readonly MiniappPlatform[];
|
|
10
|
+
permissions?: MiniappPermissionDeclarations;
|
|
9
11
|
}
|
|
10
12
|
export interface ParseMiniappManifestResult {
|
|
11
13
|
manifest: MiniappManifest;
|
|
@@ -17,6 +19,9 @@ export declare function validateMiniappManifestVersion(version: unknown, sourceL
|
|
|
17
19
|
export declare function renderMiniappManifest(manifest: MiniappManifest): string;
|
|
18
20
|
export declare function parseMiniappManifestJson(raw: string, sourceLabel?: string): ParseMiniappManifestResult;
|
|
19
21
|
export declare function validateMiniappManifestForDeploy(manifest: MiniappManifest): {
|
|
22
|
+
permissions?: Partial<Record<"userInfo" | "steamLibrary" | "share" | "storage" | "filesystem" | "clipboard" | "leaderboard", import("./permissions").SimpleMiniappPermissionDeclaration> & {
|
|
23
|
+
network: import("./permissions").NetworkMiniappPermissionDeclaration;
|
|
24
|
+
}> | undefined;
|
|
20
25
|
version: string;
|
|
21
26
|
sdkVersion: string;
|
|
22
27
|
platforms: readonly ("android" | "ios" | "ohos" | "windows" | "macos" | "linux")[];
|
|
@@ -6,7 +6,7 @@ export type ShowShareMenuPayload = MiniProgramShowShareMenuOptions;
|
|
|
6
6
|
/** `share.showShareMenu` 返回值由客户端协议决定。 */
|
|
7
7
|
export type ShowShareMenuResult = unknown;
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* 展示以当前小程序通用分享页为落地页的基础分享面板。
|
|
10
10
|
*
|
|
11
11
|
* @param requester - 底层 bridge 请求能力。
|
|
12
12
|
* @param options - 基础分享参数。
|
|
@@ -25,16 +25,14 @@ export interface MiniProgramSharePostOptions {
|
|
|
25
25
|
* 展示基础分享面板的配置。
|
|
26
26
|
*
|
|
27
27
|
* @remarks
|
|
28
|
-
*
|
|
28
|
+
* 分享落地页固定为当前小程序的通用分享页。该配置只暴露基础分享字段,不暴露宿主内部上报、回调、自定义按钮等协议参数。
|
|
29
29
|
*/
|
|
30
30
|
export interface MiniProgramShowShareMenuOptions {
|
|
31
31
|
/** 分享标题。 */
|
|
32
32
|
title: string;
|
|
33
33
|
/** 分享描述。 */
|
|
34
34
|
desc: string;
|
|
35
|
-
/**
|
|
36
|
-
url?: string;
|
|
37
|
-
/** 分享扩展数据;最多 8 层、单层最多 64 项、容量不超过 128 字节,且不能与 `url` 同时使用。 */
|
|
35
|
+
/** 分享扩展数据;最多 8 层、单层最多 64 项、容量不超过 128 字节。 */
|
|
38
36
|
extra?: MiniProgramShareExtraValue;
|
|
39
37
|
/** 分享缩略图 URL。 */
|
|
40
38
|
imageUrl?: string;
|
package/types/vite/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { MINIAPP_PLATFORM_VALUES, type MiniappPlatform } from '../miniapp-manifest/schema';
|
|
2
2
|
export interface MiniappManifestPlugin {
|
|
3
3
|
name: string;
|
|
4
|
-
config: (config: MiniappManifestUserConfig
|
|
4
|
+
config: (config: MiniappManifestUserConfig, env?: {
|
|
5
|
+
command: 'build' | 'serve';
|
|
6
|
+
}) => MiniappManifestUserConfig | void;
|
|
5
7
|
configResolved: (resolved: MiniappManifestResolvedConfig) => void;
|
|
6
8
|
/** Rollup 在构建失败后仍会跑 closeBundle;用 buildEnd 记录真实错误,避免二次校验掩盖原因。 */
|
|
7
9
|
buildEnd: (error?: Error) => void;
|