@greenarmor/ges-audit-engine 1.5.4 → 1.5.6

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 (2) hide show
  1. package/dist/index.js +26 -2
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -37,6 +37,31 @@ function loadGesIgnore(root) {
37
37
  return [];
38
38
  }
39
39
  }
40
+ function globMatch(pattern, text) {
41
+ let pi = 0, ti = 0, starIdx = -1, matchIdx = 0;
42
+ while (ti < text.length) {
43
+ if (pi < pattern.length && pattern[pi] === text[ti]) {
44
+ pi++;
45
+ ti++;
46
+ }
47
+ else if (pi < pattern.length && pattern[pi] === "*") {
48
+ starIdx = pi;
49
+ matchIdx = ti;
50
+ pi++;
51
+ }
52
+ else if (starIdx !== -1) {
53
+ pi = starIdx + 1;
54
+ matchIdx++;
55
+ ti = matchIdx;
56
+ }
57
+ else {
58
+ return false;
59
+ }
60
+ }
61
+ while (pi < pattern.length && pattern[pi] === "*")
62
+ pi++;
63
+ return pi === pattern.length;
64
+ }
40
65
  function isIgnored(filePath, patterns) {
41
66
  for (const pattern of patterns) {
42
67
  if (pattern.endsWith("/")) {
@@ -50,8 +75,7 @@ function isIgnored(filePath, patterns) {
50
75
  return true;
51
76
  }
52
77
  else if (pattern.includes("*")) {
53
- const regex = new RegExp("^" + pattern.replace(/\./g, "\\.").replace(/\*/g, ".*") + "$");
54
- if (regex.test(filePath))
78
+ if (globMatch(pattern, filePath))
55
79
  return true;
56
80
  }
57
81
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "dependencies": {
3
- "@greenarmor/ges-core": "1.5.4"
3
+ "@greenarmor/ges-core": "1.5.6"
4
4
  },
5
5
  "description": "GESF Audit Engine - Audit trails and compliance evaluation",
6
6
  "devDependencies": {
@@ -24,7 +24,7 @@
24
24
  "name": "@greenarmor/ges-audit-engine",
25
25
  "type": "module",
26
26
  "types": "./dist/index.d.ts",
27
- "version": "1.5.4",
27
+ "version": "1.5.6",
28
28
  "scripts": {
29
29
  "build": "tsc",
30
30
  "clean": "rm -rf dist tsconfig.tsbuildinfo",