view-ignored 0.3.2 → 0.4.0
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/LICENSE.txt +21 -21
- package/README.md +95 -95
- package/out/package.json +19 -19
- package/out/src/browser/binds/index.js +1 -1
- package/out/src/browser/binds/plugins/git.js +4 -4
- package/out/src/browser/binds/plugins/npm.js +2 -2
- package/out/src/browser/binds/plugins/vsce.js +2 -2
- package/out/src/browser/binds/plugins/yarn.js +1 -2
- package/out/src/browser/binds/scanner.js +1 -1
- package/out/src/browser/binds/targets.d.ts +2 -2
- package/out/src/browser/binds/targets.js +1 -1
- package/out/src/browser/fs/directory.d.ts +3 -3
- package/out/src/browser/fs/directory.js +2 -2
- package/out/src/browser/fs/file-info.js +13 -9
- package/out/src/browser/lib.js +1 -1
- package/out/src/cli.js +11 -8
- package/out/src/config.js +20 -5
- package/package.json +19 -19
package/LICENSE.txt
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 Mopsgamer
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Mopsgamer
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
# view-ignored
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/view-ignored)
|
|
4
|
-
[](https://www.npmjs.com/package/view-ignored)
|
|
5
|
-
[](https://github.com/Mopsgamer/view-ignored)
|
|
6
|
-
[](https://github.com/Mopsgamer/view-ignored/issues)
|
|
7
|
-
|
|
8
|
-
Retrieve list of files ignored/included by Git, NPM, Yarn and VSC Extension.
|
|
9
|
-
|
|
10
|
-
## Highlights
|
|
11
|
-
|
|
12
|
-
- **Multi-target.** Get list of included files, using configuration files reader, not command-line wrapper.
|
|
13
|
-
- **Use in browser.** view-ignored supports file system adapter.
|
|
14
|
-
- **Command-line.** Supports no-color and multiple output styles, including [nerd fonts](https://github.com/ryanoasis/nerd-fonts).
|
|
15
|
-
- **Plugins.** view-ignored allows you to add new [targets](#targets) programmatically. Command-line interface supports plugins throught `--plugin` option.
|
|
16
|
-
|
|
17
|
-
## Install
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
npm i view-ignored
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Usage
|
|
24
|
-
|
|
25
|
-
### Command-line
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
# get started
|
|
29
|
-
npm i -g view-ignored
|
|
30
|
-
viewig --help
|
|
31
|
-
view-ignored --help
|
|
32
|
-
|
|
33
|
-
# scan: git (default) and npm
|
|
34
|
-
viewig scan .
|
|
35
|
-
viewig scan . --target=npm
|
|
36
|
-
viewig scan . --parsable
|
|
37
|
-
|
|
38
|
-
# scan: plugins (space, comma or pipe separated)
|
|
39
|
-
# all built-in plugins loaded automatically
|
|
40
|
-
viewig scan . --plugins="example1, example2"
|
|
41
|
-
viewig scan . --plugins="example1 example2"
|
|
42
|
-
viewig scan . --plugins example1 example2
|
|
43
|
-
viewig scan . --plugins example1, example2
|
|
44
|
-
|
|
45
|
-
# config: print configuration entries
|
|
46
|
-
viewig config get
|
|
47
|
-
viewig config get --real
|
|
48
|
-
# config: set npm as default target and scan for npm
|
|
49
|
-
viewig config set target=npm
|
|
50
|
-
viewig scan .
|
|
51
|
-
# config: always use nerdfonts
|
|
52
|
-
viewig config set style=tree
|
|
53
|
-
# config: always use nerdfonts
|
|
54
|
-
viewig config set decor=nerdfonts
|
|
55
|
-
# config: always use plugins
|
|
56
|
-
viewig config set plugins=example1,example2
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### Programmatically
|
|
60
|
-
|
|
61
|
-
All you need it to add
|
|
62
|
-
|
|
63
|
-
```js
|
|
64
|
-
import * as vign from "view-ignored"; // or "view-ignored/browser"
|
|
65
|
-
|
|
66
|
-
await vign.Plugins.loadBuiltIns(["git", "npm"]); // load built-in plugins
|
|
67
|
-
await vign.Plugins.loadBuiltIns(); // load all built-in plugins
|
|
68
|
-
await vign.Plugins.loadPlugins(["example"]); // load third-party plugins
|
|
69
|
-
|
|
70
|
-
// scan - options available
|
|
71
|
-
const fileInfoList = await vign.scan(".", { target: "git", cwd: process.cwd() });
|
|
72
|
-
const fileInfoList = await vign.scan(["./path/to/file"], { target: "git", process.cwd() });
|
|
73
|
-
|
|
74
|
-
// use results
|
|
75
|
-
if (fileInfo.ignored) {
|
|
76
|
-
superCodeEditor.explorer.colorFile(fileInfo.relativePath, "gray");
|
|
77
|
-
}
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
#### Sorting
|
|
81
|
-
|
|
82
|
-
```js
|
|
83
|
-
const sorter = vign.Sorting.firstFolders;
|
|
84
|
-
const fileInfoList = await vign.scan(".", {target: "npm"});
|
|
85
|
-
const fileInfoSorted = fileInfoList.sort((a, b) => sorter(String(a), String(b)));
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
### Targets
|
|
89
|
-
|
|
90
|
-
- `git`
|
|
91
|
-
- `npm` (use it for PNPM and Bun)
|
|
92
|
-
- `yarn`
|
|
93
|
-
- `vsce`
|
|
94
|
-
- `jsr` *planned*
|
|
95
|
-
- `deno` *planned*
|
|
1
|
+
# view-ignored
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/view-ignored)
|
|
4
|
+
[](https://www.npmjs.com/package/view-ignored)
|
|
5
|
+
[](https://github.com/Mopsgamer/view-ignored)
|
|
6
|
+
[](https://github.com/Mopsgamer/view-ignored/issues)
|
|
7
|
+
|
|
8
|
+
Retrieve list of files ignored/included by Git, NPM, Yarn and VSC Extension.
|
|
9
|
+
|
|
10
|
+
## Highlights
|
|
11
|
+
|
|
12
|
+
- **Multi-target.** Get list of included files, using configuration files reader, not command-line wrapper.
|
|
13
|
+
- **Use in browser.** view-ignored supports file system adapter.
|
|
14
|
+
- **Command-line.** Supports no-color and multiple output styles, including [nerd fonts](https://github.com/ryanoasis/nerd-fonts).
|
|
15
|
+
- **Plugins.** view-ignored allows you to add new [targets](#targets) programmatically. Command-line interface supports plugins throught `--plugin` option.
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm i view-ignored
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
### Command-line
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# get started
|
|
29
|
+
npm i -g view-ignored
|
|
30
|
+
viewig --help
|
|
31
|
+
view-ignored --help
|
|
32
|
+
|
|
33
|
+
# scan: git (default) and npm
|
|
34
|
+
viewig scan .
|
|
35
|
+
viewig scan . --target=npm
|
|
36
|
+
viewig scan . --parsable
|
|
37
|
+
|
|
38
|
+
# scan: plugins (space, comma or pipe separated)
|
|
39
|
+
# all built-in plugins loaded automatically
|
|
40
|
+
viewig scan . --plugins="example1, example2"
|
|
41
|
+
viewig scan . --plugins="example1 example2"
|
|
42
|
+
viewig scan . --plugins example1 example2
|
|
43
|
+
viewig scan . --plugins example1, example2
|
|
44
|
+
|
|
45
|
+
# config: print configuration entries
|
|
46
|
+
viewig config get
|
|
47
|
+
viewig config get --real
|
|
48
|
+
# config: set npm as default target and scan for npm
|
|
49
|
+
viewig config set target=npm
|
|
50
|
+
viewig scan .
|
|
51
|
+
# config: always use nerdfonts
|
|
52
|
+
viewig config set style=tree
|
|
53
|
+
# config: always use nerdfonts
|
|
54
|
+
viewig config set decor=nerdfonts
|
|
55
|
+
# config: always use plugins
|
|
56
|
+
viewig config set plugins=example1,example2
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Programmatically
|
|
60
|
+
|
|
61
|
+
All you need it to add
|
|
62
|
+
|
|
63
|
+
```js
|
|
64
|
+
import * as vign from "view-ignored"; // or "view-ignored/browser"
|
|
65
|
+
|
|
66
|
+
await vign.Plugins.loadBuiltIns(["git", "npm"]); // load built-in plugins
|
|
67
|
+
await vign.Plugins.loadBuiltIns(); // load all built-in plugins
|
|
68
|
+
await vign.Plugins.loadPlugins(["example"]); // load third-party plugins
|
|
69
|
+
|
|
70
|
+
// scan - options available
|
|
71
|
+
const fileInfoList = await vign.scan(".", { target: "git", cwd: process.cwd() });
|
|
72
|
+
const fileInfoList = await vign.scan(["./path/to/file"], { target: "git", cwd: process.cwd() });
|
|
73
|
+
|
|
74
|
+
// use results
|
|
75
|
+
if (fileInfo.ignored) {
|
|
76
|
+
superCodeEditor.explorer.colorFile(fileInfo.relativePath, "gray");
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
#### Sorting
|
|
81
|
+
|
|
82
|
+
```js
|
|
83
|
+
const sorter = vign.Sorting.firstFolders;
|
|
84
|
+
const fileInfoList = await vign.scan(".", {target: "npm"});
|
|
85
|
+
const fileInfoSorted = fileInfoList.sort((a, b) => sorter(String(a), String(b)));
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Targets
|
|
89
|
+
|
|
90
|
+
- `git`
|
|
91
|
+
- `npm` (use it for PNPM and Bun)
|
|
92
|
+
- `yarn`
|
|
93
|
+
- `vsce`
|
|
94
|
+
- `jsr` *planned*
|
|
95
|
+
- `deno` *planned*
|
package/out/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "view-ignored",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Retrieve list of files ignored/included by Git, NPM, Yarn and VSC Extension.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -78,32 +78,32 @@
|
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
80
|
"@humanwhocodes/gitignore-to-minimatch": "^1.0.2",
|
|
81
|
-
"@m234/nerd-fonts": "^0.
|
|
81
|
+
"@m234/nerd-fonts": "^0.3.0",
|
|
82
82
|
"ansi-regex": "^6.1.0",
|
|
83
83
|
"boxen": "^8.0.1",
|
|
84
|
-
"chalk": "^5.
|
|
85
|
-
"commander": "^
|
|
84
|
+
"chalk": "^5.4.1",
|
|
85
|
+
"commander": "^14.0.0",
|
|
86
86
|
"jsonify-paths": "^1.1.0",
|
|
87
|
-
"listr2": "^8.
|
|
87
|
+
"listr2": "^8.3.3",
|
|
88
88
|
"load-plugin": "^6.0.3",
|
|
89
|
-
"minimatch": "^10.0.
|
|
90
|
-
"p-limit": "^6.
|
|
89
|
+
"minimatch": "^10.0.3",
|
|
90
|
+
"p-limit": "^6.2.0",
|
|
91
91
|
"treeify": "^1.1.0",
|
|
92
|
-
"tslib": "^2.
|
|
93
|
-
"yaml": "^2.
|
|
92
|
+
"tslib": "^2.8.1",
|
|
93
|
+
"yaml": "^2.8.0"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
|
96
|
-
"@release-it/keep-a-changelog": "^
|
|
97
|
-
"@types/mocha": "^10.0.
|
|
98
|
-
"@types/node": "^
|
|
96
|
+
"@release-it/keep-a-changelog": "^7.0.0",
|
|
97
|
+
"@types/mocha": "^10.0.10",
|
|
98
|
+
"@types/node": "^24.0.3",
|
|
99
99
|
"@types/treeify": "^1.0.3",
|
|
100
|
-
"fs-fixture": "^2.
|
|
101
|
-
"globals": "^
|
|
102
|
-
"mocha": "^
|
|
103
|
-
"release-it": "^
|
|
104
|
-
"shx": "^0.
|
|
105
|
-
"typescript": "^5.
|
|
106
|
-
"xo": "^
|
|
100
|
+
"fs-fixture": "^2.8.1",
|
|
101
|
+
"globals": "^16.2.0",
|
|
102
|
+
"mocha": "^11.7.0",
|
|
103
|
+
"release-it": "^19.0.3",
|
|
104
|
+
"shx": "^0.4.0",
|
|
105
|
+
"typescript": "^5.8.3",
|
|
106
|
+
"xo": "^1.1.0"
|
|
107
107
|
},
|
|
108
108
|
"keywords": [
|
|
109
109
|
"tree",
|
|
@@ -85,7 +85,7 @@ export function loadBuiltIn(builtIn) {
|
|
|
85
85
|
* @returns The import result for the list of modules.
|
|
86
86
|
* @public
|
|
87
87
|
*/
|
|
88
|
-
export async function loadBuiltIns(builtInList =
|
|
88
|
+
export async function loadBuiltIns(builtInList = [...builtInNameList]) {
|
|
89
89
|
const limit = pLimit(5);
|
|
90
90
|
const allLoaded = await Promise.all(builtInList.map(modulePath => limit(() => loadBuiltIn(modulePath))));
|
|
91
91
|
return allLoaded;
|
|
@@ -3,7 +3,7 @@ import { File, NoSourceError, SourceInfo, InvalidPatternError, Directory, } from
|
|
|
3
3
|
import { ScannerGitignore } from '../scanner.js';
|
|
4
4
|
const id = 'git';
|
|
5
5
|
const name = 'Git';
|
|
6
|
-
const icon = { ...icons['nf-seti-git'], color:
|
|
6
|
+
const icon = { ...icons['nf-seti-git'], color: '#F44E28' };
|
|
7
7
|
const testCommand = 'git ls-tree -r <git-branch-name> --name-only';
|
|
8
8
|
/**
|
|
9
9
|
* @private
|
|
@@ -36,11 +36,11 @@ export function useSourceFile(map, sourceFile, scanner) {
|
|
|
36
36
|
export const methodologyGitignoreLike = (base) => function (tree, o) {
|
|
37
37
|
const sourceList = tree.deep(File).filter(dirent => dirent.base === base);
|
|
38
38
|
const map = new Map();
|
|
39
|
+
if (sourceList.length === 0) {
|
|
40
|
+
throw new NoSourceError(base);
|
|
41
|
+
}
|
|
39
42
|
for (const sourceFile of sourceList) {
|
|
40
43
|
const scanner = new ScannerGitignore({ exclude: matcherExclude });
|
|
41
|
-
if (sourceFile === undefined) {
|
|
42
|
-
throw new NoSourceError(base);
|
|
43
|
-
}
|
|
44
44
|
const content = o.modules.fs.readFileSync(sourceFile.absolutePath).toString();
|
|
45
45
|
const pattern = content;
|
|
46
46
|
if (!scanner.isValid(pattern)) {
|
|
@@ -4,7 +4,7 @@ import { ScannerGitignore } from '../scanner.js';
|
|
|
4
4
|
import * as git from './git.js';
|
|
5
5
|
const id = 'npm';
|
|
6
6
|
const name = 'NPM';
|
|
7
|
-
const icon = { ...icons['nf-seti-npm'], color:
|
|
7
|
+
const icon = { ...icons['nf-seti-npm'], color: '#CA0404' };
|
|
8
8
|
const testCommand = 'npm pack --dry-run';
|
|
9
9
|
/**
|
|
10
10
|
* @private
|
|
@@ -53,7 +53,7 @@ export function isValidManifest(value) {
|
|
|
53
53
|
* @private
|
|
54
54
|
*/
|
|
55
55
|
export function useChildren(tree, map, getMap) {
|
|
56
|
-
for (const child of
|
|
56
|
+
for (const child of tree.children.values()) {
|
|
57
57
|
if (!(child instanceof Directory)) {
|
|
58
58
|
continue;
|
|
59
59
|
}
|
|
@@ -3,7 +3,7 @@ import { NoSourceError, File, BadSourceError, } from '../../index.js';
|
|
|
3
3
|
import * as git from './git.js';
|
|
4
4
|
const id = 'vsce';
|
|
5
5
|
const name = 'VSCE';
|
|
6
|
-
const icon = { ...icons['nf-md-microsoft_visual_studio_code'], color:
|
|
6
|
+
const icon = { ...icons['nf-md-microsoft_visual_studio_code'], color: '#23A9F1' };
|
|
7
7
|
const testCommand = 'vsce ls';
|
|
8
8
|
/**
|
|
9
9
|
* @private
|
|
@@ -32,7 +32,7 @@ export function isValidManifest(value) {
|
|
|
32
32
|
* @private
|
|
33
33
|
*/
|
|
34
34
|
export const methodologyManifestVsce = function (tree, o) {
|
|
35
|
-
const packageJson =
|
|
35
|
+
const packageJson = [...tree.deepIterator()].find(dirent => dirent instanceof File && dirent.base === 'package.json');
|
|
36
36
|
if (packageJson === undefined) {
|
|
37
37
|
throw new NoSourceError('package.json');
|
|
38
38
|
}
|
|
@@ -3,8 +3,7 @@ import { ScannerGitignore } from '../scanner.js';
|
|
|
3
3
|
import * as npm from './npm.js';
|
|
4
4
|
const id = 'yarn';
|
|
5
5
|
const name = 'Yarn';
|
|
6
|
-
const icon = { ...icons['nf-seti-yarn'], color:
|
|
7
|
-
// FIXME: Yarn can all this stuff another way.
|
|
6
|
+
const icon = { ...icons['nf-seti-yarn'], color: '#2E2A65' };
|
|
8
7
|
/**
|
|
9
8
|
* @private
|
|
10
9
|
*/
|
|
@@ -36,9 +36,9 @@ export type DeepStreamProgress = {
|
|
|
36
36
|
* @public
|
|
37
37
|
*/
|
|
38
38
|
export type DeepStreamEventMap = {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
data: [DeepStreamData];
|
|
40
|
+
end: [DeepStreamDataRoot];
|
|
41
|
+
progress: [DeepStreamProgress];
|
|
42
42
|
};
|
|
43
43
|
/**
|
|
44
44
|
* @public
|
|
@@ -79,7 +79,7 @@ export class Directory {
|
|
|
79
79
|
tree.set(file.base, file);
|
|
80
80
|
return tree;
|
|
81
81
|
}
|
|
82
|
-
let directory =
|
|
82
|
+
let directory = [...tree.children.values()].find(c => c instanceof Directory && c.absolutePath === absolutePath);
|
|
83
83
|
if (directory === undefined) {
|
|
84
84
|
directory = new Directory(tree, relativePath, absolutePath, new Map());
|
|
85
85
|
tree.set(`${directory.base}/`, directory);
|
|
@@ -198,7 +198,7 @@ export class Directory {
|
|
|
198
198
|
* @param instanceOf Optionally filter children by type.
|
|
199
199
|
*/
|
|
200
200
|
deep(instanceOf) {
|
|
201
|
-
return
|
|
201
|
+
return [...Directory.deepIterator(this, instanceOf)];
|
|
202
202
|
}
|
|
203
203
|
/**
|
|
204
204
|
* @returns The relative path to the directory.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import PATH from 'node:path';
|
|
2
|
-
import nf from '@m234/nerd-fonts';
|
|
2
|
+
import * as nf from '@m234/nerd-fonts';
|
|
3
3
|
import { decorCondition } from '../styling.js';
|
|
4
4
|
import { File } from './file.js';
|
|
5
5
|
/**
|
|
@@ -34,7 +34,8 @@ export class FileInfo extends File {
|
|
|
34
34
|
source) {
|
|
35
35
|
super(parent, relativePath, absolutePath);
|
|
36
36
|
this.source = source;
|
|
37
|
-
this.status = source === undefined
|
|
37
|
+
this.status = source === undefined
|
|
38
|
+
? 'non-target'
|
|
38
39
|
: (source.scanner.ignores(relativePath) ? 'ignored' : 'included');
|
|
39
40
|
}
|
|
40
41
|
/**
|
|
@@ -45,18 +46,21 @@ export class FileInfo extends File {
|
|
|
45
46
|
const { fileIcon, chalk, usePrefix = false, source: useSource = false, entire = true, posix = false } = options ?? {};
|
|
46
47
|
const patha = posix ? PATH.posix : PATH;
|
|
47
48
|
const parsed = PATH.parse(this.relativePath);
|
|
48
|
-
const glyph = nf.
|
|
49
|
-
const fIcon = fileIcon
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
const glyph = nf.Seti.fromParsedPath(parsed);
|
|
50
|
+
const fIcon = fileIcon
|
|
51
|
+
? decorCondition(fileIcon, {
|
|
52
|
+
ifEmoji: '📄',
|
|
53
|
+
ifNerd: chalk && glyph.color !== undefined ? chalk.hex(glyph.color)(glyph.value) : glyph.value,
|
|
54
|
+
postfix: ' ',
|
|
55
|
+
})
|
|
56
|
+
: '';
|
|
54
57
|
let prefix = usePrefix && this.status !== 'non-target' ? (this.status === 'ignored' ? '!' : '+') : '';
|
|
55
58
|
let postfix = useSource && this.source !== undefined ? ' < ' + this.source.toString() : '';
|
|
56
59
|
if (chalk) {
|
|
57
60
|
prefix = chalk.dim(prefix);
|
|
58
61
|
postfix = chalk.dim(postfix);
|
|
59
|
-
const clr = this.status === 'non-target'
|
|
62
|
+
const clr = this.status === 'non-target'
|
|
63
|
+
? chalk.white
|
|
60
64
|
: (this.status === 'included' ? chalk.green : chalk.white);
|
|
61
65
|
if (entire) {
|
|
62
66
|
return fIcon + clr(prefix + this.relativePath + postfix);
|
package/out/src/browser/lib.js
CHANGED
|
@@ -49,7 +49,7 @@ export async function scan(argument0, options) {
|
|
|
49
49
|
const fileInfoList = [];
|
|
50
50
|
const promiseList = [];
|
|
51
51
|
const cacheDirectories = new Map();
|
|
52
|
-
for (const directory of [tree
|
|
52
|
+
for (const directory of [tree, ...tree.deep(Directory)]) {
|
|
53
53
|
cacheDirectories.set(directory, pLimit(optionsReal.concurrency));
|
|
54
54
|
}
|
|
55
55
|
for (const entry of tree.deepIterator(File)) {
|
package/out/src/cli.js
CHANGED
|
@@ -31,7 +31,7 @@ export async function programInit() {
|
|
|
31
31
|
const loadResultConfig = configManager.load();
|
|
32
32
|
const builtInPlugins = await loadBuiltIns();
|
|
33
33
|
const configPlugins = configManager.get('plugins');
|
|
34
|
-
const loadResultPlugins = (flags.plugins ? await loadPlugins(flags.plugins) : [])
|
|
34
|
+
const loadResultPlugins = [...(flags.plugins ? await loadPlugins(flags.plugins) : []), ...builtInPlugins];
|
|
35
35
|
for (const loadResult of loadResultPlugins) {
|
|
36
36
|
if (loadResult.isLoaded) {
|
|
37
37
|
continue;
|
|
@@ -48,9 +48,9 @@ export async function programInit() {
|
|
|
48
48
|
configManager.keySetValidator('target', configDefault.target, configValueLiteral(targets));
|
|
49
49
|
{
|
|
50
50
|
const title = 'view-ignored - Configuration loading failed.';
|
|
51
|
-
const infoSymbol = decorCondition(flags.decor, { ifEmoji: 'ℹ️', ifNerd: icons['nf-seti-info'].
|
|
51
|
+
const infoSymbol = decorCondition(flags.decor, { ifEmoji: 'ℹ️', ifNerd: icons['nf-seti-info'].value, postfix: ' ' });
|
|
52
52
|
const errorIcon = decorCondition(flags.decor, {
|
|
53
|
-
ifNerd: icons['nf-seti-error'].
|
|
53
|
+
ifNerd: icons['nf-seti-error'].value, ifEmoji: '⚠️', postfix: ' ',
|
|
54
54
|
});
|
|
55
55
|
const footer = `\n\n${chalk.blue(infoSymbol)}Configuration path: ${Config.configManager.path}`;
|
|
56
56
|
if (typeof loadResultConfig === 'string') {
|
|
@@ -58,7 +58,10 @@ export async function programInit() {
|
|
|
58
58
|
process.exit(1);
|
|
59
59
|
}
|
|
60
60
|
if (loadResultConfig && loadResultConfig?.size > 0) {
|
|
61
|
-
const propertiesErrors =
|
|
61
|
+
const propertiesErrors = [...loadResultConfig.entries()].map(([key, message]) => {
|
|
62
|
+
const pair = Config.configManager.getPairString(key, { chalk, types: false, real: true });
|
|
63
|
+
return `${pair} - ${chalk.red(errorIcon)}${message}`;
|
|
64
|
+
}).join('\n');
|
|
62
65
|
logError(`Invalid properties:\n${propertiesErrors}${footer}`, { title });
|
|
63
66
|
process.exit(1);
|
|
64
67
|
}
|
|
@@ -249,9 +252,9 @@ export async function actionScan() {
|
|
|
249
252
|
console.log(fileInfoList.map(fileInfo => fileInfo.relativePath + (flags.showSources && fileInfo.source !== undefined ? '<' + (fileInfo.source.relativePath) : '')).join(','));
|
|
250
253
|
}
|
|
251
254
|
else {
|
|
252
|
-
let name = decorCondition(flags.decor, { ifNerd: bind.icon?.
|
|
255
|
+
let name = decorCondition(flags.decor, { ifNerd: bind.icon?.value, postfix: ' ' }) + bind.name;
|
|
253
256
|
if (bind.icon?.color !== undefined) {
|
|
254
|
-
name = chalk.hex('#' + bind.icon.color
|
|
257
|
+
name = chalk.hex('#' + bind.icon.color)(name);
|
|
255
258
|
}
|
|
256
259
|
const context = {
|
|
257
260
|
count: {
|
|
@@ -307,8 +310,8 @@ export async function actionScan() {
|
|
|
307
310
|
decor: flags.decor,
|
|
308
311
|
showSources: flags.showSources,
|
|
309
312
|
});
|
|
310
|
-
const fastSymbol = decorCondition(flags.decor, { ifEmoji: '⚡', ifNerd: icons['nf-md-lightning_bolt'].
|
|
311
|
-
const infoSymbol = decorCondition(flags.decor, { ifEmoji: 'ℹ️', ifNerd: icons['nf-seti-info'].
|
|
313
|
+
const fastSymbol = decorCondition(flags.decor, { ifEmoji: '⚡', ifNerd: icons['nf-md-lightning_bolt'].value });
|
|
314
|
+
const infoSymbol = decorCondition(flags.decor, { ifEmoji: 'ℹ️', ifNerd: icons['nf-seti-info'].value, postfix: ' ' });
|
|
312
315
|
let message = '';
|
|
313
316
|
message += files;
|
|
314
317
|
message += '\n';
|
package/out/src/config.js
CHANGED
|
@@ -21,7 +21,20 @@ const configFilePath = path.join(os.homedir(), configFileName);
|
|
|
21
21
|
* Command-line configuration property list.
|
|
22
22
|
* @public
|
|
23
23
|
*/
|
|
24
|
-
export const configKeyList = [
|
|
24
|
+
export const configKeyList = [
|
|
25
|
+
'posix',
|
|
26
|
+
'noColor',
|
|
27
|
+
'target',
|
|
28
|
+
'filter',
|
|
29
|
+
'sort',
|
|
30
|
+
'style',
|
|
31
|
+
'decor',
|
|
32
|
+
'depth',
|
|
33
|
+
'showSources',
|
|
34
|
+
'plugins',
|
|
35
|
+
'parsable',
|
|
36
|
+
'concurrency',
|
|
37
|
+
];
|
|
25
38
|
/**
|
|
26
39
|
* @public
|
|
27
40
|
*/
|
|
@@ -91,7 +104,7 @@ export const switchFalseValues = ['false', 'off', 'no', 'n', 'disable', 'disable
|
|
|
91
104
|
/**
|
|
92
105
|
* @public
|
|
93
106
|
*/
|
|
94
|
-
export const booleanValues = switchTrueValues
|
|
107
|
+
export const booleanValues = [...switchTrueValues, ...switchFalseValues];
|
|
95
108
|
/**
|
|
96
109
|
* @public
|
|
97
110
|
*/
|
|
@@ -242,7 +255,7 @@ export class ConfigManager {
|
|
|
242
255
|
if (this.configValidation.has(key)) {
|
|
243
256
|
return;
|
|
244
257
|
}
|
|
245
|
-
return `Unknown config key '${key}'. Choices: ${
|
|
258
|
+
return `Unknown config key '${key}'. Choices: ${[...this.configValidation.keys()].join(', ')}`;
|
|
246
259
|
}
|
|
247
260
|
checkValue(key, value) {
|
|
248
261
|
const validate = this.configValidation.get(key);
|
|
@@ -321,7 +334,7 @@ export class ConfigManager {
|
|
|
321
334
|
* @returns An array of properties which defined in the configuration file.
|
|
322
335
|
*/
|
|
323
336
|
keyList(real = true) {
|
|
324
|
-
const keys = real ?
|
|
337
|
+
const keys = real ? [...this.configValidation.keys()] : Object.keys(this.data);
|
|
325
338
|
return keys;
|
|
326
339
|
}
|
|
327
340
|
get(key, options) {
|
|
@@ -359,7 +372,9 @@ export class ConfigManager {
|
|
|
359
372
|
const value = format('%o', this.get(key, options));
|
|
360
373
|
const type = this.getType(key);
|
|
361
374
|
const pad = keyMaxLength - key.length;
|
|
362
|
-
const line = types
|
|
375
|
+
const line = types
|
|
376
|
+
? format(`${' '.repeat(pad)}%s ${highlight('=', chalk)} %s${highlight(':', chalk)} %s`, (chalk ? chalk.hex('#FFBC42')(key) : key), chalk ? highlight(value, chalk) : value, (chalk ? chalk.dim(highlight(type, chalk)) : type))
|
|
377
|
+
: format(`${' '.repeat(pad)}%s ${highlight('=', chalk)} %s`, (chalk ? chalk.hex('#FFBC42')(key) : key), chalk ? highlight(value, chalk) : value);
|
|
363
378
|
return line;
|
|
364
379
|
}).join('\n');
|
|
365
380
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "view-ignored",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Retrieve list of files ignored/included by Git, NPM, Yarn and VSC Extension.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -78,32 +78,32 @@
|
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
80
|
"@humanwhocodes/gitignore-to-minimatch": "^1.0.2",
|
|
81
|
-
"@m234/nerd-fonts": "^0.
|
|
81
|
+
"@m234/nerd-fonts": "^0.3.0",
|
|
82
82
|
"ansi-regex": "^6.1.0",
|
|
83
83
|
"boxen": "^8.0.1",
|
|
84
|
-
"chalk": "^5.
|
|
85
|
-
"commander": "^
|
|
84
|
+
"chalk": "^5.4.1",
|
|
85
|
+
"commander": "^14.0.0",
|
|
86
86
|
"jsonify-paths": "^1.1.0",
|
|
87
|
-
"listr2": "^8.
|
|
87
|
+
"listr2": "^8.3.3",
|
|
88
88
|
"load-plugin": "^6.0.3",
|
|
89
|
-
"minimatch": "^10.0.
|
|
90
|
-
"p-limit": "^6.
|
|
89
|
+
"minimatch": "^10.0.3",
|
|
90
|
+
"p-limit": "^6.2.0",
|
|
91
91
|
"treeify": "^1.1.0",
|
|
92
|
-
"tslib": "^2.
|
|
93
|
-
"yaml": "^2.
|
|
92
|
+
"tslib": "^2.8.1",
|
|
93
|
+
"yaml": "^2.8.0"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
|
96
|
-
"@release-it/keep-a-changelog": "^
|
|
97
|
-
"@types/mocha": "^10.0.
|
|
98
|
-
"@types/node": "^
|
|
96
|
+
"@release-it/keep-a-changelog": "^7.0.0",
|
|
97
|
+
"@types/mocha": "^10.0.10",
|
|
98
|
+
"@types/node": "^24.0.3",
|
|
99
99
|
"@types/treeify": "^1.0.3",
|
|
100
|
-
"fs-fixture": "^2.
|
|
101
|
-
"globals": "^
|
|
102
|
-
"mocha": "^
|
|
103
|
-
"release-it": "^
|
|
104
|
-
"shx": "^0.
|
|
105
|
-
"typescript": "^5.
|
|
106
|
-
"xo": "^
|
|
100
|
+
"fs-fixture": "^2.8.1",
|
|
101
|
+
"globals": "^16.2.0",
|
|
102
|
+
"mocha": "^11.7.0",
|
|
103
|
+
"release-it": "^19.0.3",
|
|
104
|
+
"shx": "^0.4.0",
|
|
105
|
+
"typescript": "^5.8.3",
|
|
106
|
+
"xo": "^1.1.0"
|
|
107
107
|
},
|
|
108
108
|
"keywords": [
|
|
109
109
|
"tree",
|