@appthreat/atom 1.1.1 → 1.1.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.
Files changed (3) hide show
  1. package/astgen.js +6 -5
  2. package/package.json +1 -1
  3. package/utils.mjs +1 -1
package/astgen.js CHANGED
@@ -67,18 +67,19 @@ const getAllSrcJSAndTSFiles = (src) =>
67
67
  getAllFiles(src, ".cjs"),
68
68
  getAllFiles(src, ".mjs"),
69
69
  getAllFiles(src, ".ts"),
70
- getAllFiles(src, ".tsx")
70
+ getAllFiles(src, ".tsx"),
71
+ getAllFiles(src, ".vue"),
72
+ getAllFiles(src, ".svelte")
71
73
  ]);
72
74
 
73
75
  /**
74
76
  * Convert a single JS/TS file to AST
75
77
  */
76
78
  const fileToJsAst = (file) => {
77
- try {
78
- return parse(readFileSync(file, "utf-8"), babelParserOptions);
79
- } catch {
80
- return parse(readFileSync(file, "utf-8"), babelSafeParserOptions);
79
+ if (file.endsWith(".vue") || file.endsWith(".svelte")) {
80
+ return toVueAst(file);
81
81
  }
82
+ return codeToJsAst(readFileSync(file, "utf-8"));
82
83
  };
83
84
 
84
85
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appthreat/atom",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Create atom (⚛) representation for your application, packages and libraries",
5
5
  "exports": "./index.js",
6
6
  "type": "module",
package/utils.mjs CHANGED
@@ -28,7 +28,7 @@ const IGNORE_DIRS = process.env.ASTGEN_IGNORE_DIRS
28
28
 
29
29
  const IGNORE_FILE_PATTERN = new RegExp(
30
30
  process.env.ASTGEN_IGNORE_FILE_PATTERN ||
31
- "(conf|test|spec|min|three|\\.d)\\.(js|ts|jsx|tsx)$",
31
+ "(conf|config|test|spec|min|three|\\.d)\\.(js|ts|jsx|tsx)$",
32
32
  "i"
33
33
  );
34
34