@kezh/my-custom-js-converter 0.0.23 → 0.0.25
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 -9
- package/package.json +1 -1
package/core/encode.js
CHANGED
|
@@ -99,23 +99,23 @@ function getImportMethods(modPathByName, methodNamesByMod) {
|
|
|
99
99
|
return [];
|
|
100
100
|
}
|
|
101
101
|
const modMethodNames = modMethods.map((m) => m.key.name);
|
|
102
|
-
console.log(`mod methods => ${modMethodNames}`);
|
|
102
|
+
// console.log(`mod methods => ${modMethodNames}`);
|
|
103
103
|
const useMethodNames = methodNamesByMod.get(name);
|
|
104
|
-
console.log(`use methods => ${useMethodNames}`);
|
|
104
|
+
// console.log(`use methods => ${useMethodNames}`);
|
|
105
105
|
const inlineMethodNames = getInlineThisMethodNames(modMethodNames, useMethodNames, modAst);
|
|
106
|
-
console.log(`inline methods => ${inlineMethodNames}`);
|
|
106
|
+
// console.log(`inline methods => ${inlineMethodNames}`);
|
|
107
107
|
let mergeMethodNames = [
|
|
108
108
|
...new Set([...useMethodNames, ...inlineMethodNames])
|
|
109
109
|
];
|
|
110
110
|
modifyModMethods(name, mergeMethodNames, modAst);
|
|
111
|
-
console.log((
|
|
111
|
+
// console.log(generate(modAst).code);
|
|
112
112
|
const mergeMethods = mergeMethodNames
|
|
113
113
|
.map((name) => {
|
|
114
114
|
return modMethods.find((m) => core_1.types.isIdentifier(m.key) && m.key.name === name);
|
|
115
115
|
})
|
|
116
116
|
.filter((m) => m);
|
|
117
|
-
console.log(`inline methods size => ${inlineMethodNames.length}`);
|
|
118
|
-
console.log(`import methods size => ${mergeMethods.length}`);
|
|
117
|
+
// console.log(`inline methods size => ${inlineMethodNames.length}`);
|
|
118
|
+
// console.log(`import methods size => ${mergeMethods.length}`);
|
|
119
119
|
return mergeMethods.map((m) => {
|
|
120
120
|
if (core_1.types.isIdentifier(m.key)) {
|
|
121
121
|
const key = m.key;
|
|
@@ -324,9 +324,8 @@ function modifyModMethods(mod, methodNames, modAst) {
|
|
|
324
324
|
if (core_1.types.isIdentifier(path.node.property)) {
|
|
325
325
|
const property = path.node.property;
|
|
326
326
|
if (methodNames.includes(property.name)) {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
core_1.types.isThisExpression(path.node)) {
|
|
327
|
+
if (core_1.types.isIdentifier(path.node.object) ||
|
|
328
|
+
core_1.types.isThisExpression(path.node.object)) {
|
|
330
329
|
property.name = `${property.name}__${mod}`;
|
|
331
330
|
}
|
|
332
331
|
}
|