view-ignored 0.4.0 → 0.4.1
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/bin/viewig +1 -1
- package/out/{src/browser → browser}/binds/index.d.ts +0 -19
- package/out/{src/browser → browser}/binds/index.js +1 -8
- package/out/browser/binds/plugins/git.d.ts +3 -0
- package/out/{src/browser → browser}/binds/plugins/git.js +3 -3
- package/out/browser/binds/plugins/npm.d.ts +3 -0
- package/out/{src/browser → browser}/binds/plugins/npm.js +6 -6
- package/out/browser/binds/plugins/vsce.d.ts +3 -0
- package/out/{src/browser → browser}/binds/plugins/vsce.js +3 -3
- package/out/browser/binds/plugins/yarn.d.ts +3 -0
- package/out/{src/browser → browser}/binds/plugins/yarn.js +2 -2
- package/out/{src/browser → browser}/binds/scanner.d.ts +0 -12
- package/out/{src/browser → browser}/binds/scanner.js +0 -6
- package/out/{src/browser → browser}/binds/targets.d.ts +0 -11
- package/out/{src/browser → browser}/binds/targets.js +1 -6
- package/out/{src/browser → browser}/errors.d.ts +0 -15
- package/out/{src/browser → browser}/errors.js +0 -15
- package/out/{src/browser → browser}/filtering.d.ts +0 -3
- package/out/{src/browser → browser}/filtering.js +0 -2
- package/out/{src/browser → browser}/fs/directory.d.ts +0 -53
- package/out/{src/browser → browser}/fs/directory.js +1 -4
- package/out/{src/browser → browser}/fs/file-info.d.ts +0 -5
- package/out/{src/browser → browser}/fs/file-info.js +0 -1
- package/out/{src/browser → browser}/fs/file.d.ts +0 -3
- package/out/{src/browser → browser}/fs/file.js +0 -3
- package/out/{src/browser → browser}/fs/source-info.d.ts +0 -1
- package/out/{src/browser → browser}/fs/source-info.js +0 -1
- package/out/{src/browser → browser}/lib.d.ts +1 -12
- package/out/{src/browser → browser}/lib.js +1 -4
- package/out/{src/browser → browser}/sorting.d.ts +0 -10
- package/out/{src/browser → browser}/sorting.js +0 -8
- package/out/{src/browser → browser}/styling.d.ts +0 -14
- package/out/{src/browser → browser}/styling.js +0 -7
- package/out/{src/cli.d.ts → cli.d.ts} +0 -47
- package/out/{src/cli.js → cli.js} +2 -37
- package/out/{src/config.d.ts → config.d.ts} +0 -57
- package/out/{src/config.js → config.js} +3 -45
- package/out/{src/errors.d.ts → errors.d.ts} +0 -1
- package/out/{src/styling.d.ts → styling.d.ts} +0 -6
- package/out/{src/styling.js → styling.js} +0 -6
- package/package.json +27 -35
- package/out/package.json +0 -122
- package/out/src/browser/binds/plugins/git.d.ts +0 -22
- package/out/src/browser/binds/plugins/npm.d.ts +0 -38
- package/out/src/browser/binds/plugins/vsce.d.ts +0 -25
- package/out/src/browser/binds/plugins/yarn.d.ts +0 -11
- /package/out/{src/browser → browser}/fs/index.d.ts +0 -0
- /package/out/{src/browser → browser}/fs/index.js +0 -0
- /package/out/{src/browser → browser}/index.d.ts +0 -0
- /package/out/{src/browser → browser}/index.js +0 -0
- /package/out/{src/errors.js → errors.js} +0 -0
- /package/out/{src/index.d.ts → index.d.ts} +0 -0
- /package/out/{src/index.js → index.js} +0 -0
- /package/out/{src/lib.d.ts → lib.d.ts} +0 -0
- /package/out/{src/lib.js → lib.js} +0 -0
package/bin/viewig
CHANGED
|
@@ -1,64 +1,45 @@
|
|
|
1
|
-
import { type TargetBind } from './targets.js';
|
|
2
1
|
export * from './scanner.js';
|
|
3
2
|
export * from './targets.js';
|
|
4
3
|
/**
|
|
5
4
|
* Built-in name list.
|
|
6
|
-
* @public
|
|
7
5
|
*/
|
|
8
6
|
export declare const builtInNameList: readonly ["git", "npm", "vsce", "yarn"];
|
|
9
7
|
/**
|
|
10
8
|
* Built-in name type.
|
|
11
|
-
* @public
|
|
12
9
|
*/
|
|
13
10
|
export type BuiltInName = typeof builtInNameList[number];
|
|
14
11
|
/**
|
|
15
12
|
* The result of loading.
|
|
16
|
-
* @public
|
|
17
13
|
*/
|
|
18
14
|
export type PluginLoaded = {
|
|
19
15
|
resource: string;
|
|
20
16
|
isLoaded: boolean;
|
|
21
17
|
exports: unknown;
|
|
22
18
|
};
|
|
23
|
-
/**
|
|
24
|
-
* If a plugin wants to change something, it must export default.
|
|
25
|
-
* @private
|
|
26
|
-
*/
|
|
27
|
-
export type PluginExport = {
|
|
28
|
-
viewignored: {
|
|
29
|
-
addTargets: TargetBind[];
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
19
|
/**
|
|
33
20
|
* Checks if the value is the {@link PluginExport}.
|
|
34
|
-
* @public
|
|
35
21
|
*/
|
|
36
22
|
export declare function isPluginExport(value: unknown): value is PluginExport;
|
|
37
23
|
/**
|
|
38
24
|
* Imports the plugin's exported data.
|
|
39
|
-
* @public
|
|
40
25
|
*/
|
|
41
26
|
export declare function importPlugin(exportData: PluginExport): void;
|
|
42
27
|
/**
|
|
43
28
|
* @param modulePath The plugin name.
|
|
44
29
|
* @returns The import result for the module.
|
|
45
|
-
* @public
|
|
46
30
|
*/
|
|
47
31
|
export declare function loadPlugin(modulePath: string, useImport?: boolean): Promise<PluginLoaded>;
|
|
48
32
|
/**
|
|
49
33
|
* @param modulePathList The plugin name list.
|
|
50
34
|
* @returns The import result for the list of modules.
|
|
51
|
-
* @public
|
|
52
35
|
*/
|
|
53
36
|
export declare function loadPlugins(modulePathList: string[]): Promise<PluginLoaded[]>;
|
|
54
37
|
/**
|
|
55
38
|
* Load any built-in plugin.
|
|
56
|
-
* @public
|
|
57
39
|
*/
|
|
58
40
|
export declare function loadBuiltIn(builtIn: BuiltInName): Promise<PluginLoaded>;
|
|
59
41
|
/**
|
|
60
42
|
* @param modulePathList The plugin name list.
|
|
61
43
|
* @returns The import result for the list of modules.
|
|
62
|
-
* @public
|
|
63
44
|
*/
|
|
64
45
|
export declare function loadBuiltIns(builtInList?: BuiltInName[]): Promise<PluginLoaded[]>;
|
|
@@ -4,7 +4,7 @@ import { isTargetBind, targetSet } from './targets.js';
|
|
|
4
4
|
export * from './scanner.js';
|
|
5
5
|
export * from './targets.js';
|
|
6
6
|
/**
|
|
7
|
-
* @
|
|
7
|
+
* @internal
|
|
8
8
|
*/
|
|
9
9
|
const builtInImportMap = {
|
|
10
10
|
git: './plugins/git.js',
|
|
@@ -14,12 +14,10 @@ const builtInImportMap = {
|
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
16
|
* Built-in name list.
|
|
17
|
-
* @public
|
|
18
17
|
*/
|
|
19
18
|
export const builtInNameList = ['git', 'npm', 'vsce', 'yarn'];
|
|
20
19
|
/**
|
|
21
20
|
* Checks if the value is the {@link PluginExport}.
|
|
22
|
-
* @public
|
|
23
21
|
*/
|
|
24
22
|
export function isPluginExport(value) {
|
|
25
23
|
if (value?.constructor !== Object) {
|
|
@@ -31,7 +29,6 @@ export function isPluginExport(value) {
|
|
|
31
29
|
}
|
|
32
30
|
/**
|
|
33
31
|
* Imports the plugin's exported data.
|
|
34
|
-
* @public
|
|
35
32
|
*/
|
|
36
33
|
export function importPlugin(exportData) {
|
|
37
34
|
const { addTargets } = exportData.viewignored;
|
|
@@ -42,7 +39,6 @@ export function importPlugin(exportData) {
|
|
|
42
39
|
/**
|
|
43
40
|
* @param modulePath The plugin name.
|
|
44
41
|
* @returns The import result for the module.
|
|
45
|
-
* @public
|
|
46
42
|
*/
|
|
47
43
|
export async function loadPlugin(modulePath, useImport = false) {
|
|
48
44
|
try {
|
|
@@ -66,7 +62,6 @@ export async function loadPlugin(modulePath, useImport = false) {
|
|
|
66
62
|
/**
|
|
67
63
|
* @param modulePathList The plugin name list.
|
|
68
64
|
* @returns The import result for the list of modules.
|
|
69
|
-
* @public
|
|
70
65
|
*/
|
|
71
66
|
export async function loadPlugins(modulePathList) {
|
|
72
67
|
const limit = pLimit(5);
|
|
@@ -75,7 +70,6 @@ export async function loadPlugins(modulePathList) {
|
|
|
75
70
|
}
|
|
76
71
|
/**
|
|
77
72
|
* Load any built-in plugin.
|
|
78
|
-
* @public
|
|
79
73
|
*/
|
|
80
74
|
export function loadBuiltIn(builtIn) {
|
|
81
75
|
return loadPlugin(builtInImportMap[builtIn], true);
|
|
@@ -83,7 +77,6 @@ export function loadBuiltIn(builtIn) {
|
|
|
83
77
|
/**
|
|
84
78
|
* @param modulePathList The plugin name list.
|
|
85
79
|
* @returns The import result for the list of modules.
|
|
86
|
-
* @public
|
|
87
80
|
*/
|
|
88
81
|
export async function loadBuiltIns(builtInList = [...builtInNameList]) {
|
|
89
82
|
const limit = pLimit(5);
|
|
@@ -6,7 +6,7 @@ const name = 'Git';
|
|
|
6
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
|
+
* @internal
|
|
10
10
|
*/
|
|
11
11
|
export const matcherExclude = [
|
|
12
12
|
'**/.git/**',
|
|
@@ -17,7 +17,7 @@ export const matcherExclude = [
|
|
|
17
17
|
* @param map The output.
|
|
18
18
|
* @param scanner The scanner.
|
|
19
19
|
* @param sourceFile This file will be converted to a {@link SourceInfo}.
|
|
20
|
-
* @
|
|
20
|
+
* @internal
|
|
21
21
|
*/
|
|
22
22
|
export function useSourceFile(map, sourceFile, scanner) {
|
|
23
23
|
const sourceInfo = SourceInfo.from(sourceFile, scanner);
|
|
@@ -31,7 +31,7 @@ export function useSourceFile(map, sourceFile, scanner) {
|
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* @param base The name for gitignore-like file.
|
|
34
|
-
* @
|
|
34
|
+
* @internal
|
|
35
35
|
*/
|
|
36
36
|
export const methodologyGitignoreLike = (base) => function (tree, o) {
|
|
37
37
|
const sourceList = tree.deep(File).filter(dirent => dirent.base === base);
|
|
@@ -7,7 +7,7 @@ const name = 'NPM';
|
|
|
7
7
|
const icon = { ...icons['nf-seti-npm'], color: '#CA0404' };
|
|
8
8
|
const testCommand = 'npm pack --dry-run';
|
|
9
9
|
/**
|
|
10
|
-
* @
|
|
10
|
+
* @internal
|
|
11
11
|
*/
|
|
12
12
|
export const matcherExclude = [
|
|
13
13
|
...git.matcherExclude,
|
|
@@ -28,7 +28,7 @@ export const matcherExclude = [
|
|
|
28
28
|
'**/npm-debug.log',
|
|
29
29
|
];
|
|
30
30
|
/**
|
|
31
|
-
* @
|
|
31
|
+
* @internal
|
|
32
32
|
*/
|
|
33
33
|
export const matcherInclude = [
|
|
34
34
|
'bin/**',
|
|
@@ -38,7 +38,7 @@ export const matcherInclude = [
|
|
|
38
38
|
'LICENCE*',
|
|
39
39
|
];
|
|
40
40
|
/**
|
|
41
|
-
* @
|
|
41
|
+
* @internal
|
|
42
42
|
*/
|
|
43
43
|
export function isValidManifest(value) {
|
|
44
44
|
if (value?.constructor !== Object) {
|
|
@@ -50,7 +50,7 @@ export function isValidManifest(value) {
|
|
|
50
50
|
&& (value_.files === undefined || (Array.isArray(value_.files) && value_.files.every(element => typeof element === 'string')));
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
|
-
* @
|
|
53
|
+
* @internal
|
|
54
54
|
*/
|
|
55
55
|
export function useChildren(tree, map, getMap) {
|
|
56
56
|
for (const child of tree.children.values()) {
|
|
@@ -65,7 +65,7 @@ export function useChildren(tree, map, getMap) {
|
|
|
65
65
|
return map;
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
|
-
* @
|
|
68
|
+
* @internal
|
|
69
69
|
*/
|
|
70
70
|
export const sourceSearch = (priority, scanner) => function (tree, o) {
|
|
71
71
|
const map = new Map();
|
|
@@ -105,7 +105,7 @@ export const sourceSearch = (priority, scanner) => function (tree, o) {
|
|
|
105
105
|
/**
|
|
106
106
|
* @param priority The list of file names from highest to lowest priority.
|
|
107
107
|
* @param scanner The pattern scanner.
|
|
108
|
-
* @
|
|
108
|
+
* @internal
|
|
109
109
|
*/
|
|
110
110
|
export const methodologyManifestNpmLike = (priority, scanner) => function (tree, o) {
|
|
111
111
|
const packageJson = tree.get('package.json');
|
|
@@ -6,13 +6,13 @@ const name = 'VSCE';
|
|
|
6
6
|
const icon = { ...icons['nf-md-microsoft_visual_studio_code'], color: '#23A9F1' };
|
|
7
7
|
const testCommand = 'vsce ls';
|
|
8
8
|
/**
|
|
9
|
-
* @
|
|
9
|
+
* @internal
|
|
10
10
|
*/
|
|
11
11
|
export const matcherExclude = [
|
|
12
12
|
...git.matcherExclude,
|
|
13
13
|
];
|
|
14
14
|
/**
|
|
15
|
-
* @
|
|
15
|
+
* @internal
|
|
16
16
|
*/
|
|
17
17
|
export function isValidManifest(value) {
|
|
18
18
|
if (value?.constructor !== Object) {
|
|
@@ -29,7 +29,7 @@ export function isValidManifest(value) {
|
|
|
29
29
|
return 'vscode' in engines && typeof engines.vscode === 'string';
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
|
-
* @
|
|
32
|
+
* @internal
|
|
33
33
|
*/
|
|
34
34
|
export const methodologyManifestVsce = function (tree, o) {
|
|
35
35
|
const packageJson = [...tree.deepIterator()].find(dirent => dirent instanceof File && dirent.base === 'package.json');
|
|
@@ -5,7 +5,7 @@ const id = 'yarn';
|
|
|
5
5
|
const name = 'Yarn';
|
|
6
6
|
const icon = { ...icons['nf-seti-yarn'], color: '#2E2A65' };
|
|
7
7
|
/**
|
|
8
|
-
* @
|
|
8
|
+
* @internal
|
|
9
9
|
*/
|
|
10
10
|
export const matcherExclude = [
|
|
11
11
|
...npm.matcherExclude,
|
|
@@ -13,7 +13,7 @@ export const matcherExclude = [
|
|
|
13
13
|
'.yarnrc',
|
|
14
14
|
];
|
|
15
15
|
/**
|
|
16
|
-
* @
|
|
16
|
+
* @internal
|
|
17
17
|
*/
|
|
18
18
|
export const matcherInclude = [
|
|
19
19
|
...npm.matcherInclude,
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import { type Scanner } from '../lib.js';
|
|
2
|
-
/**
|
|
3
|
-
* @public
|
|
4
|
-
*/
|
|
5
2
|
export type PatternScannerOptions = {
|
|
6
3
|
pattern?: string | string[];
|
|
7
4
|
exclude?: string | string[];
|
|
8
5
|
include?: string | string[];
|
|
9
6
|
negated?: boolean;
|
|
10
7
|
};
|
|
11
|
-
/**
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
8
|
export type PatternScanner = Scanner & {
|
|
15
9
|
pattern: string | string[];
|
|
16
10
|
exclude: string | string[];
|
|
@@ -21,9 +15,6 @@ export type PatternScanner = Scanner & {
|
|
|
21
15
|
ignores(path: string, options?: PatternScannerOptions): boolean;
|
|
22
16
|
ignores(path: string, argument?: PatternScannerOptions | string | string[]): boolean;
|
|
23
17
|
};
|
|
24
|
-
/**
|
|
25
|
-
* @public
|
|
26
|
-
*/
|
|
27
18
|
export declare class ScannerMinimatch implements PatternScanner {
|
|
28
19
|
negated: boolean;
|
|
29
20
|
protected _pattern: string | string[];
|
|
@@ -40,9 +31,6 @@ export declare class ScannerMinimatch implements PatternScanner {
|
|
|
40
31
|
ignores(path: string, pattern: string | string[]): boolean;
|
|
41
32
|
ignores(path: string, options?: PatternScannerOptions): boolean;
|
|
42
33
|
}
|
|
43
|
-
/**
|
|
44
|
-
* @public
|
|
45
|
-
*/
|
|
46
34
|
export declare class ScannerGitignore extends ScannerMinimatch {
|
|
47
35
|
private static gitignoreToMinimatch;
|
|
48
36
|
constructor(options?: PatternScannerOptions);
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { minimatch } from 'minimatch';
|
|
2
2
|
import { gitignoreToMinimatch } from '@humanwhocodes/gitignore-to-minimatch';
|
|
3
|
-
/**
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
3
|
export class ScannerMinimatch {
|
|
7
4
|
negated;
|
|
8
5
|
_pattern;
|
|
@@ -69,9 +66,6 @@ export class ScannerMinimatch {
|
|
|
69
66
|
return (argument?.negated ?? this.negated) ? !check : check;
|
|
70
67
|
}
|
|
71
68
|
}
|
|
72
|
-
/**
|
|
73
|
-
* @public
|
|
74
|
-
*/
|
|
75
69
|
export class ScannerGitignore extends ScannerMinimatch {
|
|
76
70
|
static gitignoreToMinimatch(argument) {
|
|
77
71
|
if (typeof argument === 'string') {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type ScanOptions } from '../lib.js';
|
|
2
2
|
/**
|
|
3
3
|
* The target icon/logo as a {@link https://www.nerdfonts.com/ NF} icon.
|
|
4
|
-
* @public
|
|
5
4
|
*/
|
|
6
5
|
export type TargetIcon = {
|
|
7
6
|
/**
|
|
@@ -13,25 +12,19 @@ export type TargetIcon = {
|
|
|
13
12
|
*/
|
|
14
13
|
color?: string;
|
|
15
14
|
};
|
|
16
|
-
/**
|
|
17
|
-
* @public
|
|
18
|
-
*/
|
|
19
15
|
export type TargetName = string;
|
|
20
16
|
/**
|
|
21
17
|
* Should satisfy RegExp: `/^[-a-zA-Z0-9]+$/`.
|
|
22
|
-
* @public
|
|
23
18
|
*/
|
|
24
19
|
export type TargetId = string;
|
|
25
20
|
/**
|
|
26
21
|
* @param value Target's id. Simple name.
|
|
27
22
|
* @returns `true`, if the id is available for binding.
|
|
28
|
-
* @public
|
|
29
23
|
*/
|
|
30
24
|
export declare function isTargetId(value: unknown): value is TargetId;
|
|
31
25
|
/**
|
|
32
26
|
* The bind which allows use predefined options for scan functions.
|
|
33
27
|
* @see {@link scanFolder}
|
|
34
|
-
* @public
|
|
35
28
|
*/
|
|
36
29
|
export type TargetBind = {
|
|
37
30
|
/**
|
|
@@ -61,12 +54,10 @@ export type TargetBind = {
|
|
|
61
54
|
};
|
|
62
55
|
/**
|
|
63
56
|
* Checks if the value is the {@link TargetBind}.
|
|
64
|
-
* @public
|
|
65
57
|
*/
|
|
66
58
|
export declare function isTargetBind(value: unknown): value is TargetBind;
|
|
67
59
|
/**
|
|
68
60
|
* Allows to create targets for view-ignored scan* functions.
|
|
69
|
-
* @public
|
|
70
61
|
* @example
|
|
71
62
|
* scanFolder("abc") // error
|
|
72
63
|
* Bindings.targetSet("abc", {...})
|
|
@@ -75,7 +66,6 @@ export declare function isTargetBind(value: unknown): value is TargetBind;
|
|
|
75
66
|
export declare function targetSet(bind: TargetBind): void;
|
|
76
67
|
/**
|
|
77
68
|
* Get all target ids.
|
|
78
|
-
* @public
|
|
79
69
|
* @example
|
|
80
70
|
* ["git", "npm", "vsce", ...]
|
|
81
71
|
*/
|
|
@@ -83,6 +73,5 @@ export declare function targetList(): string[];
|
|
|
83
73
|
/**
|
|
84
74
|
* Get target bind by target id.
|
|
85
75
|
* @param id Target id.
|
|
86
|
-
* @public
|
|
87
76
|
*/
|
|
88
77
|
export declare function targetGet(id: TargetId): TargetBind | undefined;
|
|
@@ -1,26 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @param value Target's id. Simple name.
|
|
3
3
|
* @returns `true`, if the id is available for binding.
|
|
4
|
-
* @public
|
|
5
4
|
*/
|
|
6
5
|
export function isTargetId(value) {
|
|
7
6
|
return typeof value === 'string' && (/^[-a-zA-Z\d]+$/.exec(value)) !== null;
|
|
8
7
|
}
|
|
9
8
|
/**
|
|
10
9
|
* Checks if the value is the {@link TargetBind}.
|
|
11
|
-
* @public
|
|
12
10
|
*/
|
|
13
11
|
export function isTargetBind(value) {
|
|
14
12
|
return value?.constructor === Object;
|
|
15
13
|
}
|
|
16
14
|
/**
|
|
17
15
|
* The container for binds: id=bind.
|
|
18
|
-
* @
|
|
16
|
+
* @internal
|
|
19
17
|
*/
|
|
20
18
|
const targetBindMap = new Map();
|
|
21
19
|
/**
|
|
22
20
|
* Allows to create targets for view-ignored scan* functions.
|
|
23
|
-
* @public
|
|
24
21
|
* @example
|
|
25
22
|
* scanFolder("abc") // error
|
|
26
23
|
* Bindings.targetSet("abc", {...})
|
|
@@ -31,7 +28,6 @@ export function targetSet(bind) {
|
|
|
31
28
|
}
|
|
32
29
|
/**
|
|
33
30
|
* Get all target ids.
|
|
34
|
-
* @public
|
|
35
31
|
* @example
|
|
36
32
|
* ["git", "npm", "vsce", ...]
|
|
37
33
|
*/
|
|
@@ -42,7 +38,6 @@ export function targetList() {
|
|
|
42
38
|
/**
|
|
43
39
|
* Get target bind by target id.
|
|
44
40
|
* @param id Target id.
|
|
45
|
-
* @public
|
|
46
41
|
*/
|
|
47
42
|
export function targetGet(id) {
|
|
48
43
|
return targetBindMap.get(id);
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import { type File } from './lib.js';
|
|
2
|
-
/**
|
|
3
|
-
* @public
|
|
4
|
-
*/
|
|
5
2
|
export declare class ViewIgnoredError extends Error {
|
|
6
3
|
name: string;
|
|
7
4
|
}
|
|
8
|
-
/**
|
|
9
|
-
* @public
|
|
10
|
-
*/
|
|
11
5
|
export declare class NoSourceError extends ViewIgnoredError {
|
|
12
6
|
static joinOr(fileBaseList: string[]): string;
|
|
13
7
|
static joinAnd(fileBaseList: string[]): string;
|
|
@@ -25,9 +19,6 @@ export declare class NoSourceError extends ViewIgnoredError {
|
|
|
25
19
|
*/
|
|
26
20
|
constructor(file: File);
|
|
27
21
|
}
|
|
28
|
-
/**
|
|
29
|
-
* @public
|
|
30
|
-
*/
|
|
31
22
|
export declare class BadSourceError extends ViewIgnoredError {
|
|
32
23
|
name: string;
|
|
33
24
|
/**
|
|
@@ -45,16 +36,10 @@ export declare class BadSourceError extends ViewIgnoredError {
|
|
|
45
36
|
*/
|
|
46
37
|
constructor(file: File, message: string);
|
|
47
38
|
}
|
|
48
|
-
/**
|
|
49
|
-
* @public
|
|
50
|
-
*/
|
|
51
39
|
export declare class InvalidPatternError extends ViewIgnoredError {
|
|
52
40
|
name: string;
|
|
53
41
|
constructor(file: File, pattern?: string | string[]);
|
|
54
42
|
}
|
|
55
|
-
/**
|
|
56
|
-
* @public
|
|
57
|
-
*/
|
|
58
43
|
export declare class TargetNotBoundError extends ViewIgnoredError {
|
|
59
44
|
name: string;
|
|
60
45
|
constructor(targetId: string);
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @public
|
|
3
|
-
*/
|
|
4
1
|
export class ViewIgnoredError extends Error {
|
|
5
2
|
name = 'ViewIgnoredError';
|
|
6
3
|
}
|
|
7
|
-
/**
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
10
4
|
export class NoSourceError extends ViewIgnoredError {
|
|
11
5
|
static joinOr(fileBaseList) {
|
|
12
6
|
return fileBaseList.map(base => `'${base}'`).join(' or ');
|
|
@@ -19,27 +13,18 @@ export class NoSourceError extends ViewIgnoredError {
|
|
|
19
13
|
super(`There was no configuration file (${typeof argument0 === 'string' ? argument0 : argument0.relativePath}) in the folders and subfolders that would correctly describe the ignoring.`);
|
|
20
14
|
}
|
|
21
15
|
}
|
|
22
|
-
/**
|
|
23
|
-
* @public
|
|
24
|
-
*/
|
|
25
16
|
export class BadSourceError extends ViewIgnoredError {
|
|
26
17
|
name = 'BadSourceError';
|
|
27
18
|
constructor(argument0, message) {
|
|
28
19
|
super(`Invalid ${typeof argument0 === 'string' ? argument0 : argument0.relativePath}: ${message}`);
|
|
29
20
|
}
|
|
30
21
|
}
|
|
31
|
-
/**
|
|
32
|
-
* @public
|
|
33
|
-
*/
|
|
34
22
|
export class InvalidPatternError extends ViewIgnoredError {
|
|
35
23
|
name = 'InvalidPatternError';
|
|
36
24
|
constructor(file, pattern) {
|
|
37
25
|
super(`Invalid pattern in ${file.relativePath}: ${pattern === undefined ? '' : ` Pattern: ${JSON.stringify(pattern)}`}`);
|
|
38
26
|
}
|
|
39
27
|
}
|
|
40
|
-
/**
|
|
41
|
-
* @public
|
|
42
|
-
*/
|
|
43
28
|
export class TargetNotBoundError extends ViewIgnoredError {
|
|
44
29
|
name = 'TargetNotBoundError';
|
|
45
30
|
constructor(targetId) {
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Contains all filter names.
|
|
3
|
-
* @public
|
|
4
3
|
*/
|
|
5
4
|
export declare const filterNameList: readonly ["ignored", "included", "all"];
|
|
6
5
|
/**
|
|
7
6
|
* Contains all filter names as a type.
|
|
8
|
-
* @public
|
|
9
7
|
*/
|
|
10
8
|
export type FilterName = typeof filterNameList[number];
|
|
11
9
|
/**
|
|
12
10
|
* Checks if the value is the {@link FilterName}.
|
|
13
|
-
* @public
|
|
14
11
|
*/
|
|
15
12
|
export declare function isFilterName(value: unknown): value is FilterName;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Contains all filter names.
|
|
3
|
-
* @public
|
|
4
3
|
*/
|
|
5
4
|
export const filterNameList = ['ignored', 'included', 'all'];
|
|
6
5
|
/**
|
|
7
6
|
* Checks if the value is the {@link FilterName}.
|
|
8
|
-
* @public
|
|
9
7
|
*/
|
|
10
8
|
export function isFilterName(value) {
|
|
11
9
|
return typeof value === 'string' && filterNameList.includes(value);
|
|
@@ -2,83 +2,38 @@ import { type ParsedPath } from 'node:path';
|
|
|
2
2
|
import EventEmitter from 'node:events';
|
|
3
3
|
import { type RealScanOptions } from '../lib.js';
|
|
4
4
|
import { File } from './file.js';
|
|
5
|
-
/**
|
|
6
|
-
* @public
|
|
7
|
-
*/
|
|
8
5
|
export type DeepStreamEventEmitter = EventEmitter<DeepStreamEventMap> & {
|
|
9
6
|
endPromise: Promise<DeepStreamDataRoot>;
|
|
10
7
|
run(): void;
|
|
11
8
|
};
|
|
12
|
-
/**
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
15
9
|
export type DeepStreamDataRoot = {
|
|
16
10
|
tree: Directory;
|
|
17
11
|
progress: DeepStreamProgress;
|
|
18
12
|
};
|
|
19
|
-
/**
|
|
20
|
-
* @public
|
|
21
|
-
*/
|
|
22
13
|
export type DeepStreamData = {
|
|
23
14
|
target: Entry;
|
|
24
15
|
progress: DeepStreamProgress;
|
|
25
16
|
};
|
|
26
|
-
/**
|
|
27
|
-
* @public
|
|
28
|
-
*/
|
|
29
17
|
export type DeepStreamProgress = {
|
|
30
18
|
directories: number;
|
|
31
19
|
files: number;
|
|
32
20
|
current: number;
|
|
33
21
|
total: number;
|
|
34
22
|
};
|
|
35
|
-
/**
|
|
36
|
-
* @public
|
|
37
|
-
*/
|
|
38
23
|
export type DeepStreamEventMap = {
|
|
39
24
|
data: [DeepStreamData];
|
|
40
25
|
end: [DeepStreamDataRoot];
|
|
41
26
|
progress: [DeepStreamProgress];
|
|
42
27
|
};
|
|
43
|
-
/**
|
|
44
|
-
* @public
|
|
45
|
-
*/
|
|
46
28
|
export type DeepStream = ReadableStream<Entry>;
|
|
47
|
-
/**
|
|
48
|
-
* @private
|
|
49
|
-
*/
|
|
50
|
-
type DeepStreamNestedOptions = DeepStreamOptions & {
|
|
51
|
-
controller?: DeepStreamEventEmitter;
|
|
52
|
-
parent?: Directory;
|
|
53
|
-
progress?: DeepStreamProgress;
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* @public
|
|
57
|
-
*/
|
|
58
29
|
export type DeepCountOptions = Pick<DeepStreamNestedOptions, 'modules' | 'cwd' | 'concurrency' | 'progress'>;
|
|
59
|
-
/**
|
|
60
|
-
* @public
|
|
61
|
-
*/
|
|
62
30
|
export type DeepModifiedTimeOptions = Pick<RealScanOptions, 'concurrency' | 'modules'>;
|
|
63
|
-
/**
|
|
64
|
-
* @public
|
|
65
|
-
*/
|
|
66
31
|
export type DeepStreamOptions = Pick<RealScanOptions, 'cwd' | 'modules' | 'concurrency'>;
|
|
67
|
-
/**
|
|
68
|
-
* @public
|
|
69
|
-
*/
|
|
70
32
|
export type Entry = Directory | File;
|
|
71
|
-
/**
|
|
72
|
-
* @public
|
|
73
|
-
*/
|
|
74
33
|
export type EntryClass = typeof Directory | typeof File;
|
|
75
|
-
/**
|
|
76
|
-
* @public
|
|
77
|
-
*/
|
|
78
34
|
export type EntryInstanceFrom<T extends undefined | EntryClass> = T extends undefined ? Entry : T extends typeof Directory ? Directory : File;
|
|
79
35
|
/**
|
|
80
36
|
* File system directory representation.
|
|
81
|
-
* @public
|
|
82
37
|
*/
|
|
83
38
|
export declare class Directory implements ParsedPath {
|
|
84
39
|
/**
|
|
@@ -125,13 +80,6 @@ export declare class Directory implements ParsedPath {
|
|
|
125
80
|
* Get deep iterator for the directory.
|
|
126
81
|
*/
|
|
127
82
|
static deepIterator: <T extends undefined | EntryClass>(directory: Directory, instanceOf?: T) => IterableIterator<EntryInstanceFrom<T>>;
|
|
128
|
-
/**
|
|
129
|
-
* Read directories and files progressively.
|
|
130
|
-
* @private This function should be wrapped by {@link deepStream}.
|
|
131
|
-
* @param directoryPath Relative path to the directory.
|
|
132
|
-
* @param options The reader options.
|
|
133
|
-
*/
|
|
134
|
-
private static deepStreamNested;
|
|
135
83
|
readonly base: string;
|
|
136
84
|
readonly dir: string;
|
|
137
85
|
readonly ext: string;
|
|
@@ -178,4 +126,3 @@ export declare class Directory implements ParsedPath {
|
|
|
178
126
|
*/
|
|
179
127
|
deepModifiedTime(out: Map<File, number>, realOptions: DeepModifiedTimeOptions): Promise<Map<File, number>>;
|
|
180
128
|
}
|
|
181
|
-
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable unicorn/prefer-event-target */
|
|
2
1
|
import { join, parse, relative, } from 'node:path';
|
|
3
2
|
import EventEmitter from 'node:events';
|
|
4
3
|
import * as FSP from 'node:fs/promises';
|
|
@@ -8,7 +7,6 @@ import { configDefault } from '../../config.js';
|
|
|
8
7
|
import { File } from './file.js';
|
|
9
8
|
/**
|
|
10
9
|
* File system directory representation.
|
|
11
|
-
* @public
|
|
12
10
|
*/
|
|
13
11
|
export class Directory {
|
|
14
12
|
parent;
|
|
@@ -70,7 +68,6 @@ export class Directory {
|
|
|
70
68
|
const tree = new Directory(undefined, '.', cwd, new Map());
|
|
71
69
|
for (const path of pathList) {
|
|
72
70
|
const entryNameList = path.toString().split(/[\\/]/);
|
|
73
|
-
// eslint-disable-next-line unicorn/no-array-reduce
|
|
74
71
|
entryNameList.reduce((tree, entryName, index) => {
|
|
75
72
|
const absolutePath = join(tree.absolutePath, entryName);
|
|
76
73
|
const relativePath = relative(cwd, absolutePath);
|
|
@@ -108,7 +105,7 @@ export class Directory {
|
|
|
108
105
|
};
|
|
109
106
|
/**
|
|
110
107
|
* Read directories and files progressively.
|
|
111
|
-
* @
|
|
108
|
+
* @internal This function should be wrapped by {@link deepStream}.
|
|
112
109
|
* @param directoryPath Relative path to the directory.
|
|
113
110
|
* @param options The reader options.
|
|
114
111
|
*/
|