MCPcopy Create free account
hub / github.com/Crain99/cc-reverse / reverseProject

Function reverseProject

src/core/reverseEngine.js:31–140  ·  view source on GitHub ↗

* 逆向工程主函数 * @param {Object} options 配置选项 * @param {string} options.sourcePath 源项目路径 * @param {string} options.outputPath 输出路径 * @param {boolean} options.verbose 是否显示详细日志 * @param {boolean} options.silent 是否静默模式 * @param {string} options.versionHint 版本提示 * @returns {Promise }

(options)

Source from the content-addressed store, hash-verified

29 verbose = false,
30 versionHint,
31 key,
32 bundle,
33 assetsOnly = false,
34 scriptsOnly = false,
35 scriptFormat = '',
36 noAstFallback = false,
37 } = options;
38
39 const config = loadConfig();
40 const ctx = new ReverseContext({
41 sourcePath,
42 outputPath,
43 verbose,
44 silent: options.silent,
45 versionHint,
46 key,
47 bundle,
48 assetsOnly,
49 scriptsOnly,
50 config,
51 });
52
53 // 检测 Cocos Creator 版本
54 const projectInfo = detectProjectVersion(sourcePath, versionHint);
55 ctx.version = projectInfo.version;
56 ctx.applyGlobals();
57
58 const optionSummary = {
59 versionHint: versionHint || '',
60 scriptFormat: scriptFormat || 'auto',
61 noAstFallback: !!noAstFallback,
62 assetsOnly: !!assetsOnly,
63 scriptsOnly: !!scriptsOnly,
64 bundle: Array.isArray(bundle) ? bundle : [],
65 };
66
67 // 3.x pipeline is bundle-oriented — dispatch early.
68 if (projectInfo.version === '3.x') {
69 ctx.paths = { source: sourcePath, output: outputPath };
70 ctx.applyGlobals();
71 const summary3x = await reverseProject3x({
72 sourcePath,
73 outputPath,
74 bundleFilter: ctx.bundleFilter,
75 assetsOnly,
76 scriptsOnly,
77 key: key || config.decrypt?.key || extractKeyFromProject(sourcePath),
78 verbose,
79 });
80 summary3x.options = optionSummary;
81 // Re-write report so options/flavor land in the shared template
82 summary3x.reportPath = await writeRecoveryReport(outputPath, summary3x, sourcePath);
83 return summary3x;
84 }
85
86 // 检查文件是否存在 (2.x pipeline)
87 validatePaths(projectInfo.resPath, projectInfo.settingsPath, projectInfo.projectPath);
88

Callers 1

index.jsFile · 0.85

Calls 9

loadConfigFunction · 0.85
detectProjectVersionFunction · 0.85
reverseProject3xFunction · 0.85
extractKeyFromProjectFunction · 0.85
validatePathsFunction · 0.85
scanJscFilesFunction · 0.85
decryptProjectFunction · 0.85
readFileFunction · 0.85
parseSettingsFunction · 0.85

Tested by

no test coverage detected