@chrisdudek/yg 5.0.0-alpha.3 → 5.0.0-alpha.5

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/ast.d.ts CHANGED
@@ -6,8 +6,13 @@ interface SourceFile {
6
6
  path: string;
7
7
  /** Raw source code */
8
8
  content: string;
9
- /** Parsed tree-sitter Tree */
10
- ast: Tree;
9
+ /**
10
+ * Parsed tree-sitter Tree, or `undefined` for a file whose extension has no
11
+ * registered grammar (e.g. `.md`, `.sh`, `.json`). Such files are still
12
+ * delivered to `check()` so content/regex rules can iterate them; rules that
13
+ * touch `file.ast` must guard with `if (!file.ast) continue;`.
14
+ */
15
+ ast?: Tree;
11
16
  }
12
17
  interface CheckContext {
13
18
  files: SourceFile[];
package/dist/ast.js CHANGED
@@ -8,10 +8,15 @@ function report(file, node, message) {
8
8
  };
9
9
  }
10
10
 
11
- // src/ast/file-path.ts
11
+ // src/utils/mapping-path.ts
12
12
  import { minimatch } from "minimatch";
13
+ function globMatch(file, pattern) {
14
+ return minimatch(file, pattern, { dot: true });
15
+ }
16
+
17
+ // src/ast/file-path.ts
13
18
  function inFile(file, pattern) {
14
- if ("glob" in pattern) return minimatch(file.path, pattern.glob);
19
+ if ("glob" in pattern) return globMatch(file.path, pattern.glob);
15
20
  if ("regex" in pattern) return pattern.regex.test(file.path);
16
21
  if ("contains" in pattern) return file.path.includes(pattern.contains);
17
22
  return false;