fad-checker 2.1.0 → 2.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.
@@ -14,7 +14,9 @@ const path = require("path");
14
14
 
15
15
  const POLICY = (() => {
16
16
  try {
17
- const raw = JSON.parse(fs.readFileSync(path.join(__dirname, "..", "data", "license-policy.json"), "utf8"));
17
+ // require() (not fs.readFileSync) so bun --compile bundles the data file
18
+ // into the standalone binary instead of reading it off disk at runtime.
19
+ const raw = require("../data/license-policy.json");
18
20
  return { categories: raw.categories || {}, aliases: raw.aliases || {} };
19
21
  } catch { return { categories: {}, aliases: {} }; }
20
22
  })();
package/lib/outdated.js CHANGED
@@ -318,4 +318,7 @@ module.exports = {
318
318
  EOL_MAPPING,
319
319
  EOL_CACHE_PATH,
320
320
  KNOWN_OBSOLETE,
321
+ loadJsonCache,
322
+ saveJsonCache,
323
+ CACHE_DIR,
321
324
  };
@@ -0,0 +1,47 @@
1
+ /**
2
+ * lib/parallel-walk.js — bounded-concurrency recursive directory walk.
3
+ *
4
+ * A serial readdirSync walk is fine on a fast local disk, but on a high-latency
5
+ * filesystem (WSL/9p, network mounts, the air-gapped VM in the field) each readdir
6
+ * pays a round-trip, so a big tree takes tens of seconds per walk — and fad-checker
7
+ * walks the tree several times (detection, pom discovery, jar discovery, JS manifest
8
+ * discovery). Issuing many readdirs concurrently turns that latency-bound serial walk
9
+ * into something close to a single round-trip deep, which is dramatically faster.
10
+ *
11
+ * `onDir(absDir, entries)` is called once per visited directory with its Dirent[].
12
+ * `skipDir(name)` prunes a child directory by basename (caller's own skip policy).
13
+ *
14
+ * @author: N.BRAUN
15
+ * @email: pp9ping@gmail.com
16
+ */
17
+ const fs = require("fs");
18
+ const path = require("path");
19
+
20
+ const DEFAULT_CONCURRENCY = 48;
21
+
22
+ async function walkDirs(root, { skipDir = () => false, concurrency = DEFAULT_CONCURRENCY, onDir } = {}) {
23
+ const queue = [root];
24
+ let active = 0;
25
+ await new Promise(resolve => {
26
+ let settled = false;
27
+ const finish = () => { if (!settled) { settled = true; resolve(); } };
28
+ const pump = () => {
29
+ if (settled) return;
30
+ if (queue.length === 0 && active === 0) return finish();
31
+ while (active < concurrency && queue.length) {
32
+ const cur = queue.pop();
33
+ active++;
34
+ fs.promises.readdir(cur, { withFileTypes: true }).then(entries => {
35
+ if (onDir) onDir(cur, entries);
36
+ for (const e of entries) {
37
+ if (e.isDirectory() && !skipDir(e.name)) queue.push(path.join(cur, e.name));
38
+ }
39
+ }).catch(() => { /* unreadable dir → skip, same as readdirSync catch */ })
40
+ .finally(() => { active--; pump(); });
41
+ }
42
+ };
43
+ pump();
44
+ });
45
+ }
46
+
47
+ module.exports = { walkDirs };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fad-checker",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "Scan ALL Maven, npm, Yarn, Composer, Python, C#/.NET, Go & Ruby dependencies — plus embedded JARs (fat-jars/war/ear) — in a source tree ONE SHOT without mvn/python/etc — CVE (EPSS/KEV-prioritised), EOL, obsolete, outdated & licenses, with SBOM/CSAF/SARIF/JSON exports, CI gating and fix recos",
5
5
  "keywords": [
6
6
  "sca",