@kezh/my-custom-js-converter 0.0.24 → 0.0.26
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 +12 -6
- 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;
|
|
@@ -326,6 +326,12 @@ function modifyModMethods(mod, methodNames, modAst) {
|
|
|
326
326
|
if (methodNames.includes(property.name)) {
|
|
327
327
|
if (core_1.types.isIdentifier(path.node.object) ||
|
|
328
328
|
core_1.types.isThisExpression(path.node.object)) {
|
|
329
|
+
if (core_1.types.isIdentifier(path.node.object)) {
|
|
330
|
+
const object = path.node.object;
|
|
331
|
+
if (object.name !== mod) {
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
329
335
|
property.name = `${property.name}__${mod}`;
|
|
330
336
|
}
|
|
331
337
|
}
|