Skip to content

Commit 6c54b34

Browse files
committed
Rename and document current purpose of macro functions
1 parent af45049 commit 6c54b34

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export default function macros(babel: typeof Babel): Babel.PluginObj<State> {
100100
},
101101

102102
exit() {
103-
this.macroBuilder.expand();
103+
this.macroBuilder.cleanImports();
104104
},
105105
},
106106

src/utils/macros.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,6 @@ export default class Macros {
2626
});
2727
}
2828

29-
/**
30-
* Injects the either the env-flags module with the debug binding or
31-
* adds the debug binding if missing from the env-flags module.
32-
*/
33-
expand() {
34-
this._cleanImports();
35-
}
36-
3729
/**
3830
* Collects the import bindings for the debug tools.
3931
*/
@@ -53,7 +45,7 @@ export default class Macros {
5345
}
5446

5547
/**
56-
* Builds the expressions that the CallExpression will expand into.
48+
* Expands the given expression, if it is simple CallExpression statement for the debug tools.
5749
*/
5850
build(path: NodePath<t.ExpressionStatement>) {
5951
if (!isCallStatementPath(path)) {
@@ -68,7 +60,10 @@ export default class Macros {
6860
}
6961
}
7062

71-
_cleanImports() {
63+
/**
64+
* Removes obsolete import bindings for the debug tools.
65+
*/
66+
cleanImports() {
7267
if (!this.debugHelpers?.module) {
7368
if (this.localDebugBindings.length > 0) {
7469
let importPath = this.localDebugBindings[0].findParent((p) =>

0 commit comments

Comments
 (0)