修改
This commit is contained in:
parent
240ce16eba
commit
958ad500de
@ -0,0 +1,25 @@
|
||||
发表 Issue 前请仔细阅读以下内容:
|
||||
|
||||
1. 如果你是要反馈 bug, 请按以下`模板`书写 Issue;
|
||||
2. 如果你遇到的是 Node.js 使用问题, 请尽可能依赖搜索引擎解决问题;
|
||||
3. 遇到包依赖问题,请联系对应项目;
|
||||
4. 任何对某类小程序包的适配问题都应提供 wxapkg 程序包,否则直接 Close 处理;
|
||||
5. 提交前请确认 wxapkg 程序包版本不小于 v0.6vv_20180111_fbi (直接用文本编辑器打开 wxapkg包搜索 v0.6vv 或 v0.5vv 即可查到,注意版本大小主要比较的是日期), 旧版本不提供支持, 相关 Issue 直接 Close 处理;
|
||||
6. 直接分包和直接处理含插件的包两个功能暂不支持, 请勿重复发表 Issue, 新样例可在已存在的 Issue 下提出;
|
||||
7. 请不要在其他 Issue 下发表与该 Issue 无关的回复, 否则将有可能被删除。
|
||||
|
||||
模板内容如下:
|
||||
|
||||
程序执行命令(可选):
|
||||
|
||||
程序执行错误信息(如果反馈是抛出异常的错误,必填):
|
||||
|
||||
```
|
||||
复制到这里
|
||||
```
|
||||
|
||||
程序结果错误信息(如果反馈不是抛出异常的错误, 必填, 请尽可能详细描述):
|
||||
|
||||
程序包(你所要解压的程序包地址, 可为网盘链接, 也可直接上传[上传前请先打包]. 必填):
|
||||
|
||||
其他附加内容:
|
||||
67
README.md
67
README.md
@ -1,52 +1,46 @@
|
||||
|
||||
# wxappUnpacker
|
||||
|
||||
  
|
||||
|
||||
> Forked from https://github.com/system-cpu/wxappUnpacker
|
||||
|
||||
> Wechat App(微信小程序, .wxapkg)解包及相关文件(.wxss, .json, .wxs, .wxml)还原工具
|
||||
|
||||
### wxapkg 包的获取
|
||||
|
||||
Android 手机最近使用过的微信小程序所对应的 wxapkg 包文件都存储在特定文件夹下,可通过以下命令查看:
|
||||
|
||||
adb pull /data/data/com.tencent.mm/MicroMsg/{User}/appbrand/pkg
|
||||
|
||||
其中`{User}` 为当前用户的用户名,类似于 `2bc**************b65`。
|
||||
|
||||
# 安装
|
||||
```
|
||||
npm install
|
||||
```
|
||||
|
||||
## 依赖
|
||||
# 安装依赖
|
||||
```
|
||||
npm install esprima
|
||||
|
||||
npm install css-tree
|
||||
|
||||
npm install cssbeautify
|
||||
|
||||
npm install vm2
|
||||
|
||||
npm install uglify-es
|
||||
|
||||
npm install js-beautify
|
||||
|
||||
这些 node.js 程序除了自带的 API 外还依赖于以下包:
|
||||
[cssbeautify](https://github.com/senchalabs/cssbeautify)、[CSSTree](https://github.com/csstree/csstree)、[VM2](https://github.com/patriksimek/vm2)、[Esprima](https://github.com/jquery/esprima)、[UglifyES](https://github.com/mishoo/UglifyJS2/tree/harmony)、[js-beautify](https://github.com/beautify-web/js-beautify)
|
||||
|
||||
您需要安装这些包才能正确执行这些程序,为了做到这一点,您可以执行`npm install`;另外如需全局安装这些包可执行以下命令:
|
||||
```
|
||||
# 使用
|
||||
|
||||
npm install esprima -g
|
||||
npm install css-tree -g
|
||||
npm install cssbeautify -g
|
||||
npm install vm2 -g
|
||||
npm install uglify-es -g
|
||||
npm install js-beautify -g
|
||||
npm install escodegen -g
|
||||
Android 手机最近使用过的微信小程序所对应的 wxapkg 包文件都存储在特定文件夹下,可通过以下命令查看:
|
||||
|
||||
此外,这些 node.js 程序之间也有一定的依赖关系,比如他们都依赖于 wuLib.js 。
|
||||
adb pull /data/data/com.tencent.mm/MicroMsg/{User}/appbrand/pkg
|
||||
|
||||
### 使用
|
||||
其中`{User}` 为当前用户的用户名,类似于 `2bc**************b65`。
|
||||
|
||||
node wuWxapkg.js .wxapkg 的文件路径 // 例子 D:/node/wxappUnpacker-master._1123949441_321.wxapkg
|
||||
|
||||
# 分包功能
|
||||
|
||||
当检测到 wxapkg 为子包时, 添加-s 参数指定主包源码路径即可自动将子包的 wxss,wxml,js 解析到主包的对应位置下. 完整流程大致如下:
|
||||
1. 获取主包和若干子包
|
||||
2. 解包主包 `./bingo.sh testpkg/master-xxx.wxapkg`
|
||||
3. 解包子包 `./bingo.sh testpkg/sub-1-xxx.wxapkg -s=../master-xxx`
|
||||
2. 解包主包
|
||||
- windows系统使用: `./bingo.bat testpkg/master-xxx.wxapkg`
|
||||
- Linux系统使用: `./bingo.sh testpkg/master-xxx.wxapkg`
|
||||
3. 解包子包
|
||||
- windows系统使用: `./bingo.bat testpkg/sub-1-xxx.wxapkg -s=../master-xxx`
|
||||
- Linux系统使用: `./bingo.sh testpkg/sub-1-xxx.wxapkg -s=../master-xxx`
|
||||
|
||||
觉得麻烦?可以使用[自助解包客户端](#自助解包客户端)
|
||||
|
||||
TIP
|
||||
> -s 参数可为相对路径或绝对路径, 推荐使用绝对路径, 因为相对路径的起点不是当前目录 而是子包解包后的目录
|
||||
@ -60,12 +54,3 @@ TIP
|
||||
│ └── master-xxx # ../master-xxx 就是这个目录
|
||||
│ ├── app.json
|
||||
```
|
||||
# 本人代搭建流量主小程序
|
||||
```
|
||||
技术微信 : li1664771111
|
||||
```
|
||||
|
||||
# 支持
|
||||
```
|
||||
Star 一个吧
|
||||
```
|
||||
|
||||
BIN
geek_road.jpg
Normal file
BIN
geek_road.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 27 KiB |
10
wuLib.js
10
wuLib.js
@ -1,5 +1,7 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const os = require('os');
|
||||
let platform = os.platform();
|
||||
|
||||
class CntEvent {
|
||||
constructor() {
|
||||
@ -83,7 +85,13 @@ function mkdirs(dir, cb) {
|
||||
function save(name, content) {
|
||||
ioEvent.encount();
|
||||
mkdirs(path.dirname(name), () => ioLimit.runWithCb(fs.writeFile.bind(fs), name, content, err => {
|
||||
if (err) throw Error("Save file error: " + err);
|
||||
if (err) {
|
||||
if (platform.indexOf('win') != -1) {
|
||||
console.log('Save file error: ' + err);
|
||||
} else {
|
||||
throw Error('Save file error: ' + err);
|
||||
}
|
||||
}
|
||||
ioEvent.decount();
|
||||
}));
|
||||
}
|
||||
|
||||
47
wuWxss.js
47
wuWxss.js
@ -23,6 +23,7 @@ function doWxss(dir, cb, mainDir, nowDir) {
|
||||
for (let i = 0; i < 300; i++) GwxCfg.prototype["$gwx" + i] = GwxCfg.prototype.$gwx;
|
||||
let runList = {}, pureData = {}, result = {}, actualPure = {}, importCnt = {}, frameName = "", onlyTest = true,
|
||||
blockCss = [];//custom block css file which won't be imported by others.(no extension name)
|
||||
let commonStyle = {};//some global css
|
||||
function cssRebuild(data) {//need to bind this as {cssFile:__name__} before call
|
||||
let cssFile;
|
||||
|
||||
@ -32,8 +33,10 @@ function doWxss(dir, cb, mainDir, nowDir) {
|
||||
else ++importCnt[id];
|
||||
}
|
||||
|
||||
if (typeof data === "number") return addStat(data);
|
||||
for (let content of data) if (typeof content === "object" && content[0] == 2) addStat(content[1]);
|
||||
if (typeof data === "number") return addStat(data);
|
||||
if (data != undefined) {
|
||||
for (let content of data) if (typeof content === "object" && content[0] == 2) addStat(content[1]);
|
||||
}
|
||||
}
|
||||
|
||||
function makeup(data) {
|
||||
@ -59,6 +62,24 @@ function doWxss(dir, cb, mainDir, nowDir) {
|
||||
}
|
||||
}
|
||||
let exactData = isPure ? pureData[data] : data;
|
||||
if (typeof data === 'string') {
|
||||
let styleData = commonStyle[data]
|
||||
let fileStyle = ''
|
||||
if (styleData != undefined) {
|
||||
for (let content of styleData) {
|
||||
if (typeof content === 'string') {
|
||||
if (content != '1') {
|
||||
fileStyle += content
|
||||
}
|
||||
} else {
|
||||
if (content.length != 1) {
|
||||
fileStyle += content[1] + 'rpx'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
exactData = fileStyle
|
||||
}
|
||||
for (let content of exactData)
|
||||
if (typeof content === "object") {
|
||||
switch (content[0]) {
|
||||
@ -232,11 +253,31 @@ function doWxss(dir, cb, mainDir, nowDir) {
|
||||
';\nvar __mainPageFrameReady__ = window.__mainPageFrameReady__ || function(){};var __WXML_GLOBAL__={entrys:{},defines:{},modules:{},ops:[],wxs_nf_init:undefined,total_ops:0};var __vd_version_info__=__vd_version_info__||{}' +
|
||||
";\n" + scriptCode;
|
||||
|
||||
if (code.indexOf('__COMMON_STYLESHEETS__') != -1) {
|
||||
let commonStyles = code.slice(
|
||||
code.indexOf('__COMMON_STYLESHEETS__||{}') + 26,
|
||||
code.indexOf(
|
||||
'var setCssToHead = function(file, _xcInvalid, info)'
|
||||
)
|
||||
)
|
||||
commonStyles =
|
||||
';var __COMMON_STYLESHEETS__ = __COMMON_STYLESHEETS__||{};' +
|
||||
commonStyles +
|
||||
';__COMMON_STYLESHEETS__;'
|
||||
commonStyle = new VM().run(commonStyles)
|
||||
}
|
||||
|
||||
//remove setCssToHead function
|
||||
mainCode = mainCode.replace('var setCssToHead = function', 'var setCssToHead2 = function');
|
||||
|
||||
code = code.slice(code.lastIndexOf('var setCssToHead = function(file, _xcInvalid'));
|
||||
code = code.slice(code.lastIndexOf('\nvar _C= ') + 1);
|
||||
code = code.replace('__COMMON_STYLESHEETS__', '[]');
|
||||
|
||||
if (code.indexOf('_C =') == -1) {
|
||||
code = code.slice(code.lastIndexOf('\nvar _C= ') + 1);
|
||||
} else {
|
||||
code = code.slice(code.lastIndexOf('\nvar _C = ') + 1);
|
||||
}
|
||||
|
||||
code = code.slice(0, code.indexOf('\n'));
|
||||
let vm = new VM({sandbox: {}});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user