view-ignored 0.3.1 → 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 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
- [![npm version](https://img.shields.io/npm/v/view-ignored.svg?style=flat)](https://www.npmjs.com/package/view-ignored)
4
- [![npm downloads](https://img.shields.io/npm/dm/view-ignored.svg?style=flat)](https://www.npmjs.com/package/view-ignored)
5
- [![github](https://img.shields.io/github/stars/Mopsgamer/view-ignored.svg?style=flat)](https://github.com/Mopsgamer/view-ignored)
6
- [![github issues](https://img.shields.io/github/issues/Mopsgamer/view-ignored.svg?style=flat)](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
+ [![npm version](https://img.shields.io/npm/v/view-ignored.svg?style=flat)](https://www.npmjs.com/package/view-ignored)
4
+ [![npm downloads](https://img.shields.io/npm/dm/view-ignored.svg?style=flat)](https://www.npmjs.com/package/view-ignored)
5
+ [![github](https://img.shields.io/github/stars/Mopsgamer/view-ignored.svg?style=flat)](https://github.com/Mopsgamer/view-ignored)
6
+ [![github issues](https://img.shields.io/github/issues/Mopsgamer/view-ignored.svg?style=flat)](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*
@@ -0,0 +1,122 @@
1
+ {
2
+ "name": "view-ignored",
3
+ "version": "0.3.2",
4
+ "description": "Retrieve list of files ignored/included by Git, NPM, Yarn and VSC Extension.",
5
+ "type": "module",
6
+ "bin": {
7
+ "viewig": "./bin/viewig",
8
+ "view-ignored": "./bin/viewig"
9
+ },
10
+ "scripts": {
11
+ "prerelease": "pnpm lint && pnpm build:pub && pnpm test",
12
+ "test": "pnpm mocha ./out/test/**/*.test.js",
13
+ "build": "pnpm shx rm -rf out && pnpm tsc",
14
+ "build:pub": "pnpm shx rm -rf out && pnpm tsc --sourceMap false",
15
+ "build:watch": "pnpm shx rm -rf out && pnpm tsc --watch",
16
+ "lint": "pnpm xo",
17
+ "lint:fix": "pnpm xo --fix",
18
+ "release:major": "pnpm release-it --increment=major",
19
+ "release:minor": "pnpm release-it --increment=minor",
20
+ "release:patch": "pnpm release-it --increment=patch"
21
+ },
22
+ "author": "Mopsgamer",
23
+ "license": "ISC",
24
+ "main": "./out/src/index.js",
25
+ "files": [
26
+ "/bin",
27
+ "/out/src",
28
+ "/out/package.json"
29
+ ],
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "https://github.com/Mopsgamer/view-ignored.git"
33
+ },
34
+ "bugs": {
35
+ "url": "https://github.com/Mopsgamer/view-ignored/issues"
36
+ },
37
+ "homepage": "https://github.com/Mopsgamer/view-ignored",
38
+ "exports": {
39
+ ".": "./out/src/index.js",
40
+ "./browser": "./out/src/browser/index.js"
41
+ },
42
+ "release-it": {
43
+ "hooks": {
44
+ "before:init": "pnpm prerelease"
45
+ },
46
+ "plugins": {
47
+ "@release-it/keep-a-changelog": {
48
+ "filename": "CHANGELOG.md"
49
+ }
50
+ },
51
+ "github": {
52
+ "release": true,
53
+ "draft": false,
54
+ "releaseName": "${version}"
55
+ },
56
+ "npm": {
57
+ "publish": true
58
+ }
59
+ },
60
+ "xo": {
61
+ "ignores": "/out/",
62
+ "rules": {
63
+ "@typescript-eslint/promise-function-async": "off",
64
+ "@typescript-eslint/use-unknown-in-catch-callback-variable": "off",
65
+ "@typescript-eslint/no-unused-vars": "error",
66
+ "n/no-unpublished-bin": "off",
67
+ "linebreak-style": [
68
+ "error",
69
+ "unix"
70
+ ]
71
+ }
72
+ },
73
+ "publishConfig": {
74
+ "access": "public"
75
+ },
76
+ "directories": {
77
+ "lib": "out/src"
78
+ },
79
+ "dependencies": {
80
+ "@humanwhocodes/gitignore-to-minimatch": "^1.0.2",
81
+ "@m234/nerd-fonts": "^0.3.0",
82
+ "ansi-regex": "^6.1.0",
83
+ "boxen": "^8.0.1",
84
+ "chalk": "^5.4.1",
85
+ "commander": "^14.0.0",
86
+ "jsonify-paths": "^1.1.0",
87
+ "listr2": "^8.3.3",
88
+ "load-plugin": "^6.0.3",
89
+ "minimatch": "^10.0.3",
90
+ "p-limit": "^6.2.0",
91
+ "treeify": "^1.1.0",
92
+ "tslib": "^2.8.1",
93
+ "yaml": "^2.8.0"
94
+ },
95
+ "devDependencies": {
96
+ "@release-it/keep-a-changelog": "^7.0.0",
97
+ "@types/mocha": "^10.0.10",
98
+ "@types/node": "^24.0.3",
99
+ "@types/treeify": "^1.0.3",
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
+ },
108
+ "keywords": [
109
+ "tree",
110
+ "ls-tree",
111
+ "ignore",
112
+ "gitignore",
113
+ "npmignore",
114
+ "vscodeignore",
115
+ "cli",
116
+ "fs",
117
+ "file-system",
118
+ "output",
119
+ "project",
120
+ "migration"
121
+ ]
122
+ }
@@ -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 = Array.from(builtInNameList)) {
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: 0xF4_4E_28 };
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: 0xCA_04_04 };
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 Array.from(tree.children.values())) {
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: 0x23_A9_F1 };
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 = Array.from(tree.deepIterator()).find(dirent => dirent instanceof File && dirent.base === 'package.json');
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: 0x2E_2A_65 };
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
  */
@@ -7,7 +7,7 @@ export class ScannerMinimatch {
7
7
  negated;
8
8
  _pattern;
9
9
  get pattern() {
10
- return this.pattern;
10
+ return this._pattern;
11
11
  }
12
12
  set pattern(value) {
13
13
  this._pattern = value;
@@ -7,11 +7,11 @@ export type TargetIcon = {
7
7
  /**
8
8
  * Glyph character.
9
9
  */
10
- char: string;
10
+ value: string;
11
11
  /**
12
12
  * The icon's color.
13
13
  */
14
- color?: number;
14
+ color?: string;
15
15
  };
16
16
  /**
17
17
  * @public
@@ -36,7 +36,7 @@ export function targetSet(bind) {
36
36
  * ["git", "npm", "vsce", ...]
37
37
  */
38
38
  export function targetList() {
39
- const list = Array.from(targetBindMap.keys());
39
+ const list = [...targetBindMap.keys()];
40
40
  return list;
41
41
  }
42
42
  /**
@@ -36,9 +36,9 @@ export type DeepStreamProgress = {
36
36
  * @public
37
37
  */
38
38
  export type DeepStreamEventMap = {
39
- 'data': [DeepStreamData];
40
- 'end': [DeepStreamDataRoot];
41
- 'progress': [DeepStreamProgress];
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 = Array.from(tree.children.values()).find(c => c instanceof Directory && c.absolutePath === absolutePath);
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 Array.from(Directory.deepIterator(this, instanceOf));
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 ? 'non-target'
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.FSC.fromPath(parsed, nf.FSC.mappings.seti);
49
- const fIcon = fileIcon ? decorCondition(fileIcon, {
50
- ifEmoji: '📄',
51
- ifNerd: chalk && glyph.color !== undefined ? chalk.hex(glyph.color.toString(16))(glyph.char) : glyph.char,
52
- postfix: ' ',
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' ? chalk.white
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);
@@ -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].concat(tree.deep(Directory))) {
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) : []).concat(builtInPlugins);
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'].char, postfix: ' ' });
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'].char, ifEmoji: '⚠️', postfix: ' ',
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 = Array.from(loadResultConfig.entries()).map(([key, message]) => `${Config.configManager.getPairString(key, { chalk, types: false, real: true })} - ${chalk.red(errorIcon)}${message}`).join('\n');
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?.char, postfix: ' ' }) + bind.name;
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.toString(16))(name);
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'].char });
311
- const infoSymbol = decorCondition(flags.decor, { ifEmoji: 'ℹ️', ifNerd: icons['nf-seti-info'].char, postfix: ' ' });
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 = ['posix', 'noColor', 'target', 'filter', 'sort', 'style', 'decor', 'depth', 'showSources', 'plugins', 'parsable', 'concurrency'];
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.concat(switchFalseValues);
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: ${Array.from(this.configValidation.keys()).join(', ')}`;
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 ? Array.from(this.configValidation.keys()) : Object.keys(this.data);
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 ? 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)) : format(`${' '.repeat(pad)}%s ${highlight('=', chalk)} %s`, (chalk ? chalk.hex('#FFBC42')(key) : key), chalk ? highlight(value, chalk) : value);
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.1",
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": {
@@ -24,7 +24,8 @@
24
24
  "main": "./out/src/index.js",
25
25
  "files": [
26
26
  "/bin",
27
- "/out/src"
27
+ "/out/src",
28
+ "/out/package.json"
28
29
  ],
29
30
  "repository": {
30
31
  "type": "git",
@@ -77,32 +78,32 @@
77
78
  },
78
79
  "dependencies": {
79
80
  "@humanwhocodes/gitignore-to-minimatch": "^1.0.2",
80
- "@m234/nerd-fonts": "^0.1.3",
81
+ "@m234/nerd-fonts": "^0.3.0",
81
82
  "ansi-regex": "^6.1.0",
82
83
  "boxen": "^8.0.1",
83
- "chalk": "^5.3.0",
84
- "commander": "^12.1.0",
84
+ "chalk": "^5.4.1",
85
+ "commander": "^14.0.0",
85
86
  "jsonify-paths": "^1.1.0",
86
- "listr2": "^8.2.5",
87
+ "listr2": "^8.3.3",
87
88
  "load-plugin": "^6.0.3",
88
- "minimatch": "^10.0.1",
89
- "p-limit": "^6.1.0",
89
+ "minimatch": "^10.0.3",
90
+ "p-limit": "^6.2.0",
90
91
  "treeify": "^1.1.0",
91
- "tslib": "^2.7.0",
92
- "yaml": "^2.5.1"
92
+ "tslib": "^2.8.1",
93
+ "yaml": "^2.8.0"
93
94
  },
94
95
  "devDependencies": {
95
- "@release-it/keep-a-changelog": "^5.0.0",
96
- "@types/mocha": "^10.0.9",
97
- "@types/node": "^20.16.11",
96
+ "@release-it/keep-a-changelog": "^7.0.0",
97
+ "@types/mocha": "^10.0.10",
98
+ "@types/node": "^24.0.3",
98
99
  "@types/treeify": "^1.0.3",
99
- "fs-fixture": "^2.4.0",
100
- "globals": "^15.11.0",
101
- "mocha": "^10.7.3",
102
- "release-it": "^17.8.2",
103
- "shx": "^0.3.4",
104
- "typescript": "^5.6.3",
105
- "xo": "^0.59.3"
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"
106
107
  },
107
108
  "keywords": [
108
109
  "tree",