@kezh/my-custom-js-converter 0.0.12 → 0.0.14
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/core/encode.js +8 -3
- 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
|
-
})
|
|
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.");
|
|
@@ -150,7 +151,10 @@ function getInlineThisMethodNames(modMethodNames, useMethodNames, modAst) {
|
|
|
150
151
|
}
|
|
151
152
|
}
|
|
152
153
|
});
|
|
153
|
-
return [
|
|
154
|
+
return [
|
|
155
|
+
...thisMethodNames,
|
|
156
|
+
...getInlineThisMethodNames(modMethodNames, [...thisMethodNames])
|
|
157
|
+
];
|
|
154
158
|
}
|
|
155
159
|
/**
|
|
156
160
|
* 获取所有依赖第三方模块路径
|
|
@@ -230,6 +234,7 @@ function getSrcMethodNames(entry, srcAst) {
|
|
|
230
234
|
}
|
|
231
235
|
/**
|
|
232
236
|
* 获取源码入口对象所有方法
|
|
237
|
+
* todo: 重复获取方法
|
|
233
238
|
* @param entry - 入口对象
|
|
234
239
|
* @param ast - AST
|
|
235
240
|
* @returns
|