@eventra_dev/eventra-cli 0.2.2 → 0.2.4
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/dist/commands/sync.js
CHANGED
|
@@ -58,7 +58,7 @@ async function sync() {
|
|
|
58
58
|
const parsed = cache.get(file);
|
|
59
59
|
if (!parsed)
|
|
60
60
|
continue;
|
|
61
|
-
const res = engine.
|
|
61
|
+
const res = engine.scanFile((0, getVirtualFile_1.getVirtualFile)(file), parsed.content, config);
|
|
62
62
|
res.detectedFunctionWrappers.forEach(w => detectedFn.add(w));
|
|
63
63
|
res.detectedComponentWrappers.forEach((v, k) => detectedCmp.set(k, v));
|
|
64
64
|
}
|
|
@@ -46,15 +46,7 @@ class TSService {
|
|
|
46
46
|
this.compilerOptions = compilerOptions;
|
|
47
47
|
this.baseUrl = baseUrl;
|
|
48
48
|
this.paths = paths;
|
|
49
|
-
const allFiles = typescript_1.default.sys.readDirectory(root, [
|
|
50
|
-
".ts",
|
|
51
|
-
".tsx",
|
|
52
|
-
".js",
|
|
53
|
-
".jsx",
|
|
54
|
-
".vue",
|
|
55
|
-
".svelte",
|
|
56
|
-
".astro"
|
|
57
|
-
], undefined, undefined);
|
|
49
|
+
const allFiles = typescript_1.default.sys.readDirectory(root, [".ts", ".tsx", ".js", ".jsx"], undefined, undefined);
|
|
58
50
|
for (const f of allFiles) {
|
|
59
51
|
this.fileNames.add(this.normalize(f));
|
|
60
52
|
}
|
|
@@ -68,10 +60,7 @@ class TSService {
|
|
|
68
60
|
},
|
|
69
61
|
getScriptKind: (fileName) => {
|
|
70
62
|
fileName = this.normalize(fileName);
|
|
71
|
-
if (fileName.endsWith(".tsx")
|
|
72
|
-
fileName.endsWith(".vue") ||
|
|
73
|
-
fileName.endsWith(".svelte") ||
|
|
74
|
-
fileName.endsWith(".astro")) {
|
|
63
|
+
if (fileName.endsWith(".tsx")) {
|
|
75
64
|
return typescript_1.default.ScriptKind.TSX;
|
|
76
65
|
}
|
|
77
66
|
if (fileName.endsWith(".ts")) {
|
|
@@ -102,7 +91,8 @@ class TSService {
|
|
|
102
91
|
return typescript_1.default.ScriptSnapshot.fromString(content);
|
|
103
92
|
}
|
|
104
93
|
}
|
|
105
|
-
catch {
|
|
94
|
+
catch {
|
|
95
|
+
}
|
|
106
96
|
return typescript_1.default.ScriptSnapshot.fromString("");
|
|
107
97
|
},
|
|
108
98
|
getCurrentDirectory: () => this.root,
|
package/dist/engine/scanner.js
CHANGED
|
@@ -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
|
-
|
|
52
|
-
|
|
51
|
+
const name = getCallName(expr);
|
|
52
|
+
// direct track()
|
|
53
|
+
if (name === "track") {
|
|
54
|
+
return true;
|
|
53
55
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
// configured wrappers
|
|
57
|
+
if (config.functionWrappers?.some(w => w.name === name)) {
|
|
58
|
+
return true;
|
|
56
59
|
}
|
|
57
|
-
|
|
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
package/src/commands/sync.ts
CHANGED
|
@@ -59,15 +59,7 @@ export class TSService {
|
|
|
59
59
|
|
|
60
60
|
const allFiles = ts.sys.readDirectory(
|
|
61
61
|
root,
|
|
62
|
-
[
|
|
63
|
-
".ts",
|
|
64
|
-
".tsx",
|
|
65
|
-
".js",
|
|
66
|
-
".jsx",
|
|
67
|
-
".vue",
|
|
68
|
-
".svelte",
|
|
69
|
-
".astro"
|
|
70
|
-
],
|
|
62
|
+
[".ts", ".tsx", ".js", ".jsx"],
|
|
71
63
|
undefined,
|
|
72
64
|
undefined
|
|
73
65
|
);
|
|
@@ -88,12 +80,7 @@ export class TSService {
|
|
|
88
80
|
getScriptKind: (fileName) => {
|
|
89
81
|
fileName = this.normalize(fileName);
|
|
90
82
|
|
|
91
|
-
if (
|
|
92
|
-
fileName.endsWith(".tsx") ||
|
|
93
|
-
fileName.endsWith(".vue") ||
|
|
94
|
-
fileName.endsWith(".svelte") ||
|
|
95
|
-
fileName.endsWith(".astro")
|
|
96
|
-
) {
|
|
83
|
+
if (fileName.endsWith(".tsx")) {
|
|
97
84
|
return ts.ScriptKind.TSX;
|
|
98
85
|
}
|
|
99
86
|
|
|
@@ -131,7 +118,8 @@ export class TSService {
|
|
|
131
118
|
|
|
132
119
|
return ts.ScriptSnapshot.fromString(content);
|
|
133
120
|
}
|
|
134
|
-
} catch {
|
|
121
|
+
} catch {
|
|
122
|
+
}
|
|
135
123
|
|
|
136
124
|
return ts.ScriptSnapshot.fromString("");
|
|
137
125
|
},
|
package/src/engine/scanner.ts
CHANGED
|
@@ -54,15 +54,27 @@ export function scanSource(
|
|
|
54
54
|
|
|
55
55
|
// TRACK DETECTION
|
|
56
56
|
function isTrackCall(expr: ts.Expression) {
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
const name = getCallName(expr);
|
|
58
|
+
|
|
59
|
+
// direct track()
|
|
60
|
+
if (name === "track") {
|
|
61
|
+
return true;
|
|
59
62
|
}
|
|
60
63
|
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
// configured wrappers
|
|
65
|
+
if (
|
|
66
|
+
config.functionWrappers?.some(
|
|
67
|
+
w => w.name === name
|
|
68
|
+
)
|
|
69
|
+
) {
|
|
70
|
+
return true;
|
|
63
71
|
}
|
|
64
72
|
|
|
65
|
-
|
|
73
|
+
// *.track()
|
|
74
|
+
return ts.isPropertyAccessExpression(expr) &&
|
|
75
|
+
expr.name.text === "track";
|
|
76
|
+
|
|
77
|
+
|
|
66
78
|
}
|
|
67
79
|
|
|
68
80
|
function extractTrackCall(
|