Export standalone signer
mp_sandbox_exportExports a self-contained Node.js signing script from a WeChat Mini Program sandbox by tracing signing-function dependencies and generating a minimal .mjs file independent of wx-sandbox/app-service.js.
Instructions
从沙箱导出独立 Node.js 签名脚本。追踪签名函数的依赖模块,提取最小子集,生成不依赖 wx-sandbox / app-service.js 的自包含 .mjs 文件。流程:加载 bundle → 运行 verify 验证签名能跑通 → 追踪依赖 → 生成独立脚本。需要先 mp_analyze 解包 + mp_sandbox_run 确认签名函数路径。
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"appid": "<appid>",
"entry": "<entry>"
},
"name": "mp_sandbox_export"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fn | No | 要导出的函数名 (如 'sign'),不填则 export default 整个模块 | |
| appid | Yes | 小程序 appid | |
| entry | Yes | 签名模块路径 (如 'npm/some-sdk/index.js') | |
| output | No | 输出文件路径 (默认 static/out/<appid>/signer.mjs) | |
| verify | No | 验证代码 (如 "requireMod('npm/sdk').sign({ts:1})"),确保签名能跑通 | |
| storage | No | 预设 wx storage JSON |