crabatool 1.0.396 → 1.0.398

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "crabatool",
3
- "version": "1.0.396",
3
+ "version": "1.0.398",
4
4
  "description": "crabatool",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -20,7 +20,7 @@
20
20
  "checkUpdate": "node run.js -checkUpdate -version master -webPath F:\\crabaevery\\www",
21
21
  "upload": "node run.js -upload -version master -Debug true -host http://127.0.0.1:9998 -hidejspath true -targetPath F:\\CarpaNET_NEW",
22
22
  "crabaNgp": "node run.js -mergejs -hidejspath true -targetPath F:\\CarpaNET_NEW\\src\\Carpa.Web\\js\\crabaNgp -inNames initMs.js,businessControl.js -outName F:\\CarpaMS\\src\\js\\crabaNgp.js",
23
- "mergeJs2":"node run.js -mergejs -targetPath -inNames F:\\CarpaNET_NEW\\src\\Carpa.Web\\js\\craba.js,F:\\CarpaNET_NEW\\src\\Carpa.Web\\js\\controls.js -outName F:\\a.js -ignorecompress true",
23
+ "mergeJs2": "node run.js -mergejs -targetPath -inNames F:\\CarpaNET_NEW\\src\\Carpa.Web\\js\\craba.js,F:\\CarpaNET_NEW\\src\\Carpa.Web\\js\\controls.js -outName F:\\a.js -ignorecompress true",
24
24
  "webPath": "node ./test/test.js -checkjs -webPath F:\\crabaevery\\www -modName crabaevery -Debug true",
25
25
  "biconfont": "node ./test/test.js -iconfont -zipPath F:\\crabaevery\\www\\biconfont -fontPath F:\\crabaevery\\www\\skins\\bicon -prefix .bicon- -fontName biconfont",
26
26
  "aiconfont": "node ./test/test.js -iconfont -zipPath F:\\crabaevery\\www\\iconfont -fontPath F:\\CarpaNET_NEW\\src\\Carpa.Web\\skins -prefix .aicon- -fontName iconfont",
@@ -68,4 +68,4 @@
68
68
  "crabatool"
69
69
  ],
70
70
  "license": "UNLICENSED"
71
- }
71
+ }
@@ -149,11 +149,11 @@ function mergeInitAndBiz() {
149
149
  var filesToMerge = [];
150
150
 
151
151
  // 1. 添加主模块的 modName.js 文件
152
- // var modJs = utils.join(config.webPath, '/js/' + config.modName + '.js');
153
- // if (fs.existsSync(modJs)) {
154
- // filesToMerge.push(modJs);
155
- // utils.debug('添加主模块文件: ' + modJs);
156
- // }
152
+ var modJs = utils.join(config.webPath, '/js/' + config.modName + '.js');
153
+ if (fs.existsSync(modJs)) {
154
+ filesToMerge.push(modJs);
155
+ utils.debug('添加主模块文件: ' + modJs);
156
+ }
157
157
 
158
158
  // 2. 添加所有子模块的 init.js 文件
159
159
  config.childModList.forEach(childName => {
@@ -41,6 +41,7 @@ module.exports.run = function(opts) {
41
41
  utils.debug("输入文件清单:" + options.inPath);
42
42
  utils.debug("输出文件:" + options.outPath);
43
43
  utils.log("ignoreCompress:" + options.ignoreCompress);
44
+ utils.log("blackFileName:" + options.blackFileName);
44
45
 
45
46
  var startT = new Date();
46
47
  buildFolder(options);
@@ -141,13 +142,21 @@ function getAbsPath(filePath) {
141
142
  function replaceBlackFunction(content, options) {
142
143
  //return content; // 还有点问题
143
144
 
144
- if (!options.blackFileName) return content;
145
+ if (!options.blackFileName) {
146
+ return content;
147
+ }
145
148
 
146
149
  var blackFile = getAbsPath(options.blackFileName);
147
- if (!fs.existsSync(blackFile)) return content;
150
+ if (!fs.existsSync(blackFile)) {
151
+ utils.debug("黑名单不存在:" + blackFile);
152
+ return content;
153
+ }
148
154
 
149
155
  var stats = fs.statSync(blackFile);
150
- if (!stats.isFile()) return content;
156
+ if (!stats.isFile()) {
157
+ utils.debug("黑名单应该是文件:" + blackFile);
158
+ return content;
159
+ }
151
160
 
152
161
  var txt = fs.readFileSync(blackFile);
153
162
  var list = txt.toString().split('\r\n');
@@ -218,6 +227,7 @@ function compressFile(filePath, options, filePath2, stats) {
218
227
  if (!filePath2) {
219
228
  // 只有当ignoreCompress为false时才执行replaceBlackFunction
220
229
  if (options.ext == '.js' && !options.ignoreCompress) {
230
+ utils.debug("替换黑名单:" + options.blackFileName);
221
231
  content = replaceBlackFunction(content, options); // 手动混淆和替换一些标签,更大的压缩js容量,具体替换规则请参考黑名单里的清单
222
232
  }
223
233