@eventra_dev/eventra-cli 0.1.34 → 0.2.2

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.
@@ -1,6 +1,25 @@
1
+ import path from "path";
1
2
  import { parseUniversal } from "./universal";
2
3
 
4
+ function extractImports(content: string, file: string) {
5
+ return parseUniversal(content, file).deps;
6
+ }
7
+
3
8
  export function processFile(file: string, content: string) {
9
+ const ext = path.extname(file);
10
+
11
+ if (
12
+ ext === ".ts" ||
13
+ ext === ".tsx" ||
14
+ ext === ".js" ||
15
+ ext === ".jsx"
16
+ ) {
17
+ return {
18
+ content,
19
+ deps: extractImports(content, file),
20
+ };
21
+ }
22
+
4
23
  const parsed = parseUniversal(content, file);
5
24
 
6
25
  return {
@@ -243,7 +243,7 @@ export function parseUniversal(
243
243
  parts.push(...dyn.calls);
244
244
 
245
245
  return {
246
- code: [...new Set(parts)].join("\n"),
246
+ code: parts.length ? parts.join("\n") : content,
247
247
  deps: [...new Set(deps.filter(Boolean))],
248
248
  };
249
249
  }