view-ignored 0.2.2 → 0.3.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/README.md +23 -27
- package/bin/viewig +3 -1
- package/out/src/browser/binds/index.d.ts +40 -21
- package/out/src/browser/binds/index.js +62 -48
- package/out/src/browser/binds/plugins/git.d.ts +22 -3
- package/out/src/browser/binds/plugins/git.js +57 -21
- package/out/src/browser/binds/plugins/npm.d.ts +36 -9
- package/out/src/browser/binds/plugins/npm.js +125 -59
- package/out/src/browser/binds/plugins/vsce.d.ts +24 -8
- package/out/src/browser/binds/plugins/vsce.js +56 -16
- package/out/src/browser/binds/plugins/yarn.d.ts +5 -10
- package/out/src/browser/binds/plugins/yarn.js +18 -68
- package/out/src/browser/binds/scanner.d.ts +56 -0
- package/out/src/browser/binds/scanner.js +134 -0
- package/out/src/browser/binds/targets.d.ts +35 -11
- package/out/src/browser/binds/targets.js +10 -17
- package/out/src/browser/errors.d.ts +58 -7
- package/out/src/browser/errors.js +40 -12
- package/out/src/browser/filtering.d.ts +15 -0
- package/out/src/browser/filtering.js +12 -0
- package/out/src/browser/fs/directory.d.ts +181 -0
- package/out/src/browser/fs/directory.js +235 -0
- package/out/src/browser/{fileinfo.d.ts → fs/file-info.d.ts} +38 -27
- package/out/src/browser/fs/file-info.js +86 -0
- package/out/src/browser/fs/file.d.ts +41 -0
- package/out/src/browser/fs/file.js +43 -0
- package/out/src/browser/fs/index.d.ts +4 -0
- package/out/src/browser/fs/index.js +4 -0
- package/out/src/browser/fs/source-info.d.ts +29 -0
- package/out/src/browser/fs/source-info.js +31 -0
- package/out/src/browser/index.d.ts +2 -2
- package/out/src/browser/index.js +2 -2
- package/out/src/browser/lib.d.ts +102 -101
- package/out/src/browser/lib.js +86 -120
- package/out/src/browser/sorting.d.ts +22 -2
- package/out/src/browser/sorting.js +37 -32
- package/out/src/browser/styling.d.ts +41 -15
- package/out/src/browser/styling.js +28 -97
- package/out/src/cli.d.ts +73 -34
- package/out/src/cli.js +308 -155
- package/out/src/config.d.ts +163 -65
- package/out/src/config.js +285 -171
- package/out/src/errors.d.ts +7 -0
- package/out/src/errors.js +1 -0
- package/out/src/index.d.ts +2 -2
- package/out/src/index.js +2 -2
- package/out/src/lib.d.ts +4 -4
- package/out/src/lib.js +4 -4
- package/out/src/styling.d.ts +10 -4
- package/out/src/styling.js +46 -33
- package/package.json +37 -23
- package/out/src/bin.d.ts +0 -2
- package/out/src/bin.js +0 -3
- package/out/src/browser/fileinfo.js +0 -78
- package/out/src/browser/scanner.d.ts +0 -103
- package/out/src/browser/scanner.js +0 -161
- package/out/src/browser/sourceinfo.d.ts +0 -62
- package/out/src/browser/sourceinfo.js +0 -107
package/out/src/config.d.ts
CHANGED
|
@@ -1,103 +1,199 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export declare const colorTypeList: readonly [0, 1, 2, 3];
|
|
8
|
-
/**
|
|
9
|
-
* Contains all color level names as a type.
|
|
10
|
-
*/
|
|
11
|
-
export type ColorType = ColorSupportLevel;
|
|
12
|
-
/**
|
|
13
|
-
* Checks if the value is the {@link ColorType}.
|
|
14
|
-
*/
|
|
15
|
-
export declare function isColorType(value: unknown): value is ColorType;
|
|
1
|
+
import { type ChalkInstance } from 'chalk';
|
|
2
|
+
import { type Command, type Option } from 'commander';
|
|
3
|
+
import { type DecorName, type StyleName } from './styling.js';
|
|
4
|
+
import { type ConfigCheckMap } from './errors.js';
|
|
5
|
+
import { type SortName } from './browser/sorting.js';
|
|
6
|
+
import { type FilterName } from './browser/filtering.js';
|
|
16
7
|
/**
|
|
17
8
|
* The full config file name - `".view-ignored"`.
|
|
9
|
+
* @public
|
|
18
10
|
*/
|
|
19
11
|
export declare const configFileName = ".view-ignored";
|
|
20
|
-
/**
|
|
21
|
-
* The user's home directory + the config file name.
|
|
22
|
-
* @see {@link os.homedir}
|
|
23
|
-
*/
|
|
24
|
-
export declare const configFilePath: string;
|
|
25
12
|
/**
|
|
26
13
|
* Command-line configuration property list.
|
|
14
|
+
* @public
|
|
27
15
|
*/
|
|
28
|
-
export declare const configKeyList: readonly ["
|
|
16
|
+
export declare const configKeyList: readonly ["posix", "noColor", "target", "filter", "sort", "style", "decor", "depth", "showSources", "plugins", "parsable", "concurrency"];
|
|
29
17
|
/**
|
|
30
|
-
* Command-line configuration's
|
|
18
|
+
* Command-line configuration's property type.
|
|
19
|
+
* @public
|
|
31
20
|
*/
|
|
32
21
|
export type ConfigKey = typeof configKeyList[number] & keyof Config;
|
|
33
22
|
/**
|
|
34
|
-
*
|
|
23
|
+
* @public
|
|
35
24
|
*/
|
|
36
|
-
export declare function isConfigKey(value: unknown): value is ConfigKey;
|
|
37
25
|
export type ConfigValue<KeyT extends ConfigKey = ConfigKey> = Config[KeyT];
|
|
26
|
+
/**
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
38
29
|
export type ShowSourcesType = boolean;
|
|
39
|
-
export declare function isShowSources(value: unknown): value is ShowSourcesType;
|
|
40
30
|
/**
|
|
41
|
-
*
|
|
31
|
+
* @public
|
|
42
32
|
*/
|
|
43
|
-
export declare function
|
|
33
|
+
export declare function isShowSources(value: unknown): value is ShowSourcesType;
|
|
44
34
|
/**
|
|
45
35
|
* Represents array with the key nad the value.
|
|
36
|
+
* @public
|
|
46
37
|
*/
|
|
47
38
|
export type ConfigPair<KeyT extends ConfigKey = ConfigKey> = [key: KeyT, value: ConfigValue<KeyT>];
|
|
48
39
|
/**
|
|
49
40
|
* Command-line configuration structure.
|
|
50
41
|
* @see {@link configKeyList} Before adding new properties.
|
|
42
|
+
* @public
|
|
51
43
|
*/
|
|
52
44
|
export type Config = {
|
|
45
|
+
[key: string]: unknown;
|
|
53
46
|
parsable: boolean;
|
|
47
|
+
noColor: boolean;
|
|
48
|
+
posix: boolean;
|
|
54
49
|
plugins: string[];
|
|
55
|
-
color: ColorType;
|
|
56
50
|
target: string;
|
|
57
51
|
filter: FilterName;
|
|
58
|
-
sort:
|
|
59
|
-
style:
|
|
60
|
-
decor:
|
|
52
|
+
sort: SortName;
|
|
53
|
+
style: StyleName;
|
|
54
|
+
decor: DecorName;
|
|
61
55
|
depth: number;
|
|
62
56
|
showSources: ShowSourcesType;
|
|
57
|
+
concurrency: number;
|
|
63
58
|
};
|
|
64
59
|
/**
|
|
65
60
|
* Command-line default config values.
|
|
61
|
+
* @public
|
|
66
62
|
*/
|
|
67
63
|
export declare const configDefault: Readonly<Config>;
|
|
68
64
|
/**
|
|
69
|
-
* @returns
|
|
65
|
+
* @returns Error message and parsed value.
|
|
66
|
+
* @public
|
|
67
|
+
*/
|
|
68
|
+
export type ConfigValidator = ((value: unknown) => string | undefined) & {
|
|
69
|
+
typeName: string;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* @public
|
|
73
|
+
*/
|
|
74
|
+
export declare const configValueArray: <T extends ConfigValidator>(type?: T) => ConfigValidator;
|
|
75
|
+
/**
|
|
76
|
+
* @public
|
|
77
|
+
*/
|
|
78
|
+
export declare const configValueLiteral: (choices: readonly unknown[]) => ConfigValidator;
|
|
79
|
+
/**
|
|
80
|
+
* @public
|
|
81
|
+
*/
|
|
82
|
+
export declare const switchTrueValues: string[];
|
|
83
|
+
/**
|
|
84
|
+
* @public
|
|
85
|
+
*/
|
|
86
|
+
export declare const switchFalseValues: string[];
|
|
87
|
+
/**
|
|
88
|
+
* @public
|
|
89
|
+
*/
|
|
90
|
+
export declare const booleanValues: string[];
|
|
91
|
+
/**
|
|
92
|
+
* @public
|
|
93
|
+
*/
|
|
94
|
+
export declare const configValueSwitch: () => ConfigValidator;
|
|
95
|
+
/**
|
|
96
|
+
* @public
|
|
97
|
+
*/
|
|
98
|
+
export declare const configValueBoolean: () => ConfigValidator;
|
|
99
|
+
/**
|
|
100
|
+
* @public
|
|
101
|
+
*/
|
|
102
|
+
export declare const configValueObject: () => ConfigValidator;
|
|
103
|
+
/**
|
|
104
|
+
* @public
|
|
105
|
+
*/
|
|
106
|
+
export declare const configValueString: () => ConfigValidator;
|
|
107
|
+
/**
|
|
108
|
+
* @public
|
|
109
|
+
*/
|
|
110
|
+
export declare const configValueNumber: () => ConfigValidator;
|
|
111
|
+
/**
|
|
112
|
+
* @public
|
|
113
|
+
*/
|
|
114
|
+
export declare const configValueInteger: () => ConfigValidator;
|
|
115
|
+
/**
|
|
116
|
+
* @public
|
|
70
117
|
*/
|
|
71
|
-
export
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
118
|
+
export type ConfigManagerGetOptions = {
|
|
119
|
+
/**
|
|
120
|
+
* Use default value as fallback.
|
|
121
|
+
* @default true
|
|
122
|
+
*/
|
|
123
|
+
real?: boolean;
|
|
124
|
+
};
|
|
75
125
|
/**
|
|
76
|
-
* @
|
|
77
|
-
* @param key The config property.
|
|
78
|
-
* @param fallbackDefault If `true`, the default value will be used when the value is `undefined`. Default `true`.
|
|
126
|
+
* @public
|
|
79
127
|
*/
|
|
80
|
-
export
|
|
81
|
-
|
|
82
|
-
|
|
128
|
+
export type ConfigManagerGetPairStringOptions = ConfigManagerGetOptions & {
|
|
129
|
+
/**
|
|
130
|
+
* Add the type postfix.
|
|
131
|
+
* @default true
|
|
132
|
+
*/
|
|
133
|
+
types?: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Determine the colors behavior.
|
|
136
|
+
* @default undefined
|
|
137
|
+
*/
|
|
138
|
+
chalk?: ChalkInstance;
|
|
139
|
+
/**
|
|
140
|
+
* Use parsable format. If enabled, `chalk` option ignored.
|
|
141
|
+
* @default false
|
|
142
|
+
*/
|
|
143
|
+
parsable?: boolean;
|
|
144
|
+
};
|
|
83
145
|
/**
|
|
84
146
|
* File-specific actions container.
|
|
147
|
+
* @public
|
|
85
148
|
*/
|
|
86
|
-
export declare class ConfigManager {
|
|
87
|
-
readonly
|
|
88
|
-
constructor(filePath: string);
|
|
149
|
+
export declare class ConfigManager<ConfigType extends Config = Config> {
|
|
150
|
+
readonly path: string;
|
|
89
151
|
/**
|
|
90
152
|
* Do not change this value directly.
|
|
91
153
|
* @see {@link configManager}.
|
|
92
154
|
*/
|
|
93
155
|
private data;
|
|
94
|
-
|
|
95
|
-
|
|
156
|
+
private readonly configValidation;
|
|
157
|
+
private readonly cliOptionLinkMap;
|
|
158
|
+
private readonly dataDefault;
|
|
159
|
+
constructor(path: string);
|
|
160
|
+
dataCheck(data: unknown): ConfigCheckMap | string;
|
|
161
|
+
/**
|
|
162
|
+
* Get type name for the key.
|
|
163
|
+
*/
|
|
164
|
+
getType<T extends keyof ConfigType>(key: T): string;
|
|
165
|
+
getType(key: string): string;
|
|
166
|
+
/**
|
|
167
|
+
* Get type checker for the key.
|
|
168
|
+
*/
|
|
169
|
+
keyGetValidator<T extends keyof ConfigType>(key: T): ConfigValidator | undefined;
|
|
170
|
+
/**
|
|
171
|
+
* Define type checker for the key.
|
|
172
|
+
*/
|
|
173
|
+
keySetValidator<T extends keyof ConfigType & string>(key: T, defaultValue: ConfigType[T], type: ConfigValidator): this;
|
|
174
|
+
/**
|
|
175
|
+
* Checks if the key is defined.
|
|
176
|
+
* @returns Error message if the key is not defined.
|
|
177
|
+
*/
|
|
178
|
+
checkKey(key: string): string | undefined;
|
|
179
|
+
/**
|
|
180
|
+
* Call the type checker for the key.
|
|
181
|
+
*/
|
|
182
|
+
checkValue<T extends keyof ConfigType>(key: T, value: unknown): string | undefined;
|
|
183
|
+
/**
|
|
184
|
+
* Link a configuration property with a command-line option.
|
|
185
|
+
*/
|
|
186
|
+
setOption<T extends keyof ConfigType>(key: T, command: Command, option: Option, parseArgument?: (argument: string) => unknown): this;
|
|
187
|
+
/**
|
|
188
|
+
* Get a command-line option for the configuration property.
|
|
189
|
+
*/
|
|
190
|
+
getOption<T extends keyof ConfigType>(key: T): Option | undefined;
|
|
191
|
+
getOption(key: string): Option | undefined;
|
|
96
192
|
/**
|
|
97
|
-
* Loads the config from the file to {@link configManager.data}.
|
|
98
|
-
* @returns
|
|
193
|
+
* Loads the config from the file to {@link configManager.data}.
|
|
194
|
+
* @returns The error message for each invalid property.
|
|
99
195
|
*/
|
|
100
|
-
load():
|
|
196
|
+
load(): ConfigCheckMap | string | undefined;
|
|
101
197
|
/**
|
|
102
198
|
* Saves the partial config to the file. If there are no settings, the file will be deleted, if exists.
|
|
103
199
|
*/
|
|
@@ -108,34 +204,36 @@ export declare class ConfigManager {
|
|
|
108
204
|
* @param key The name of the config property.
|
|
109
205
|
* @param value The new value for the config property.
|
|
110
206
|
*/
|
|
111
|
-
set<T extends
|
|
207
|
+
set<T extends keyof ConfigType>(key: T, value: ConfigType[T]): string | undefined;
|
|
208
|
+
set(key: string, value: unknown): string | undefined;
|
|
112
209
|
/**
|
|
113
210
|
* Deletes the specified property from the config.
|
|
114
211
|
* If the property is not specified, then all properties will be deleted.
|
|
115
212
|
* @param key The config property.
|
|
116
213
|
*/
|
|
117
|
-
unset<T extends
|
|
214
|
+
unset<T extends keyof ConfigType>(key?: T): this;
|
|
215
|
+
unset(key?: string): this;
|
|
118
216
|
/**
|
|
119
217
|
* @returns An array of properties which defined in the configuration file.
|
|
120
218
|
*/
|
|
121
|
-
|
|
219
|
+
keyList(real?: boolean): Array<keyof ConfigType>;
|
|
122
220
|
/**
|
|
123
221
|
* @param key The config property.
|
|
124
|
-
* @param
|
|
222
|
+
* @param real The options.
|
|
125
223
|
* @returns The value for the specified property.
|
|
126
224
|
*/
|
|
127
|
-
get<
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
getPairString<KeyT extends ConfigKey>(key?: KeyT, defs?: boolean): string;
|
|
225
|
+
get<T extends keyof ConfigType>(key: T, options: ConfigManagerGetOptions & {
|
|
226
|
+
real?: false;
|
|
227
|
+
}): ConfigType[T] | undefined;
|
|
228
|
+
get<T extends keyof ConfigType>(key: T, options?: ConfigManagerGetOptions & {
|
|
229
|
+
real: true;
|
|
230
|
+
}): ConfigType[T];
|
|
231
|
+
get(key: string, options?: ConfigManagerGetOptions): unknown;
|
|
232
|
+
getPairString<T extends keyof ConfigType>(keys?: T | T[], options?: ConfigManagerGetPairStringOptions): string;
|
|
233
|
+
getPairString(keys?: string | string[], options?: ConfigManagerGetPairStringOptions): string;
|
|
137
234
|
}
|
|
138
235
|
/**
|
|
139
236
|
* File-specific actions container. Contains get, set, unset, save, load and other configuration actions.
|
|
237
|
+
* @public
|
|
140
238
|
*/
|
|
141
|
-
export declare const configManager: ConfigManager
|
|
239
|
+
export declare const configManager: ConfigManager<Config>;
|