cocos-obfuscator 1.0.1 → 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 +18 -17
- package/package.json +1 -1
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
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
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
|
// 执行混淆
|