@kezh/my-custom-js-converter 0.0.12 → 0.0.13

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.
Files changed (2) hide show
  1. package/core/encode.js +8 -4
  2. package/package.json +1 -1
package/core/encode.js CHANGED
@@ -99,7 +99,6 @@ function getImportMethods(modPathByName, methodNamesByMod) {
99
99
  return [];
100
100
  }
101
101
  const modMethodNames = modMethods.map((m) => m.key.name);
102
- console.log(`method names => ${modMethodNames}`);
103
102
  const useMethodNames = methodNamesByMod.get(name);
104
103
  const inlineMethodNames = getInlineThisMethodNames(modMethodNames, useMethodNames, modAst);
105
104
  let mergeMethodNames = [
@@ -110,7 +109,9 @@ function getImportMethods(modPathByName, methodNamesByMod) {
110
109
  const mergeMethods = mergeMethodNames
111
110
  .map((name) => {
112
111
  return modMethods.find((m) => core_1.types.isIdentifier(m.key) && m.key.name === name);
113
- }).filter(m => m);
112
+ })
113
+ .filter((m) => m);
114
+ console.log(`inline methods size => ${inlineMethodNames.length}`);
114
115
  console.log(`import methods size => ${mergeMethods.length}`);
115
116
  return mergeMethods.map((m) => {
116
117
  m.body = core_1.types.addComment(m.body, "inner", "auto-generated: Please do not modify the.");
@@ -143,14 +144,16 @@ function getInlineThisMethodNames(modMethodNames, useMethodNames, modAst) {
143
144
  if (!core_1.types.isIdentifier(property)) {
144
145
  return;
145
146
  }
146
- console.log(`property name => ${property.name}`);
147
147
  if (modMethodNames.includes(property.name)) {
148
148
  thisMethodNames.add(property.name);
149
149
  }
150
150
  }
151
151
  }
152
152
  });
153
- return [...thisMethodNames];
153
+ return [
154
+ ...thisMethodNames,
155
+ ...getInlineThisMethodNames(modMethodNames, [...thisMethodNames])
156
+ ];
154
157
  }
155
158
  /**
156
159
  * 获取所有依赖第三方模块路径
@@ -230,6 +233,7 @@ function getSrcMethodNames(entry, srcAst) {
230
233
  }
231
234
  /**
232
235
  * 获取源码入口对象所有方法
236
+ * todo: 重复获取方法
233
237
  * @param entry - 入口对象
234
238
  * @param ast - AST
235
239
  * @returns
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kezh/my-custom-js-converter",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "description": "自定义代码转换器",
5
5
  "main": "index.js",
6
6
  "bin": {