@eventra_dev/eventra-cli 0.2.2 → 0.2.3

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.
@@ -48,13 +48,18 @@ function scanSource(source, checker, config, visited = new Set(), inheritedParam
48
48
  visited.add(source.fileName);
49
49
  // TRACK DETECTION
50
50
  function isTrackCall(expr) {
51
- if (typescript_1.default.isIdentifier(expr)) {
52
- return expr.text === "track";
51
+ const name = getCallName(expr);
52
+ // direct track()
53
+ if (name === "track") {
54
+ return true;
53
55
  }
54
- if (typescript_1.default.isPropertyAccessExpression(expr)) {
55
- return expr.name.text === "track";
56
+ // configured wrappers
57
+ if (config.functionWrappers?.some(w => w.name === name)) {
58
+ return true;
56
59
  }
57
- return false;
60
+ // *.track()
61
+ return typescript_1.default.isPropertyAccessExpression(expr) &&
62
+ expr.name.text === "track";
58
63
  }
59
64
  function extractTrackCall(node, paramMap) {
60
65
  if (!isTrackCall(node.expression))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eventra_dev/eventra-cli",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Eventra CLI",
5
5
  "type": "commonjs",
6
6
  "bin": {
@@ -54,15 +54,27 @@ export function scanSource(
54
54
 
55
55
  // TRACK DETECTION
56
56
  function isTrackCall(expr: ts.Expression) {
57
- if (ts.isIdentifier(expr)) {
58
- return expr.text === "track";
57
+ const name = getCallName(expr);
58
+
59
+ // direct track()
60
+ if (name === "track") {
61
+ return true;
59
62
  }
60
63
 
61
- if (ts.isPropertyAccessExpression(expr)) {
62
- return expr.name.text === "track";
64
+ // configured wrappers
65
+ if (
66
+ config.functionWrappers?.some(
67
+ w => w.name === name
68
+ )
69
+ ) {
70
+ return true;
63
71
  }
64
72
 
65
- return false;
73
+ // *.track()
74
+ return ts.isPropertyAccessExpression(expr) &&
75
+ expr.name.text === "track";
76
+
77
+
66
78
  }
67
79
 
68
80
  function extractTrackCall(