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
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/* eslint-disable unicorn/prefer-event-target */
|
|
2
|
+
import { join, parse, relative, } from 'node:path';
|
|
3
|
+
import EventEmitter from 'node:events';
|
|
4
|
+
import * as FSP from 'node:fs/promises';
|
|
5
|
+
import process from 'node:process';
|
|
6
|
+
import pLimit from 'p-limit';
|
|
7
|
+
import { configDefault } from '../../config.js';
|
|
8
|
+
import { File } from './file.js';
|
|
9
|
+
/**
|
|
10
|
+
* File system directory representation.
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export class Directory {
|
|
14
|
+
parent;
|
|
15
|
+
relativePath;
|
|
16
|
+
absolutePath;
|
|
17
|
+
children;
|
|
18
|
+
/**
|
|
19
|
+
* Get the number of directories and files.
|
|
20
|
+
* @param directoryPath Relative path to the directory.
|
|
21
|
+
* @param options The counter and reader options.
|
|
22
|
+
*/
|
|
23
|
+
static async deepCount(directoryPath, options) {
|
|
24
|
+
const { modules, cwd, concurrency, progress = {
|
|
25
|
+
current: 0, total: 0, files: 0, directories: 0,
|
|
26
|
+
}, } = options;
|
|
27
|
+
const limit = pLimit(concurrency);
|
|
28
|
+
const readdir = modules.fs.promises.readdir ?? FSP.readdir;
|
|
29
|
+
const absolutePath = modules.path.join(cwd, String(directoryPath));
|
|
30
|
+
const entryList = await readdir(absolutePath, { withFileTypes: true });
|
|
31
|
+
const promises = entryList.map(entry => limit(async () => {
|
|
32
|
+
++progress.total;
|
|
33
|
+
if (entry.isDirectory() && !entry.isSymbolicLink()) {
|
|
34
|
+
const absolutePath = modules.path.join(entry.parentPath, entry.name);
|
|
35
|
+
const relativePath = modules.path.relative(cwd, absolutePath);
|
|
36
|
+
await Directory.deepCount(relativePath, { ...options, progress });
|
|
37
|
+
++progress.directories;
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
++progress.files;
|
|
41
|
+
}));
|
|
42
|
+
await Promise.all(promises);
|
|
43
|
+
return progress;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Read directories and files progressively.
|
|
47
|
+
* @param directoryPath Relative path to the directory.
|
|
48
|
+
* @param options The reader options.
|
|
49
|
+
*/
|
|
50
|
+
static deepStream(directoryPath, optionsReal) {
|
|
51
|
+
const controller = new EventEmitter();
|
|
52
|
+
controller.endPromise = new Promise(resolve => {
|
|
53
|
+
controller.once('end', data => {
|
|
54
|
+
resolve(data);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
controller.run = async function () {
|
|
58
|
+
const data = await Directory.deepStreamNested(directoryPath, { ...optionsReal, controller });
|
|
59
|
+
const { progress, target } = data;
|
|
60
|
+
const dataRoot = { progress, tree: target };
|
|
61
|
+
controller.emit('end', dataRoot);
|
|
62
|
+
return dataRoot;
|
|
63
|
+
};
|
|
64
|
+
return controller;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Get the {@link Directory} instance from a file path list. Paths should be relative.
|
|
68
|
+
*/
|
|
69
|
+
static from(pathList, cwd = process.cwd()) {
|
|
70
|
+
const tree = new Directory(undefined, '.', cwd, new Map());
|
|
71
|
+
for (const path of pathList) {
|
|
72
|
+
const entryNameList = path.toString().split(/[\\/]/);
|
|
73
|
+
// eslint-disable-next-line unicorn/no-array-reduce
|
|
74
|
+
entryNameList.reduce((tree, entryName, index) => {
|
|
75
|
+
const absolutePath = join(tree.absolutePath, entryName);
|
|
76
|
+
const relativePath = relative(cwd, absolutePath);
|
|
77
|
+
if (index === entryNameList.length - 1) {
|
|
78
|
+
const file = new File(tree, relativePath, absolutePath);
|
|
79
|
+
tree.set(file.base, file);
|
|
80
|
+
return tree;
|
|
81
|
+
}
|
|
82
|
+
let directory = Array.from(tree.children.values()).find(c => c instanceof Directory && c.absolutePath === absolutePath);
|
|
83
|
+
if (directory === undefined) {
|
|
84
|
+
directory = new Directory(tree, relativePath, absolutePath, new Map());
|
|
85
|
+
tree.set(`${directory.base}/`, directory);
|
|
86
|
+
}
|
|
87
|
+
return directory;
|
|
88
|
+
}, tree);
|
|
89
|
+
}
|
|
90
|
+
return tree;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Get deep iterator for the directory.
|
|
94
|
+
*/
|
|
95
|
+
static deepIterator = function* (directory, instanceOf) {
|
|
96
|
+
const subDirectories = [];
|
|
97
|
+
for (const element of directory.children.values()) {
|
|
98
|
+
if (instanceOf === undefined || element instanceof instanceOf) {
|
|
99
|
+
yield element;
|
|
100
|
+
}
|
|
101
|
+
if (element instanceof Directory) {
|
|
102
|
+
subDirectories.push(element);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
for (const subDirectory of subDirectories) {
|
|
106
|
+
yield* Directory.deepIterator(subDirectory);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Read directories and files progressively.
|
|
111
|
+
* @private This function should be wrapped by {@link deepStream}.
|
|
112
|
+
* @param directoryPath Relative path to the directory.
|
|
113
|
+
* @param options The reader options.
|
|
114
|
+
*/
|
|
115
|
+
static async deepStreamNested(directoryPath, options) {
|
|
116
|
+
const { modules, cwd, concurrency, parent } = options;
|
|
117
|
+
const controller = options.controller ?? new EventEmitter();
|
|
118
|
+
const progress = options.progress ?? await Directory.deepCount(directoryPath, options);
|
|
119
|
+
controller.emit('progress', progress);
|
|
120
|
+
const limit = pLimit(concurrency);
|
|
121
|
+
const readdir = modules.fs.promises.readdir ?? FSP.readdir;
|
|
122
|
+
const absolutePath = modules.path.join(cwd, String(directoryPath));
|
|
123
|
+
const relativePath = modules.path.relative(cwd, absolutePath);
|
|
124
|
+
const directory = new Directory(parent, relativePath, absolutePath, new Map());
|
|
125
|
+
const entryList = await readdir(absolutePath, { withFileTypes: true });
|
|
126
|
+
const promises = entryList.map(entry => limit(async () => {
|
|
127
|
+
const parent = directory;
|
|
128
|
+
const absolutePath = modules.path.join(entry.parentPath, entry.name);
|
|
129
|
+
const relativePath = modules.path.relative(cwd, absolutePath);
|
|
130
|
+
if (entry.isDirectory() && !entry.isSymbolicLink()) {
|
|
131
|
+
const data = await Directory.deepStreamNested(relativePath, {
|
|
132
|
+
...options, controller, progress, parent,
|
|
133
|
+
});
|
|
134
|
+
++progress.current;
|
|
135
|
+
controller.emit('progress', progress);
|
|
136
|
+
return data;
|
|
137
|
+
}
|
|
138
|
+
const file = new File(parent, relativePath, absolutePath);
|
|
139
|
+
const data = { target: file, progress };
|
|
140
|
+
++progress.current;
|
|
141
|
+
controller.emit('progress', progress);
|
|
142
|
+
controller.emit('data', data);
|
|
143
|
+
return data;
|
|
144
|
+
}));
|
|
145
|
+
const dataList = await Promise.all(promises);
|
|
146
|
+
for (const { target: entry } of dataList) {
|
|
147
|
+
directory.children.set(`${entry.base}${entry instanceof Directory ? '/' : ''}`, entry);
|
|
148
|
+
}
|
|
149
|
+
const data = { target: directory, progress };
|
|
150
|
+
controller.emit('progress', progress);
|
|
151
|
+
controller.emit('data', data);
|
|
152
|
+
return data;
|
|
153
|
+
}
|
|
154
|
+
base;
|
|
155
|
+
dir;
|
|
156
|
+
ext;
|
|
157
|
+
name;
|
|
158
|
+
root;
|
|
159
|
+
constructor(
|
|
160
|
+
/**
|
|
161
|
+
* The parent of the directory.
|
|
162
|
+
*/
|
|
163
|
+
parent,
|
|
164
|
+
/**
|
|
165
|
+
* The relative path to the directory.
|
|
166
|
+
*/
|
|
167
|
+
relativePath,
|
|
168
|
+
/**
|
|
169
|
+
* The absolute path to the file.
|
|
170
|
+
*/
|
|
171
|
+
absolutePath,
|
|
172
|
+
/**
|
|
173
|
+
* The content of the directory. It is a Map for performance reasons: you can find any file or folder without a loop if you know the name.
|
|
174
|
+
*
|
|
175
|
+
* Keys: {@link File.base} or {@link Directory.base}. Directory base ends with '/'.
|
|
176
|
+
*
|
|
177
|
+
* Values: {@link File} or {@link Directory} itself.
|
|
178
|
+
*/
|
|
179
|
+
children) {
|
|
180
|
+
this.parent = parent;
|
|
181
|
+
this.relativePath = relativePath;
|
|
182
|
+
this.absolutePath = absolutePath;
|
|
183
|
+
this.children = children;
|
|
184
|
+
const parsed = parse(absolutePath);
|
|
185
|
+
this.base = parsed.base;
|
|
186
|
+
this.dir = parsed.dir;
|
|
187
|
+
this.ext = parsed.ext;
|
|
188
|
+
this.name = parsed.name;
|
|
189
|
+
this.root = parsed.root;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* @param instanceOf Optionally filter children by type.
|
|
193
|
+
*/
|
|
194
|
+
deepIterator(instanceOf) {
|
|
195
|
+
return Directory.deepIterator(this, instanceOf);
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* @param instanceOf Optionally filter children by type.
|
|
199
|
+
*/
|
|
200
|
+
deep(instanceOf) {
|
|
201
|
+
return Array.from(Directory.deepIterator(this, instanceOf));
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* @returns The relative path to the directory.
|
|
205
|
+
*/
|
|
206
|
+
toString() {
|
|
207
|
+
return this.relativePath;
|
|
208
|
+
}
|
|
209
|
+
get(key) {
|
|
210
|
+
return this.children.get(key);
|
|
211
|
+
}
|
|
212
|
+
set(key, value) {
|
|
213
|
+
return this.children.set(key, value);
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* @returns The cache for each file of the directory with last time edited number.
|
|
217
|
+
* @see {@link modified}.
|
|
218
|
+
*/
|
|
219
|
+
async deepModifiedTime(out, realOptions) {
|
|
220
|
+
const { concurrency = configDefault.concurrency, modules } = realOptions;
|
|
221
|
+
const limit = pLimit(concurrency);
|
|
222
|
+
const promiseList = [];
|
|
223
|
+
for (const entry of this.deepIterator()) {
|
|
224
|
+
if (entry instanceof Directory) {
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
promiseList.push(limit(async () => {
|
|
228
|
+
const fileStat = await modules.fs.promises.stat(entry.absolutePath);
|
|
229
|
+
out.set(entry, fileStat.mtime.getTime());
|
|
230
|
+
}));
|
|
231
|
+
}
|
|
232
|
+
void await Promise.all(promiseList);
|
|
233
|
+
return out;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
@@ -1,10 +1,23 @@
|
|
|
1
|
-
import { ChalkInstance } from
|
|
2
|
-
import { DecorName } from
|
|
3
|
-
import { FilterName
|
|
1
|
+
import { type ChalkInstance } from 'chalk';
|
|
2
|
+
import { type DecorName } from '../styling.js';
|
|
3
|
+
import { type FilterName } from '../filtering.js';
|
|
4
|
+
import { File } from './file.js';
|
|
5
|
+
import { type SourceInfo } from './source-info.js';
|
|
6
|
+
import { type Directory } from './directory.js';
|
|
4
7
|
/**
|
|
5
8
|
* @see {@link FileInfo.prototype.toString}
|
|
9
|
+
* @public
|
|
6
10
|
*/
|
|
7
|
-
export
|
|
11
|
+
export type FileInfoToStringOptions = {
|
|
12
|
+
/**
|
|
13
|
+
* On posix systems, this has no effect. But, on Windows, it means that
|
|
14
|
+
* paths will be `/` delimited, and absolute paths will be their full
|
|
15
|
+
* resolved UNC forms, eg instead of `'C:\\foo\\bar'`, it would return
|
|
16
|
+
* `'//?/C:/foo/bar'`
|
|
17
|
+
* @default false
|
|
18
|
+
* @returns `/` delimited paths, even on Windows.
|
|
19
|
+
*/
|
|
20
|
+
posix?: boolean;
|
|
8
21
|
/**
|
|
9
22
|
* The appearance behavior of the file icon.
|
|
10
23
|
* @default undefined
|
|
@@ -31,44 +44,42 @@ export interface FileInfoToStringOptions {
|
|
|
31
44
|
* @default true
|
|
32
45
|
*/
|
|
33
46
|
entire?: boolean;
|
|
34
|
-
}
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* @public
|
|
50
|
+
*/
|
|
51
|
+
export type FileInfoStatus = 'ignored' | 'included' | 'non-target';
|
|
35
52
|
/**
|
|
36
53
|
* The result of the file path scan.
|
|
54
|
+
* @public
|
|
37
55
|
*/
|
|
38
|
-
export declare class FileInfo {
|
|
39
|
-
/**
|
|
40
|
-
* Relative path to the file.
|
|
41
|
-
*/
|
|
42
|
-
readonly filePath: string;
|
|
43
|
-
/**
|
|
44
|
-
* Source of patterns, used by {@link scanner}.
|
|
45
|
-
*/
|
|
46
|
-
readonly source: SourceInfo;
|
|
56
|
+
export declare class FileInfo extends File {
|
|
47
57
|
/**
|
|
48
|
-
* The
|
|
58
|
+
* The source of patterns.
|
|
49
59
|
*/
|
|
50
|
-
readonly
|
|
51
|
-
|
|
60
|
+
readonly source?: SourceInfo | undefined;
|
|
61
|
+
static from(file: File, source?: SourceInfo): FileInfo;
|
|
52
62
|
/**
|
|
53
|
-
*
|
|
63
|
+
* Determines if ignored file is ignored or not.
|
|
54
64
|
*/
|
|
55
|
-
|
|
65
|
+
readonly status: FileInfoStatus;
|
|
66
|
+
constructor(
|
|
56
67
|
/**
|
|
57
|
-
*
|
|
68
|
+
* The parent of the file.
|
|
58
69
|
*/
|
|
59
|
-
|
|
70
|
+
parent: Directory,
|
|
60
71
|
/**
|
|
61
|
-
*
|
|
72
|
+
* The relative path to the file.
|
|
62
73
|
*/
|
|
63
|
-
|
|
74
|
+
relativePath: string,
|
|
64
75
|
/**
|
|
65
|
-
*
|
|
76
|
+
* The absolute path to the file.
|
|
66
77
|
*/
|
|
67
|
-
|
|
78
|
+
absolutePath: string,
|
|
68
79
|
/**
|
|
69
|
-
*
|
|
80
|
+
* The source of patterns.
|
|
70
81
|
*/
|
|
71
|
-
|
|
82
|
+
source?: SourceInfo | undefined);
|
|
72
83
|
/**
|
|
73
84
|
* @param options Styling options.
|
|
74
85
|
* @returns Relative file path. Optionally formatted.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import PATH from 'node:path';
|
|
2
|
+
import nf from '@m234/nerd-fonts';
|
|
3
|
+
import { decorCondition } from '../styling.js';
|
|
4
|
+
import { File } from './file.js';
|
|
5
|
+
/**
|
|
6
|
+
* The result of the file path scan.
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export class FileInfo extends File {
|
|
10
|
+
source;
|
|
11
|
+
static from(file, source) {
|
|
12
|
+
return new FileInfo(file.parent, file.relativePath, file.absolutePath, source);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Determines if ignored file is ignored or not.
|
|
16
|
+
*/
|
|
17
|
+
status;
|
|
18
|
+
constructor(
|
|
19
|
+
/**
|
|
20
|
+
* The parent of the file.
|
|
21
|
+
*/
|
|
22
|
+
parent,
|
|
23
|
+
/**
|
|
24
|
+
* The relative path to the file.
|
|
25
|
+
*/
|
|
26
|
+
relativePath,
|
|
27
|
+
/**
|
|
28
|
+
* The absolute path to the file.
|
|
29
|
+
*/
|
|
30
|
+
absolutePath,
|
|
31
|
+
/**
|
|
32
|
+
* The source of patterns.
|
|
33
|
+
*/
|
|
34
|
+
source) {
|
|
35
|
+
super(parent, relativePath, absolutePath);
|
|
36
|
+
this.source = source;
|
|
37
|
+
this.status = source === undefined ? 'non-target'
|
|
38
|
+
: (source.scanner.ignores(relativePath) ? 'ignored' : 'included');
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @param options Styling options.
|
|
42
|
+
* @returns Relative file path. Optionally formatted.
|
|
43
|
+
*/
|
|
44
|
+
toString(options) {
|
|
45
|
+
const { fileIcon, chalk, usePrefix = false, source: useSource = false, entire = true, posix = false } = options ?? {};
|
|
46
|
+
const patha = posix ? PATH.posix : PATH;
|
|
47
|
+
const parsed = PATH.parse(this.relativePath);
|
|
48
|
+
const glyph = nf.FSC.fromPath(parsed, nf.FSC.mappings.seti);
|
|
49
|
+
const fIcon = fileIcon ? decorCondition(fileIcon, {
|
|
50
|
+
ifEmoji: '📄',
|
|
51
|
+
ifNerd: chalk && glyph.color !== undefined ? chalk.hex(glyph.color.toString(16))(glyph.char) : glyph.char,
|
|
52
|
+
postfix: ' ',
|
|
53
|
+
}) : '';
|
|
54
|
+
let prefix = usePrefix && this.status !== 'non-target' ? (this.status === 'ignored' ? '!' : '+') : '';
|
|
55
|
+
let postfix = useSource && this.source !== undefined ? ' < ' + this.source.toString() : '';
|
|
56
|
+
if (chalk) {
|
|
57
|
+
prefix = chalk.dim(prefix);
|
|
58
|
+
postfix = chalk.dim(postfix);
|
|
59
|
+
const clr = this.status === 'non-target' ? chalk.white
|
|
60
|
+
: (this.status === 'included' ? chalk.green : chalk.white);
|
|
61
|
+
if (entire) {
|
|
62
|
+
return fIcon + clr(prefix + this.relativePath + postfix);
|
|
63
|
+
}
|
|
64
|
+
return parsed.dir + patha.sep + fIcon + clr(prefix + parsed.base + postfix);
|
|
65
|
+
}
|
|
66
|
+
if (entire) {
|
|
67
|
+
return prefix + this.relativePath + postfix;
|
|
68
|
+
}
|
|
69
|
+
return parsed.dir + patha.sep + fIcon + prefix + parsed.base + postfix;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* @param filter The group name. Default: `"all"`
|
|
73
|
+
* @returns `true`, if the file is contained by the filter.
|
|
74
|
+
*/
|
|
75
|
+
isIncludedBy(filter) {
|
|
76
|
+
if (typeof filter === 'function') {
|
|
77
|
+
return filter(this);
|
|
78
|
+
}
|
|
79
|
+
filter ??= 'all';
|
|
80
|
+
const filterIgnore = (filter === 'ignored') && this.status === 'ignored';
|
|
81
|
+
const filterInclude = (filter === 'included') && this.status === 'included';
|
|
82
|
+
const filterAll = filter === 'all';
|
|
83
|
+
const result = filterIgnore || filterInclude || filterAll;
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type ParsedPath } from 'node:path';
|
|
2
|
+
import { type Directory } from './directory.js';
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export declare class File implements ParsedPath {
|
|
7
|
+
/**
|
|
8
|
+
* The parent of the file.
|
|
9
|
+
*/
|
|
10
|
+
readonly parent: Directory;
|
|
11
|
+
/**
|
|
12
|
+
* The relative path to the file.
|
|
13
|
+
*/
|
|
14
|
+
readonly relativePath: string;
|
|
15
|
+
/**
|
|
16
|
+
* The absolute path to the file.
|
|
17
|
+
*/
|
|
18
|
+
readonly absolutePath: string;
|
|
19
|
+
readonly base: string;
|
|
20
|
+
readonly dir: string;
|
|
21
|
+
readonly ext: string;
|
|
22
|
+
readonly name: string;
|
|
23
|
+
readonly root: string;
|
|
24
|
+
constructor(
|
|
25
|
+
/**
|
|
26
|
+
* The parent of the file.
|
|
27
|
+
*/
|
|
28
|
+
parent: Directory,
|
|
29
|
+
/**
|
|
30
|
+
* The relative path to the file.
|
|
31
|
+
*/
|
|
32
|
+
relativePath: string,
|
|
33
|
+
/**
|
|
34
|
+
* The absolute path to the file.
|
|
35
|
+
*/
|
|
36
|
+
absolutePath: string);
|
|
37
|
+
/**
|
|
38
|
+
* @returns The relative path to the file.
|
|
39
|
+
*/
|
|
40
|
+
toString(): string;
|
|
41
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { parse } from 'node:path';
|
|
2
|
+
/**
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export class File {
|
|
6
|
+
parent;
|
|
7
|
+
relativePath;
|
|
8
|
+
absolutePath;
|
|
9
|
+
base;
|
|
10
|
+
dir;
|
|
11
|
+
ext;
|
|
12
|
+
name;
|
|
13
|
+
root;
|
|
14
|
+
constructor(
|
|
15
|
+
/**
|
|
16
|
+
* The parent of the file.
|
|
17
|
+
*/
|
|
18
|
+
parent,
|
|
19
|
+
/**
|
|
20
|
+
* The relative path to the file.
|
|
21
|
+
*/
|
|
22
|
+
relativePath,
|
|
23
|
+
/**
|
|
24
|
+
* The absolute path to the file.
|
|
25
|
+
*/
|
|
26
|
+
absolutePath) {
|
|
27
|
+
this.parent = parent;
|
|
28
|
+
this.relativePath = relativePath;
|
|
29
|
+
this.absolutePath = absolutePath;
|
|
30
|
+
const parsed = parse(absolutePath);
|
|
31
|
+
this.base = parsed.base;
|
|
32
|
+
this.dir = parsed.dir;
|
|
33
|
+
this.ext = parsed.ext;
|
|
34
|
+
this.name = parsed.name;
|
|
35
|
+
this.root = parsed.root;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @returns The relative path to the file.
|
|
39
|
+
*/
|
|
40
|
+
toString() {
|
|
41
|
+
return this.relativePath;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type Directory, File, type Scanner } from '../lib.js';
|
|
2
|
+
/**
|
|
3
|
+
* The source of patterns.
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export declare class SourceInfo extends File {
|
|
7
|
+
/**
|
|
8
|
+
* The scanner of patterns.
|
|
9
|
+
*/
|
|
10
|
+
readonly scanner: Scanner;
|
|
11
|
+
static from(file: File, scanner: Scanner): SourceInfo;
|
|
12
|
+
constructor(
|
|
13
|
+
/**
|
|
14
|
+
* The parent of the file.
|
|
15
|
+
*/
|
|
16
|
+
parent: Directory,
|
|
17
|
+
/**
|
|
18
|
+
* The relative path to the file.
|
|
19
|
+
*/
|
|
20
|
+
relativePath: string,
|
|
21
|
+
/**
|
|
22
|
+
* The absolute path to the file.
|
|
23
|
+
*/
|
|
24
|
+
absolutePath: string,
|
|
25
|
+
/**
|
|
26
|
+
* The scanner of patterns.
|
|
27
|
+
*/
|
|
28
|
+
scanner: Scanner);
|
|
29
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { File, } from '../lib.js';
|
|
2
|
+
/**
|
|
3
|
+
* The source of patterns.
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export class SourceInfo extends File {
|
|
7
|
+
scanner;
|
|
8
|
+
static from(file, scanner) {
|
|
9
|
+
return new SourceInfo(file.parent, file.relativePath, file.absolutePath, scanner);
|
|
10
|
+
}
|
|
11
|
+
constructor(
|
|
12
|
+
/**
|
|
13
|
+
* The parent of the file.
|
|
14
|
+
*/
|
|
15
|
+
parent,
|
|
16
|
+
/**
|
|
17
|
+
* The relative path to the file.
|
|
18
|
+
*/
|
|
19
|
+
relativePath,
|
|
20
|
+
/**
|
|
21
|
+
* The absolute path to the file.
|
|
22
|
+
*/
|
|
23
|
+
absolutePath,
|
|
24
|
+
/**
|
|
25
|
+
* The scanner of patterns.
|
|
26
|
+
*/
|
|
27
|
+
scanner) {
|
|
28
|
+
super(parent, relativePath, absolutePath);
|
|
29
|
+
this.scanner = scanner;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import * as ViewIgnored from
|
|
1
|
+
import * as ViewIgnored from './lib.js';
|
|
2
2
|
export default ViewIgnored;
|
|
3
|
-
export * from
|
|
3
|
+
export * from './lib.js';
|
package/out/src/browser/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import * as ViewIgnored from
|
|
1
|
+
import * as ViewIgnored from './lib.js';
|
|
2
2
|
export default ViewIgnored;
|
|
3
|
-
export * from
|
|
3
|
+
export * from './lib.js';
|