@kezh/my-custom-js-converter 1.9.0 → 1.10.0

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.
@@ -97,23 +97,22 @@ function decoding$0(inPath, outPath, config, settingDir, libDirs, conflicts) {
97
97
  mapContext.writeToLocalDir(settingDir);
98
98
  }
99
99
  // 稽核内联工具方法体是否与源文件一致(忽略注释)
100
- // 必须在 importMods 之前:有不一致方法的依赖不生成 require(方案B:自包含)
100
+ // 必须在 importMods/deleteModMethods 之前:若存在任一不一致方法,
101
+ // 则 decoded.js 原样包裹 coded.js(不 require、不删除内联方法、不还原调用)
101
102
  const mismatches = (0, ast_1.auditModMethods)(srcAst, mapContext);
102
- const skipDepNames = new Set();
103
103
  if (mismatches.length) {
104
- // 推导出有不一致方法的依赖名集合:该依赖所有方法都保留内联,不 require
105
- mismatches.forEach((m) => skipDepNames.add(m.modName));
106
- logger.warn(`检测到 ${mismatches.length} 个内联工具方法与源文件不一致,涉及依赖: ${[
107
- ...skipDepNames
108
- ].join(", ")}`);
109
- logger.warn(`以下依赖的所有方法将保留内联形态不还原(不生成 require,decoded.js 自包含):`);
104
+ logger.warn(`检测到 ${mismatches.length} 个内联工具方法与源文件不一致,decoded.js 将原样保留 coded.js(不还原、不 require):`);
110
105
  mismatches.forEach((m) => {
111
106
  logger.warn(` - ${m.methodKey}(源文件: ${m.srcPath})`);
112
107
  });
113
108
  logger.warn(`请检查上述方法,确认 coded.js 与源文件差异后手动处理或重新 encode。`);
109
+ // 跳过 importMods 和 deleteModMethods:保留 coded.js 原样形态
110
+ }
111
+ else {
112
+ // 全部一致:正常还原(生成 require、删除内联方法、还原调用)
113
+ (0, ast_1.importMods)(path_1.default.dirname(outPath), srcAst, mapContext, config.encode.useAlias);
114
+ (0, ast_1.deleteModMethods)(srcAst, mapContext);
114
115
  }
115
- (0, ast_1.importMods)(path_1.default.dirname(outPath), srcAst, mapContext, config.encode.useAlias, skipDepNames);
116
- (0, ast_1.deleteModMethods)(srcAst, mapContext, skipDepNames);
117
116
  // 从onFormReady方法中提取版本日志并移除
118
117
  extractAndRemoveVersionLog(srcAst, settingDir);
119
118
  let { code: dist } = (0, generator_1.default)(srcAst, { compact: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kezh/my-custom-js-converter",
3
- "version": "1.9.0",
3
+ "version": "1.10.0",
4
4
  "description": "自定义代码转换器",
5
5
  "main": "index.js",
6
6
  "files": [