@noahnu/unused-files 0.2.1 → 0.2.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  <!-- MONOWEAVE:BELOW -->
4
4
 
5
+ ## @noahnu/unused-files (v0.2.2) <a name="0.2.2"></a>
6
+
7
+ Filter out files based on source directories.
8
+
9
+
10
+
5
11
  ## @noahnu/unused-files (v0.2.1) <a name="0.2.1"></a>
6
12
 
7
13
  Respect ignorePatterns for visiting files.
package/lib/api/index.js CHANGED
@@ -50,12 +50,14 @@ async function findUnusedFiles({ entryFiles, ignorePatterns = ['**/node_modules'
50
50
  unvisitedFiles.delete(resolvedDependency);
51
51
  }
52
52
  }
53
+ const unused = Array.from(unvisitedFiles.intersection(files))
54
+ .map((abspath) => node_path_1.default.relative(cwd, abspath))
55
+ .sort();
56
+ const used = Array.from(visitedFiles.intersection(files))
57
+ .map((abspath) => node_path_1.default.relative(cwd, abspath))
58
+ .sort();
53
59
  return {
54
- unused: Array.from(unvisitedFiles)
55
- .map((abspath) => node_path_1.default.relative(cwd, abspath))
56
- .sort(),
57
- used: Array.from(visitedFiles)
58
- .map((abspath) => node_path_1.default.relative(cwd, abspath))
59
- .sort(),
60
+ unused,
61
+ used,
60
62
  };
61
63
  }
@@ -18,6 +18,8 @@ async function* walkDependencyTree(source, { resolvers, visited, depth = DEFAULT
18
18
  debug(`${source}: Unknown file extension '${ext}' [skipping]`);
19
19
  return;
20
20
  }
21
+ // Convert to realpath if possible
22
+ source = await node_fs_1.default.promises.realpath(source).catch(() => source);
21
23
  const visitedSet = visited ?? new Set();
22
24
  if (visitedSet.has(source))
23
25
  return;
package/lib/command.js CHANGED
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.BaseCommand = void 0;
27
37
  const clipanion_1 = require("clipanion");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noahnu/unused-files",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/noahnu/nodejs-tools.git",
@@ -43,7 +43,7 @@
43
43
  "@noahnu/internal-test-utils": "0.0.0",
44
44
  "@types/micromatch": "^4.0.9",
45
45
  "@types/node": "^22.9.0",
46
- "typescript": "^5.6.3"
46
+ "typescript": "^5.7.2"
47
47
  },
48
48
  "types": "./lib/api/index.d.ts"
49
49
  }