@vibgrate/cli 1.0.13 → 1.0.14

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,8 +1,8 @@
1
1
  import {
2
2
  baselineCommand,
3
3
  runBaseline
4
- } from "./chunk-QHBZIYWP.js";
5
- import "./chunk-S4C6KWCP.js";
4
+ } from "./chunk-POMRKRQN.js";
5
+ import "./chunk-4N4BALQQ.js";
6
6
  export {
7
7
  baselineCommand,
8
8
  runBaseline
@@ -1,6 +1,38 @@
1
1
  // src/utils/fs.ts
2
2
  import * as fs from "fs/promises";
3
+ import * as os from "os";
3
4
  import * as path from "path";
5
+
6
+ // src/utils/semaphore.ts
7
+ var Semaphore = class {
8
+ available;
9
+ queue = [];
10
+ constructor(max) {
11
+ this.available = max;
12
+ }
13
+ async run(fn) {
14
+ await this.acquire();
15
+ try {
16
+ return await fn();
17
+ } finally {
18
+ this.release();
19
+ }
20
+ }
21
+ acquire() {
22
+ if (this.available > 0) {
23
+ this.available--;
24
+ return Promise.resolve();
25
+ }
26
+ return new Promise((resolve6) => this.queue.push(resolve6));
27
+ }
28
+ release() {
29
+ const next = this.queue.shift();
30
+ if (next) next();
31
+ else this.available++;
32
+ }
33
+ };
34
+
35
+ // src/utils/fs.ts
4
36
  var SKIP_DIRS = /* @__PURE__ */ new Set([
5
37
  "node_modules",
6
38
  ".git",
@@ -20,28 +52,27 @@ var SKIP_DIRS = /* @__PURE__ */ new Set([
20
52
  ]);
21
53
  async function findFiles(rootDir, predicate) {
22
54
  const results = [];
55
+ const maxConcurrentReads = Math.max(8, Math.min(64, os.availableParallelism() * 4));
56
+ const readDirSemaphore = new Semaphore(maxConcurrentReads);
23
57
  async function walk(dir) {
24
58
  let entries;
25
59
  try {
26
- const dirents = await fs.readdir(dir, { withFileTypes: true });
27
- entries = dirents.map((d) => ({
28
- name: d.name,
29
- isDirectory: d.isDirectory(),
30
- isFile: d.isFile()
31
- }));
60
+ entries = await fs.readdir(dir, { withFileTypes: true });
32
61
  } catch {
33
62
  return;
34
63
  }
64
+ const subDirectoryWalks = [];
35
65
  for (const e of entries) {
36
- if (e.isDirectory) {
66
+ if (e.isDirectory()) {
37
67
  if (SKIP_DIRS.has(e.name)) continue;
38
- await walk(path.join(dir, e.name));
39
- } else if (e.isFile && predicate(e.name)) {
68
+ subDirectoryWalks.push(readDirSemaphore.run(() => walk(path.join(dir, e.name))));
69
+ } else if (e.isFile() && predicate(e.name)) {
40
70
  results.push(path.join(dir, e.name));
41
71
  }
42
72
  }
73
+ await Promise.all(subDirectoryWalks);
43
74
  }
44
- await walk(rootDir);
75
+ await readDirSemaphore.run(() => walk(rootDir));
45
76
  return results;
46
77
  }
47
78
  async function findPackageJsonFiles(rootDir) {
@@ -1620,35 +1651,6 @@ async function scanOneCsproj(csprojPath, rootDir) {
1620
1651
  };
1621
1652
  }
1622
1653
 
1623
- // src/utils/semaphore.ts
1624
- var Semaphore = class {
1625
- available;
1626
- queue = [];
1627
- constructor(max) {
1628
- this.available = max;
1629
- }
1630
- async run(fn) {
1631
- await this.acquire();
1632
- try {
1633
- return await fn();
1634
- } finally {
1635
- this.release();
1636
- }
1637
- }
1638
- acquire() {
1639
- if (this.available > 0) {
1640
- this.available--;
1641
- return Promise.resolve();
1642
- }
1643
- return new Promise((resolve6) => this.queue.push(resolve6));
1644
- }
1645
- release() {
1646
- const next = this.queue.shift();
1647
- if (next) next();
1648
- else this.available++;
1649
- }
1650
- };
1651
-
1652
1654
  // src/config.ts
1653
1655
  import * as path6 from "path";
1654
1656
  import * as fs2 from "fs/promises";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  runScan,
3
3
  writeJsonFile
4
- } from "./chunk-S4C6KWCP.js";
4
+ } from "./chunk-4N4BALQQ.js";
5
5
 
6
6
  // src/commands/baseline.ts
7
7
  import * as path from "path";
package/dist/cli.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-VXZT34Y5.js";
5
5
  import {
6
6
  baselineCommand
7
- } from "./chunk-QHBZIYWP.js";
7
+ } from "./chunk-POMRKRQN.js";
8
8
  import {
9
9
  VERSION,
10
10
  dsnCommand,
@@ -15,7 +15,7 @@ import {
15
15
  readJsonFile,
16
16
  scanCommand,
17
17
  writeDefaultConfig
18
- } from "./chunk-S4C6KWCP.js";
18
+ } from "./chunk-4N4BALQQ.js";
19
19
 
20
20
  // src/cli.ts
21
21
  import { Command as Command4 } from "commander";
@@ -38,7 +38,7 @@ var initCommand = new Command("init").description("Initialize vibgrate in a proj
38
38
  console.log(chalk.green("\u2714") + ` Created ${chalk.bold("vibgrate.config.ts")}`);
39
39
  }
40
40
  if (opts.baseline) {
41
- const { runBaseline } = await import("./baseline-OPUTCJOQ.js");
41
+ const { runBaseline } = await import("./baseline-RV3GAW72.js");
42
42
  await runBaseline(rootDir);
43
43
  }
44
44
  console.log("");
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  formatText,
8
8
  generateFindings,
9
9
  runScan
10
- } from "./chunk-S4C6KWCP.js";
10
+ } from "./chunk-4N4BALQQ.js";
11
11
  export {
12
12
  computeDriftScore,
13
13
  formatMarkdown,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibgrate/cli",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "CLI for measuring upgrade drift across Node & .NET projects",
5
5
  "type": "module",
6
6
  "bin": {