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/scan.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { posix } from 'node:path';
|
|
2
|
+
import { opendir } from './walk.js';
|
|
3
|
+
/**
|
|
4
|
+
* Scan the directory for included files based on the provided targets.
|
|
5
|
+
*
|
|
6
|
+
* Note that this function uses `fs/promises.readFile` and `fs/promises.opendir` without options within
|
|
7
|
+
* custom recursion, instead of `fs.promises.readdir` with `{ withFileTypes: true }.
|
|
8
|
+
* It also normalizes paths to use forward slashes.
|
|
9
|
+
* Please report any issues if you encounter problems related to this behavior.
|
|
10
|
+
*
|
|
11
|
+
* @param options Scan options.
|
|
12
|
+
* @returns A promise that resolves to a {@link MatcherContext} containing the scan results.
|
|
13
|
+
*/
|
|
14
|
+
export async function scan(options) {
|
|
15
|
+
const { target, cwd: cwdo = (await import('node:process')).cwd(), depth: maxDepth = Infinity, invert = false, signal = undefined, fastDepth = false, } = options;
|
|
16
|
+
const cwd = cwdo.replaceAll('\\', '/');
|
|
17
|
+
const ctx = {
|
|
18
|
+
paths: new Set(),
|
|
19
|
+
external: new Map(),
|
|
20
|
+
depthPaths: new Map(),
|
|
21
|
+
sourceErrors: [],
|
|
22
|
+
totalFiles: 0,
|
|
23
|
+
totalMatchedFiles: 0,
|
|
24
|
+
totalDirs: 0,
|
|
25
|
+
};
|
|
26
|
+
await opendir(cwd, async (entry) => {
|
|
27
|
+
if (signal?.aborted) {
|
|
28
|
+
return 2;
|
|
29
|
+
}
|
|
30
|
+
const path = posix.join(posix.relative(cwd, entry.parentPath.replaceAll('\\', '/')), entry.name);
|
|
31
|
+
if (entry.isDirectory()) {
|
|
32
|
+
ctx.totalDirs++;
|
|
33
|
+
if (!fastDepth) {
|
|
34
|
+
return 0;
|
|
35
|
+
}
|
|
36
|
+
const { depth } = getDepth(path, maxDepth);
|
|
37
|
+
if (depth <= maxDepth) {
|
|
38
|
+
return 0;
|
|
39
|
+
}
|
|
40
|
+
return 1;
|
|
41
|
+
}
|
|
42
|
+
ctx.totalFiles++;
|
|
43
|
+
if (fastDepth) {
|
|
44
|
+
const { depth, depthSlash } = getDepth(path, maxDepth);
|
|
45
|
+
if (depth > maxDepth) {
|
|
46
|
+
let ignored = await target.matcher(path, false, ctx);
|
|
47
|
+
if (ctx.sourceErrors.length > 0) {
|
|
48
|
+
return 2;
|
|
49
|
+
}
|
|
50
|
+
if (invert) {
|
|
51
|
+
ignored = !ignored;
|
|
52
|
+
}
|
|
53
|
+
if (ignored) {
|
|
54
|
+
return 0;
|
|
55
|
+
}
|
|
56
|
+
const dir = path.substring(0, depthSlash);
|
|
57
|
+
ctx.depthPaths.set(dir, (ctx.depthPaths.get(dir) ?? 0) + 1);
|
|
58
|
+
return 1;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
let ignored = await target.matcher(path, false, ctx);
|
|
62
|
+
if (ctx.sourceErrors.length > 0) {
|
|
63
|
+
return 2;
|
|
64
|
+
}
|
|
65
|
+
if (invert) {
|
|
66
|
+
ignored = !ignored;
|
|
67
|
+
}
|
|
68
|
+
if (ignored) {
|
|
69
|
+
return 0;
|
|
70
|
+
}
|
|
71
|
+
ctx.totalMatchedFiles++;
|
|
72
|
+
const { depth, depthSlash } = getDepth(path, maxDepth);
|
|
73
|
+
if (depth > maxDepth) {
|
|
74
|
+
const dir = path.substring(0, depthSlash);
|
|
75
|
+
ctx.depthPaths.set(dir, (ctx.depthPaths.get(dir) ?? 0) + 1);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
ctx.paths.add(path);
|
|
79
|
+
}
|
|
80
|
+
return 0;
|
|
81
|
+
});
|
|
82
|
+
if (signal?.aborted) {
|
|
83
|
+
return ctx;
|
|
84
|
+
}
|
|
85
|
+
for (const [dir, count] of ctx.depthPaths) {
|
|
86
|
+
if (count === 0) {
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
ctx.paths.add(dir + '/');
|
|
90
|
+
}
|
|
91
|
+
return ctx;
|
|
92
|
+
}
|
|
93
|
+
function getDepth(path, maxDepth) {
|
|
94
|
+
const result = {
|
|
95
|
+
depth: 0,
|
|
96
|
+
depthSlash: 0,
|
|
97
|
+
};
|
|
98
|
+
result.depthSlash = -1;
|
|
99
|
+
if (maxDepth < 0) {
|
|
100
|
+
return result;
|
|
101
|
+
}
|
|
102
|
+
for (const [i, c] of Array.from(path).entries()) {
|
|
103
|
+
if (c !== '/') {
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
result.depth++;
|
|
107
|
+
if (result.depth < maxDepth) {
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
result.depthSlash = i;
|
|
111
|
+
return result;
|
|
112
|
+
}
|
|
113
|
+
return result;
|
|
114
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { signedPatternIgnores, findAndExtract } from '../patterns/matcher.js';
|
|
2
|
+
import { extractGitignore } from '../patterns/gitignore.js';
|
|
3
|
+
const gitSources = ['.gitignore'];
|
|
4
|
+
const gitSourceMap = new Map([
|
|
5
|
+
['.gitignore', extractGitignore],
|
|
6
|
+
]);
|
|
7
|
+
const gitPattern = {
|
|
8
|
+
exclude: [
|
|
9
|
+
'.git',
|
|
10
|
+
'.DS_Store',
|
|
11
|
+
],
|
|
12
|
+
include: [],
|
|
13
|
+
};
|
|
14
|
+
export const Git = {
|
|
15
|
+
async matcher(entry, isDir, ctx) {
|
|
16
|
+
if (isDir) {
|
|
17
|
+
await findAndExtract(entry, gitSources, gitSourceMap, ctx);
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
return await signedPatternIgnores(gitPattern, entry, gitSources, gitSourceMap, ctx);
|
|
21
|
+
},
|
|
22
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { signedPatternIgnores, findAndExtract } from '../patterns/matcher.js';
|
|
2
|
+
import { extractJsrJson, extractJsrJsonc } from '../patterns/jsrjson.js';
|
|
3
|
+
const jsrSources = ['deno.json', 'deno.jsonc', 'jsr.json', 'jsr.jsonc'];
|
|
4
|
+
const jsrSourceMap = new Map([
|
|
5
|
+
['deno.json', extractJsrJson],
|
|
6
|
+
['deno.jsonc', extractJsrJsonc],
|
|
7
|
+
['jsr.json', extractJsrJson],
|
|
8
|
+
['jsr.jsonc', extractJsrJsonc],
|
|
9
|
+
]);
|
|
10
|
+
const vscePattern = {
|
|
11
|
+
exclude: [
|
|
12
|
+
'.git',
|
|
13
|
+
'.DS_Store',
|
|
14
|
+
],
|
|
15
|
+
include: [],
|
|
16
|
+
};
|
|
17
|
+
export const JSR = {
|
|
18
|
+
async matcher(entry, isDir, ctx) {
|
|
19
|
+
if (isDir) {
|
|
20
|
+
await findAndExtract(entry, jsrSources, jsrSourceMap, ctx);
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
return await signedPatternIgnores(vscePattern, entry, jsrSources, jsrSourceMap, ctx);
|
|
24
|
+
},
|
|
25
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { signedPatternIgnores, findAndExtract } from '../patterns/matcher.js';
|
|
2
|
+
import { extractGitignore } from '../patterns/gitignore.js';
|
|
3
|
+
import { extractPackageJson } from '../patterns/packagejson.js';
|
|
4
|
+
const npmSources = ['package.json', '.npmignore', '.gitignore'];
|
|
5
|
+
const npmSourceMap = new Map([
|
|
6
|
+
['package.json', extractPackageJson],
|
|
7
|
+
['.npmignore', extractGitignore],
|
|
8
|
+
['.gitignore', extractGitignore],
|
|
9
|
+
]);
|
|
10
|
+
const npmPattern = {
|
|
11
|
+
exclude: [
|
|
12
|
+
'.git',
|
|
13
|
+
'.DS_Store',
|
|
14
|
+
'node_modules',
|
|
15
|
+
'.*.swp',
|
|
16
|
+
'._*',
|
|
17
|
+
'.DS_Store',
|
|
18
|
+
'.git',
|
|
19
|
+
'.gitignore',
|
|
20
|
+
'.hg',
|
|
21
|
+
'.npmignore',
|
|
22
|
+
'.npmrc',
|
|
23
|
+
'.lock-wscript',
|
|
24
|
+
'.svn',
|
|
25
|
+
'.wafpickle-*',
|
|
26
|
+
'config.gypi',
|
|
27
|
+
'CVS',
|
|
28
|
+
'npm-debug.log',
|
|
29
|
+
],
|
|
30
|
+
include: [
|
|
31
|
+
'bin',
|
|
32
|
+
'package.json',
|
|
33
|
+
'README*',
|
|
34
|
+
'LICENSE*',
|
|
35
|
+
'LICENCE*',
|
|
36
|
+
],
|
|
37
|
+
};
|
|
38
|
+
export const NPM = {
|
|
39
|
+
async matcher(entry, isDir, ctx) {
|
|
40
|
+
if (isDir) {
|
|
41
|
+
await findAndExtract(entry, npmSources, npmSourceMap, ctx);
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
return await signedPatternIgnores(npmPattern, entry, npmSources, npmSourceMap, ctx);
|
|
45
|
+
},
|
|
46
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { signedPatternIgnores, findAndExtract } from '../patterns/matcher.js';
|
|
2
|
+
import { extractGitignore } from '../patterns/gitignore.js';
|
|
3
|
+
import { extractPackageJson } from '../patterns/packagejson.js';
|
|
4
|
+
const vsceSources = ['package.json', '.vscodeignore'];
|
|
5
|
+
const vsceSourceMap = new Map([
|
|
6
|
+
['package.json', extractPackageJson],
|
|
7
|
+
['.vscodeignore', extractGitignore],
|
|
8
|
+
]);
|
|
9
|
+
const vscePattern = {
|
|
10
|
+
exclude: [
|
|
11
|
+
'.git',
|
|
12
|
+
'.DS_Store',
|
|
13
|
+
],
|
|
14
|
+
include: [],
|
|
15
|
+
};
|
|
16
|
+
export const VSCE = {
|
|
17
|
+
async matcher(entry, isDir, ctx) {
|
|
18
|
+
if (isDir) {
|
|
19
|
+
await findAndExtract(entry, vsceSources, vsceSourceMap, ctx);
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
return await signedPatternIgnores(vscePattern, entry, vsceSources, vsceSourceMap, ctx);
|
|
23
|
+
},
|
|
24
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { signedPatternIgnores, findAndExtract } from '../patterns/matcher.js';
|
|
2
|
+
import { extractGitignore } from '../patterns/gitignore.js';
|
|
3
|
+
import { extractPackageJson } from '../patterns/packagejson.js';
|
|
4
|
+
const yarnSources = ['package.json', '.yarnignore', '.npmignore', '.gitignore'];
|
|
5
|
+
const yarnSourceMap = new Map([
|
|
6
|
+
['package.json', extractPackageJson],
|
|
7
|
+
['.yarnignore', extractGitignore],
|
|
8
|
+
['.npmignore', extractGitignore],
|
|
9
|
+
['.gitignore', extractGitignore],
|
|
10
|
+
]);
|
|
11
|
+
const yarnPattern = {
|
|
12
|
+
exclude: [
|
|
13
|
+
'.git',
|
|
14
|
+
'.DS_Store',
|
|
15
|
+
'node_modules',
|
|
16
|
+
'.*.swp',
|
|
17
|
+
'._*',
|
|
18
|
+
'.DS_Store',
|
|
19
|
+
'.git',
|
|
20
|
+
'.gitignore',
|
|
21
|
+
'.hg',
|
|
22
|
+
'.npmignore',
|
|
23
|
+
'.npmrc',
|
|
24
|
+
'.lock-wscript',
|
|
25
|
+
'.svn',
|
|
26
|
+
'.wafpickle-*',
|
|
27
|
+
'config.gypi',
|
|
28
|
+
'CVS',
|
|
29
|
+
'npm-debug.log',
|
|
30
|
+
'.yarnignore',
|
|
31
|
+
'.yarnrc',
|
|
32
|
+
],
|
|
33
|
+
include: [
|
|
34
|
+
'bin',
|
|
35
|
+
'package.json',
|
|
36
|
+
'README*',
|
|
37
|
+
'LICENSE*',
|
|
38
|
+
'LICENCE*',
|
|
39
|
+
],
|
|
40
|
+
};
|
|
41
|
+
export const Yarn = {
|
|
42
|
+
async matcher(entry, isDir, ctx) {
|
|
43
|
+
if (isDir) {
|
|
44
|
+
await findAndExtract(entry, yarnSources, yarnSourceMap, ctx);
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
return await signedPatternIgnores(yarnPattern, entry, yarnSources, yarnSourceMap, ctx);
|
|
48
|
+
},
|
|
49
|
+
};
|
package/out/walk.d.ts
ADDED
package/out/walk.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as fsp from 'node:fs/promises';
|
|
2
|
+
export async function opendir(path, cb) {
|
|
3
|
+
const dir = await fsp.opendir(path);
|
|
4
|
+
for await (const entry of dir) {
|
|
5
|
+
const r = await cb(entry);
|
|
6
|
+
if (r === 2) {
|
|
7
|
+
return 2;
|
|
8
|
+
}
|
|
9
|
+
if (r === 1) {
|
|
10
|
+
continue;
|
|
11
|
+
}
|
|
12
|
+
if (entry.isDirectory()) {
|
|
13
|
+
const r = await opendir(path + '/' + entry.name, cb);
|
|
14
|
+
if (r === 2) {
|
|
15
|
+
return 2;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
package/package.json
CHANGED
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "view-ignored",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Retrieve list of files ignored/included by Git, NPM, Yarn, JSR, VSCE or other tools.",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"bin": {
|
|
7
|
-
"viewig": "./bin/viewig",
|
|
8
|
-
"view-ignored": "./bin/viewig"
|
|
9
|
-
},
|
|
10
6
|
"scripts": {
|
|
11
7
|
"prerelease": "bun run test && bun run build:prod && bun run lint",
|
|
12
8
|
"test": "bun run build && node --test out/**/*.test.js",
|
|
13
|
-
"build": "rm -rf out &&
|
|
14
|
-
"build:prod": "
|
|
9
|
+
"build": "rm -rf out && tsgo -p .",
|
|
10
|
+
"build:prod": "rm -rf out && tsgo -p tsconfig.prod.json",
|
|
15
11
|
"lint": "bun run eslint .",
|
|
16
12
|
"release:major": "bun run release-it --increment=major",
|
|
17
13
|
"release:minor": "bun run release-it --increment=minor",
|
|
18
14
|
"release:patch": "bun run release-it --increment=patch"
|
|
19
15
|
},
|
|
20
16
|
"author": "Mopsgamer",
|
|
21
|
-
"license": "
|
|
22
|
-
"main": "./out/index.js",
|
|
17
|
+
"license": "MIT",
|
|
23
18
|
"files": [
|
|
24
|
-
"/bin",
|
|
25
19
|
"/out"
|
|
26
20
|
],
|
|
27
21
|
"repository": {
|
|
@@ -31,7 +25,6 @@
|
|
|
31
25
|
"bugs": {
|
|
32
26
|
"url": "https://github.com/Mopsgamer/view-ignored/issues"
|
|
33
27
|
},
|
|
34
|
-
"homepage": "https://github.com/Mopsgamer/view-ignored",
|
|
35
28
|
"engines": {
|
|
36
29
|
"node": ">=18"
|
|
37
30
|
},
|
|
@@ -40,27 +33,13 @@
|
|
|
40
33
|
"default": "./out/index.js",
|
|
41
34
|
"types": "./out/index.d.ts"
|
|
42
35
|
},
|
|
43
|
-
"./
|
|
44
|
-
"default": "./out/
|
|
45
|
-
"types": "./out/
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
"release-it": {
|
|
49
|
-
"hooks": {
|
|
50
|
-
"before:init": "bun prerelease"
|
|
51
|
-
},
|
|
52
|
-
"plugins": {
|
|
53
|
-
"@release-it/keep-a-changelog": {
|
|
54
|
-
"filename": "CHANGELOG.md"
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
"github": {
|
|
58
|
-
"release": true,
|
|
59
|
-
"draft": false,
|
|
60
|
-
"releaseName": "${version}"
|
|
36
|
+
"./patterns": {
|
|
37
|
+
"default": "./out/patterns/index.js",
|
|
38
|
+
"types": "./out/patterns/index.d.ts"
|
|
61
39
|
},
|
|
62
|
-
"
|
|
63
|
-
"
|
|
40
|
+
"./targets": {
|
|
41
|
+
"default": "./out/targets/index.js",
|
|
42
|
+
"types": "./out/targets/index.d.ts"
|
|
64
43
|
}
|
|
65
44
|
},
|
|
66
45
|
"publishConfig": {
|
|
@@ -70,45 +49,32 @@
|
|
|
70
49
|
"lib": "out"
|
|
71
50
|
},
|
|
72
51
|
"dependencies": {
|
|
73
|
-
"
|
|
74
|
-
"@m234/nerd-fonts": "^0.4.0",
|
|
75
|
-
"ansi-regex": "^6.2.2",
|
|
76
|
-
"chalk": "^5.6.2",
|
|
77
|
-
"commander": "^14.0.2",
|
|
78
|
-
"jsonify-paths": "^1.1.0",
|
|
79
|
-
"load-plugin": "^6.0.3",
|
|
52
|
+
"arktype": "^2.1.29",
|
|
80
53
|
"minimatch": "^10.1.1",
|
|
81
|
-
"
|
|
82
|
-
"strip-json-comments": "^5.0.3",
|
|
83
|
-
"treeify": "^1.1.0",
|
|
84
|
-
"yaml": "^2.8.2",
|
|
85
|
-
"zod": "^4.1.13"
|
|
54
|
+
"strip-json-comments": "^5.0.3"
|
|
86
55
|
},
|
|
87
56
|
"devDependencies": {
|
|
88
|
-
"@eslint/js": "^9.39.
|
|
57
|
+
"@eslint/js": "^9.39.2",
|
|
89
58
|
"@release-it/keep-a-changelog": "^7.0.0",
|
|
90
59
|
"@stylistic/eslint-plugin": "^5.6.1",
|
|
91
|
-
"@types/node": "
|
|
92
|
-
"@
|
|
93
|
-
"eslint": "^9.39.
|
|
60
|
+
"@types/node": "22",
|
|
61
|
+
"@typescript/native-preview": "^7.0.0-dev.20251214.1",
|
|
62
|
+
"eslint": "^9.39.2",
|
|
94
63
|
"fs-fixture": "^2.11.0",
|
|
95
|
-
"
|
|
96
|
-
"release-it": "^19.0.6",
|
|
97
|
-
"typescript": "^5.9.3",
|
|
64
|
+
"release-it": "^19.1.0",
|
|
98
65
|
"typescript-eslint": "^8.49.0"
|
|
99
66
|
},
|
|
100
67
|
"keywords": [
|
|
101
68
|
"tree",
|
|
102
69
|
"ls-tree",
|
|
103
70
|
"ignore",
|
|
71
|
+
"match",
|
|
104
72
|
"gitignore",
|
|
105
73
|
"npmignore",
|
|
74
|
+
"yarnignore",
|
|
106
75
|
"vscodeignore",
|
|
107
|
-
"cli",
|
|
108
76
|
"fs",
|
|
109
|
-
"
|
|
110
|
-
"output",
|
|
111
|
-
"project",
|
|
77
|
+
"files",
|
|
112
78
|
"migration"
|
|
113
79
|
]
|
|
114
80
|
}
|
package/bin/viewig
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { type TargetBind } from './targets.js';
|
|
2
|
-
export * from './scanner.js';
|
|
3
|
-
export * from './targets.js';
|
|
4
|
-
/**
|
|
5
|
-
* Built-in name list.
|
|
6
|
-
*/
|
|
7
|
-
export declare const builtInNameList: readonly ["git", "npm", "vsce", "yarn", "jsr"];
|
|
8
|
-
/**
|
|
9
|
-
* Built-in name type.
|
|
10
|
-
*/
|
|
11
|
-
export type BuiltInName = typeof builtInNameList[number];
|
|
12
|
-
/**
|
|
13
|
-
* The result of loading.
|
|
14
|
-
*/
|
|
15
|
-
export type PluginLoaded = {
|
|
16
|
-
resource: string;
|
|
17
|
-
isLoaded: boolean;
|
|
18
|
-
exports: unknown;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* If a plugin wants to change something, it must export default.
|
|
22
|
-
* @internal
|
|
23
|
-
*/
|
|
24
|
-
export type PluginExport = {
|
|
25
|
-
viewignored: {
|
|
26
|
-
addTargets: TargetBind[];
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Checks if the value is the {@link PluginExport}.
|
|
31
|
-
*/
|
|
32
|
-
export declare function isPluginExport(value: unknown): value is PluginExport;
|
|
33
|
-
/**
|
|
34
|
-
* Imports the plugin's exported data.
|
|
35
|
-
*/
|
|
36
|
-
export declare function importPlugin(exportData: PluginExport): void;
|
|
37
|
-
/**
|
|
38
|
-
* @param modulePath The plugin name.
|
|
39
|
-
* @returns The import result for the module.
|
|
40
|
-
*/
|
|
41
|
-
export declare function loadPlugin(modulePath: string, useImport?: boolean): Promise<PluginLoaded>;
|
|
42
|
-
/**
|
|
43
|
-
* @param modulePathList The plugin name list.
|
|
44
|
-
* @returns The import result for the list of modules.
|
|
45
|
-
*/
|
|
46
|
-
export declare function loadPlugins(modulePathList: string[]): Promise<PluginLoaded[]>;
|
|
47
|
-
/**
|
|
48
|
-
* Load any built-in plugin.
|
|
49
|
-
*/
|
|
50
|
-
export declare function loadBuiltIn(builtIn: BuiltInName): Promise<PluginLoaded>;
|
|
51
|
-
/**
|
|
52
|
-
* @param modulePathList The plugin name list.
|
|
53
|
-
* @returns The import result for the list of modules.
|
|
54
|
-
*/
|
|
55
|
-
export declare function loadBuiltIns(builtInList?: BuiltInName[]): Promise<PluginLoaded[]>;
|
|
56
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/browser/binds/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,UAAU,EAAa,MAAM,cAAc,CAAA;AAGvE,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAa5B;;GAEG;AACH,eAAO,MAAM,eAAe,gDAAiD,CAAA;AAE7E;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,eAAe,CAAC,MAAM,CAAC,CAAA;AAExD;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,OAAO,CAAA;IACjB,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,WAAW,EAAE;QACX,UAAU,EAAE,UAAU,EAAE,CAAA;KACzB,CAAA;CACF,CAAA;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CASpE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,YAAY,QAKpD;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAC9B,UAAU,EAAE,MAAM,EAClB,SAAS,UAAQ,GAChB,OAAO,CAAC,YAAY,CAAC,CA+BvB;AAED;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,cAAc,EAAE,MAAM,EAAE,GACvB,OAAO,CAAC,YAAY,EAAE,CAAC,CAIzB;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,CAEvE;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAChC,WAAW,GAAE,WAAW,EAAyB,GAChD,OAAO,CAAC,YAAY,EAAE,CAAC,CAIzB"}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { loadPlugin as load } from 'load-plugin';
|
|
2
|
-
import { isTargetBind, targetSet } from './targets.js';
|
|
3
|
-
import { conc } from '../conc.js';
|
|
4
|
-
export * from './scanner.js';
|
|
5
|
-
export * from './targets.js';
|
|
6
|
-
/**
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
|
-
const builtInImportMap = {
|
|
10
|
-
git: './plugins/git.js',
|
|
11
|
-
npm: './plugins/npm.js',
|
|
12
|
-
vsce: './plugins/vsce.js',
|
|
13
|
-
yarn: './plugins/yarn.js',
|
|
14
|
-
jsr: './plugins/jsr.js',
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Built-in name list.
|
|
18
|
-
*/
|
|
19
|
-
export const builtInNameList = ['git', 'npm', 'vsce', 'yarn', 'jsr'];
|
|
20
|
-
/**
|
|
21
|
-
* Checks if the value is the {@link PluginExport}.
|
|
22
|
-
*/
|
|
23
|
-
export function isPluginExport(value) {
|
|
24
|
-
if (value?.constructor !== Object) {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
const vign = value.viewignored;
|
|
28
|
-
return (vign?.constructor === Object)
|
|
29
|
-
&& 'addTargets' in vign && Array.isArray(vign.addTargets)
|
|
30
|
-
&& vign.addTargets.every(v => isTargetBind(v));
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Imports the plugin's exported data.
|
|
34
|
-
*/
|
|
35
|
-
export function importPlugin(exportData) {
|
|
36
|
-
const { addTargets } = exportData.viewignored;
|
|
37
|
-
for (const targetBind of addTargets) {
|
|
38
|
-
targetSet(targetBind);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* @param modulePath The plugin name.
|
|
43
|
-
* @returns The import result for the module.
|
|
44
|
-
*/
|
|
45
|
-
export async function loadPlugin(modulePath, useImport = false) {
|
|
46
|
-
try {
|
|
47
|
-
const exports = useImport
|
|
48
|
-
? Object.getOwnPropertyDescriptor(await import(modulePath), 'default')
|
|
49
|
-
?.value
|
|
50
|
-
: await load(modulePath);
|
|
51
|
-
const result = {
|
|
52
|
-
resource: modulePath,
|
|
53
|
-
isLoaded: true,
|
|
54
|
-
exports,
|
|
55
|
-
};
|
|
56
|
-
if (isPluginExport(exports)) {
|
|
57
|
-
importPlugin(exports);
|
|
58
|
-
}
|
|
59
|
-
return result;
|
|
60
|
-
}
|
|
61
|
-
catch (error) {
|
|
62
|
-
const r = error;
|
|
63
|
-
let reason = r;
|
|
64
|
-
if (r?.code === 'ERR_MODULE_NOT_FOUND') {
|
|
65
|
-
reason = r.message;
|
|
66
|
-
}
|
|
67
|
-
const fail = {
|
|
68
|
-
resource: modulePath,
|
|
69
|
-
isLoaded: false,
|
|
70
|
-
exports: reason,
|
|
71
|
-
};
|
|
72
|
-
return fail;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* @param modulePathList The plugin name list.
|
|
77
|
-
* @returns The import result for the list of modules.
|
|
78
|
-
*/
|
|
79
|
-
export async function loadPlugins(modulePathList) {
|
|
80
|
-
return await conc(modulePathList.map(modulePath => async () => await loadPlugin(modulePath)), 4);
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Load any built-in plugin.
|
|
84
|
-
*/
|
|
85
|
-
export function loadBuiltIn(builtIn) {
|
|
86
|
-
return loadPlugin(builtInImportMap[builtIn], true);
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* @param modulePathList The plugin name list.
|
|
90
|
-
* @returns The import result for the list of modules.
|
|
91
|
-
*/
|
|
92
|
-
export async function loadBuiltIns(builtInList = [...builtInNameList]) {
|
|
93
|
-
return await conc(builtInList.map(modulePath => async () => await loadBuiltIn(modulePath)), 4);
|
|
94
|
-
}
|
|
95
|
-
//# sourceMappingURL=index.js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