@kezh/my-custom-js-converter 0.0.16 → 0.0.18
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 +4 -4
- package/package.json +1 -1
package/core/encode.js
CHANGED
|
@@ -99,8 +99,11 @@ 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
103
|
const useMethodNames = methodNamesByMod.get(name);
|
|
104
|
+
console.log(`use methods => ${useMethodNames}`);
|
|
103
105
|
const inlineMethodNames = getInlineThisMethodNames(modMethodNames, useMethodNames, modAst);
|
|
106
|
+
console.log(`inline methods => ${inlineMethodNames}`);
|
|
104
107
|
let mergeMethodNames = [
|
|
105
108
|
...new Set([...useMethodNames, ...inlineMethodNames])
|
|
106
109
|
];
|
|
@@ -130,7 +133,6 @@ function getInlineThisMethodNames(modMethodNames, useMethodNames, modAst) {
|
|
|
130
133
|
if (!useMethodNames.length) {
|
|
131
134
|
return [];
|
|
132
135
|
}
|
|
133
|
-
console.log(`use method names => ${useMethodNames}`);
|
|
134
136
|
const thisMethodNames = new Set();
|
|
135
137
|
(0, traverse_1.default)(modAst, {
|
|
136
138
|
ThisExpression(path) {
|
|
@@ -140,13 +142,11 @@ function getInlineThisMethodNames(modMethodNames, useMethodNames, modAst) {
|
|
|
140
142
|
return;
|
|
141
143
|
}
|
|
142
144
|
if (useMethodNames.includes(id.name)) {
|
|
143
|
-
console.log(`id name => ${id.name}`);
|
|
144
145
|
const memberExpression = path.findParent((path) => path.isMemberExpression());
|
|
145
146
|
const property = memberExpression === null || memberExpression === void 0 ? void 0 : memberExpression.node.property;
|
|
146
147
|
if (!core_1.types.isIdentifier(property)) {
|
|
147
148
|
return;
|
|
148
149
|
}
|
|
149
|
-
console.log(`property name => ${property.name}`);
|
|
150
150
|
if (modMethodNames.includes(property.name)) {
|
|
151
151
|
thisMethodNames.add(property.name);
|
|
152
152
|
}
|
|
@@ -155,7 +155,7 @@ function getInlineThisMethodNames(modMethodNames, useMethodNames, modAst) {
|
|
|
155
155
|
});
|
|
156
156
|
return [
|
|
157
157
|
...thisMethodNames,
|
|
158
|
-
...getInlineThisMethodNames(modMethodNames, [...thisMethodNames])
|
|
158
|
+
...getInlineThisMethodNames(modMethodNames, [...thisMethodNames], modAst)
|
|
159
159
|
];
|
|
160
160
|
}
|
|
161
161
|
/**
|