view-ignored 0.4.8 → 0.5.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 +84 -103
- package/out/index.d.ts +1 -4
- package/out/index.js +1 -4
- package/out/patterns/gitignore.d.ts +3 -0
- package/out/patterns/gitignore.js +35 -0
- package/out/patterns/index.d.ts +4 -0
- package/out/patterns/index.js +4 -0
- package/out/patterns/jsrjson.d.ts +4 -0
- package/out/patterns/jsrjson.js +39 -0
- package/out/patterns/matcher.d.ts +102 -0
- package/out/patterns/matcher.js +125 -0
- package/out/patterns/packagejson.d.ts +3 -0
- package/out/patterns/packagejson.js +25 -0
- package/out/scan.d.ts +49 -0
- package/out/scan.js +114 -0
- package/out/targets/git.d.ts +2 -0
- package/out/targets/git.js +22 -0
- package/out/targets/index.d.ts +6 -0
- package/out/targets/index.js +6 -0
- package/out/targets/jsr.d.ts +2 -0
- package/out/targets/jsr.js +25 -0
- package/out/targets/npm.d.ts +2 -0
- package/out/targets/npm.js +46 -0
- package/out/targets/target.d.ts +10 -0
- package/out/targets/target.js +1 -0
- package/out/targets/vsce.d.ts +2 -0
- package/out/targets/vsce.js +24 -0
- package/out/targets/yarn.d.ts +2 -0
- package/out/targets/yarn.js +49 -0
- package/out/walk.d.ts +2 -0
- package/out/walk.js +19 -0
- package/package.json +20 -54
- package/bin/viewig +0 -4
- package/out/browser/binds/index.d.ts +0 -56
- package/out/browser/binds/index.d.ts.map +0 -1
- package/out/browser/binds/index.js +0 -95
- package/out/browser/binds/index.js.map +0 -1
- package/out/browser/binds/plugins/git.d.ts +0 -23
- package/out/browser/binds/plugins/git.d.ts.map +0 -1
- package/out/browser/binds/plugins/git.js +0 -67
- package/out/browser/binds/plugins/git.js.map +0 -1
- package/out/browser/binds/plugins/jsr.d.ts +0 -39
- package/out/browser/binds/plugins/jsr.d.ts.map +0 -1
- package/out/browser/binds/plugins/jsr.js +0 -117
- package/out/browser/binds/plugins/jsr.js.map +0 -1
- package/out/browser/binds/plugins/npm.d.ts +0 -39
- package/out/browser/binds/plugins/npm.d.ts.map +0 -1
- package/out/browser/binds/plugins/npm.js +0 -146
- package/out/browser/binds/plugins/npm.js.map +0 -1
- package/out/browser/binds/plugins/vsce.d.ts +0 -26
- package/out/browser/binds/plugins/vsce.d.ts.map +0 -1
- package/out/browser/binds/plugins/vsce.js +0 -71
- package/out/browser/binds/plugins/vsce.js.map +0 -1
- package/out/browser/binds/plugins/yarn.d.ts +0 -12
- package/out/browser/binds/plugins/yarn.d.ts.map +0 -1
- package/out/browser/binds/plugins/yarn.js +0 -36
- package/out/browser/binds/plugins/yarn.js.map +0 -1
- package/out/browser/binds/scanner.d.ts +0 -47
- package/out/browser/binds/scanner.d.ts.map +0 -1
- package/out/browser/binds/scanner.js +0 -166
- package/out/browser/binds/scanner.js.map +0 -1
- package/out/browser/binds/targets.d.ts +0 -78
- package/out/browser/binds/targets.d.ts.map +0 -1
- package/out/browser/binds/targets.js +0 -46
- package/out/browser/binds/targets.js.map +0 -1
- package/out/browser/conc.d.ts +0 -2
- package/out/browser/conc.d.ts.map +0 -1
- package/out/browser/conc.js +0 -19
- package/out/browser/conc.js.map +0 -1
- package/out/browser/errors.d.ts +0 -47
- package/out/browser/errors.d.ts.map +0 -1
- package/out/browser/errors.js +0 -35
- package/out/browser/errors.js.map +0 -1
- package/out/browser/filtering.d.ts +0 -13
- package/out/browser/filtering.d.ts.map +0 -1
- package/out/browser/filtering.js +0 -12
- package/out/browser/filtering.js.map +0 -1
- package/out/browser/fs/directory.d.ts +0 -145
- package/out/browser/fs/directory.d.ts.map +0 -1
- package/out/browser/fs/directory.js +0 -244
- package/out/browser/fs/directory.js.map +0 -1
- package/out/browser/fs/file-info.d.ts +0 -89
- package/out/browser/fs/file-info.d.ts.map +0 -1
- package/out/browser/fs/file-info.js +0 -101
- package/out/browser/fs/file-info.js.map +0 -1
- package/out/browser/fs/file.d.ts +0 -39
- package/out/browser/fs/file.d.ts.map +0 -1
- package/out/browser/fs/file.js +0 -42
- package/out/browser/fs/file.js.map +0 -1
- package/out/browser/fs/index.d.ts +0 -5
- package/out/browser/fs/index.d.ts.map +0 -1
- package/out/browser/fs/index.js +0 -5
- package/out/browser/fs/index.js.map +0 -1
- package/out/browser/fs/source-info.d.ts +0 -29
- package/out/browser/fs/source-info.d.ts.map +0 -1
- package/out/browser/fs/source-info.js +0 -31
- package/out/browser/fs/source-info.js.map +0 -1
- package/out/browser/index.d.ts +0 -4
- package/out/browser/index.d.ts.map +0 -1
- package/out/browser/index.js +0 -4
- package/out/browser/index.js.map +0 -1
- package/out/browser/lib.d.ts +0 -138
- package/out/browser/lib.d.ts.map +0 -1
- package/out/browser/lib.js +0 -93
- package/out/browser/lib.js.map +0 -1
- package/out/browser/sorting.d.ts +0 -52
- package/out/browser/sorting.d.ts.map +0 -1
- package/out/browser/sorting.js +0 -137
- package/out/browser/sorting.js.map +0 -1
- package/out/browser/styling.d.ts +0 -92
- package/out/browser/styling.d.ts.map +0 -1
- package/out/browser/styling.js +0 -66
- package/out/browser/styling.js.map +0 -1
- package/out/cli.d.ts +0 -90
- package/out/cli.d.ts.map +0 -1
- package/out/cli.js +0 -360
- package/out/cli.js.map +0 -1
- package/out/config.d.ts +0 -186
- package/out/config.d.ts.map +0 -1
- package/out/config.js +0 -370
- package/out/config.js.map +0 -1
- package/out/errors.d.ts +0 -7
- package/out/errors.d.ts.map +0 -1
- package/out/errors.js +0 -3
- package/out/errors.js.map +0 -1
- package/out/index.d.ts.map +0 -1
- package/out/index.js.map +0 -1
- package/out/lib.d.ts +0 -5
- package/out/lib.d.ts.map +0 -1
- package/out/lib.js +0 -5
- package/out/lib.js.map +0 -1
- package/out/styling.d.ts +0 -5
- package/out/styling.d.ts.map +0 -1
- package/out/styling.js +0 -49
- package/out/styling.js.map +0 -1
package/out/browser/fs/file.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { parse } from 'node:path';
|
|
2
|
-
import {} from './directory.js';
|
|
3
|
-
export class File {
|
|
4
|
-
parent;
|
|
5
|
-
relativePath;
|
|
6
|
-
absolutePath;
|
|
7
|
-
base;
|
|
8
|
-
dir;
|
|
9
|
-
ext;
|
|
10
|
-
name;
|
|
11
|
-
root;
|
|
12
|
-
constructor(
|
|
13
|
-
/**
|
|
14
|
-
* The parent of the file.
|
|
15
|
-
*/
|
|
16
|
-
parent,
|
|
17
|
-
/**
|
|
18
|
-
* The relative path to the file.
|
|
19
|
-
*/
|
|
20
|
-
relativePath,
|
|
21
|
-
/**
|
|
22
|
-
* The absolute path to the file.
|
|
23
|
-
*/
|
|
24
|
-
absolutePath) {
|
|
25
|
-
this.parent = parent;
|
|
26
|
-
this.relativePath = relativePath;
|
|
27
|
-
this.absolutePath = absolutePath;
|
|
28
|
-
const parsed = parse(absolutePath);
|
|
29
|
-
this.base = parsed.base;
|
|
30
|
-
this.dir = parsed.dir;
|
|
31
|
-
this.ext = parsed.ext;
|
|
32
|
-
this.name = parsed.name;
|
|
33
|
-
this.root = parsed.root;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* @returns The relative path to the file.
|
|
37
|
-
*/
|
|
38
|
-
toString() {
|
|
39
|
-
return this.relativePath;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=file.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../../src/browser/fs/file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAmB,MAAM,WAAW,CAAA;AAClD,OAAO,EAAkB,MAAM,gBAAgB,CAAA;AAE/C,MAAM,OAAO,IAAI;IAUG;IAIA;IAIA;IAjBF,IAAI,CAAQ;IACZ,GAAG,CAAQ;IACX,GAAG,CAAQ;IACX,IAAI,CAAQ;IACZ,IAAI,CAAQ;IAC5B;IACE;;OAEG;IACa,MAAiB;IACjC;;OAEG;IACa,YAAoB;IACpC;;OAEG;IACa,YAAoB;QARpB,WAAM,GAAN,MAAM,CAAW;QAIjB,iBAAY,GAAZ,YAAY,CAAQ;QAIpB,iBAAY,GAAZ,YAAY,CAAQ;QAEpC,MAAM,MAAM,GAAG,KAAK,CAAC,YAAY,CAAC,CAAA;QAClC,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAA;QACvB,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAA;QACrB,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAA;QACrB,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAA;QACvB,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAA;IACzB,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,OAAO,IAAI,CAAC,YAAY,CAAA;IAC1B,CAAC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/browser/fs/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA"}
|
package/out/browser/fs/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/browser/fs/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { type Directory, File, type Scanner } from '../lib.js';
|
|
2
|
-
/**
|
|
3
|
-
* The source of patterns.
|
|
4
|
-
*/
|
|
5
|
-
export declare class SourceInfo extends File {
|
|
6
|
-
/**
|
|
7
|
-
* The scanner of patterns.
|
|
8
|
-
*/
|
|
9
|
-
readonly scanner: Scanner;
|
|
10
|
-
static from(file: File, scanner: Scanner): SourceInfo;
|
|
11
|
-
constructor(
|
|
12
|
-
/**
|
|
13
|
-
* The parent of the file.
|
|
14
|
-
*/
|
|
15
|
-
parent: Directory,
|
|
16
|
-
/**
|
|
17
|
-
* The relative path to the file.
|
|
18
|
-
*/
|
|
19
|
-
relativePath: string,
|
|
20
|
-
/**
|
|
21
|
-
* The absolute path to the file.
|
|
22
|
-
*/
|
|
23
|
-
absolutePath: string,
|
|
24
|
-
/**
|
|
25
|
-
* The scanner of patterns.
|
|
26
|
-
*/
|
|
27
|
-
scanner: Scanner);
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=source-info.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"source-info.d.ts","sourceRoot":"","sources":["../../../src/browser/fs/source-info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,IAAI,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAA;AAE9D;;GAEG;AACH,qBAAa,UAAW,SAAQ,IAAI;IAuBhC;;OAEG;aACa,OAAO,EAAE,OAAO;IAzBlC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO;;IAUtC;;OAEG;IACH,MAAM,EAAE,SAAS;IACjB;;OAEG;IACH,YAAY,EAAE,MAAM;IACpB;;OAEG;IACH,YAAY,EAAE,MAAM;IACpB;;OAEG;IACa,OAAO,EAAE,OAAO;CAInC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { File } from '../lib.js';
|
|
2
|
-
/**
|
|
3
|
-
* The source of patterns.
|
|
4
|
-
*/
|
|
5
|
-
export class SourceInfo extends File {
|
|
6
|
-
scanner;
|
|
7
|
-
static from(file, scanner) {
|
|
8
|
-
return new SourceInfo(file.parent, file.relativePath, file.absolutePath, scanner);
|
|
9
|
-
}
|
|
10
|
-
constructor(
|
|
11
|
-
/**
|
|
12
|
-
* The parent of the file.
|
|
13
|
-
*/
|
|
14
|
-
parent,
|
|
15
|
-
/**
|
|
16
|
-
* The relative path to the file.
|
|
17
|
-
*/
|
|
18
|
-
relativePath,
|
|
19
|
-
/**
|
|
20
|
-
* The absolute path to the file.
|
|
21
|
-
*/
|
|
22
|
-
absolutePath,
|
|
23
|
-
/**
|
|
24
|
-
* The scanner of patterns.
|
|
25
|
-
*/
|
|
26
|
-
scanner) {
|
|
27
|
-
super(parent, relativePath, absolutePath);
|
|
28
|
-
this.scanner = scanner;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=source-info.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"source-info.js","sourceRoot":"","sources":["../../../src/browser/fs/source-info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,IAAI,EAAgB,MAAM,WAAW,CAAA;AAE9D;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,IAAI;IA0BhB;IAzBlB,MAAM,CAAC,IAAI,CAAC,IAAU,EAAE,OAAgB;QACtC,OAAO,IAAI,UAAU,CACnB,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,YAAY,EACjB,OAAO,CACR,CAAA;IACH,CAAC;IAED;IACE;;OAEG;IACH,MAAiB;IACjB;;OAEG;IACH,YAAoB;IACpB;;OAEG;IACH,YAAoB;IACpB;;OAEG;IACa,OAAgB;QAEhC,KAAK,CAAC,MAAM,EAAE,YAAY,EAAE,YAAY,CAAC,CAAA;QAFzB,YAAO,GAAP,OAAO,CAAS;IAGlC,CAAC;CACF"}
|
package/out/browser/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,UAAU,CAAA;AAEvC,eAAe,WAAW,CAAA;AAC1B,cAAc,UAAU,CAAA"}
|
package/out/browser/index.js
DELETED
package/out/browser/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,UAAU,CAAA;AAEvC,eAAe,WAAW,CAAA;AAC1B,cAAc,UAAU,CAAA"}
|
package/out/browser/lib.d.ts
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import * as PATH from 'node:path';
|
|
2
|
-
import * as FS from 'node:fs';
|
|
3
|
-
import { type DeepStreamDataRoot, type DeepStreamEventEmitter, Directory, File, FileInfo, type SourceInfo } from './fs/index.js';
|
|
4
|
-
import { type FilterName } from './filtering.js';
|
|
5
|
-
export * from './errors.js';
|
|
6
|
-
export * from './fs/index.js';
|
|
7
|
-
export * as Filtering from './filtering.js';
|
|
8
|
-
export * as Styling from './styling.js';
|
|
9
|
-
export * as Sorting from './sorting.js';
|
|
10
|
-
export * as Plugins from './binds/index.js';
|
|
11
|
-
/**
|
|
12
|
-
* ViewIgnored's package.json.
|
|
13
|
-
*/
|
|
14
|
-
export declare const package_: typeof import("../../package.json");
|
|
15
|
-
/**
|
|
16
|
-
* Uses `node:fs` and `node:fs/promises` by default.
|
|
17
|
-
*/
|
|
18
|
-
export type FileSystemAdapter = {
|
|
19
|
-
readFileSync?: typeof FS.readFileSync;
|
|
20
|
-
readdirSync?: typeof FS.readdirSync;
|
|
21
|
-
promises?: {
|
|
22
|
-
readdir(path: string, options: {
|
|
23
|
-
withFileTypes: true;
|
|
24
|
-
}): Promise<FS.Dirent[]>;
|
|
25
|
-
stat(path: string): Promise<FS.Stats>;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* The custom scanner.
|
|
30
|
-
*/
|
|
31
|
-
export type Scanner = {
|
|
32
|
-
/**
|
|
33
|
-
* @returns `true`, if the given path is ignored.
|
|
34
|
-
*/
|
|
35
|
-
ignores(path: string): boolean;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Recursively creates a cache scanner for each file.
|
|
39
|
-
* @throws If the target does not allow the current ignore configurations: {@link ViewIgnoredError}.
|
|
40
|
-
* For example, {@link https://www.npmjs.com/package/@vscode/vsce vsce} considers it invalid if your manifest is missing the 'engines' field.
|
|
41
|
-
* Similarly, npm will raise an error if you attempt to publish a package without a basic 'package.json'.
|
|
42
|
-
*/
|
|
43
|
-
export type Methodology = (tree: Directory, realOptions: RealScanOptions) => Map<File, SourceInfo>;
|
|
44
|
-
/**
|
|
45
|
-
* Options with defaults and additional properties.
|
|
46
|
-
*/
|
|
47
|
-
export type RealScanOptions = Required<Omit<ScanOptions, 'fsa'>> & {
|
|
48
|
-
modules: {
|
|
49
|
-
/**
|
|
50
|
-
* File system adapter.
|
|
51
|
-
*/
|
|
52
|
-
fs: Required<FileSystemAdapter>;
|
|
53
|
-
/**
|
|
54
|
-
* Path module adapter.
|
|
55
|
-
*/
|
|
56
|
-
path: PATH.PlatformPath;
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* Folder deep scanning options.
|
|
61
|
-
*/
|
|
62
|
-
export type ScanOptions = {
|
|
63
|
-
/**
|
|
64
|
-
* The target or the scan methodology.
|
|
65
|
-
* @default "git"
|
|
66
|
-
*/
|
|
67
|
-
target?: string | Methodology;
|
|
68
|
-
/**
|
|
69
|
-
* The max concurrency for file-system operations.
|
|
70
|
-
* @default 8
|
|
71
|
-
*/
|
|
72
|
-
concurrency?: number;
|
|
73
|
-
/**
|
|
74
|
-
* Custom implementation of methods for working with the file system.
|
|
75
|
-
* @default import * as FS from "fs"
|
|
76
|
-
*/
|
|
77
|
-
fsa?: FileSystemAdapter;
|
|
78
|
-
/**
|
|
79
|
-
* The current working directory in which to search.
|
|
80
|
-
* @default process.cwd()
|
|
81
|
-
*/
|
|
82
|
-
cwd?: string;
|
|
83
|
-
/**
|
|
84
|
-
* Specifies the maximum depth of a read directory relative to the start
|
|
85
|
-
* directory.
|
|
86
|
-
* @default Infinity
|
|
87
|
-
*/
|
|
88
|
-
maxDepth?: number;
|
|
89
|
-
/**
|
|
90
|
-
* On posix systems, this has no effect. But, on Windows, it means that
|
|
91
|
-
* paths will be `/` delimited, and absolute paths will be their full
|
|
92
|
-
* resolved UNC forms, eg instead of `'C:\\foo\\bar'`, it would return
|
|
93
|
-
* `'//?/C:/foo/bar'`
|
|
94
|
-
* @default false
|
|
95
|
-
* @returns `/` delimited paths, even on Windows.
|
|
96
|
-
*/
|
|
97
|
-
posix?: boolean;
|
|
98
|
-
/**
|
|
99
|
-
* Filter output.
|
|
100
|
-
* @default "included"
|
|
101
|
-
*/
|
|
102
|
-
filter?: FilterName | ((fileInfo: FileInfo) => boolean);
|
|
103
|
-
};
|
|
104
|
-
/**
|
|
105
|
-
* Gets info about the each file: it is ignored or not.
|
|
106
|
-
* @param directoryPath The relative path to the directory.
|
|
107
|
-
* @throws If no valid sources: {@link ErrorNoSources}.
|
|
108
|
-
*/
|
|
109
|
-
export declare function scan(directoryPath: string, options?: ScanOptions): Promise<FileInfo[]>;
|
|
110
|
-
/**
|
|
111
|
-
* Gets info about the each file: it is ignored or not.
|
|
112
|
-
* @param directory The current working directory.
|
|
113
|
-
* @throws If no valid sources: {@link ErrorNoSources}.
|
|
114
|
-
*/
|
|
115
|
-
export declare function scan(directory: Directory, options?: ScanOptions): Promise<FileInfo[]>;
|
|
116
|
-
/**
|
|
117
|
-
* Gets info about the each file: it is ignored or not.
|
|
118
|
-
* @param stream The stream of the current working directory reading.
|
|
119
|
-
* @throws If no valid sources: {@link ErrorNoSources}.
|
|
120
|
-
*/
|
|
121
|
-
export declare function scan(stream: DeepStreamEventEmitter, options?: ScanOptions): Promise<FileInfo[]>;
|
|
122
|
-
/**
|
|
123
|
-
* Gets info about the each file: it is ignored or not.
|
|
124
|
-
* @param treeRoot Completed {@link DeepStreamEventEmitter}.
|
|
125
|
-
* @throws If no valid sources: {@link ErrorNoSources}.
|
|
126
|
-
*/
|
|
127
|
-
export declare function scan(treeRoot: DeepStreamDataRoot, options?: ScanOptions): Promise<FileInfo[]>;
|
|
128
|
-
/**
|
|
129
|
-
* Gets info about the each file: it is ignored or not.
|
|
130
|
-
* @param pathList The list of relative paths. The should be relative to the current working directory.
|
|
131
|
-
* @throws If no valid sources: {@link ErrorNoSources}.
|
|
132
|
-
*/
|
|
133
|
-
export declare function scan(pathList: string[], options?: ScanOptions): Promise<FileInfo[]>;
|
|
134
|
-
/**
|
|
135
|
-
* @returns Options with defaults and additional properties.
|
|
136
|
-
*/
|
|
137
|
-
export declare function makeOptionsReal(options?: ScanOptions): RealScanOptions;
|
|
138
|
-
//# sourceMappingURL=lib.d.ts.map
|
package/out/browser/lib.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../src/browser/lib.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAI7B,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,KAAK,UAAU,EAChB,MAAM,eAAe,CAAA;AAGtB,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAGhD,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAA;AAE3C;;GAEG;AAEH,eAAO,MAAM,QAAQ,EAEhB,cAAc,oBAAoB,CAAC,CAAA;AAExC;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,YAAY,CAAC,EAAE,OAAO,EAAE,CAAC,YAAY,CAAA;IACrC,WAAW,CAAC,EAAE,OA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AU,GAAG,CAAC,CAAC,QAAQ,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAA;CACxD,CAAA;AAED;;;;GAIG;AACH,wBAAsB,IAAI,CACxB,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAA;AAEtB;;;;GAIG;AACH,wBAAsB,IAAI,CACxB,SAAS,EAAE,SAAS,EACpB,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAA;AAEtB;;;;GAIG;AACH,wBAAsB,IAAI,CACxB,MAAM,EAAE,sBAAsB,EAC9B,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAA;AAEtB;;;;GAIG;AACH,wBAAsB,IAAI,CACxB,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAA;AAEtB;;;;GAIG;AACH,wBAAsB,IAAI,CACxB,QAAQ,EAAE,MAAM,EAAE,EAClB,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAA;AAwEtB;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,eAAe,CAiBtE"}
|
package/out/browser/lib.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import * as PATH from 'node:path';
|
|
2
|
-
import process from 'node:process';
|
|
3
|
-
import * as FS from 'node:fs';
|
|
4
|
-
import { createRequire } from 'node:module';
|
|
5
|
-
import EventEmitter from 'node:events';
|
|
6
|
-
import { configDefault } from '../config.js';
|
|
7
|
-
import { Directory, File, FileInfo, } from './fs/index.js';
|
|
8
|
-
import { targetGet } from './binds/index.js';
|
|
9
|
-
import { TargetNotBoundError } from './errors.js';
|
|
10
|
-
import {} from './filtering.js';
|
|
11
|
-
import { conc } from './conc.js';
|
|
12
|
-
export * from './errors.js';
|
|
13
|
-
export * from './fs/index.js';
|
|
14
|
-
export * as Filtering from './filtering.js';
|
|
15
|
-
export * as Styling from './styling.js';
|
|
16
|
-
export * as Sorting from './sorting.js';
|
|
17
|
-
export * as Plugins from './binds/index.js';
|
|
18
|
-
/**
|
|
19
|
-
* ViewIgnored's package.json.
|
|
20
|
-
*/
|
|
21
|
-
export const package_ = createRequire(import.meta.url)('../../package.json');
|
|
22
|
-
export async function scan(argument0, options) {
|
|
23
|
-
options ??= {};
|
|
24
|
-
const optionsReal = makeOptionsReal(options);
|
|
25
|
-
if (typeof optionsReal.target === 'string') {
|
|
26
|
-
const bind = targetGet(optionsReal.target);
|
|
27
|
-
if (bind === undefined) {
|
|
28
|
-
throw new TargetNotBoundError(optionsReal.target);
|
|
29
|
-
}
|
|
30
|
-
return scan(argument0, Object.assign(options, bind.scanOptions));
|
|
31
|
-
}
|
|
32
|
-
if (typeof argument0 === 'string') {
|
|
33
|
-
const stream = Directory.deepStream(argument0, optionsReal);
|
|
34
|
-
const result = scan(stream, options);
|
|
35
|
-
stream.run();
|
|
36
|
-
return result;
|
|
37
|
-
}
|
|
38
|
-
if (Array.isArray(argument0)) {
|
|
39
|
-
const tree = Directory.from(argument0, optionsReal.cwd);
|
|
40
|
-
return scan(tree, options);
|
|
41
|
-
}
|
|
42
|
-
if (argument0 instanceof EventEmitter) {
|
|
43
|
-
const { tree } = await argument0.endPromise;
|
|
44
|
-
argument0 = tree;
|
|
45
|
-
}
|
|
46
|
-
if ('progress' in argument0) {
|
|
47
|
-
argument0 = argument0.tree;
|
|
48
|
-
}
|
|
49
|
-
const tree = argument0;
|
|
50
|
-
const cache = optionsReal.target(tree, optionsReal);
|
|
51
|
-
const fileInfoList = [];
|
|
52
|
-
const promises = [];
|
|
53
|
-
for (const entry of tree.deepIterator(File)) {
|
|
54
|
-
promises.push(async () => {
|
|
55
|
-
const sourceInfo = cache.get(entry);
|
|
56
|
-
const depth = entry.relativePath.split(/[/\\]/).length - 1;
|
|
57
|
-
if (depth > optionsReal.maxDepth) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
const fileInfo = FileInfo.from(entry, sourceInfo);
|
|
61
|
-
const ignored = !fileInfo.isIncludedBy(optionsReal.filter);
|
|
62
|
-
if (ignored) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
fileInfoList.push(fileInfo);
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
await conc(promises, optionsReal.concurrency);
|
|
69
|
-
return fileInfoList;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* @returns Options with defaults and additional properties.
|
|
73
|
-
*/
|
|
74
|
-
export function makeOptionsReal(options) {
|
|
75
|
-
options ??= {};
|
|
76
|
-
const posix = options.posix ?? false;
|
|
77
|
-
const concurrency = options.concurrency ?? configDefault.concurrency;
|
|
78
|
-
const optionsReal = {
|
|
79
|
-
concurrency,
|
|
80
|
-
target: options.target ?? 'git',
|
|
81
|
-
cwd: options.cwd ?? process.cwd(),
|
|
82
|
-
filter: options.filter ?? configDefault.filter,
|
|
83
|
-
modules: {
|
|
84
|
-
fs: (options.fsa ?? FS),
|
|
85
|
-
path: posix ? PATH.posix : PATH,
|
|
86
|
-
},
|
|
87
|
-
maxDepth: options.maxDepth ?? configDefault.depth,
|
|
88
|
-
posix,
|
|
89
|
-
};
|
|
90
|
-
return optionsReal;
|
|
91
|
-
}
|
|
92
|
-
// #endregion
|
|
93
|
-
//# sourceMappingURL=lib.js.map
|
package/out/browser/lib.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../../src/browser/lib.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,OAAO,MAAM,cAAc,CAAA;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAA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
|
|
|
1
|
-
/**
|
|
2
|
-
* Contains all file sort names.
|
|
3
|
-
*/
|
|
4
|
-
export declare const sortNameList: readonly ["firstFolders", "firstFiles", "type", "mixed", "modified"];
|
|
5
|
-
/**
|
|
6
|
-
* Contains all file sort names as a type.
|
|
7
|
-
*/
|
|
8
|
-
export type SortName = typeof sortNameList[number];
|
|
9
|
-
/**
|
|
10
|
-
* {@link Array.prototype.sort}'s file path comparator.
|
|
11
|
-
*/
|
|
12
|
-
export type SortFunction = (a: string, b: string) => number;
|
|
13
|
-
/**
|
|
14
|
-
* Checks if the value is the {@link SortName}.
|
|
15
|
-
*/
|
|
16
|
-
export declare function isSortName(value: unknown): value is SortName;
|
|
17
|
-
/**
|
|
18
|
-
* @example
|
|
19
|
-
* "path/to/the/file" -> ["path", "to/the/file", false]
|
|
20
|
-
* "file" -> ["file", "file", true]
|
|
21
|
-
* "file/" -> ["file", "", false]
|
|
22
|
-
*/
|
|
23
|
-
export declare function shiftPath(p: string): [next: string, other: string, isLast: boolean];
|
|
24
|
-
/**
|
|
25
|
-
* Files and folders are sorted by their names.
|
|
26
|
-
* Folders are displayed before files.
|
|
27
|
-
*/
|
|
28
|
-
export declare function firstFolders(a: string, b: string): number;
|
|
29
|
-
/**
|
|
30
|
-
* Files and folders are sorted by their names.
|
|
31
|
-
* Files are displayed before folders.
|
|
32
|
-
*/
|
|
33
|
-
export declare function firstFiles(a: string, b: string): number;
|
|
34
|
-
/**
|
|
35
|
-
* Files and folders are sorted by last modified date in descending order.
|
|
36
|
-
* Folders are displayed before files.
|
|
37
|
-
* @see {@link makeMtimeCache}
|
|
38
|
-
*/
|
|
39
|
-
export declare function modified(a: string, b: string, map: Map<{
|
|
40
|
-
toString(): string;
|
|
41
|
-
}, number>): number;
|
|
42
|
-
/**
|
|
43
|
-
* Files and folders are grouped by extension type then sorted by thir names.
|
|
44
|
-
* Folders are displayed before files.
|
|
45
|
-
*/
|
|
46
|
-
export declare function type(a: string, b: string): number;
|
|
47
|
-
/**
|
|
48
|
-
* Files and folders are sorted by their names.
|
|
49
|
-
* Files are interwoven with folders.
|
|
50
|
-
*/
|
|
51
|
-
export declare function mixed(a: string, b: string): number;
|
|
52
|
-
//# sourceMappingURL=sorting.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sorting.d.ts","sourceRoot":"","sources":["../../src/browser/sorting.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,YAAY,sEAMf,CAAA;AAEV;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,YAAY,CAAC,MAAM,CAAC,CAAA;AAElD;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;AAE3D;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAE5D;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CACvB,CAAC,EAAE,MAAM,GACR,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAMhD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAsBzD;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAsBvD;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CACtB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,GAAG,EAAE,GAAG,CAAC;IAAE,QAAQ,IAAI,MAAM,CAAA;CAAE,EAAE,MAAM,CAAC,GACvC,MAAM,CAsBR;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAwBjD;AAED;;;GAGG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAElD"}
|
package/out/browser/sorting.js
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
/**
|
|
3
|
-
* Contains all file sort names.
|
|
4
|
-
*/
|
|
5
|
-
export const sortNameList = [
|
|
6
|
-
'firstFolders',
|
|
7
|
-
'firstFiles',
|
|
8
|
-
'type',
|
|
9
|
-
'mixed',
|
|
10
|
-
'modified',
|
|
11
|
-
];
|
|
12
|
-
/**
|
|
13
|
-
* Checks if the value is the {@link SortName}.
|
|
14
|
-
*/
|
|
15
|
-
export function isSortName(value) {
|
|
16
|
-
return typeof value === 'string' && sortNameList.includes(value);
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* @example
|
|
20
|
-
* "path/to/the/file" -> ["path", "to/the/file", false]
|
|
21
|
-
* "file" -> ["file", "file", true]
|
|
22
|
-
* "file/" -> ["file", "", false]
|
|
23
|
-
*/
|
|
24
|
-
export function shiftPath(p) {
|
|
25
|
-
const slashIndex = p.search(/[/\\]/);
|
|
26
|
-
const next = p.slice(0, Math.max(0, slashIndex));
|
|
27
|
-
const other = p.slice(Math.max(0, slashIndex + 1));
|
|
28
|
-
const isLast = next === '';
|
|
29
|
-
return [slashIndex < 0 ? other : next, other, isLast];
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Files and folders are sorted by their names.
|
|
33
|
-
* Folders are displayed before files.
|
|
34
|
-
*/
|
|
35
|
-
export function firstFolders(a, b) {
|
|
36
|
-
let comp = 0;
|
|
37
|
-
for (; comp === 0;) {
|
|
38
|
-
const [next1, post1, last1] = shiftPath(a);
|
|
39
|
-
a = post1;
|
|
40
|
-
const [next2, post2, last2] = shiftPath(b);
|
|
41
|
-
b = post2;
|
|
42
|
-
comp = mixed(next1, next2);
|
|
43
|
-
if (last1 || last2) {
|
|
44
|
-
if (last1 === last2) {
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
47
|
-
if (!last1) {
|
|
48
|
-
return -1;
|
|
49
|
-
}
|
|
50
|
-
return +1;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return comp;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Files and folders are sorted by their names.
|
|
57
|
-
* Files are displayed before folders.
|
|
58
|
-
*/
|
|
59
|
-
export function firstFiles(a, b) {
|
|
60
|
-
let comp = 0;
|
|
61
|
-
for (; comp === 0;) {
|
|
62
|
-
const [next1, post1, last1] = shiftPath(a);
|
|
63
|
-
a = post1;
|
|
64
|
-
const [next2, post2, last2] = shiftPath(b);
|
|
65
|
-
b = post2;
|
|
66
|
-
comp = mixed(next1, next2);
|
|
67
|
-
if (last1 || last2) {
|
|
68
|
-
if (last1 === last2) {
|
|
69
|
-
break;
|
|
70
|
-
}
|
|
71
|
-
if (last1) {
|
|
72
|
-
return -1;
|
|
73
|
-
}
|
|
74
|
-
return +1;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return comp;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Files and folders are sorted by last modified date in descending order.
|
|
81
|
-
* Folders are displayed before files.
|
|
82
|
-
* @see {@link makeMtimeCache}
|
|
83
|
-
*/
|
|
84
|
-
export function modified(a, b, map) {
|
|
85
|
-
let comp = 0;
|
|
86
|
-
for (; comp === 0;) {
|
|
87
|
-
const [, post1, last1] = shiftPath(a);
|
|
88
|
-
a = post1;
|
|
89
|
-
const [, post2, last2] = shiftPath(b);
|
|
90
|
-
b = post2;
|
|
91
|
-
comp = (map.get(a) ?? 0) - (map.get(b) ?? 0);
|
|
92
|
-
if (last1 || last2) {
|
|
93
|
-
if (last1 === last2) {
|
|
94
|
-
break;
|
|
95
|
-
}
|
|
96
|
-
if (!last1) {
|
|
97
|
-
return -1;
|
|
98
|
-
}
|
|
99
|
-
return +1;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
return comp;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Files and folders are grouped by extension type then sorted by thir names.
|
|
106
|
-
* Folders are displayed before files.
|
|
107
|
-
*/
|
|
108
|
-
export function type(a, b) {
|
|
109
|
-
let comp = 0;
|
|
110
|
-
for (; comp === 0;) {
|
|
111
|
-
const [next1, post1, last1] = shiftPath(a);
|
|
112
|
-
a = post1;
|
|
113
|
-
const [next2, post2, last2] = shiftPath(b);
|
|
114
|
-
b = post2;
|
|
115
|
-
const ppa = path.parse(next1);
|
|
116
|
-
const ppb = path.parse(next2);
|
|
117
|
-
comp = mixed(ppa.ext, ppb.ext) || mixed(ppa.name, ppb.name);
|
|
118
|
-
if (last1 || last2) {
|
|
119
|
-
if (last1 === last2) {
|
|
120
|
-
break;
|
|
121
|
-
}
|
|
122
|
-
if (!last1) {
|
|
123
|
-
return -1;
|
|
124
|
-
}
|
|
125
|
-
return +1;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return comp;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Files and folders are sorted by their names.
|
|
132
|
-
* Files are interwoven with folders.
|
|
133
|
-
*/
|
|
134
|
-
export function mixed(a, b) {
|
|
135
|
-
return a.localeCompare(b, undefined, { ignorePunctuation: false });
|
|
136
|
-
}
|
|
137
|
-
//# sourceMappingURL=sorting.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sorting.js","sourceRoot":"","sources":["../../src/browser/sorting.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,cAAc;IACd,YAAY;IACZ,MAAM;IACN,OAAO;IACP,UAAU;CACF,CAAA;AAYV;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,YAAY,CAAC,QAAQ,CAAC,KAA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