view-ignored 0.4.0 → 0.4.2
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 +3 -4
- package/bin/viewig +1 -1
- package/out/{src/browser → browser}/binds/index.d.ts +1 -20
- package/out/{src/browser → browser}/binds/index.js +3 -9
- 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/jsr.d.ts +3 -0
- package/out/browser/binds/plugins/jsr.js +96 -0
- package/out/browser/binds/plugins/npm.d.ts +3 -0
- package/out/{src/browser → browser}/binds/plugins/npm.js +15 -16
- 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 +3 -6
- package/out/{src/browser → browser}/fs/file-info.d.ts +1 -6
- package/out/{src/browser → browser}/fs/file-info.js +1 -2
- 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 +2 -16
- 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} +4 -39
- package/out/{src/config.d.ts → config.d.ts} +0 -57
- package/out/{src/config.js → config.js} +11 -53
- 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} +1 -7
- package/package.json +32 -39
- 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
|
@@ -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;
|
|
@@ -49,8 +47,8 @@ export class Directory {
|
|
|
49
47
|
*/
|
|
50
48
|
static deepStream(directoryPath, optionsReal) {
|
|
51
49
|
const controller = new EventEmitter();
|
|
52
|
-
controller.endPromise = new Promise(resolve => {
|
|
53
|
-
controller.once('end', data => {
|
|
50
|
+
controller.endPromise = new Promise((resolve) => {
|
|
51
|
+
controller.once('end', (data) => {
|
|
54
52
|
resolve(data);
|
|
55
53
|
});
|
|
56
54
|
});
|
|
@@ -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
|
*/
|
|
@@ -6,7 +6,6 @@ import { type SourceInfo } from './source-info.js';
|
|
|
6
6
|
import { type Directory } from './directory.js';
|
|
7
7
|
/**
|
|
8
8
|
* @see {@link FileInfo.prototype.toString}
|
|
9
|
-
* @public
|
|
10
9
|
*/
|
|
11
10
|
export type FileInfoToStringOptions = {
|
|
12
11
|
/**
|
|
@@ -45,13 +44,9 @@ export type FileInfoToStringOptions = {
|
|
|
45
44
|
*/
|
|
46
45
|
entire?: boolean;
|
|
47
46
|
};
|
|
48
|
-
/**
|
|
49
|
-
* @public
|
|
50
|
-
*/
|
|
51
47
|
export type FileInfoStatus = 'ignored' | 'included' | 'non-target';
|
|
52
48
|
/**
|
|
53
49
|
* The result of the file path scan.
|
|
54
|
-
* @public
|
|
55
50
|
*/
|
|
56
51
|
export declare class FileInfo extends File {
|
|
57
52
|
/**
|
|
@@ -61,7 +56,7 @@ export declare class FileInfo extends File {
|
|
|
61
56
|
static from(file: File, source?: SourceInfo): FileInfo;
|
|
62
57
|
/**
|
|
63
58
|
* Determines if ignored file is ignored or not.
|
|
64
|
-
|
|
59
|
+
*/
|
|
65
60
|
readonly status: FileInfoStatus;
|
|
66
61
|
constructor(
|
|
67
62
|
/**
|
|
@@ -4,7 +4,6 @@ import { decorCondition } from '../styling.js';
|
|
|
4
4
|
import { File } from './file.js';
|
|
5
5
|
/**
|
|
6
6
|
* The result of the file path scan.
|
|
7
|
-
* @public
|
|
8
7
|
*/
|
|
9
8
|
export class FileInfo extends File {
|
|
10
9
|
source;
|
|
@@ -13,7 +12,7 @@ export class FileInfo extends File {
|
|
|
13
12
|
}
|
|
14
13
|
/**
|
|
15
14
|
* Determines if ignored file is ignored or not.
|
|
16
|
-
|
|
15
|
+
*/
|
|
17
16
|
status;
|
|
18
17
|
constructor(
|
|
19
18
|
/**
|
|
@@ -10,12 +10,10 @@ export * as Sorting from './sorting.js';
|
|
|
10
10
|
export * as Plugins from './binds/index.js';
|
|
11
11
|
/**
|
|
12
12
|
* ViewIgnored's package.json.
|
|
13
|
-
|
|
14
|
-
*/
|
|
13
|
+
*/
|
|
15
14
|
export declare const package_: typeof import("../../package.json");
|
|
16
15
|
/**
|
|
17
16
|
* Uses `node:fs` and `node:fs/promises` by default.
|
|
18
|
-
* @public
|
|
19
17
|
*/
|
|
20
18
|
export type FileSystemAdapter = {
|
|
21
19
|
readFileSync?: typeof FS.readFileSync;
|
|
@@ -29,7 +27,6 @@ export type FileSystemAdapter = {
|
|
|
29
27
|
};
|
|
30
28
|
/**
|
|
31
29
|
* The custom scanner.
|
|
32
|
-
* @public
|
|
33
30
|
*/
|
|
34
31
|
export type Scanner = {
|
|
35
32
|
/**
|
|
@@ -42,12 +39,10 @@ export type Scanner = {
|
|
|
42
39
|
* @throws If the target does not allow the current ignore configurations: {@link ViewIgnoredError}.
|
|
43
40
|
* For example, {@link https://www.npmjs.com/package/@vscode/vsce vsce} considers it invalid if your manifest is missing the 'engines' field.
|
|
44
41
|
* Similarly, npm will raise an error if you attempt to publish a package without a basic 'package.json'.
|
|
45
|
-
* @public
|
|
46
42
|
*/
|
|
47
43
|
export type Methodology = (tree: Directory, realOptions: RealScanOptions) => Map<File, SourceInfo>;
|
|
48
44
|
/**
|
|
49
45
|
* Options with defaults and additional properties.
|
|
50
|
-
* @public
|
|
51
46
|
*/
|
|
52
47
|
export type RealScanOptions = Required<Omit<ScanOptions, 'fsa'>> & {
|
|
53
48
|
modules: {
|
|
@@ -63,7 +58,6 @@ export type RealScanOptions = Required<Omit<ScanOptions, 'fsa'>> & {
|
|
|
63
58
|
};
|
|
64
59
|
/**
|
|
65
60
|
* Folder deep scanning options.
|
|
66
|
-
* @public
|
|
67
61
|
*/
|
|
68
62
|
export type ScanOptions = {
|
|
69
63
|
/**
|
|
@@ -111,32 +105,27 @@ export type ScanOptions = {
|
|
|
111
105
|
* Gets info about the each file: it is ignored or not.
|
|
112
106
|
* @param directoryPath The relative path to the directory.
|
|
113
107
|
* @throws If no valid sources: {@link ErrorNoSources}.
|
|
114
|
-
* @public
|
|
115
108
|
*/
|
|
116
109
|
export declare function scan(directoryPath: string, options?: ScanOptions): Promise<FileInfo[]>;
|
|
117
110
|
/**
|
|
118
111
|
* Gets info about the each file: it is ignored or not.
|
|
119
112
|
* @param directory The current working directory.
|
|
120
113
|
* @throws If no valid sources: {@link ErrorNoSources}.
|
|
121
|
-
* @public
|
|
122
114
|
*/
|
|
123
115
|
export declare function scan(directory: Directory, options?: ScanOptions): Promise<FileInfo[]>;
|
|
124
116
|
/**
|
|
125
117
|
* Gets info about the each file: it is ignored or not.
|
|
126
118
|
* @param stream The stream of the current working directory reading.
|
|
127
119
|
* @throws If no valid sources: {@link ErrorNoSources}.
|
|
128
|
-
* @public
|
|
129
120
|
*/
|
|
130
121
|
export declare function scan(stream: DeepStreamEventEmitter, options?: ScanOptions): Promise<FileInfo[]>;
|
|
131
122
|
/**
|
|
132
123
|
* Gets info about the each file: it is ignored or not.
|
|
133
124
|
* @param pathList The list of relative paths. The should be relative to the current working directory.
|
|
134
125
|
* @throws If no valid sources: {@link ErrorNoSources}.
|
|
135
|
-
* @public
|
|
136
126
|
*/
|
|
137
127
|
export declare function scan(pathList: string[], options?: ScanOptions): Promise<FileInfo[]>;
|
|
138
128
|
/**
|
|
139
129
|
* @returns Options with defaults and additional properties.
|
|
140
|
-
* @public
|
|
141
130
|
*/
|
|
142
131
|
export declare function makeOptionsReal(options?: ScanOptions): RealScanOptions;
|
|
@@ -16,9 +16,7 @@ export * as Sorting from './sorting.js';
|
|
|
16
16
|
export * as Plugins from './binds/index.js';
|
|
17
17
|
/**
|
|
18
18
|
* ViewIgnored's package.json.
|
|
19
|
-
|
|
20
|
-
*/
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
|
|
19
|
+
*/
|
|
22
20
|
export const package_ = createRequire(import.meta.url)('../../package.json');
|
|
23
21
|
export async function scan(argument0, options) {
|
|
24
22
|
options ??= {};
|
|
@@ -69,7 +67,6 @@ export async function scan(argument0, options) {
|
|
|
69
67
|
}
|
|
70
68
|
/**
|
|
71
69
|
* @returns Options with defaults and additional properties.
|
|
72
|
-
* @public
|
|
73
70
|
*/
|
|
74
71
|
export function makeOptionsReal(options) {
|
|
75
72
|
options ??= {};
|
|
@@ -1,25 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Contains all file sort names.
|
|
3
|
-
* @public
|
|
4
3
|
*/
|
|
5
4
|
export declare const sortNameList: readonly ["firstFolders", "firstFiles", "type", "mixed", "modified"];
|
|
6
5
|
/**
|
|
7
6
|
* Contains all file sort names as a type.
|
|
8
|
-
* @public
|
|
9
7
|
*/
|
|
10
8
|
export type SortName = typeof sortNameList[number];
|
|
11
9
|
/**
|
|
12
10
|
* {@link Array.prototype.sort}'s file path comparator.
|
|
13
|
-
* @public
|
|
14
11
|
*/
|
|
15
12
|
export type SortFunction = (a: string, b: string) => number;
|
|
16
13
|
/**
|
|
17
14
|
* Checks if the value is the {@link SortName}.
|
|
18
|
-
* @public
|
|
19
15
|
*/
|
|
20
16
|
export declare function isSortName(value: unknown): value is SortName;
|
|
21
17
|
/**
|
|
22
|
-
* @public
|
|
23
18
|
* @example
|
|
24
19
|
* "path/to/the/file" -> ["path", "to/the/file", false]
|
|
25
20
|
* "file" -> ["file", "file", true]
|
|
@@ -29,20 +24,17 @@ export declare function shiftPath(p: string): [next: string, other: string, isLa
|
|
|
29
24
|
/**
|
|
30
25
|
* Files and folders are sorted by their names.
|
|
31
26
|
* Folders are displayed before files.
|
|
32
|
-
* @public
|
|
33
27
|
*/
|
|
34
28
|
export declare function firstFolders(a: string, b: string): number;
|
|
35
29
|
/**
|
|
36
30
|
* Files and folders are sorted by their names.
|
|
37
31
|
* Files are displayed before folders.
|
|
38
|
-
* @public
|
|
39
32
|
*/
|
|
40
33
|
export declare function firstFiles(a: string, b: string): number;
|
|
41
34
|
/**
|
|
42
35
|
* Files and folders are sorted by last modified date in descending order.
|
|
43
36
|
* Folders are displayed before files.
|
|
44
37
|
* @see {@link makeMtimeCache}
|
|
45
|
-
* @public
|
|
46
38
|
*/
|
|
47
39
|
export declare function modified(a: string, b: string, map: Map<{
|
|
48
40
|
toString(): string;
|
|
@@ -50,12 +42,10 @@ export declare function modified(a: string, b: string, map: Map<{
|
|
|
50
42
|
/**
|
|
51
43
|
* Files and folders are grouped by extension type then sorted by thir names.
|
|
52
44
|
* Folders are displayed before files.
|
|
53
|
-
* @public
|
|
54
45
|
*/
|
|
55
46
|
export declare function type(a: string, b: string): number;
|
|
56
47
|
/**
|
|
57
48
|
* Files and folders are sorted by their names.
|
|
58
49
|
* Files are interwoven with folders.
|
|
59
|
-
* @public
|
|
60
50
|
*/
|
|
61
51
|
export declare function mixed(a: string, b: string): number;
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
/**
|
|
3
3
|
* Contains all file sort names.
|
|
4
|
-
* @public
|
|
5
4
|
*/
|
|
6
5
|
export const sortNameList = ['firstFolders', 'firstFiles', 'type', 'mixed', 'modified'];
|
|
7
6
|
/**
|
|
8
7
|
* Checks if the value is the {@link SortName}.
|
|
9
|
-
* @public
|
|
10
8
|
*/
|
|
11
9
|
export function isSortName(value) {
|
|
12
10
|
return typeof value === 'string' && sortNameList.includes(value);
|
|
13
11
|
}
|
|
14
12
|
/**
|
|
15
|
-
* @public
|
|
16
13
|
* @example
|
|
17
14
|
* "path/to/the/file" -> ["path", "to/the/file", false]
|
|
18
15
|
* "file" -> ["file", "file", true]
|
|
@@ -28,7 +25,6 @@ export function shiftPath(p) {
|
|
|
28
25
|
/**
|
|
29
26
|
* Files and folders are sorted by their names.
|
|
30
27
|
* Folders are displayed before files.
|
|
31
|
-
* @public
|
|
32
28
|
*/
|
|
33
29
|
export function firstFolders(a, b) {
|
|
34
30
|
let comp = 0;
|
|
@@ -53,7 +49,6 @@ export function firstFolders(a, b) {
|
|
|
53
49
|
/**
|
|
54
50
|
* Files and folders are sorted by their names.
|
|
55
51
|
* Files are displayed before folders.
|
|
56
|
-
* @public
|
|
57
52
|
*/
|
|
58
53
|
export function firstFiles(a, b) {
|
|
59
54
|
let comp = 0;
|
|
@@ -79,7 +74,6 @@ export function firstFiles(a, b) {
|
|
|
79
74
|
* Files and folders are sorted by last modified date in descending order.
|
|
80
75
|
* Folders are displayed before files.
|
|
81
76
|
* @see {@link makeMtimeCache}
|
|
82
|
-
* @public
|
|
83
77
|
*/
|
|
84
78
|
export function modified(a, b, map) {
|
|
85
79
|
let comp = 0;
|
|
@@ -104,7 +98,6 @@ export function modified(a, b, map) {
|
|
|
104
98
|
/**
|
|
105
99
|
* Files and folders are grouped by extension type then sorted by thir names.
|
|
106
100
|
* Folders are displayed before files.
|
|
107
|
-
* @public
|
|
108
101
|
*/
|
|
109
102
|
export function type(a, b) {
|
|
110
103
|
let comp = 0;
|
|
@@ -131,7 +124,6 @@ export function type(a, b) {
|
|
|
131
124
|
/**
|
|
132
125
|
* Files and folders are sorted by their names.
|
|
133
126
|
* Files are interwoven with folders.
|
|
134
|
-
* @public
|
|
135
127
|
*/
|
|
136
128
|
export function mixed(a, b) {
|
|
137
129
|
return a.localeCompare(b, undefined, { ignorePunctuation: false });
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { type ChalkInstance } from 'chalk';
|
|
2
2
|
import { type Options } from 'boxen';
|
|
3
3
|
import { type FileInfo } from '../index.js';
|
|
4
|
-
/**
|
|
5
|
-
* @public
|
|
6
|
-
*/
|
|
7
4
|
export type FormatFilesOptions = {
|
|
8
5
|
/**
|
|
9
6
|
* On posix systems, this has no effect. But, on Windows, it means that
|
|
@@ -11,8 +8,8 @@ export type FormatFilesOptions = {
|
|
|
11
8
|
* resolved UNC forms, eg instead of `'C:\\foo\\bar'`, it would return
|
|
12
9
|
* `'//?/C:/foo/bar'`
|
|
13
10
|
* @default false
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
* @returns `/` delimited paths, even on Windows.
|
|
12
|
+
*/
|
|
16
13
|
posix?: boolean;
|
|
17
14
|
/**
|
|
18
15
|
* @default false
|
|
@@ -33,42 +30,34 @@ export type FormatFilesOptions = {
|
|
|
33
30
|
};
|
|
34
31
|
/**
|
|
35
32
|
* @returns Prints a readable file list. Here is '\n' ending.
|
|
36
|
-
* @public
|
|
37
33
|
*/
|
|
38
34
|
export declare function formatFiles(files: FileInfo[], options: FormatFilesOptions): string;
|
|
39
35
|
/**
|
|
40
36
|
* Contains all style names.
|
|
41
|
-
* @public
|
|
42
37
|
*/
|
|
43
38
|
export declare const styleNameList: readonly ["tree", "paths"];
|
|
44
39
|
/**
|
|
45
40
|
* Contains all style names as a type.
|
|
46
|
-
* @public
|
|
47
41
|
*/
|
|
48
42
|
export type StyleName = typeof styleNameList[number];
|
|
49
43
|
/**
|
|
50
44
|
* Checks if the value is the {@link StyleName}.
|
|
51
|
-
* @public
|
|
52
45
|
*/
|
|
53
46
|
export declare function isStyleName(value: unknown): value is StyleName;
|
|
54
47
|
/**
|
|
55
48
|
* Contains all decor names.
|
|
56
|
-
* @public
|
|
57
49
|
*/
|
|
58
50
|
export declare const decorNameList: readonly ["normal", "emoji", "nerdfonts"];
|
|
59
51
|
/**
|
|
60
52
|
* Contains all decor names as a type.
|
|
61
|
-
* @public
|
|
62
53
|
*/
|
|
63
54
|
export type DecorName = typeof decorNameList[number];
|
|
64
55
|
/**
|
|
65
56
|
* Checks if the value is the {@link DecorName}.
|
|
66
|
-
* @public
|
|
67
57
|
*/
|
|
68
58
|
export declare function isDecorName(value: unknown): value is DecorName;
|
|
69
59
|
/**
|
|
70
60
|
* Formatting options for the {@link decorCondition}.
|
|
71
|
-
* @public
|
|
72
61
|
*/
|
|
73
62
|
export type DecorConditionOptions = {
|
|
74
63
|
/**
|
|
@@ -99,18 +88,15 @@ export type DecorConditionOptions = {
|
|
|
99
88
|
* Formats the string for specific style types.
|
|
100
89
|
* @param decor The decor name.
|
|
101
90
|
* @param condition Formatting options.
|
|
102
|
-
* @public
|
|
103
91
|
*/
|
|
104
92
|
export declare function decorCondition(decor: DecorName, condition: DecorConditionOptions): string;
|
|
105
93
|
/**
|
|
106
94
|
* @see {@link boxError}
|
|
107
|
-
* @public
|
|
108
95
|
*/
|
|
109
96
|
export type BoxOptions = {
|
|
110
97
|
noColor?: boolean;
|
|
111
98
|
} & Options;
|
|
112
99
|
/**
|
|
113
100
|
* Make a message in a red box. Or without color.
|
|
114
|
-
* @public
|
|
115
101
|
*/
|
|
116
102
|
export declare function boxError(message: string, options?: BoxOptions): string;
|
|
@@ -5,7 +5,6 @@ import jsonifyPaths from 'jsonify-paths';
|
|
|
5
5
|
import boxen from 'boxen';
|
|
6
6
|
/**
|
|
7
7
|
* @returns Prints a readable file list. Here is '\n' ending.
|
|
8
|
-
* @public
|
|
9
8
|
*/
|
|
10
9
|
export function formatFiles(files, options) {
|
|
11
10
|
const { showSources = false, chalk, decor = 'normal', style, posix = false } = options ?? {};
|
|
@@ -24,24 +23,20 @@ export function formatFiles(files, options) {
|
|
|
24
23
|
}
|
|
25
24
|
/**
|
|
26
25
|
* Contains all style names.
|
|
27
|
-
* @public
|
|
28
26
|
*/
|
|
29
27
|
export const styleNameList = ['tree', 'paths'];
|
|
30
28
|
/**
|
|
31
29
|
* Checks if the value is the {@link StyleName}.
|
|
32
|
-
* @public
|
|
33
30
|
*/
|
|
34
31
|
export function isStyleName(value) {
|
|
35
32
|
return typeof value === 'string' && styleNameList.includes(value);
|
|
36
33
|
}
|
|
37
34
|
/**
|
|
38
35
|
* Contains all decor names.
|
|
39
|
-
* @public
|
|
40
36
|
*/
|
|
41
37
|
export const decorNameList = ['normal', 'emoji', 'nerdfonts'];
|
|
42
38
|
/**
|
|
43
39
|
* Checks if the value is the {@link DecorName}.
|
|
44
|
-
* @public
|
|
45
40
|
*/
|
|
46
41
|
export function isDecorName(value) {
|
|
47
42
|
return typeof value === 'string' && decorNameList.includes(value);
|
|
@@ -50,7 +45,6 @@ export function isDecorName(value) {
|
|
|
50
45
|
* Formats the string for specific style types.
|
|
51
46
|
* @param decor The decor name.
|
|
52
47
|
* @param condition Formatting options.
|
|
53
|
-
* @public
|
|
54
48
|
*/
|
|
55
49
|
export function decorCondition(decor, condition) {
|
|
56
50
|
let result = condition.ifNormal ?? '';
|
|
@@ -67,7 +61,6 @@ export function decorCondition(decor, condition) {
|
|
|
67
61
|
}
|
|
68
62
|
/**
|
|
69
63
|
* Make a message in a red box. Or without color.
|
|
70
|
-
* @public
|
|
71
64
|
*/
|
|
72
65
|
export function boxError(message, options) {
|
|
73
66
|
let result = ('\n' + boxen(message, {
|