@heybox/hb-sdk 0.9.5-alpha.1 → 0.9.5-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.
- package/CHANGELOG.md +10 -0
- package/dist/cli-chunks/{artifact-CevKlc1g.cjs → artifact-BQm9xFcY.cjs} +3 -3
- package/dist/cli-chunks/{build-CF1-28D8.cjs → build-D6tP7Uje.cjs} +7 -5
- package/dist/cli-chunks/{create-Q50un0Bg.cjs → create-BBXC3wLI.cjs} +3 -1
- package/dist/cli-chunks/{dev-Bsa-tW7L.cjs → dev-XoWrqt1g.cjs} +8 -8
- package/dist/cli-chunks/{dev-context-D007Z2-c.cjs → dev-context-Gh3m20fd.cjs} +2 -2
- package/dist/cli-chunks/{doctor-CIWDaPfi.cjs → doctor-Cuc3EQQ8.cjs} +3 -1
- package/dist/cli-chunks/{games-CNjfXQjT.cjs → games-CoddgAux.cjs} +5 -4
- package/dist/cli-chunks/{index-xZw-b2po.cjs → index-CS6WpCn8.cjs} +502 -66
- package/dist/cli-chunks/{index-CYTciTqL.cjs → index-_1anHmAG.cjs} +1 -1
- package/dist/cli-chunks/{index.esm-hwkHnZhi.cjs → index.esm-CrdqnD7E.cjs} +8 -6
- package/dist/cli-chunks/{login-ClnBJiRJ.cjs → login-Bk3T3PMe.cjs} +2 -1
- package/dist/cli-chunks/{project-vite-CgMLPNS6.cjs → project-vite-CL-SW3RW.cjs} +1 -1
- package/dist/cli-chunks/{remote-D-N5Gj1e.cjs → remote-Dfg2HLIt.cjs} +8 -8
- package/dist/cli-chunks/{runtime-permission-env-BF-Jw5-T.cjs → runtime-permission-env-CgH1Dz4q.cjs} +2 -2
- package/dist/cli-chunks/{skill-ba1VHnEN.cjs → skill-BGxlDR-g.cjs} +4 -2
- package/dist/cli-chunks/{version-CArGts-T.cjs → version-B1hlMGq2.cjs} +1 -1
- package/dist/cli.cjs +3 -1
- package/dist/devtools/browser-dev-host/assets/{browser-dev-host-D9zSDJJ8.js → browser-dev-host-BHv7t_Sz.js} +1 -1
- package/dist/devtools/browser-dev-host/assets/{desktop-app-launch-BXS6eaj9.js → desktop-app-launch-DlaXmxAI.js} +1 -1
- package/dist/devtools/browser-dev-host/assets/{index-Bn6Xr40h.js → index-CmITJMxu.js} +3 -3
- package/dist/devtools/browser-dev-host/index.html +2 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/vite.cjs.js +1 -1
- package/dist/vite.esm.js +1 -1
- package/package.json +5 -5
- package/skill/SKILL.md +2 -0
- package/skill/skill.json +5 -5
- package/dist/cli-chunks/deploy-lock-CpdL3s9E.cjs +0 -148
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<meta name="theme-color" content="#f4f5f7" />
|
|
7
7
|
<title>小程序工坊调试台</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
9
|
-
<link rel="modulepreload" crossorigin href="/assets/desktop-app-launch-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-CmITJMxu.js"></script>
|
|
9
|
+
<link rel="modulepreload" crossorigin href="/assets/desktop-app-launch-DlaXmxAI.js">
|
|
10
10
|
<link rel="stylesheet" crossorigin href="/assets/index-h-fYisyX.css">
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|
package/dist/index.cjs.js
CHANGED
|
@@ -7492,7 +7492,7 @@ function createMessageId() {
|
|
|
7492
7492
|
/** 构建时替换为当前发布包的实际版本。 */
|
|
7493
7493
|
const HB_SDK_VERSION = typeof undefined === 'string'
|
|
7494
7494
|
? undefined
|
|
7495
|
-
: '0.9.5-alpha.
|
|
7495
|
+
: '0.9.5-alpha.2';
|
|
7496
7496
|
|
|
7497
7497
|
const RUNTIME_MODES = new Set(['production', 'preview', 'development', 'unknown']);
|
|
7498
7498
|
const OPERATING_SYSTEM_NAMES = new Set(['android', 'ios', 'ohos', 'windows', 'macos', 'linux', 'unknown']);
|
package/dist/index.esm.js
CHANGED
|
@@ -7488,7 +7488,7 @@ function createMessageId() {
|
|
|
7488
7488
|
/** 构建时替换为当前发布包的实际版本。 */
|
|
7489
7489
|
const HB_SDK_VERSION = typeof undefined === 'string'
|
|
7490
7490
|
? undefined
|
|
7491
|
-
: '0.9.5-alpha.
|
|
7491
|
+
: '0.9.5-alpha.2';
|
|
7492
7492
|
|
|
7493
7493
|
const RUNTIME_MODES = new Set(['production', 'preview', 'development', 'unknown']);
|
|
7494
7494
|
const OPERATING_SYSTEM_NAMES = new Set(['android', 'ios', 'ohos', 'windows', 'macos', 'linux', 'unknown']);
|
package/dist/vite.cjs.js
CHANGED
|
@@ -10329,7 +10329,7 @@ async function ensureBasicInfoDirectory(rootPath, relative) {
|
|
|
10329
10329
|
/** 构建时替换为当前发布包的实际版本。 */
|
|
10330
10330
|
const HB_SDK_VERSION = typeof undefined === 'string'
|
|
10331
10331
|
? undefined
|
|
10332
|
-
: '0.9.5-alpha.
|
|
10332
|
+
: '0.9.5-alpha.2';
|
|
10333
10333
|
|
|
10334
10334
|
/**
|
|
10335
10335
|
* iframe 与调试台页面的开发期 console 捕获转发。
|
package/dist/vite.esm.js
CHANGED
|
@@ -10326,7 +10326,7 @@ async function ensureBasicInfoDirectory(rootPath, relative) {
|
|
|
10326
10326
|
/** 构建时替换为当前发布包的实际版本。 */
|
|
10327
10327
|
const HB_SDK_VERSION = typeof undefined === 'string'
|
|
10328
10328
|
? undefined
|
|
10329
|
-
: '0.9.5-alpha.
|
|
10329
|
+
: '0.9.5-alpha.2';
|
|
10330
10330
|
|
|
10331
10331
|
/**
|
|
10332
10332
|
* iframe 与调试台页面的开发期 console 捕获转发。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heybox/hb-sdk",
|
|
3
|
-
"version": "0.9.5-alpha.
|
|
3
|
+
"version": "0.9.5-alpha.2",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"./src/index.ts",
|
|
6
6
|
"./src/core/singleton.ts",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"undici": "^7.28.0",
|
|
77
77
|
"ws": "^8.18.0",
|
|
78
78
|
"sharp": "^0.34.5",
|
|
79
|
-
"@heybox/hb-sdk-protocol": "0.9.5-alpha.
|
|
79
|
+
"@heybox/hb-sdk-protocol": "0.9.5-alpha.2"
|
|
80
80
|
},
|
|
81
81
|
"peerDependencies": {
|
|
82
82
|
"vite": ">=5"
|
|
@@ -129,9 +129,9 @@
|
|
|
129
129
|
"@ai-desktop/view-contract": "file:../hb-sdk-protocol/vendor/view-contract-2.2.2-6ac49bbf6410.tgz",
|
|
130
130
|
"rollup-plugin-dts": "6.4.0",
|
|
131
131
|
"@heybox-domain/heybox-theme": "~0.1.0",
|
|
132
|
-
"@heybox-domain/heybox-vue3-ui": "~0.1.0",
|
|
133
132
|
"@heybox/hb-api": "~1.28.19",
|
|
134
|
-
"@heybox/
|
|
133
|
+
"@heybox-domain/heybox-vue3-ui": "~0.1.0",
|
|
134
|
+
"@heybox/hb-sdk-runtime": "~0.9.5-alpha.2",
|
|
135
135
|
"@heybox/runtime": "~0.2.1",
|
|
136
136
|
"@heybox/runtime-policy": "~0.2.1",
|
|
137
137
|
"@heybox/runtime-transport-fetch": "~0.2.1"
|
|
@@ -202,7 +202,7 @@
|
|
|
202
202
|
"changelog:draft": "node scripts/changelog-draft.cjs",
|
|
203
203
|
"check:changelog": "node scripts/check-changelog.cjs",
|
|
204
204
|
"release:verify-tarball": "node scripts/skill/verify-tarball-install.mjs",
|
|
205
|
-
"test:release": "node --test scripts/public-changelog.test.mjs scripts/public-changelog-workflow.test.cjs scripts/release-family.test.cjs ../../ops/jobs/publish-changed-packages/publish.test.cjs",
|
|
205
|
+
"test:release": "node --test scripts/release-notices.test.cjs scripts/public-changelog.test.mjs scripts/public-changelog-workflow.test.cjs scripts/release-family.test.cjs ../../ops/jobs/publish-changed-packages/publish.test.cjs ../../ops/jobs/release-hb-sdk/notify-release.test.cjs",
|
|
206
206
|
"test:compatibility-evidence": "node --test scripts/validate-compatibility-evidence.test.mjs",
|
|
207
207
|
"release:prepare": "node scripts/release-prepare.cjs",
|
|
208
208
|
"release:tag": "node scripts/release-tag.cjs",
|
package/skill/SKILL.md
CHANGED
|
@@ -40,6 +40,8 @@ Before giving hb-sdk-specific guidance or changing hb-sdk consumer code:
|
|
|
40
40
|
3. Use the index titles and summaries to select the smallest relevant set of linked pages; do not guess page URLs.
|
|
41
41
|
4. Resolve relative links against `https://docs.xiaoheihe.cn/hb_sdk/`, fetch those Markdown pages, and verify their responses before acting.
|
|
42
42
|
5. Check the project's installed `@heybox/hb-sdk` version. If it may differ from the live documentation, read the compatibility and changelog pages linked by the index before recommending an API or CLI command.
|
|
43
|
+
6. For proactive SDK update reminders, read the single approved CDN notice at `https://activity.xiaoheihe.cn/u/hb-sdk/approved-notice.json`. The indexed `Release notices` document is manually authored; it is not approval status. Match notices to the installed version and APIs used; link the applicable Changelog details. An empty or unavailable CDN document must not be represented as an approved announcement. Changelog remains the source for API facts and compatibility checks.
|
|
44
|
+
7. When the task upgrades the SDK, prepares a build, or deploys or publishes a mini-program, read the changelog entries for every stable version after the installed version up to the target version, and check each `必须操作` item first. Decide whether it applies from the APIs, permissions, platforms, and CLI workflows the project actually uses; read the linked guide or migration page before changing code, then verify the change. Report applicable items that remain unhandled instead of skipping them silently.
|
|
43
45
|
|
|
44
46
|
Do not use copied package references, an installed Skill snapshot, registry contents, remembered API shapes, or HTML documentation as a fallback. If the index or any required linked Markdown page is unavailable or invalid, report that the canonical hb-sdk documentation is unavailable and stop the hb-sdk-specific part of the task.
|
|
45
47
|
|
package/skill/skill.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hb-sdk",
|
|
3
|
-
"skillVersion": "0.9.5-alpha.
|
|
3
|
+
"skillVersion": "0.9.5-alpha.2+skill.fe3b525ecac8",
|
|
4
4
|
"sdk": {
|
|
5
5
|
"package": "@heybox/hb-sdk",
|
|
6
|
-
"version": "0.9.5-alpha.
|
|
7
|
-
"compatibility": "0.9.5-alpha.
|
|
6
|
+
"version": "0.9.5-alpha.2",
|
|
7
|
+
"compatibility": "0.9.5-alpha.2"
|
|
8
8
|
},
|
|
9
9
|
"distribution": {
|
|
10
10
|
"type": "npm",
|
|
11
11
|
"package": "@heybox/hb-sdk",
|
|
12
|
-
"version": "0.9.5-alpha.
|
|
12
|
+
"version": "0.9.5-alpha.2",
|
|
13
13
|
"path": "skill"
|
|
14
14
|
},
|
|
15
|
-
"integrity": "sha256-
|
|
15
|
+
"integrity": "sha256-fe3b525ecac8431e1774ee453864cf9ba58ff6897272e2356ceb17b621c8c427"
|
|
16
16
|
}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var node_crypto = require('node:crypto');
|
|
4
|
-
var fs = require('node:fs/promises');
|
|
5
|
-
var path = require('node:path');
|
|
6
|
-
var index = require('./index-xZw-b2po.cjs');
|
|
7
|
-
|
|
8
|
-
const DEPLOY_LOCKED_MESSAGE = '当前设备已有同版本产物正在上传,请等待完成后重试';
|
|
9
|
-
const DEPLOY_LOCK_DIRECTORY_NAME = 'deploy-locks';
|
|
10
|
-
const DEPLOY_LOCK_OWNER_FILE = 'owner.json';
|
|
11
|
-
const INCOMPLETE_LOCK_GRACE_MS = 30_000;
|
|
12
|
-
const defaultPaths = index.envPaths('hb-sdk', { suffix: '' });
|
|
13
|
-
class DeployLockConflictError extends Error {
|
|
14
|
-
}
|
|
15
|
-
async function withDeployLock(scope, operation, options = {}) {
|
|
16
|
-
let lock;
|
|
17
|
-
try {
|
|
18
|
-
lock = await acquireDeployLock(scope, options);
|
|
19
|
-
}
|
|
20
|
-
catch (error) {
|
|
21
|
-
if (error instanceof DeployLockConflictError) {
|
|
22
|
-
throw error;
|
|
23
|
-
}
|
|
24
|
-
// 本地文件锁只减少重复操作,文件系统异常不阻断服务端上传流程。
|
|
25
|
-
return operation();
|
|
26
|
-
}
|
|
27
|
-
try {
|
|
28
|
-
return await operation();
|
|
29
|
-
}
|
|
30
|
-
finally {
|
|
31
|
-
await lock.release().catch(() => undefined);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
async function acquireDeployLock(scope, options = {}) {
|
|
35
|
-
const lockDirectory = getDeployLockDirectory(scope, options.cacheRoot);
|
|
36
|
-
const ownerFile = path.join(lockDirectory, DEPLOY_LOCK_OWNER_FILE);
|
|
37
|
-
const owner = {
|
|
38
|
-
version: 1,
|
|
39
|
-
pid: options.pid ?? process.pid,
|
|
40
|
-
token: options.token ?? node_crypto.randomBytes(16).toString('hex'),
|
|
41
|
-
};
|
|
42
|
-
await fs.mkdir(path.dirname(lockDirectory), { recursive: true, mode: 0o700 });
|
|
43
|
-
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
44
|
-
let created = false;
|
|
45
|
-
try {
|
|
46
|
-
await fs.mkdir(lockDirectory, { mode: 0o700 });
|
|
47
|
-
created = true;
|
|
48
|
-
await fs.writeFile(ownerFile, `${JSON.stringify(owner)}\n`, { encoding: 'utf8', mode: 0o600 });
|
|
49
|
-
return createDeployLock(lockDirectory, ownerFile, owner.token);
|
|
50
|
-
}
|
|
51
|
-
catch (error) {
|
|
52
|
-
if (created) {
|
|
53
|
-
await fs.rm(lockDirectory, { force: true, recursive: true });
|
|
54
|
-
throw error;
|
|
55
|
-
}
|
|
56
|
-
if (!isNodeError(error) || error.code !== 'EEXIST') {
|
|
57
|
-
throw error;
|
|
58
|
-
}
|
|
59
|
-
if (!(await canReclaimDeployLock(lockDirectory, ownerFile, options))) {
|
|
60
|
-
throw new DeployLockConflictError(DEPLOY_LOCKED_MESSAGE);
|
|
61
|
-
}
|
|
62
|
-
await reclaimDeployLock(lockDirectory, owner.token);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
throw new DeployLockConflictError(DEPLOY_LOCKED_MESSAGE);
|
|
66
|
-
}
|
|
67
|
-
function getDeployLockDirectory(scope, cacheRoot = defaultPaths.cache) {
|
|
68
|
-
const scopeHash = node_crypto.createHash('sha256').update(`${scope.apiBaseUrl}\0${scope.miniProgramId}\0${scope.version}`).digest('hex');
|
|
69
|
-
return path.join(cacheRoot, DEPLOY_LOCK_DIRECTORY_NAME, scopeHash);
|
|
70
|
-
}
|
|
71
|
-
function createDeployLock(lockDirectory, ownerFile, token) {
|
|
72
|
-
let released = false;
|
|
73
|
-
return {
|
|
74
|
-
async release() {
|
|
75
|
-
if (released)
|
|
76
|
-
return;
|
|
77
|
-
released = true;
|
|
78
|
-
await removeOwnedLock(lockDirectory, ownerFile, token);
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
async function canReclaimDeployLock(lockDirectory, ownerFile, options) {
|
|
83
|
-
const owner = await readDeployLockOwner(ownerFile);
|
|
84
|
-
if (owner) {
|
|
85
|
-
return !(options.isProcessRunning ?? isProcessRunning)(owner.pid);
|
|
86
|
-
}
|
|
87
|
-
try {
|
|
88
|
-
const lockStat = await fs.stat(lockDirectory);
|
|
89
|
-
return (options.now ?? Date.now)() - lockStat.mtimeMs >= INCOMPLETE_LOCK_GRACE_MS;
|
|
90
|
-
}
|
|
91
|
-
catch (error) {
|
|
92
|
-
return isNodeError(error) && error.code === 'ENOENT';
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
async function removeOwnedLock(lockDirectory, ownerFile, token) {
|
|
96
|
-
const owner = await readDeployLockOwner(ownerFile);
|
|
97
|
-
if (owner?.token === token) {
|
|
98
|
-
await fs.rm(lockDirectory, { force: true, recursive: true });
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
async function reclaimDeployLock(lockDirectory, token) {
|
|
102
|
-
const reclaimDirectory = `${lockDirectory}.reclaim-${node_crypto.createHash('sha256').update(token).digest('hex')}`;
|
|
103
|
-
try {
|
|
104
|
-
await fs.rename(lockDirectory, reclaimDirectory);
|
|
105
|
-
}
|
|
106
|
-
catch (error) {
|
|
107
|
-
if (isNodeError(error) && error.code === 'ENOENT')
|
|
108
|
-
return;
|
|
109
|
-
throw error;
|
|
110
|
-
}
|
|
111
|
-
await fs.rm(reclaimDirectory, { force: true, recursive: true });
|
|
112
|
-
}
|
|
113
|
-
async function readDeployLockOwner(ownerFile) {
|
|
114
|
-
try {
|
|
115
|
-
const value = JSON.parse(await fs.readFile(ownerFile, 'utf8'));
|
|
116
|
-
return isDeployLockOwner(value) ? value : null;
|
|
117
|
-
}
|
|
118
|
-
catch (error) {
|
|
119
|
-
if (isNodeError(error) && error.code === 'ENOENT')
|
|
120
|
-
return null;
|
|
121
|
-
if (error instanceof SyntaxError)
|
|
122
|
-
return null;
|
|
123
|
-
throw error;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
function isDeployLockOwner(value) {
|
|
127
|
-
return (typeof value === 'object' &&
|
|
128
|
-
value !== null &&
|
|
129
|
-
value.version === 1 &&
|
|
130
|
-
Number.isInteger(value.pid) &&
|
|
131
|
-
typeof value.token === 'string');
|
|
132
|
-
}
|
|
133
|
-
function isProcessRunning(pid) {
|
|
134
|
-
try {
|
|
135
|
-
process.kill(pid, 0);
|
|
136
|
-
return true;
|
|
137
|
-
}
|
|
138
|
-
catch (error) {
|
|
139
|
-
return !isNodeError(error) || error.code !== 'ESRCH';
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
function isNodeError(error) {
|
|
143
|
-
return error instanceof Error && 'code' in error;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
exports.DEPLOY_LOCKED_MESSAGE = DEPLOY_LOCKED_MESSAGE;
|
|
147
|
-
exports.acquireDeployLock = acquireDeployLock;
|
|
148
|
-
exports.withDeployLock = withDeployLock;
|