view-ignored 0.2.2 → 0.3.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/README.md +23 -27
- package/bin/viewig +4 -2
- 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 +121 -107
- 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
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import { FileSystemAdapter, Methodology, ScanFileOptions, Scanner } from "./lib.js";
|
|
3
|
-
export interface SourceInfoHierarcyOptions<T extends {
|
|
4
|
-
toString(): string;
|
|
5
|
-
}> {
|
|
6
|
-
/**
|
|
7
|
-
* @default true
|
|
8
|
-
*/
|
|
9
|
-
closest?: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* @default undefined
|
|
12
|
-
*/
|
|
13
|
-
filter?: (path: T) => boolean;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* The source of patterns.
|
|
17
|
-
*/
|
|
18
|
-
export declare class SourceInfo {
|
|
19
|
-
/**
|
|
20
|
-
* The relative path to the file.
|
|
21
|
-
*/
|
|
22
|
-
readonly sourcePath: string;
|
|
23
|
-
/**
|
|
24
|
-
* The pattern parser.
|
|
25
|
-
*/
|
|
26
|
-
readonly scanner: Scanner;
|
|
27
|
-
/**
|
|
28
|
-
* The last source file content.
|
|
29
|
-
*/
|
|
30
|
-
content?: Buffer;
|
|
31
|
-
constructor(
|
|
32
|
-
/**
|
|
33
|
-
* The relative path to the file.
|
|
34
|
-
*/
|
|
35
|
-
sourcePath: string,
|
|
36
|
-
/**
|
|
37
|
-
* The pattern parser.
|
|
38
|
-
*/
|
|
39
|
-
scanner: Scanner);
|
|
40
|
-
/**
|
|
41
|
-
* Creates new {@link SourceInfo} instance.
|
|
42
|
-
*/
|
|
43
|
-
static from(path: string, methodology: Methodology): SourceInfo;
|
|
44
|
-
/**
|
|
45
|
-
* Gets sources from the methodology.
|
|
46
|
-
*/
|
|
47
|
-
static fromMethodology(methodology: Methodology, options: ScanFileOptions): Promise<SourceInfo[]>;
|
|
48
|
-
/**
|
|
49
|
-
* Selects the closest or farthest siblings relative to the path.
|
|
50
|
-
*/
|
|
51
|
-
static hierarcy<T extends {
|
|
52
|
-
toString(): string;
|
|
53
|
-
}>(target: string, pathList: T[], options?: SourceInfoHierarcyOptions<T>): T | undefined;
|
|
54
|
-
/**
|
|
55
|
-
* @returns File path of the source.
|
|
56
|
-
*/
|
|
57
|
-
toString(): string;
|
|
58
|
-
/**
|
|
59
|
-
* @returns The contents of the source file.
|
|
60
|
-
*/
|
|
61
|
-
readSync(cwd: string | undefined, readFileSync: Exclude<FileSystemAdapter["readFileSync"], undefined>): Buffer;
|
|
62
|
-
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { dirname, join } from "path";
|
|
2
|
-
import { Scanner } from "./lib.js";
|
|
3
|
-
import { glob } from "glob";
|
|
4
|
-
import arrify from "arrify";
|
|
5
|
-
/**
|
|
6
|
-
* The source of patterns.
|
|
7
|
-
*/
|
|
8
|
-
export class SourceInfo {
|
|
9
|
-
sourcePath;
|
|
10
|
-
scanner;
|
|
11
|
-
/**
|
|
12
|
-
* The last source file content.
|
|
13
|
-
*/
|
|
14
|
-
content;
|
|
15
|
-
constructor(
|
|
16
|
-
/**
|
|
17
|
-
* The relative path to the file.
|
|
18
|
-
*/
|
|
19
|
-
sourcePath,
|
|
20
|
-
/**
|
|
21
|
-
* The pattern parser.
|
|
22
|
-
*/
|
|
23
|
-
scanner) {
|
|
24
|
-
this.sourcePath = sourcePath;
|
|
25
|
-
this.scanner = scanner;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Creates new {@link SourceInfo} instance.
|
|
29
|
-
*/
|
|
30
|
-
static from(path, methodology) {
|
|
31
|
-
const scanner = new Scanner({
|
|
32
|
-
negated: methodology.matcherNegated,
|
|
33
|
-
ignoreCase: methodology.ignoreCase,
|
|
34
|
-
patternType: methodology.matcher
|
|
35
|
-
});
|
|
36
|
-
scanner.add(methodology.matcherAdd);
|
|
37
|
-
scanner.addExclude(methodology.matcherExclude);
|
|
38
|
-
scanner.addInclude(methodology.matcherInclude);
|
|
39
|
-
return new SourceInfo(path, scanner);
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Gets sources from the methodology.
|
|
43
|
-
*/
|
|
44
|
-
static async fromMethodology(methodology, options) {
|
|
45
|
-
const patterns = arrify(methodology.pattern);
|
|
46
|
-
if (patterns.some(p => typeof p !== "string")) {
|
|
47
|
-
return patterns;
|
|
48
|
-
}
|
|
49
|
-
const paths = await glob(patterns, {
|
|
50
|
-
...options,
|
|
51
|
-
nodir: true,
|
|
52
|
-
dot: true,
|
|
53
|
-
posix: true
|
|
54
|
-
});
|
|
55
|
-
const sourceInfoList = paths.map(p => SourceInfo.from(p, methodology));
|
|
56
|
-
return sourceInfoList;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Selects the closest or farthest siblings relative to the path.
|
|
60
|
-
*/
|
|
61
|
-
static hierarcy(target, pathList, options) {
|
|
62
|
-
const { closest = true, filter: scan } = options ?? {};
|
|
63
|
-
pathList = pathList.sort((a, b) => a.toString().localeCompare(b.toString()));
|
|
64
|
-
const checkStack = [];
|
|
65
|
-
// fill checkStack
|
|
66
|
-
let dir = target.toString();
|
|
67
|
-
for (;;) {
|
|
68
|
-
const parent = dirname(dir);
|
|
69
|
-
if (dir === parent) {
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
checkStack.push(dir = parent);
|
|
73
|
-
}
|
|
74
|
-
if (!closest) {
|
|
75
|
-
checkStack.reverse();
|
|
76
|
-
}
|
|
77
|
-
const cacheDirNames = new Map();
|
|
78
|
-
for (const dir of checkStack) {
|
|
79
|
-
const closestPath = pathList.find(path => {
|
|
80
|
-
let pathDir = cacheDirNames.get(path);
|
|
81
|
-
if (!pathDir) {
|
|
82
|
-
cacheDirNames.set(path, pathDir = dirname(path.toString()));
|
|
83
|
-
}
|
|
84
|
-
if (dir !== pathDir) {
|
|
85
|
-
return false;
|
|
86
|
-
}
|
|
87
|
-
return scan ? scan?.(path) : true;
|
|
88
|
-
});
|
|
89
|
-
if (closestPath) {
|
|
90
|
-
return closestPath;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* @returns File path of the source.
|
|
96
|
-
*/
|
|
97
|
-
toString() {
|
|
98
|
-
return this.sourcePath;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* @returns The contents of the source file.
|
|
102
|
-
*/
|
|
103
|
-
readSync(cwd, readFileSync) {
|
|
104
|
-
cwd ??= process.cwd();
|
|
105
|
-
return this.content = readFileSync(join(cwd, this.sourcePath));
|
|
106
|
-
}
|
|
107
|
-
}
|