@noahnu/unused-files 0.3.6 → 0.3.8

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,66 +2,56 @@
2
2
 
3
3
  <!-- MONOWEAVE:BELOW -->
4
4
 
5
- ## @noahnu/unused-files (v0.3.6) <a name="0.3.6"></a>
5
+ ## @noahnu/unused-files (v0.3.8) <a name="0.3.8"></a>
6
6
 
7
- Release (no changes).
7
+ Dependency updates.
8
8
 
9
9
 
10
10
 
11
- ## @noahnu/unused-files (v0.3.5) <a name="0.3.5"></a>
11
+ ## @noahnu/unused-files (v0.3.7) <a name="0.3.7"></a>
12
12
 
13
- Routine dependency updates.
13
+ Add option to include top level workspace in dependency checker.
14
14
 
15
+ ## @noahnu/unused-files (v0.3.6) <a name="0.3.6"></a>
15
16
 
17
+ Release (no changes).
16
18
 
17
- ## @noahnu/unused-files (v0.3.4) <a name="0.3.4"></a>
19
+ ## @noahnu/unused-files (v0.3.5) <a name="0.3.5"></a>
18
20
 
19
- Release
21
+ Routine dependency updates.
20
22
 
23
+ ## @noahnu/unused-files (v0.3.4) <a name="0.3.4"></a>
21
24
 
25
+ Release
22
26
 
23
27
  ## @noahnu/unused-files (v0.3.0) <a name="0.3.0"></a>
24
28
 
25
29
  Migrate to ESM.
26
30
 
27
-
28
-
29
31
  ## @noahnu/unused-files (v0.2.3) <a name="0.2.3"></a>
30
32
 
31
33
  Ignore builtins.
32
34
 
33
-
34
-
35
35
  ## @noahnu/unused-files (v0.2.2) <a name="0.2.2"></a>
36
36
 
37
37
  Filter out files based on source directories.
38
38
 
39
-
40
-
41
39
  ## @noahnu/unused-files (v0.2.1) <a name="0.2.1"></a>
42
40
 
43
41
  Respect ignorePatterns for visiting files.
44
42
 
45
-
46
-
47
43
  ## @noahnu/unused-files (v0.2.0) <a name="0.2.0"></a>
48
44
 
49
45
  Support custom resolvers.
50
46
 
51
-
52
-
53
47
  ## @noahnu/unused-files (v0.0.2) <a name="0.0.2"></a>
54
48
 
55
49
  Update ESLint config and plugins to ESLint v9.
56
50
 
57
51
  Update misc. dependencies.
58
52
 
59
-
60
-
61
53
  ## [0.0.1](https://github.com/noahnu/nodejs-tools/compare/@noahnu/unused-files@0.0.0...@noahnu/unused-files@0.0.1) "@noahnu/unused-files" (2024-01-15)<a name="0.0.1"></a>
62
54
 
63
55
  ### Bug Fixes
64
56
 
65
- * initial release ([f2f8e6b](https://github.com/noahnu/nodejs-tools/commits/f2f8e6b))
66
-
67
-
57
+ - initial release ([f2f8e6b](https://github.com/noahnu/nodejs-tools/commits/f2f8e6b))
package/README.md CHANGED
@@ -12,20 +12,20 @@ Or use the Node API:
12
12
  import { findUnusedFiles } from '@noahnu/unused-files'
13
13
 
14
14
  const result = await findUnusedFiles({
15
- entryFiles: ['src/index.ts'],
16
-
17
- // optional
18
- sourceDirectories: [process.cwd()],
19
- ignorePatterns: ['**/node_modules'],
20
- resolvers: [
21
- async ({ request, context }) => {
22
- if (request === '@my/alias') {
23
- return { result: 'path/to/file/index.ts' }
24
- }
25
- return null;
26
- }
27
- ],
28
- depth: 10,
15
+ entryFiles: ['src/index.ts'],
16
+
17
+ // optional
18
+ sourceDirectories: [process.cwd()],
19
+ ignorePatterns: ['**/node_modules'],
20
+ resolvers: [
21
+ async ({ request, context }) => {
22
+ if (request === '@my/alias') {
23
+ return { result: 'path/to/file/index.ts' }
24
+ }
25
+ return null
26
+ },
27
+ ],
28
+ depth: 10,
29
29
  })
30
30
 
31
31
  console.log(result.unusedFiles.join('\n'))
package/lib/api/index.mjs CHANGED
@@ -46,10 +46,10 @@ export async function findUnusedFiles({ entryFiles, ignorePatterns = ['**/node_m
46
46
  }
47
47
  const unused = Array.from(unvisitedFiles.intersection(files))
48
48
  .map((abspath) => path.relative(cwd, abspath))
49
- .sort();
49
+ .sort((a, b) => a.localeCompare(b));
50
50
  const used = Array.from(visitedFiles.intersection(files))
51
51
  .map((abspath) => path.relative(cwd, abspath))
52
- .sort();
52
+ .sort((a, b) => a.localeCompare(b));
53
53
  return {
54
54
  unused,
55
55
  used,
package/lib/command.mjs CHANGED
@@ -24,12 +24,8 @@ export class BaseCommand extends Command {
24
24
  const result = await findUnusedFiles({
25
25
  entryFiles: this.entryFiles,
26
26
  ignorePatterns: this.ignorePatterns,
27
- sourceDirectories: this.sourceDirectories.length
28
- ? this.sourceDirectories
29
- : [process.cwd()],
30
- depth: typeof this.depth === 'undefined'
31
- ? -1
32
- : parseInt(Math.max(this.depth, -1).toFixed(0), 10),
27
+ sourceDirectories: this.sourceDirectories.length ? this.sourceDirectories : [process.cwd()],
28
+ depth: typeof this.depth === 'undefined' ? -1 : parseInt(Math.max(this.depth, -1).toFixed(0), 10),
33
29
  });
34
30
  this.context.stdout.write(result.unused.join('\n'));
35
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noahnu/unused-files",
3
- "version": "0.3.6",
3
+ "version": "0.3.8",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/noahnu/nodejs-tools.git",
@@ -30,9 +30,9 @@
30
30
  "lib"
31
31
  ],
32
32
  "dependencies": {
33
- "@noahnu/dependency-utils": "^0.0.7",
33
+ "@noahnu/dependency-utils": "^0.0.9",
34
34
  "@types/debug": "^4.1.12",
35
- "@typescript-eslint/typescript-estree": "^8.47.0",
35
+ "@typescript-eslint/typescript-estree": "^8.61.1",
36
36
  "clipanion": "^4.0.0-rc.4",
37
37
  "debug": "^4.4.3",
38
38
  "fast-glob": "^3.3.3",
@@ -40,11 +40,12 @@
40
40
  "typanion": "^3.14.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@jest/globals": "^30.2.0",
43
+ "@noahnu/dependency-utils": "0.0.9",
44
44
  "@noahnu/internal-test-utils": "0.0.0",
45
45
  "@types/micromatch": "^4.0.10",
46
- "@types/node": "^24.10.1",
47
- "typescript": "^5.9.3"
46
+ "@types/node": "^25.3.0",
47
+ "typescript": "^6.0.3",
48
+ "vitest": "^4.1.9"
48
49
  },
49
50
  "types": "./lib/api/index.d.mts"
50
51
  }