@heybox/hb-sdk 0.9.8 → 0.9.9-alpha.1
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 +13 -0
- package/README.md +2 -0
- package/dist/cli-chunks/bindings-B9HSKhmy.cjs +84 -0
- package/dist/cli-chunks/{build-BuYvQeZO.cjs → build-vZ5iT2JO.cjs} +6 -5
- package/dist/cli-chunks/{create-4XrYdjC0.cjs → create-DJseFABS.cjs} +2 -2
- package/dist/cli-chunks/{dev-BIxJPUFK.cjs → dev-CsuAVpLX.cjs} +61 -14
- package/dist/cli-chunks/{doctor-XhNbYYVj.cjs → doctor-BYzYg-oP.cjs} +1 -1
- package/dist/cli-chunks/game-binding-guide-BfKQ4e83.cjs +273 -0
- package/dist/cli-chunks/game-bindings-DWOIBCax.cjs +51 -0
- package/dist/cli-chunks/{games-Cd9fgl6N.cjs → games-DmPaqaDd.cjs} +2 -2
- package/dist/cli-chunks/{index-Cr8tP0XZ.cjs → index-D5rcGk_z.cjs} +55 -24
- package/dist/cli-chunks/{index-aGcX-ULf.cjs → index-DPEhBPfc.cjs} +1 -1
- package/dist/cli-chunks/{index.esm-CvMA_ppV.cjs → index.esm-CenYK5Bl.cjs} +73 -3
- package/dist/cli-chunks/{index.esm-UetP1FSl.cjs → index.esm-DYWovNyE.cjs} +13 -10
- package/dist/cli-chunks/{login-Dd55F6qr.cjs → login-o1LQxi8P.cjs} +1 -1
- package/dist/cli-chunks/{project-vite-quIPuubf.cjs → project-vite-CGIy1XaL.cjs} +1 -1
- package/dist/cli-chunks/{remote-BfI4Ag6B.cjs → remote-BQ3O-aiB.cjs} +131 -133
- package/dist/cli-chunks/{runtime-permission-env-C1e5q2m5.cjs → runtime-permission-env-soFtqTxP.cjs} +27 -87
- package/dist/cli-chunks/{skill-DY7-DQPL.cjs → skill-BHighcnl.cjs} +2 -2
- package/dist/cli-chunks/{version-D4jIw125.cjs → version-CAh_EBAH.cjs} +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/devtools/browser-dev-host/assets/browser-dev-host-D9CVFRHE.js +224 -0
- package/dist/devtools/browser-dev-host/assets/desktop-app-launch-FZ3iQQs-.js +13 -0
- package/dist/devtools/browser-dev-host/assets/index-CVzVitcL.js +567 -0
- package/dist/devtools/browser-dev-host/assets/index-D0XGMYIr.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 +65 -2
- package/dist/miniapp-publish.esm.js +64 -3
- package/dist/protocol.cjs.js +51 -5
- package/dist/protocol.esm.js +51 -5
- package/dist/templates/vanilla-vite-js/README.md.ejs +1 -1
- package/dist/vite.cjs.js +60 -3
- package/dist/vite.esm.js +60 -3
- package/package.json +6 -6
- package/skill/SKILL.md +3 -2
- package/skill/skill.json +5 -5
- package/types/index.d.ts +140 -4
- package/types/miniapp-publish/index.d.ts +14 -3
- package/dist/devtools/browser-dev-host/assets/browser-dev-host-x4xuSDs_.js +0 -221
- package/dist/devtools/browser-dev-host/assets/desktop-app-launch-C1gCwbuV.js +0 -13
- package/dist/devtools/browser-dev-host/assets/index-Bk5RxHO3.css +0 -1
- package/dist/devtools/browser-dev-host/assets/index-C6l2jsZT.js +0 -567
|
@@ -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-D5rcGk_z.cjs');
|
|
7
7
|
require('node:module');
|
|
8
8
|
require('readline');
|
|
9
9
|
require('os');
|
|
@@ -136,7 +136,7 @@ function normalizeGame(value) {
|
|
|
136
136
|
!game.name.trim()) {
|
|
137
137
|
throw new Error('游戏搜索返回无效 appid 或名称');
|
|
138
138
|
}
|
|
139
|
-
const icon =
|
|
139
|
+
const icon = game.image;
|
|
140
140
|
return { appid, name: game.name, ...(typeof game.name_en === 'string' && game.name_en.trim() ? { name_en: game.name_en } : {}), ...(typeof icon === 'string' && icon ? { icon_url: icon } : {}) };
|
|
141
141
|
}
|
|
142
142
|
|
|
@@ -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-D5rcGk_z.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-D5rcGk_z.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-D5rcGk_z.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-D5rcGk_z.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-D5rcGk_z.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-DPEhBPfc.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({
|
|
@@ -21935,7 +21935,7 @@ function installDevPreviewCommands(dev) {
|
|
|
21935
21935
|
}
|
|
21936
21936
|
|
|
21937
21937
|
const CLI_VERSION_PLACEHOLDER = ['__HB', 'SDK', 'CLI', 'VERSION__'].join('_');
|
|
21938
|
-
const BUILT_CLI_VERSION = '0.9.
|
|
21938
|
+
const BUILT_CLI_VERSION = '0.9.9-alpha.1';
|
|
21939
21939
|
const PACKAGE_JSON_CANDIDATES$1 = [
|
|
21940
21940
|
path.resolve(__dirname, '..', '..', 'package.json'),
|
|
21941
21941
|
path.resolve(__dirname, '..', 'package.json'),
|
|
@@ -22986,6 +22986,7 @@ function createCliProgram(overrides = {}) {
|
|
|
22986
22986
|
runDoctorCommand: defaultRunDoctorCommand,
|
|
22987
22987
|
runRemoteCommand: defaultRunRemoteCommand,
|
|
22988
22988
|
runGameSearchCommand: defaultRunGameSearchCommand,
|
|
22989
|
+
runConfigureGameBindingsCommand: defaultRunConfigureGameBindingsCommand,
|
|
22989
22990
|
runSkillInstallCommand: defaultRunSkillInstallCommand,
|
|
22990
22991
|
...overrides,
|
|
22991
22992
|
};
|
|
@@ -23034,7 +23035,10 @@ function createCliProgram(overrides = {}) {
|
|
|
23034
23035
|
.command('dev')
|
|
23035
23036
|
.description('启动当前小程序项目的 Vite 开发服务器和浏览器调试页服务')
|
|
23036
23037
|
.addOption(new Option('--browser <browser>', '预览使用的本机浏览器').choices(['chrome', 'edge']))
|
|
23037
|
-
.addOption(new Option('--browser-mode <mode>', '默认 auto:复用项目独立浏览器,否则请求日常浏览器授权后回退;isolated 使用独立环境').choices([
|
|
23038
|
+
.addOption(new Option('--browser-mode <mode>', '默认 auto:复用项目独立浏览器,否则请求日常浏览器授权后回退;isolated 使用独立环境').choices([
|
|
23039
|
+
'auto',
|
|
23040
|
+
'isolated',
|
|
23041
|
+
]))
|
|
23038
23042
|
.option('--port <port>', '小程序开发服务器端口', parsePositivePort)
|
|
23039
23043
|
.option('--browser-dev-host-port <port>', '浏览器调试页服务端口', parsePositivePort)
|
|
23040
23044
|
.option('--no-open', '不自动打开浏览器调试页')
|
|
@@ -23047,8 +23051,8 @@ function createCliProgram(overrides = {}) {
|
|
|
23047
23051
|
applyDevServiceTag(options?.serviceTag);
|
|
23048
23052
|
await handlers.runDevCommand(options, { logger });
|
|
23049
23053
|
}, handlers.printUpdateReminder, resolveLogger));
|
|
23050
|
-
installDevToolCommands(program.commands.find(command => command.name() === 'dev'));
|
|
23051
|
-
installDevPreviewCommands(program.commands.find(command => command.name() === 'dev'));
|
|
23054
|
+
installDevToolCommands(program.commands.find((command) => command.name() === 'dev'));
|
|
23055
|
+
installDevPreviewCommands(program.commands.find((command) => command.name() === 'dev'));
|
|
23052
23056
|
addVerboseOption(program.command('build').description('构建当前小程序项目')
|
|
23053
23057
|
.option('--env <name>', '加载项目根下 .env.<name> 预设并作为 Vite mode')
|
|
23054
23058
|
// 根程序开启位置化解析后,子命令必须自己声明同名选项才能拿到它;这里声明但不展示,
|
|
@@ -23124,12 +23128,13 @@ function addRemotePublicOptions(command) {
|
|
|
23124
23128
|
function installRemoteCommands(program, handlers, resolveLogger) {
|
|
23125
23129
|
const remote = addRemotePublicOptions(program.command('remote').description('管理当前项目绑定的远程 Heybox 工坊小程序'));
|
|
23126
23130
|
const games = addVerboseOption(remote.command('games').description('查询平台游戏信息'));
|
|
23127
|
-
addVerboseOption(games
|
|
23131
|
+
addVerboseOption(games
|
|
23132
|
+
.command('search')
|
|
23133
|
+
.description('按名称查找游戏 appid,不修改绑定')
|
|
23128
23134
|
.argument('<query>', '中文或英文游戏名')
|
|
23129
23135
|
.option('--offset <offset>', '结果偏移量,0–10000', '0')
|
|
23130
23136
|
.option('--limit <limit>', '每页数量,1–20', '10')
|
|
23131
|
-
.option('--json', '输出 JSON'))
|
|
23132
|
-
.action(async (query, _options, command) => {
|
|
23137
|
+
.option('--json', '输出 JSON')).action(async (query, _options, command) => {
|
|
23133
23138
|
const options = readCommandOptionsWithAncestors(command);
|
|
23134
23139
|
await handlers.runGameSearchCommand(query, {
|
|
23135
23140
|
offset: readStringOption(options.offset),
|
|
@@ -23137,6 +23142,16 @@ function installRemoteCommands(program, handlers, resolveLogger) {
|
|
|
23137
23142
|
json: Boolean(options.json),
|
|
23138
23143
|
});
|
|
23139
23144
|
});
|
|
23145
|
+
addVerboseOption(games.command('configure').description('在本地选择关联游戏;重新构建后随版本审核')
|
|
23146
|
+
.option('--app-id <appid>', '关联游戏 appid,先搜索并核对游戏,可重复', collectRepeatableOption, [])
|
|
23147
|
+
.option('--clear', '清空本地关联游戏')
|
|
23148
|
+
.option('--json', '输出 JSON;须显式传配置选项'))
|
|
23149
|
+
.action(async (_options, command) => {
|
|
23150
|
+
const options = readCommandOptionsWithAncestors(command);
|
|
23151
|
+
await handlers.runConfigureGameBindingsCommand({
|
|
23152
|
+
appIds: readStringListOption(options.appId), clear: Boolean(options.clear), json: Boolean(options.json),
|
|
23153
|
+
});
|
|
23154
|
+
});
|
|
23140
23155
|
addRemotePublicOptions(remote.command('access').description('查看当前账号的小程序工坊访问权限')).action(createRemoteAction(handlers, resolveLogger, 'access'));
|
|
23141
23156
|
const entity = addRemotePublicOptions(remote.command('entity').description('查看和切换当前开发者主体'));
|
|
23142
23157
|
addRemotePublicOptions(entity.command('list').description('列出当前账号可切换的开发者主体')).action(createRemoteAction(handlers, resolveLogger, 'entity:list'));
|
|
@@ -23164,9 +23179,20 @@ function installRemoteCommands(program, handlers, resolveLogger) {
|
|
|
23164
23179
|
miniProgramId: readStringArgument(miniProgramId, 'mini-program-id'),
|
|
23165
23180
|
})));
|
|
23166
23181
|
addRemotePublicOptions(remote.command('info').description('查看当前绑定的远程工坊小程序详情')).action(createRemoteAction(handlers, resolveLogger, 'info'));
|
|
23182
|
+
const post = addRemotePublicOptions(remote.command('post').description('管理小程序关联帖子;每个小程序最多关联一篇自己的公开帖子'));
|
|
23183
|
+
addRemotePublicOptions(post.command('get').description('查看当前关联帖子')).action(createRemoteAction(handlers, resolveLogger, 'post:get'));
|
|
23184
|
+
addRemotePublicOptions(post.command('preview').description('校验并预览待关联的帖子').argument('<post-id>', '帖子 ID')).action(createRemoteAction(handlers, resolveLogger, 'post:preview', (_command, postId) => ({
|
|
23185
|
+
postId: readStringArgument(postId, 'post-id'),
|
|
23186
|
+
})));
|
|
23187
|
+
addRemotePublicOptions(post.command('bind').description('关联或更换帖子').argument('<post-id>', '帖子 ID')).action(createRemoteAction(handlers, resolveLogger, 'post:bind', (_command, postId) => ({
|
|
23188
|
+
postId: readStringArgument(postId, 'post-id'),
|
|
23189
|
+
})));
|
|
23190
|
+
addRemotePublicOptions(post.command('unbind').description('解除当前帖子关联')).action(createRemoteAction(handlers, resolveLogger, 'post:unbind'));
|
|
23167
23191
|
const permission = addRemotePublicOptions(remote.command('permission').description('申请平台权限并查看审核状态'));
|
|
23168
23192
|
addRemotePublicOptions(permission.command('list').description('查看平台权限及最近申请状态')).action(createRemoteAction(handlers, resolveLogger, 'permission:list'));
|
|
23169
|
-
addRemotePublicOptions(permission
|
|
23193
|
+
addRemotePublicOptions(permission
|
|
23194
|
+
.command('apply')
|
|
23195
|
+
.description('提交平台权限申请')
|
|
23170
23196
|
.argument('<key>', 'network、companion 或 appProtocol;user_game_data 是声明型权限,无需申请')
|
|
23171
23197
|
.requiredOption('--reason <text>', '申请理由,不超过 500 字')
|
|
23172
23198
|
.option('--domains <domains>', 'network 访问域名,多个用逗号分隔')).action(createRemoteAction(handlers, resolveLogger, 'permission:apply', (command, key) => {
|
|
@@ -23347,39 +23373,39 @@ function createCommandLoggerResolver(options) {
|
|
|
23347
23373
|
};
|
|
23348
23374
|
}
|
|
23349
23375
|
const defaultClearLoginStatus = async (...args) => {
|
|
23350
|
-
const { clearLoginStatus } = await Promise.resolve().then(function () { return require('./login-
|
|
23376
|
+
const { clearLoginStatus } = await Promise.resolve().then(function () { return require('./login-o1LQxi8P.cjs'); });
|
|
23351
23377
|
return clearLoginStatus(...args);
|
|
23352
23378
|
};
|
|
23353
23379
|
const defaultLoginToHeybox = async (...args) => {
|
|
23354
|
-
const { loginToHeybox } = await Promise.resolve().then(function () { return require('./login-
|
|
23380
|
+
const { loginToHeybox } = await Promise.resolve().then(function () { return require('./login-o1LQxi8P.cjs'); });
|
|
23355
23381
|
return loginToHeybox(...args);
|
|
23356
23382
|
};
|
|
23357
23383
|
const defaultPrintLoginStatus = async (...args) => {
|
|
23358
|
-
const { printLoginStatus } = await Promise.resolve().then(function () { return require('./login-
|
|
23384
|
+
const { printLoginStatus } = await Promise.resolve().then(function () { return require('./login-o1LQxi8P.cjs'); });
|
|
23359
23385
|
return printLoginStatus(...args);
|
|
23360
23386
|
};
|
|
23361
23387
|
const defaultRunBuildCommand = async (...args) => {
|
|
23362
|
-
const { runBuildCommand } = await Promise.resolve().then(function () { return require('./build-
|
|
23388
|
+
const { runBuildCommand } = await Promise.resolve().then(function () { return require('./build-vZ5iT2JO.cjs'); });
|
|
23363
23389
|
return runBuildCommand(...args);
|
|
23364
23390
|
};
|
|
23365
23391
|
const defaultRunCreateCommand = async (...args) => {
|
|
23366
|
-
const { runCreateCommand } = await Promise.resolve().then(function () { return require('./create-
|
|
23392
|
+
const { runCreateCommand } = await Promise.resolve().then(function () { return require('./create-DJseFABS.cjs'); });
|
|
23367
23393
|
return runCreateCommand(...args);
|
|
23368
23394
|
};
|
|
23369
23395
|
const defaultRunDevCommand = async (...args) => {
|
|
23370
|
-
const { runDevCommand } = await Promise.resolve().then(function () { return require('./dev-
|
|
23396
|
+
const { runDevCommand } = await Promise.resolve().then(function () { return require('./dev-CsuAVpLX.cjs'); }).then(function (n) { return n.dev; });
|
|
23371
23397
|
return runDevCommand(...args);
|
|
23372
23398
|
};
|
|
23373
23399
|
const defaultRunDoctorCommand = async (...args) => {
|
|
23374
|
-
const { runDoctorCommand } = await Promise.resolve().then(function () { return require('./doctor-
|
|
23400
|
+
const { runDoctorCommand } = await Promise.resolve().then(function () { return require('./doctor-BYzYg-oP.cjs'); });
|
|
23375
23401
|
return runDoctorCommand(...args);
|
|
23376
23402
|
};
|
|
23377
23403
|
const defaultRunSkillInstallCommand = async (...args) => {
|
|
23378
|
-
const { runSkillInstallCommand } = await Promise.resolve().then(function () { return require('./skill-
|
|
23404
|
+
const { runSkillInstallCommand } = await Promise.resolve().then(function () { return require('./skill-BHighcnl.cjs'); });
|
|
23379
23405
|
return runSkillInstallCommand(...args);
|
|
23380
23406
|
};
|
|
23381
23407
|
const defaultRunRemoteCommand = async (...args) => {
|
|
23382
|
-
const { runRemoteCommand } = await Promise.resolve().then(function () { return require('./remote-
|
|
23408
|
+
const { runRemoteCommand } = await Promise.resolve().then(function () { return require('./remote-BQ3O-aiB.cjs'); }).then(function (n) { return n.remote; });
|
|
23383
23409
|
return runRemoteCommand(...args);
|
|
23384
23410
|
};
|
|
23385
23411
|
function resolveStandaloneLogger(options, verbose) {
|
|
@@ -23505,11 +23531,16 @@ function parseNonNegativeInteger(value) {
|
|
|
23505
23531
|
return parsed;
|
|
23506
23532
|
}
|
|
23507
23533
|
const defaultRunGameSearchCommand = async (...args) => {
|
|
23508
|
-
const { runGameSearchCommand } = await Promise.resolve().then(function () { return require('./games-
|
|
23534
|
+
const { runGameSearchCommand } = await Promise.resolve().then(function () { return require('./games-DmPaqaDd.cjs'); });
|
|
23509
23535
|
return runGameSearchCommand(...args);
|
|
23510
23536
|
};
|
|
23537
|
+
const defaultRunConfigureGameBindingsCommand = async (...args) => {
|
|
23538
|
+
const { runConfigureGameBindingsCommand } = await Promise.resolve().then(function () { return require('./game-bindings-DWOIBCax.cjs'); });
|
|
23539
|
+
return runConfigureGameBindingsCommand(...args);
|
|
23540
|
+
};
|
|
23511
23541
|
|
|
23512
23542
|
exports.CliError = CliError;
|
|
23543
|
+
exports.CommanderError = CommanderError;
|
|
23513
23544
|
exports.DEPLOY_LOCKED_MESSAGE = DEPLOY_LOCKED_MESSAGE;
|
|
23514
23545
|
exports.DESKTOP_DEVICE_ID = DESKTOP_DEVICE_ID;
|
|
23515
23546
|
exports.DEVICE_PRESETS = DEVICE_PRESETS;
|
|
@@ -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] = {
|
|
@@ -7961,6 +8030,7 @@ const definitions = {
|
|
|
7961
8030
|
exports.GAME_DATA_RESOURCE_CATALOG = GAME_DATA_RESOURCE_CATALOG;
|
|
7962
8031
|
exports.MINI_PROGRAM_PERMISSION_CATALOG = MINI_PROGRAM_PERMISSION_CATALOG;
|
|
7963
8032
|
exports.MINI_PROGRAM_PERMISSION_KEYS = MINI_PROGRAM_PERMISSION_KEYS;
|
|
8033
|
+
exports.USER_GAME_DATA_GAMES = USER_GAME_DATA_GAMES;
|
|
7964
8034
|
exports.USER_GAME_DATA_GAME_IDS = USER_GAME_DATA_GAME_IDS;
|
|
7965
8035
|
exports.USER_GAME_DATA_RESOURCE_FAMILIES = USER_GAME_DATA_RESOURCE_FAMILIES;
|
|
7966
8036
|
exports.USER_GAME_DATA_RESOURCE_KEYS = USER_GAME_DATA_RESOURCE_KEYS;
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var dev = require('./dev-
|
|
4
|
-
require('
|
|
5
|
-
require('
|
|
6
|
-
require('./remote-BfI4Ag6B.cjs');
|
|
7
|
-
require('./index.esm-CvMA_ppV.cjs');
|
|
8
|
-
require('./runtime-permission-env-C1e5q2m5.cjs');
|
|
9
|
-
require('node:fs');
|
|
10
|
-
require('./version-D4jIw125.cjs');
|
|
11
|
-
require('./index-Cr8tP0XZ.cjs');
|
|
3
|
+
var dev = require('./dev-CsuAVpLX.cjs');
|
|
4
|
+
require('./game-binding-guide-BfKQ4e83.cjs');
|
|
5
|
+
require('./index-D5rcGk_z.cjs');
|
|
12
6
|
require('node:module');
|
|
13
7
|
require('readline');
|
|
14
8
|
require('os');
|
|
@@ -19,14 +13,23 @@ require('stream');
|
|
|
19
13
|
require('buffer');
|
|
20
14
|
require('util');
|
|
21
15
|
require('node:crypto');
|
|
16
|
+
require('node:path');
|
|
22
17
|
require('path');
|
|
23
18
|
require('fs');
|
|
24
19
|
require('constants');
|
|
20
|
+
require('node:fs');
|
|
21
|
+
require('node:fs/promises');
|
|
25
22
|
require('node:zlib');
|
|
26
23
|
require('node:child_process');
|
|
27
24
|
require('node:util');
|
|
28
25
|
require('node:readline/promises');
|
|
29
26
|
require('node:timers/promises');
|
|
27
|
+
require('./index.esm-CenYK5Bl.cjs');
|
|
28
|
+
require('./bindings-B9HSKhmy.cjs');
|
|
29
|
+
require('./games-DmPaqaDd.cjs');
|
|
30
|
+
require('./remote-BQ3O-aiB.cjs');
|
|
31
|
+
require('./runtime-permission-env-soFtqTxP.cjs');
|
|
32
|
+
require('./version-CAh_EBAH.cjs');
|
|
30
33
|
require('node:url');
|
|
31
34
|
require('./_commonjs-dynamic-modules-DUamuDzp.cjs');
|
|
32
35
|
require('inspector');
|
|
@@ -48,7 +51,7 @@ require('net');
|
|
|
48
51
|
require('tls');
|
|
49
52
|
require('url');
|
|
50
53
|
require('zlib');
|
|
51
|
-
require('./project-vite-
|
|
54
|
+
require('./project-vite-CGIy1XaL.cjs');
|
|
52
55
|
|
|
53
56
|
/**
|
|
54
57
|
* @packageDocumentation
|
|
@@ -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-D5rcGk_z.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-D5rcGk_z.cjs');
|
|
8
8
|
|
|
9
9
|
async function loadProjectVite(projectRoot) {
|
|
10
10
|
const projectRequire = node_module.createRequire(path.join(projectRoot, 'package.json'));
|