@heybox/hb-sdk 0.9.9-alpha.0 → 0.9.9-alpha.11
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 +44 -0
- package/README.md +2 -0
- package/dist/cli-chunks/{build-Vi5Zyplz.cjs → build-D_2l0CIV.cjs} +5 -5
- package/dist/cli-chunks/{create-Cfz1IcYf.cjs → create-0QH1Tn92.cjs} +2 -2
- package/dist/cli-chunks/{dev-C2dtgF42.cjs → dev-CS5VPiB1.cjs} +912 -703
- package/dist/cli-chunks/{doctor-D-zMCLIA.cjs → doctor-B33mYzm-.cjs} +1 -1
- package/dist/cli-chunks/{game-binding-guide-z3X6h8ck.cjs → game-binding-guide-DMDuw1Pj.cjs} +3 -3
- package/dist/cli-chunks/{game-bindings-DiVP8PdD.cjs → game-bindings-CQWdvXfM.cjs} +4 -4
- package/dist/cli-chunks/{games-THhcga6y.cjs → games-deIaD0qu.cjs} +1 -1
- package/dist/cli-chunks/{index-BuYCoach.cjs → index-C91c2NGN.cjs} +1 -1
- package/dist/cli-chunks/{index-H9U6-mLY.cjs → index-DpfxAeSH.cjs} +78 -25
- package/dist/cli-chunks/{index.esm-XiyiK7eH.cjs → index.esm-B2WXn2A4.cjs} +10 -10
- package/dist/cli-chunks/{index.esm-D8lqHXUQ.cjs → index.esm-CenYK5Bl.cjs} +72 -3
- package/dist/cli-chunks/{login-Bw_1UJ8i.cjs → login-D7XGHQFo.cjs} +1 -1
- package/dist/cli-chunks/{project-vite-CFfq-fV7.cjs → project-vite-B7sylnO7.cjs} +1 -1
- package/dist/cli-chunks/{remote-CU88U8t8.cjs → remote-Crnu4l7X.cjs} +952 -742
- package/dist/cli-chunks/{runtime-permission-env-BtxzR-dv.cjs → runtime-permission-env-Cj9STUWz.cjs} +25 -4
- package/dist/cli-chunks/{skill-7RZJxGDO.cjs → skill-BDswKf84.cjs} +2 -2
- package/dist/cli-chunks/{version-COTSItDf.cjs → version-Dl0HQVTu.cjs} +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/devtools/browser-dev-host/assets/browser-dev-host-Be8jnz2C.js +224 -0
- package/dist/devtools/browser-dev-host/assets/desktop-app-launch-z3rWAJJc.js +6 -0
- package/dist/devtools/browser-dev-host/assets/index-CvUCSIVI.js +574 -0
- package/dist/devtools/browser-dev-host/assets/index-DQgWBZbX.css +1 -0
- package/dist/devtools/browser-dev-host/index.html +3 -3
- package/dist/index.cjs.js +149 -4
- package/dist/index.esm.js +149 -5
- package/dist/miniapp-publish.cjs.js +64 -1
- package/dist/miniapp-publish.esm.js +63 -2
- package/dist/protocol.cjs.js +51 -5
- package/dist/protocol.esm.js +51 -5
- package/dist/vite.cjs.js +74 -9
- package/dist/vite.esm.js +74 -9
- package/package.json +5 -5
- package/skill/SKILL.md +7 -0
- package/skill/skill.json +5 -5
- package/types/index.d.ts +140 -4
- package/types/miniapp-publish/index.d.ts +14 -3
- package/types/vite/index.d.ts +2 -0
- package/dist/devtools/browser-dev-host/assets/browser-dev-host-CHdD15qt.js +0 -221
- package/dist/devtools/browser-dev-host/assets/desktop-app-launch-az2quV7I.js +0 -13
- package/dist/devtools/browser-dev-host/assets/index-D0XGMYIr.css +0 -1
- package/dist/devtools/browser-dev-host/assets/index-o5r5oqtq.js +0 -567
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-DpfxAeSH.cjs');
|
|
4
4
|
var promises = require('node:readline/promises');
|
|
5
5
|
var node_crypto = require('node:crypto');
|
|
6
6
|
var fs = require('node:fs/promises');
|
|
7
|
-
var index_esm = require('./index.esm-
|
|
7
|
+
var index_esm = require('./index.esm-CenYK5Bl.cjs');
|
|
8
8
|
var bindings = require('./bindings-B9HSKhmy.cjs');
|
|
9
9
|
var fs$1 = require('node:fs');
|
|
10
10
|
var path = require('node:path');
|
|
11
|
-
var games = require('./games-
|
|
11
|
+
var games = require('./games-deIaD0qu.cjs');
|
|
12
12
|
|
|
13
13
|
class MiniProgramProjectBindingError extends Error {
|
|
14
14
|
code;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var gameBindingGuide = require('./game-binding-guide-
|
|
4
|
-
var index = require('./index-
|
|
3
|
+
var gameBindingGuide = require('./game-binding-guide-DMDuw1Pj.cjs');
|
|
4
|
+
var index = require('./index-DpfxAeSH.cjs');
|
|
5
5
|
require('node:readline/promises');
|
|
6
6
|
require('node:crypto');
|
|
7
7
|
require('node:fs/promises');
|
|
8
|
-
require('./index.esm-
|
|
8
|
+
require('./index.esm-CenYK5Bl.cjs');
|
|
9
9
|
require('./bindings-B9HSKhmy.cjs');
|
|
10
10
|
require('node:fs');
|
|
11
11
|
require('node:path');
|
|
12
|
-
require('./games-
|
|
12
|
+
require('./games-deIaD0qu.cjs');
|
|
13
13
|
require('node:module');
|
|
14
14
|
require('readline');
|
|
15
15
|
require('os');
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var node_crypto = require('node:crypto');
|
|
4
4
|
var fs = require('node:fs/promises');
|
|
5
5
|
var path = require('node:path');
|
|
6
|
-
var index = require('./index-
|
|
6
|
+
var index = require('./index-DpfxAeSH.cjs');
|
|
7
7
|
require('node:module');
|
|
8
8
|
require('readline');
|
|
9
9
|
require('os');
|
|
@@ -242,19 +242,19 @@ function requireArgument () {
|
|
|
242
242
|
|
|
243
243
|
var command = {};
|
|
244
244
|
|
|
245
|
-
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-
|
|
245
|
+
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-DpfxAeSH.cjs', document.baseURI).href)));
|
|
246
246
|
function __require$4() { return require$5("node:events"); }
|
|
247
247
|
|
|
248
|
-
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-
|
|
248
|
+
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-DpfxAeSH.cjs', document.baseURI).href)));
|
|
249
249
|
function __require$3() { return require$4("node:child_process"); }
|
|
250
250
|
|
|
251
|
-
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-
|
|
251
|
+
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-DpfxAeSH.cjs', document.baseURI).href)));
|
|
252
252
|
function __require$2() { return require$3("node:path"); }
|
|
253
253
|
|
|
254
|
-
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-
|
|
254
|
+
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-DpfxAeSH.cjs', document.baseURI).href)));
|
|
255
255
|
function __require$1() { return require$2("node:fs"); }
|
|
256
256
|
|
|
257
|
-
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-
|
|
257
|
+
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-DpfxAeSH.cjs', document.baseURI).href)));
|
|
258
258
|
function __require() { return require$1("node:process"); }
|
|
259
259
|
|
|
260
260
|
var help = {};
|
|
@@ -17253,7 +17253,7 @@ async function inspectFeedbackLog(file, size) {
|
|
|
17253
17253
|
return { mimeType: 'text/plain', width: 0, height: 0 };
|
|
17254
17254
|
}
|
|
17255
17255
|
async function createFeedbackCosClient(getToken) {
|
|
17256
|
-
const { default: COS } = await Promise.resolve().then(function () { return require('./index-
|
|
17256
|
+
const { default: COS } = await Promise.resolve().then(function () { return require('./index-C91c2NGN.cjs'); }).then(function (n) { return n.index; });
|
|
17257
17257
|
const cos = new COS({
|
|
17258
17258
|
getAuthorization(_options, callback) {
|
|
17259
17259
|
void getToken().then((token) => callback({
|
|
@@ -20357,6 +20357,9 @@ function installFeedbackCommand(program, runtime = {}) {
|
|
|
20357
20357
|
installFeedbackTicketCommands(command, runtime);
|
|
20358
20358
|
}
|
|
20359
20359
|
|
|
20360
|
+
/** 手机上传预览与正式发布独立;本合同不暴露上传凭据。 */
|
|
20361
|
+
const DEV_MOBILE_PREVIEW_PATH = '/__hb_sdk__/mobile-preview';
|
|
20362
|
+
|
|
20360
20363
|
/** CLI 与 Node 连接入口共用项目定位;不加载 Vite、终端交互或日志组件。 */
|
|
20361
20364
|
function findProjectRoot(startDir) {
|
|
20362
20365
|
let current = path.resolve(startDir);
|
|
@@ -21654,6 +21657,32 @@ function delay(ms, signal) {
|
|
|
21654
21657
|
function installDevToolCommands(dev) {
|
|
21655
21658
|
dev.enablePositionalOptions();
|
|
21656
21659
|
dev.parent?.enablePositionalOptions();
|
|
21660
|
+
dev
|
|
21661
|
+
.command('sync')
|
|
21662
|
+
.description('构建并上传手机预览,成功后重新扫码打开快照')
|
|
21663
|
+
.option('--port <port>', '显式指定调试台;默认发现当前项目')
|
|
21664
|
+
.action(async (options, command) => {
|
|
21665
|
+
const connection = await connectCurrentDevHost(readDevToolPort(command, options.port));
|
|
21666
|
+
let task = await requestDevHost(connection, DEV_MOBILE_PREVIEW_PATH, { method: 'POST' });
|
|
21667
|
+
const taskId = task.taskId;
|
|
21668
|
+
const deadline = Date.now() + 30 * 60_000;
|
|
21669
|
+
let message;
|
|
21670
|
+
while (!['succeeded', 'failed', 'cancelled'].includes(String(task.phase))) {
|
|
21671
|
+
if (task.message !== message) {
|
|
21672
|
+
process.stderr.write(String(task.message) + '\n');
|
|
21673
|
+
message = task.message;
|
|
21674
|
+
}
|
|
21675
|
+
if (Date.now() > deadline)
|
|
21676
|
+
throw new Error('同步等待超时,任务可能仍在运行,请用 dev inspect 查看');
|
|
21677
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
21678
|
+
task = await requestDevHost(connection, DEV_MOBILE_PREVIEW_PATH);
|
|
21679
|
+
if (task.taskId !== taskId)
|
|
21680
|
+
throw new Error('同步任务已变化,请用 dev inspect 查看');
|
|
21681
|
+
}
|
|
21682
|
+
writeDevResult(task);
|
|
21683
|
+
if (task.phase !== 'succeeded')
|
|
21684
|
+
throw new Error(String(task.message || '手机同步失败'));
|
|
21685
|
+
});
|
|
21657
21686
|
dev
|
|
21658
21687
|
.command('list')
|
|
21659
21688
|
.description('列出当前用户启动的本机开发服务')
|
|
@@ -21935,7 +21964,7 @@ function installDevPreviewCommands(dev) {
|
|
|
21935
21964
|
}
|
|
21936
21965
|
|
|
21937
21966
|
const CLI_VERSION_PLACEHOLDER = ['__HB', 'SDK', 'CLI', 'VERSION__'].join('_');
|
|
21938
|
-
const BUILT_CLI_VERSION = '0.9.9-alpha.
|
|
21967
|
+
const BUILT_CLI_VERSION = '0.9.9-alpha.11';
|
|
21939
21968
|
const PACKAGE_JSON_CANDIDATES$1 = [
|
|
21940
21969
|
path.resolve(__dirname, '..', '..', 'package.json'),
|
|
21941
21970
|
path.resolve(__dirname, '..', 'package.json'),
|
|
@@ -23035,7 +23064,10 @@ function createCliProgram(overrides = {}) {
|
|
|
23035
23064
|
.command('dev')
|
|
23036
23065
|
.description('启动当前小程序项目的 Vite 开发服务器和浏览器调试页服务')
|
|
23037
23066
|
.addOption(new Option('--browser <browser>', '预览使用的本机浏览器').choices(['chrome', 'edge']))
|
|
23038
|
-
.addOption(new Option('--browser-mode <mode>', '默认 auto:复用项目独立浏览器,否则请求日常浏览器授权后回退;isolated 使用独立环境').choices([
|
|
23067
|
+
.addOption(new Option('--browser-mode <mode>', '默认 auto:复用项目独立浏览器,否则请求日常浏览器授权后回退;isolated 使用独立环境').choices([
|
|
23068
|
+
'auto',
|
|
23069
|
+
'isolated',
|
|
23070
|
+
]))
|
|
23039
23071
|
.option('--port <port>', '小程序开发服务器端口', parsePositivePort)
|
|
23040
23072
|
.option('--browser-dev-host-port <port>', '浏览器调试页服务端口', parsePositivePort)
|
|
23041
23073
|
.option('--no-open', '不自动打开浏览器调试页')
|
|
@@ -23048,8 +23080,8 @@ function createCliProgram(overrides = {}) {
|
|
|
23048
23080
|
applyDevServiceTag(options?.serviceTag);
|
|
23049
23081
|
await handlers.runDevCommand(options, { logger });
|
|
23050
23082
|
}, handlers.printUpdateReminder, resolveLogger));
|
|
23051
|
-
installDevToolCommands(program.commands.find(command => command.name() === 'dev'));
|
|
23052
|
-
installDevPreviewCommands(program.commands.find(command => command.name() === 'dev'));
|
|
23083
|
+
installDevToolCommands(program.commands.find((command) => command.name() === 'dev'));
|
|
23084
|
+
installDevPreviewCommands(program.commands.find((command) => command.name() === 'dev'));
|
|
23053
23085
|
addVerboseOption(program.command('build').description('构建当前小程序项目')
|
|
23054
23086
|
.option('--env <name>', '加载项目根下 .env.<name> 预设并作为 Vite mode')
|
|
23055
23087
|
// 根程序开启位置化解析后,子命令必须自己声明同名选项才能拿到它;这里声明但不展示,
|
|
@@ -23125,12 +23157,13 @@ function addRemotePublicOptions(command) {
|
|
|
23125
23157
|
function installRemoteCommands(program, handlers, resolveLogger) {
|
|
23126
23158
|
const remote = addRemotePublicOptions(program.command('remote').description('管理当前项目绑定的远程 Heybox 工坊小程序'));
|
|
23127
23159
|
const games = addVerboseOption(remote.command('games').description('查询平台游戏信息'));
|
|
23128
|
-
addVerboseOption(games
|
|
23160
|
+
addVerboseOption(games
|
|
23161
|
+
.command('search')
|
|
23162
|
+
.description('按名称查找游戏 appid,不修改绑定')
|
|
23129
23163
|
.argument('<query>', '中文或英文游戏名')
|
|
23130
23164
|
.option('--offset <offset>', '结果偏移量,0–10000', '0')
|
|
23131
23165
|
.option('--limit <limit>', '每页数量,1–20', '10')
|
|
23132
|
-
.option('--json', '输出 JSON'))
|
|
23133
|
-
.action(async (query, _options, command) => {
|
|
23166
|
+
.option('--json', '输出 JSON')).action(async (query, _options, command) => {
|
|
23134
23167
|
const options = readCommandOptionsWithAncestors(command);
|
|
23135
23168
|
await handlers.runGameSearchCommand(query, {
|
|
23136
23169
|
offset: readStringOption(options.offset),
|
|
@@ -23175,9 +23208,28 @@ function installRemoteCommands(program, handlers, resolveLogger) {
|
|
|
23175
23208
|
miniProgramId: readStringArgument(miniProgramId, 'mini-program-id'),
|
|
23176
23209
|
})));
|
|
23177
23210
|
addRemotePublicOptions(remote.command('info').description('查看当前绑定的远程工坊小程序详情')).action(createRemoteAction(handlers, resolveLogger, 'info'));
|
|
23211
|
+
const post = addRemotePublicOptions(remote.command('post').description('管理小程序关联帖子;每个小程序最多关联一篇自己的公开帖子'));
|
|
23212
|
+
addRemotePublicOptions(post.command('get').description('查看当前关联帖子')).action(createRemoteAction(handlers, resolveLogger, 'post:get'));
|
|
23213
|
+
addRemotePublicOptions(post
|
|
23214
|
+
.command('preview')
|
|
23215
|
+
.addHelpText('after', '\n使用帖子链接时,请用英文双引号包裹完整链接,避免 & 被 shell 解析。\n示例\n npm exec hb-sdk -- remote post preview "https://api.xiaoheihe.cn/v3/bbs/app/api/web/share?link_id=43ef72d469fb&h_src=app"\n请直接复制 URL,不要包含 Markdown 的 [文字](链接) 格式。')
|
|
23216
|
+
.description('校验并预览待关联的帖子')
|
|
23217
|
+
.argument('<post-id-or-url>', '帖子 ID 或小黑盒帖子链接,链接必须用英文双引号包裹')).action(createRemoteAction(handlers, resolveLogger, 'post:preview', (_command, postId) => ({
|
|
23218
|
+
postId: readStringArgument(postId, 'post-id'),
|
|
23219
|
+
})));
|
|
23220
|
+
addRemotePublicOptions(post
|
|
23221
|
+
.command('bind')
|
|
23222
|
+
.addHelpText('after', '\n使用帖子链接时,请用英文双引号包裹完整链接,避免 & 被 shell 解析。\n示例\n npm exec hb-sdk -- remote post bind "https://api.xiaoheihe.cn/v3/bbs/app/api/web/share?link_id=43ef72d469fb&h_src=app"\n请直接复制 URL,不要包含 Markdown 的 [文字](链接) 格式。')
|
|
23223
|
+
.description('关联或更换帖子')
|
|
23224
|
+
.argument('<post-id-or-url>', '帖子 ID 或小黑盒帖子链接,链接必须用英文双引号包裹')).action(createRemoteAction(handlers, resolveLogger, 'post:bind', (_command, postId) => ({
|
|
23225
|
+
postId: readStringArgument(postId, 'post-id'),
|
|
23226
|
+
})));
|
|
23227
|
+
addRemotePublicOptions(post.command('unbind').description('解除当前帖子关联')).action(createRemoteAction(handlers, resolveLogger, 'post:unbind'));
|
|
23178
23228
|
const permission = addRemotePublicOptions(remote.command('permission').description('申请平台权限并查看审核状态'));
|
|
23179
23229
|
addRemotePublicOptions(permission.command('list').description('查看平台权限及最近申请状态')).action(createRemoteAction(handlers, resolveLogger, 'permission:list'));
|
|
23180
|
-
addRemotePublicOptions(permission
|
|
23230
|
+
addRemotePublicOptions(permission
|
|
23231
|
+
.command('apply')
|
|
23232
|
+
.description('提交平台权限申请')
|
|
23181
23233
|
.argument('<key>', 'network、companion 或 appProtocol;user_game_data 是声明型权限,无需申请')
|
|
23182
23234
|
.requiredOption('--reason <text>', '申请理由,不超过 500 字')
|
|
23183
23235
|
.option('--domains <domains>', 'network 访问域名,多个用逗号分隔')).action(createRemoteAction(handlers, resolveLogger, 'permission:apply', (command, key) => {
|
|
@@ -23358,39 +23410,39 @@ function createCommandLoggerResolver(options) {
|
|
|
23358
23410
|
};
|
|
23359
23411
|
}
|
|
23360
23412
|
const defaultClearLoginStatus = async (...args) => {
|
|
23361
|
-
const { clearLoginStatus } = await Promise.resolve().then(function () { return require('./login-
|
|
23413
|
+
const { clearLoginStatus } = await Promise.resolve().then(function () { return require('./login-D7XGHQFo.cjs'); });
|
|
23362
23414
|
return clearLoginStatus(...args);
|
|
23363
23415
|
};
|
|
23364
23416
|
const defaultLoginToHeybox = async (...args) => {
|
|
23365
|
-
const { loginToHeybox } = await Promise.resolve().then(function () { return require('./login-
|
|
23417
|
+
const { loginToHeybox } = await Promise.resolve().then(function () { return require('./login-D7XGHQFo.cjs'); });
|
|
23366
23418
|
return loginToHeybox(...args);
|
|
23367
23419
|
};
|
|
23368
23420
|
const defaultPrintLoginStatus = async (...args) => {
|
|
23369
|
-
const { printLoginStatus } = await Promise.resolve().then(function () { return require('./login-
|
|
23421
|
+
const { printLoginStatus } = await Promise.resolve().then(function () { return require('./login-D7XGHQFo.cjs'); });
|
|
23370
23422
|
return printLoginStatus(...args);
|
|
23371
23423
|
};
|
|
23372
23424
|
const defaultRunBuildCommand = async (...args) => {
|
|
23373
|
-
const { runBuildCommand } = await Promise.resolve().then(function () { return require('./build-
|
|
23425
|
+
const { runBuildCommand } = await Promise.resolve().then(function () { return require('./build-D_2l0CIV.cjs'); });
|
|
23374
23426
|
return runBuildCommand(...args);
|
|
23375
23427
|
};
|
|
23376
23428
|
const defaultRunCreateCommand = async (...args) => {
|
|
23377
|
-
const { runCreateCommand } = await Promise.resolve().then(function () { return require('./create-
|
|
23429
|
+
const { runCreateCommand } = await Promise.resolve().then(function () { return require('./create-0QH1Tn92.cjs'); });
|
|
23378
23430
|
return runCreateCommand(...args);
|
|
23379
23431
|
};
|
|
23380
23432
|
const defaultRunDevCommand = async (...args) => {
|
|
23381
|
-
const { runDevCommand } = await Promise.resolve().then(function () { return require('./dev-
|
|
23433
|
+
const { runDevCommand } = await Promise.resolve().then(function () { return require('./dev-CS5VPiB1.cjs'); }).then(function (n) { return n.dev; });
|
|
23382
23434
|
return runDevCommand(...args);
|
|
23383
23435
|
};
|
|
23384
23436
|
const defaultRunDoctorCommand = async (...args) => {
|
|
23385
|
-
const { runDoctorCommand } = await Promise.resolve().then(function () { return require('./doctor-
|
|
23437
|
+
const { runDoctorCommand } = await Promise.resolve().then(function () { return require('./doctor-B33mYzm-.cjs'); });
|
|
23386
23438
|
return runDoctorCommand(...args);
|
|
23387
23439
|
};
|
|
23388
23440
|
const defaultRunSkillInstallCommand = async (...args) => {
|
|
23389
|
-
const { runSkillInstallCommand } = await Promise.resolve().then(function () { return require('./skill-
|
|
23441
|
+
const { runSkillInstallCommand } = await Promise.resolve().then(function () { return require('./skill-BDswKf84.cjs'); });
|
|
23390
23442
|
return runSkillInstallCommand(...args);
|
|
23391
23443
|
};
|
|
23392
23444
|
const defaultRunRemoteCommand = async (...args) => {
|
|
23393
|
-
const { runRemoteCommand } = await Promise.resolve().then(function () { return require('./remote-
|
|
23445
|
+
const { runRemoteCommand } = await Promise.resolve().then(function () { return require('./remote-Crnu4l7X.cjs'); }).then(function (n) { return n.remote; });
|
|
23394
23446
|
return runRemoteCommand(...args);
|
|
23395
23447
|
};
|
|
23396
23448
|
function resolveStandaloneLogger(options, verbose) {
|
|
@@ -23516,11 +23568,11 @@ function parseNonNegativeInteger(value) {
|
|
|
23516
23568
|
return parsed;
|
|
23517
23569
|
}
|
|
23518
23570
|
const defaultRunGameSearchCommand = async (...args) => {
|
|
23519
|
-
const { runGameSearchCommand } = await Promise.resolve().then(function () { return require('./games-
|
|
23571
|
+
const { runGameSearchCommand } = await Promise.resolve().then(function () { return require('./games-deIaD0qu.cjs'); });
|
|
23520
23572
|
return runGameSearchCommand(...args);
|
|
23521
23573
|
};
|
|
23522
23574
|
const defaultRunConfigureGameBindingsCommand = async (...args) => {
|
|
23523
|
-
const { runConfigureGameBindingsCommand } = await Promise.resolve().then(function () { return require('./game-bindings-
|
|
23575
|
+
const { runConfigureGameBindingsCommand } = await Promise.resolve().then(function () { return require('./game-bindings-CQWdvXfM.cjs'); });
|
|
23524
23576
|
return runConfigureGameBindingsCommand(...args);
|
|
23525
23577
|
};
|
|
23526
23578
|
|
|
@@ -23531,6 +23583,7 @@ exports.DESKTOP_DEVICE_ID = DESKTOP_DEVICE_ID;
|
|
|
23531
23583
|
exports.DEVICE_PRESETS = DEVICE_PRESETS;
|
|
23532
23584
|
exports.DEV_DIAGNOSTICS_PATH = DEV_DIAGNOSTICS_PATH;
|
|
23533
23585
|
exports.DEV_DIAGNOSTICS_SCHEMA_VERSION = DEV_DIAGNOSTICS_SCHEMA_VERSION;
|
|
23586
|
+
exports.DEV_MOBILE_PREVIEW_PATH = DEV_MOBILE_PREVIEW_PATH;
|
|
23534
23587
|
exports.DEV_PRESENTATION_MAX_INTERACTIONS = DEV_PRESENTATION_MAX_INTERACTIONS;
|
|
23535
23588
|
exports.DEV_RESOURCE_PATH = DEV_RESOURCE_PATH;
|
|
23536
23589
|
exports.DEV_SANDBOX_READ_MAX_BYTES = DEV_SANDBOX_READ_MAX_BYTES;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var dev = require('./dev-
|
|
4
|
-
require('./
|
|
5
|
-
require('./index-H9U6-mLY.cjs');
|
|
3
|
+
var dev = require('./dev-CS5VPiB1.cjs');
|
|
4
|
+
require('./index-DpfxAeSH.cjs');
|
|
6
5
|
require('node:module');
|
|
7
6
|
require('readline');
|
|
8
7
|
require('os');
|
|
@@ -24,18 +23,19 @@ require('node:child_process');
|
|
|
24
23
|
require('node:util');
|
|
25
24
|
require('node:readline/promises');
|
|
26
25
|
require('node:timers/promises');
|
|
27
|
-
require('
|
|
26
|
+
require('node:os');
|
|
27
|
+
require('./remote-Crnu4l7X.cjs');
|
|
28
|
+
require('./index.esm-CenYK5Bl.cjs');
|
|
29
|
+
require('./runtime-permission-env-Cj9STUWz.cjs');
|
|
30
|
+
require('./version-Dl0HQVTu.cjs');
|
|
28
31
|
require('./bindings-B9HSKhmy.cjs');
|
|
29
|
-
require('./games-THhcga6y.cjs');
|
|
30
|
-
require('./remote-CU88U8t8.cjs');
|
|
31
|
-
require('./runtime-permission-env-BtxzR-dv.cjs');
|
|
32
|
-
require('./version-COTSItDf.cjs');
|
|
33
32
|
require('node:url');
|
|
34
33
|
require('./_commonjs-dynamic-modules-DUamuDzp.cjs');
|
|
35
34
|
require('inspector');
|
|
36
35
|
require('node:async_hooks');
|
|
37
36
|
require('sharp');
|
|
38
|
-
require('
|
|
37
|
+
require('./game-binding-guide-DMDuw1Pj.cjs');
|
|
38
|
+
require('./games-deIaD0qu.cjs');
|
|
39
39
|
require('node:net');
|
|
40
40
|
require('node:dns/promises');
|
|
41
41
|
require('node:http');
|
|
@@ -51,7 +51,7 @@ require('net');
|
|
|
51
51
|
require('tls');
|
|
52
52
|
require('url');
|
|
53
53
|
require('zlib');
|
|
54
|
-
require('./project-vite-
|
|
54
|
+
require('./project-vite-B7sylnO7.cjs');
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
57
|
* @packageDocumentation
|
|
@@ -7,6 +7,19 @@
|
|
|
7
7
|
* 并在 origin 可以固定且协议模式要求时校验 origin。
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
const POST_READ_METHODS = [
|
|
11
|
+
'post.get',
|
|
12
|
+
'post.comments.list',
|
|
13
|
+
'post.watch',
|
|
14
|
+
];
|
|
15
|
+
const POST_WRITE_METHODS = [
|
|
16
|
+
'post.setLiked',
|
|
17
|
+
'post.setFavorited',
|
|
18
|
+
'post.comments.openEditor',
|
|
19
|
+
'post.comments.delete',
|
|
20
|
+
'post.comments.setLiked',
|
|
21
|
+
];
|
|
22
|
+
|
|
10
23
|
/** 游戏资料内部 wire:业务方法由 SDK 映射为精确资源请求。 */
|
|
11
24
|
const USER_GAMES_GET_OVERVIEW_METHOD = 'user.games.getOverview';
|
|
12
25
|
const USER_DATA_QUERY_METHOD = 'user.data.query';
|
|
@@ -117,6 +130,20 @@ const COMPANION_SHOW_NOTIFICATION_METHOD = 'companion.showNotification';
|
|
|
117
130
|
* 仅表示无需 Manifest 权限声明,不表示绕过参数校验、Host 能力、可信手势或业务策略。
|
|
118
131
|
*/
|
|
119
132
|
[
|
|
133
|
+
...POST_READ_METHODS.map((method) => ({
|
|
134
|
+
method,
|
|
135
|
+
module: 'post',
|
|
136
|
+
capability: method,
|
|
137
|
+
requirement: { kind: 'all', permissions: ['post'] },
|
|
138
|
+
risk: 'medium',
|
|
139
|
+
})),
|
|
140
|
+
...POST_WRITE_METHODS.map((method) => ({
|
|
141
|
+
method,
|
|
142
|
+
module: 'post',
|
|
143
|
+
capability: method,
|
|
144
|
+
requirement: { kind: 'all', permissions: ['post'] },
|
|
145
|
+
risk: 'high',
|
|
146
|
+
})),
|
|
120
147
|
...[GAME_SAVES_LIST_METHOD, GAME_SAVES_SYNC_METHOD, GAME_SAVES_GET_FILE_METHOD, GAME_SAVES_READ_PARSED_DATA_METHOD].map((method) => ({
|
|
121
148
|
method,
|
|
122
149
|
module: 'gameSaves',
|
|
@@ -209,7 +236,13 @@ const COMPANION_SHOW_NOTIFICATION_METHOD = 'companion.showNotification';
|
|
|
209
236
|
requirement: { kind: 'all', permissions: ['share'] },
|
|
210
237
|
risk: 'medium',
|
|
211
238
|
},
|
|
212
|
-
{
|
|
239
|
+
{
|
|
240
|
+
method: SHARE_SCREENSHOT_LONG_METHOD,
|
|
241
|
+
module: 'share',
|
|
242
|
+
capability: SHARE_SCREENSHOT_LONG_METHOD,
|
|
243
|
+
requirement: { kind: 'all', permissions: ['share'] },
|
|
244
|
+
risk: 'medium',
|
|
245
|
+
},
|
|
213
246
|
{
|
|
214
247
|
method: VIEWPORT_GET_WINDOW_INFO_METHOD,
|
|
215
248
|
module: 'viewport',
|
|
@@ -688,6 +721,7 @@ const MINI_PROGRAM_PERMISSION_KEYS = [
|
|
|
688
721
|
'appProtocol',
|
|
689
722
|
'workspaceCards',
|
|
690
723
|
'user_game_data',
|
|
724
|
+
'post',
|
|
691
725
|
];
|
|
692
726
|
const MINI_PROGRAM_PERMISSION_CATALOG = [
|
|
693
727
|
{
|
|
@@ -896,6 +930,19 @@ const MINI_PROGRAM_PERMISSION_CATALOG = [
|
|
|
896
930
|
'平台取数不授予小程序 `network` 权限;已交付的数据副本无法撤回。',
|
|
897
931
|
],
|
|
898
932
|
},
|
|
933
|
+
{
|
|
934
|
+
key: 'post',
|
|
935
|
+
name: '关联帖子',
|
|
936
|
+
description: '读取关联帖子与评论,或以当前用户身份互动并打开社区原生编辑器。',
|
|
937
|
+
access: 'declaration',
|
|
938
|
+
risk: 'high',
|
|
939
|
+
config: {
|
|
940
|
+
read: { type: 'boolean', required: false, default: false, description: '读取帖子、评论和订阅变化。' },
|
|
941
|
+
write: { type: 'boolean', required: false, default: false, description: '点赞、收藏、删除评论及打开社区原生编辑器。' },
|
|
942
|
+
},
|
|
943
|
+
methods: [...POST_READ_METHODS, ...POST_WRITE_METHODS],
|
|
944
|
+
conditions: ['显式声明 read / write,省略时为 false;写操作须由用户明确触发,继续执行社区审核和权限校验。'],
|
|
945
|
+
},
|
|
899
946
|
];
|
|
900
947
|
new Set(MINI_PROGRAM_PERMISSION_KEYS);
|
|
901
948
|
|
|
@@ -982,6 +1029,7 @@ const MANAGED_RUNTIME_PERMISSION_KEYS = new Set(MINI_PROGRAM_PERMISSION_KEYS);
|
|
|
982
1029
|
* - `appProtocol`
|
|
983
1030
|
* - `workspaceCards`
|
|
984
1031
|
* - `user_game_data`
|
|
1032
|
+
* - `post`
|
|
985
1033
|
*
|
|
986
1034
|
* 匹配大小写敏感且按原字符串执行。该 guard 不 trim,因此 `' network '` 返回 `false`;历史权限 key
|
|
987
1035
|
* `network.request` 也返回 `false`,即使同名 capability method 仍是公开 method。消费完整 schema v1 权限快照时
|
|
@@ -1050,6 +1098,7 @@ function isManagedMiniProgramRuntimePermissionKey(key) {
|
|
|
1050
1098
|
* 必须是已发布的精确资源 key(见 `USER_GAME_DATA_RESOURCE_KEYS`),重复或未知项会让整份
|
|
1051
1099
|
* snapshot 失败;返回值只复制校验后的 `resources` 数组,不接受 `*`、前缀或未开放 key。
|
|
1052
1100
|
* 空数组是合法的「未声明任何资源」,它不会授予任何资源级访问。
|
|
1101
|
+
* `post` 必须显式包含 `read`、`write` 两个 boolean,分别控制读取和互动;解析后丢弃其他字段。
|
|
1053
1102
|
* 其余当前权限是无配置项权限,输入 config 可以缺失、为 `null` 或 `{}`,并统一输出 `{}`;
|
|
1054
1103
|
* 非空对象、数组或其他值会使整个 snapshot 无效。Runtime snapshot 必须显式包含
|
|
1055
1104
|
* network 的有效 boolean,即使 Manifest 目录把省略 `useOfficialDomain` 的开发者默认值定义为
|
|
@@ -1062,7 +1111,7 @@ function isManagedMiniProgramRuntimePermissionKey(key) {
|
|
|
1062
1111
|
* `valid: true` 只表示 snapshot 可安全消费,不代表 entry 已启用,更不代表某个 capability 已获
|
|
1063
1112
|
* 授权。Runtime consumer 应先查 {@link MINI_PROGRAM_PROTOCOL_CAPABILITIES} 中目标 method 的
|
|
1064
1113
|
* `requirement`:`kind: 'none'` 不读取权限;`kind: 'all'` 要求列出的每个 canonical entry 都存在
|
|
1065
|
-
* 且 `status === 'enabled'
|
|
1114
|
+
* 且 `status === 'enabled'`;`post` 还要求方法对应的 `config.read` 或 `config.write` 为 true。之后仍需通过 Host capability、可信手势、用户授权、参数和业务
|
|
1066
1115
|
* policy。当前 Runtime 对 `valid: false` 按空权限表 fail closed,受保护 method 会得到
|
|
1067
1116
|
* `PERMISSION_NOT_IN_SNAPSHOT`,而不是沿用输入中的部分 enabled entry。
|
|
1068
1117
|
*
|
|
@@ -1133,6 +1182,14 @@ function parseMiniProgramRuntimePermissions(snapshot) {
|
|
|
1133
1182
|
};
|
|
1134
1183
|
continue;
|
|
1135
1184
|
}
|
|
1185
|
+
if (key === 'post') {
|
|
1186
|
+
const config = rawEntry.config;
|
|
1187
|
+
if (!isRecord$3(config) || typeof config.read !== 'boolean' || typeof config.write !== 'boolean') {
|
|
1188
|
+
return { valid: false, permissions: {} };
|
|
1189
|
+
}
|
|
1190
|
+
permissions[key] = { key, status: rawEntry.status, config: { read: config.read, write: config.write } };
|
|
1191
|
+
continue;
|
|
1192
|
+
}
|
|
1136
1193
|
if (key === 'user_game_data') {
|
|
1137
1194
|
const config = rawEntry.config;
|
|
1138
1195
|
if (!isRecord$3(config))
|
|
@@ -1278,7 +1335,7 @@ function composeLocalDevRuntimePermissions(options) {
|
|
|
1278
1335
|
*
|
|
1279
1336
|
* @param key - 权限 key。
|
|
1280
1337
|
* @param declarations - 调用方已校验的本地声明。
|
|
1281
|
-
* @returns 与权限目录 schema
|
|
1338
|
+
* @returns 与权限目录 schema 对齐的布尔配置和资源清单。
|
|
1282
1339
|
*
|
|
1283
1340
|
* @remarks
|
|
1284
1341
|
* 目前只有 `user_game_data` 的 `config.resources` 是 `resource-map`。未开放、非字符串或重复的
|
|
@@ -1291,6 +1348,10 @@ function resolveDeclarationConfig(key, declarations) {
|
|
|
1291
1348
|
return {};
|
|
1292
1349
|
const config = {};
|
|
1293
1350
|
for (const [field, spec] of Object.entries(definition.config)) {
|
|
1351
|
+
if (key === 'post' && spec.type === 'boolean') {
|
|
1352
|
+
config[field] = declarations.post?.[field] === true;
|
|
1353
|
+
continue;
|
|
1354
|
+
}
|
|
1294
1355
|
if (spec.type !== 'resource-map')
|
|
1295
1356
|
continue;
|
|
1296
1357
|
config[field] = field === 'resources' ? parseUserGameDataResourceDeclarations(declarations[key]?.resources) : {};
|
|
@@ -7747,6 +7808,14 @@ function serializeMiniProgramDevelopmentSnapshot(snapshot) {
|
|
|
7747
7808
|
declared_permissions[key] = { enabled: declaration.enabled, useOfficialDomain: declaration.useOfficialDomain === true };
|
|
7748
7809
|
continue;
|
|
7749
7810
|
}
|
|
7811
|
+
if (key === 'post') {
|
|
7812
|
+
for (const field of ['read', 'write']) {
|
|
7813
|
+
if (declaration[field] !== undefined && typeof declaration[field] !== 'boolean')
|
|
7814
|
+
throw new Error('开发权限声明无效');
|
|
7815
|
+
}
|
|
7816
|
+
declared_permissions.post = { enabled: declaration.enabled, read: declaration.read === true, write: declaration.write === true };
|
|
7817
|
+
continue;
|
|
7818
|
+
}
|
|
7750
7819
|
// `user_game_data` 的声明必须带精确资源清单;保留字段存在性,使规范化序列化可往返。
|
|
7751
7820
|
if (key === 'user_game_data') {
|
|
7752
7821
|
declared_permissions[key] = {
|
|
@@ -3,7 +3,7 @@
|
|
|
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 index = require('./index-
|
|
6
|
+
var index = require('./index-DpfxAeSH.cjs');
|
|
7
7
|
var browser = require('./browser-RAy8e8cV.cjs');
|
|
8
8
|
require('node:module');
|
|
9
9
|
require('readline');
|
|
@@ -4,7 +4,7 @@ var fs = require('node:fs/promises');
|
|
|
4
4
|
var node_module = require('node:module');
|
|
5
5
|
var path = require('node:path');
|
|
6
6
|
var node_url = require('node:url');
|
|
7
|
-
var index = require('./index-
|
|
7
|
+
var index = require('./index-DpfxAeSH.cjs');
|
|
8
8
|
|
|
9
9
|
async function loadProjectVite(projectRoot) {
|
|
10
10
|
const projectRequire = node_module.createRequire(path.join(projectRoot, 'package.json'));
|