cocos-obfuscator 1.0.0 → 1.0.2

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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  const JavaScriptObfuscator = require('javascript-obfuscator');
4
4
  const fs = require('fs');
@@ -305,22 +305,23 @@ async function main() {
305
305
 
306
306
  // 添加分包文件(如果启用)
307
307
  if (includeSubpackages) {
308
- const subpackages = [
309
- 'com_new_v1/game.js',
310
- 'for_sm/game.js',
311
- 'for_wx/game.js',
312
- 'remote_v1/game.js'
313
- ];
314
-
315
- subpackages.forEach(subpackage => {
316
- const filePath = path.join(buildDir, 'subpackages', subpackage);
317
- if (fs.existsSync(filePath)) {
318
- filesToObfuscate.push(filePath);
319
- console.log('找到分包文件:', filePath);
320
- } else {
321
- console.warn('警告: 分包文件不存在,跳过:', filePath);
322
- }
323
- });
308
+ const subpackagesDir = path.join(buildDir, 'subpackages');
309
+
310
+ if (fs.existsSync(subpackagesDir)) {
311
+ const subpackageDirs = fs.readdirSync(subpackagesDir, { withFileTypes: true });
312
+
313
+ subpackageDirs.forEach(dir => {
314
+ if (dir.isDirectory()) {
315
+ const gameJsPath = path.join(subpackagesDir, dir.name, 'game.js');
316
+ if (fs.existsSync(gameJsPath)) {
317
+ filesToObfuscate.push(gameJsPath);
318
+ console.log('找到分包文件:', gameJsPath);
319
+ }
320
+ }
321
+ });
322
+ } else {
323
+ console.warn('警告: 分包目录不存在:', subpackagesDir);
324
+ }
324
325
  }
325
326
 
326
327
  // 执行混淆
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cocos-obfuscator",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Cocos Creator 项目代码混淆工具,支持字节跳动小游戏和微信小游戏平台",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -31,4 +31,3 @@
31
31
  "url": ""
32
32
  }
33
33
  }
34
-
File without changes