@noahnu/unused-files 0.3.7 → 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 +7 -23
- package/README.md +14 -14
- package/lib/api/index.mjs +2 -2
- package/lib/command.mjs +2 -6
- package/package.json +7 -6
package/CHANGELOG.md
CHANGED
|
@@ -2,72 +2,56 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- MONOWEAVE:BELOW -->
|
|
4
4
|
|
|
5
|
-
## @noahnu/unused-files (v0.3.
|
|
5
|
+
## @noahnu/unused-files (v0.3.8) <a name="0.3.8"></a>
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Dependency updates.
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
## @noahnu/unused-files (v0.3.
|
|
11
|
+
## @noahnu/unused-files (v0.3.7) <a name="0.3.7"></a>
|
|
12
12
|
|
|
13
|
-
|
|
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
19
|
## @noahnu/unused-files (v0.3.5) <a name="0.3.5"></a>
|
|
18
20
|
|
|
19
21
|
Routine dependency updates.
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
23
|
## @noahnu/unused-files (v0.3.4) <a name="0.3.4"></a>
|
|
24
24
|
|
|
25
25
|
Release
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
27
|
## @noahnu/unused-files (v0.3.0) <a name="0.3.0"></a>
|
|
30
28
|
|
|
31
29
|
Migrate to ESM.
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
|
|
35
31
|
## @noahnu/unused-files (v0.2.3) <a name="0.2.3"></a>
|
|
36
32
|
|
|
37
33
|
Ignore builtins.
|
|
38
34
|
|
|
39
|
-
|
|
40
|
-
|
|
41
35
|
## @noahnu/unused-files (v0.2.2) <a name="0.2.2"></a>
|
|
42
36
|
|
|
43
37
|
Filter out files based on source directories.
|
|
44
38
|
|
|
45
|
-
|
|
46
|
-
|
|
47
39
|
## @noahnu/unused-files (v0.2.1) <a name="0.2.1"></a>
|
|
48
40
|
|
|
49
41
|
Respect ignorePatterns for visiting files.
|
|
50
42
|
|
|
51
|
-
|
|
52
|
-
|
|
53
43
|
## @noahnu/unused-files (v0.2.0) <a name="0.2.0"></a>
|
|
54
44
|
|
|
55
45
|
Support custom resolvers.
|
|
56
46
|
|
|
57
|
-
|
|
58
|
-
|
|
59
47
|
## @noahnu/unused-files (v0.0.2) <a name="0.0.2"></a>
|
|
60
48
|
|
|
61
49
|
Update ESLint config and plugins to ESLint v9.
|
|
62
50
|
|
|
63
51
|
Update misc. dependencies.
|
|
64
52
|
|
|
65
|
-
|
|
66
|
-
|
|
67
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>
|
|
68
54
|
|
|
69
55
|
### Bug Fixes
|
|
70
56
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
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.
|
|
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.
|
|
33
|
+
"@noahnu/dependency-utils": "^0.0.9",
|
|
34
34
|
"@types/debug": "^4.1.12",
|
|
35
|
-
"@typescript-eslint/typescript-estree": "^8.
|
|
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
|
-
"@
|
|
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": "^25.
|
|
47
|
-
"typescript": "^
|
|
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
|
}
|