view-ignored 0.9.1 → 0.10.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 +15 -18
- package/out/browser_scan.js +5 -5
- package/out/opendir.d.ts +1 -1
- package/out/opendir.js +15 -11
- package/out/patterns/extractor.d.ts +1 -8
- package/out/patterns/gitignore.d.ts +3 -3
- package/out/patterns/gitignore.js +8 -8
- package/out/patterns/ignores.d.ts +3 -3
- package/out/patterns/index.d.ts +3 -3
- package/out/patterns/index.js +3 -3
- package/out/patterns/initState.d.ts +7 -0
- package/out/patterns/jsrjson.d.ts +1 -1
- package/out/patterns/jsrjson.js +5 -5
- package/out/patterns/matcherContext.d.ts +2 -2
- package/out/patterns/matcherContextPatch.js +7 -6
- package/out/patterns/matcherStream.d.ts +2 -2
- package/out/patterns/matcherStream.js +5 -5
- package/out/patterns/packagejson.d.ts +2 -2
- package/out/patterns/packagejson.js +7 -7
- package/out/patterns/patternCompile.d.ts +22 -0
- package/out/patterns/{stringCompile.js → patternCompile.js} +2 -2
- package/out/patterns/{pattern.d.ts → patternList.d.ts} +11 -11
- package/out/patterns/patternList.js +21 -0
- package/out/patterns/resolveSources.d.ts +5 -5
- package/out/patterns/resolveSources.js +20 -27
- package/out/patterns/rule.d.ts +115 -0
- package/out/patterns/{signedPattern.js → rule.js} +16 -13
- package/out/patterns/source.d.ts +9 -6
- package/out/patterns/source.js +5 -2
- package/out/targets/bun.js +8 -13
- package/out/targets/deno.js +6 -11
- package/out/targets/git.js +6 -11
- package/out/targets/jsr.js +6 -11
- package/out/targets/npm.js +8 -13
- package/out/targets/target.d.ts +14 -0
- package/out/targets/vsce.js +6 -11
- package/out/targets/yarn.js +8 -13
- package/out/targets/yarnClassic.js +7 -12
- package/out/unixify.js +7 -5
- package/out/walk.js +2 -2
- package/package.json +3 -3
- package/out/patterns/pattern.js +0 -21
- package/out/patterns/signedPattern.d.ts +0 -121
- package/out/patterns/stringCompile.d.ts +0 -22
package/out/targets/yarn.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type } from "arktype";
|
|
2
|
-
import {
|
|
2
|
+
import { ruleTest, ruleCompile, extractPackageJsonNocase, extractGitignoreNocase, } from "../patterns/index.js";
|
|
3
3
|
import { join, unixify } from "../unixify.js";
|
|
4
4
|
import { npmManifestParse } from "./npmManifest.js";
|
|
5
5
|
const extractors = [
|
|
@@ -23,7 +23,7 @@ const internalInclude = {
|
|
|
23
23
|
};
|
|
24
24
|
const internal = [
|
|
25
25
|
internalInclude,
|
|
26
|
-
|
|
26
|
+
ruleCompile({
|
|
27
27
|
excludes: true,
|
|
28
28
|
pattern: [
|
|
29
29
|
// https://github.com/yarnpkg/berry/blob/master/packages/plugin-pack/sources/packUtils.ts#L26
|
|
@@ -39,7 +39,7 @@ const internal = [
|
|
|
39
39
|
],
|
|
40
40
|
compiled: null,
|
|
41
41
|
}),
|
|
42
|
-
|
|
42
|
+
ruleCompile({
|
|
43
43
|
excludes: false,
|
|
44
44
|
pattern: [
|
|
45
45
|
// https://github.com/yarnpkg/berry/blob/master/packages/plugin-pack/sources/packUtils.ts#L10
|
|
@@ -58,6 +58,9 @@ const internal = [
|
|
|
58
58
|
* @since 0.6.0
|
|
59
59
|
*/
|
|
60
60
|
export const Yarn = {
|
|
61
|
+
internalRules: internal,
|
|
62
|
+
extractors,
|
|
63
|
+
root: ".",
|
|
61
64
|
async init({ fs, cwd }) {
|
|
62
65
|
let content;
|
|
63
66
|
const normalCwd = unixify(cwd);
|
|
@@ -90,15 +93,7 @@ export const Yarn = {
|
|
|
90
93
|
Object.values(dist.bin).forEach((binPath) => set.add(normal(binPath)));
|
|
91
94
|
}
|
|
92
95
|
internalInclude.pattern = Array.from(set);
|
|
93
|
-
|
|
94
|
-
},
|
|
95
|
-
extractors,
|
|
96
|
-
ignores(o) {
|
|
97
|
-
return signedPatternIgnores({
|
|
98
|
-
...o,
|
|
99
|
-
internal,
|
|
100
|
-
root: ".",
|
|
101
|
-
target: Yarn,
|
|
102
|
-
});
|
|
96
|
+
ruleCompile(internalInclude, { nocase: true });
|
|
103
97
|
},
|
|
98
|
+
ignores: ruleTest,
|
|
104
99
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type } from "arktype";
|
|
2
|
-
import {
|
|
2
|
+
import { ruleTest, ruleCompile, extractPackageJsonNocase, extractGitignoreNocase, } from "../patterns/index.js";
|
|
3
3
|
import { unixify } from "../unixify.js";
|
|
4
4
|
import { npmManifestParse } from "./npmManifest.js";
|
|
5
5
|
const extractors = [
|
|
@@ -21,7 +21,7 @@ const extractors = [
|
|
|
21
21
|
},
|
|
22
22
|
];
|
|
23
23
|
const internal = [
|
|
24
|
-
|
|
24
|
+
ruleCompile({
|
|
25
25
|
excludes: true,
|
|
26
26
|
pattern: [
|
|
27
27
|
// https://github.com/yarnpkg/berry/blob/master/packages/plugin-pack/sources/packUtils.ts#L26
|
|
@@ -55,7 +55,7 @@ const internal = [
|
|
|
55
55
|
],
|
|
56
56
|
compiled: null,
|
|
57
57
|
}, { nocase: true }),
|
|
58
|
-
|
|
58
|
+
ruleCompile({
|
|
59
59
|
excludes: false,
|
|
60
60
|
pattern: [
|
|
61
61
|
// https://github.com/yarnpkg/berry/blob/master/packages/plugin-pack/sources/packUtils.ts#L10
|
|
@@ -74,6 +74,9 @@ const internal = [
|
|
|
74
74
|
* @since 0.8.0
|
|
75
75
|
*/
|
|
76
76
|
export const YarnClassic = {
|
|
77
|
+
internalRules: internal,
|
|
78
|
+
extractors,
|
|
79
|
+
root: ".",
|
|
77
80
|
async init({ fs, cwd }) {
|
|
78
81
|
let content;
|
|
79
82
|
const normalCwd = unixify(cwd);
|
|
@@ -88,13 +91,5 @@ export const YarnClassic = {
|
|
|
88
91
|
throw new Error("Invalid 'package.json': " + dist.summary, { cause: dist });
|
|
89
92
|
}
|
|
90
93
|
},
|
|
91
|
-
|
|
92
|
-
ignores(o) {
|
|
93
|
-
return signedPatternIgnores({
|
|
94
|
-
...o,
|
|
95
|
-
internal,
|
|
96
|
-
root: ".",
|
|
97
|
-
target: YarnClassic,
|
|
98
|
-
});
|
|
99
|
-
},
|
|
94
|
+
ignores: ruleTest,
|
|
100
95
|
};
|
package/out/unixify.js
CHANGED
|
@@ -13,12 +13,14 @@ export function join(from, p2) {
|
|
|
13
13
|
if (p2 === "." || p2 === "./") {
|
|
14
14
|
return from;
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
let start = 0;
|
|
17
|
+
if (p2.startsWith("./")) {
|
|
18
|
+
start = 2;
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
-
from += "/"
|
|
20
|
+
if (!from.endsWith("/")) {
|
|
21
|
+
from += "/";
|
|
21
22
|
}
|
|
23
|
+
from += p2.substring(start);
|
|
22
24
|
return from;
|
|
23
25
|
}
|
|
24
26
|
export function relative(base, to) {
|
|
@@ -32,5 +34,5 @@ export function base(path) {
|
|
|
32
34
|
return path.substring(path.lastIndexOf("/") + 1);
|
|
33
35
|
}
|
|
34
36
|
function strip(path) {
|
|
35
|
-
return path.replaceAll("\\", "/").replace(
|
|
37
|
+
return path.replaceAll("\\", "/").replace(/^[a-zA-Z]:/, "");
|
|
36
38
|
}
|
package/out/walk.js
CHANGED
|
@@ -17,7 +17,7 @@ export async function walkIncludes(options) {
|
|
|
17
17
|
const { depth, depthSlash } = getDepth(path, maxDepth);
|
|
18
18
|
if (depth > maxDepth) {
|
|
19
19
|
const failedPrev = ctx.failed.length;
|
|
20
|
-
let match = await target.ignores({ fs, cwd, entry: path, ctx, signal });
|
|
20
|
+
let match = await target.ignores({ fs, cwd, entry: path, ctx, signal, target });
|
|
21
21
|
if (invert) {
|
|
22
22
|
match.ignored = !match.ignored;
|
|
23
23
|
}
|
|
@@ -45,7 +45,7 @@ export async function walkIncludes(options) {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
const failedPrev = ctx.failed.length;
|
|
48
|
-
let match = await target.ignores({ fs, cwd, entry: path, ctx, signal });
|
|
48
|
+
let match = await target.ignores({ fs, cwd, entry: path, ctx, signal, target });
|
|
49
49
|
if (invert) {
|
|
50
50
|
match.ignored = !match.ignored;
|
|
51
51
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "view-ignored",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Retrieve list of files ignored/included by Git, NPM, Yarn, JSR, VSCE or other tools.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
".gitignore",
|
|
@@ -78,8 +78,8 @@
|
|
|
78
78
|
"scripts": {
|
|
79
79
|
"prerelease": "bun run test && bun run prod && bun run lint && bun run fmt --check && bun publint --pack bun --strict",
|
|
80
80
|
"cpu": "bun run cpu:igw; bun run cpu:me",
|
|
81
|
-
"cpu:igw": "bun run --cpu-prof-md --cpu-prof-name CPU.igw
|
|
82
|
-
"cpu:me": "bun run --cpu-prof-md --cpu-prof-name CPU.me
|
|
81
|
+
"cpu:igw": "bun run --expose-gc --cpu-prof --cpu-prof-md --cpu-prof-name CPU.igw scripts/ignoreWalk.js",
|
|
82
|
+
"cpu:me": "bun run --expose-gc --cpu-prof --cpu-prof-md --cpu-prof-name CPU.me scripts/scan.js --fastInternal",
|
|
83
83
|
"test": "bun test src",
|
|
84
84
|
"test:patterns": "bun test src/patterns",
|
|
85
85
|
"test:targets": "bun test src/targets",
|
package/out/patterns/pattern.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { stringCompile } from "./stringCompile.js";
|
|
2
|
-
/**
|
|
3
|
-
* Safely calls RegExp.test.
|
|
4
|
-
*
|
|
5
|
-
* @since 0.6.0
|
|
6
|
-
*/
|
|
7
|
-
export function patternMinimatchTest(pattern, path) {
|
|
8
|
-
pattern.re.lastIndex = 0;
|
|
9
|
-
return pattern.re.test(path);
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Compiles the {@link Pattern}.
|
|
13
|
-
*
|
|
14
|
-
* @see {@link stringCompile}
|
|
15
|
-
* @see {@link signedPatternCompile}
|
|
16
|
-
*
|
|
17
|
-
* @since 0.6.0
|
|
18
|
-
*/
|
|
19
|
-
export function patternCompile(pattern, options) {
|
|
20
|
-
return pattern.map((p, _, pattern) => stringCompile(p, pattern, options));
|
|
21
|
-
}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import type { PatternFinderOptions } from "./extractor.js";
|
|
2
|
-
import type { Source } from "./source.js";
|
|
3
|
-
import { type Pattern, type PatternMinimatch } from "./pattern.js";
|
|
4
|
-
/**
|
|
5
|
-
* Represents a set of include and exclude patterns.
|
|
6
|
-
* These patterns are positive minimatch patterns.
|
|
7
|
-
*
|
|
8
|
-
* @see {@link signedPatternIgnores} provides the ignoring algorithm.
|
|
9
|
-
* @see {@link signedPatternCompile} compiles the signed pattern.
|
|
10
|
-
* Use this or an extractor's method to compile.
|
|
11
|
-
*
|
|
12
|
-
* @since 0.6.0
|
|
13
|
-
*/
|
|
14
|
-
export type SignedPattern = {
|
|
15
|
-
/**
|
|
16
|
-
* Provides ignored or included file and directory patterns.
|
|
17
|
-
*
|
|
18
|
-
* @see {@link signedPatternIgnores} provides the ignoring algorithm.
|
|
19
|
-
*
|
|
20
|
-
* @since 0.9.0
|
|
21
|
-
*/
|
|
22
|
-
pattern: Pattern;
|
|
23
|
-
/**
|
|
24
|
-
* If `true`, pattern "test" will exclude file named "test".
|
|
25
|
-
*
|
|
26
|
-
* @see {@link signedPatternIgnores} provides the ignoring algorithm.
|
|
27
|
-
*
|
|
28
|
-
* @since 0.9.0
|
|
29
|
-
*/
|
|
30
|
-
excludes: boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Provides compiled ignored or included file and directory patterns.
|
|
33
|
-
*
|
|
34
|
-
* @see {@link signedPatternIgnores} provides the ignoring algorithm.
|
|
35
|
-
*
|
|
36
|
-
* @since 0.6.0
|
|
37
|
-
*/
|
|
38
|
-
compiled: null | PatternMinimatch[];
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* The kind of a pattern match.
|
|
42
|
-
*
|
|
43
|
-
* @since 0.9.1
|
|
44
|
-
*/
|
|
45
|
-
export type MatchKind = SignedPatternMatch["kind"];
|
|
46
|
-
/**
|
|
47
|
-
* @see {@link SignedPatternMatch}
|
|
48
|
-
*
|
|
49
|
-
* @since 0.9.1
|
|
50
|
-
*/
|
|
51
|
-
export interface MatchBase<K extends string> {
|
|
52
|
-
kind: K;
|
|
53
|
-
ignored: boolean;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* @see {@link SignedPatternMatch}
|
|
57
|
-
*
|
|
58
|
-
* @since 0.9.1
|
|
59
|
-
*/
|
|
60
|
-
export interface MatchBaseSource<K extends string> extends MatchBase<K> {
|
|
61
|
-
source: Source;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* @see {@link SignedPatternMatch}
|
|
65
|
-
*
|
|
66
|
-
* @since 0.9.1
|
|
67
|
-
*/
|
|
68
|
-
export interface MatchBasePattern<K extends string> extends MatchBase<K> {
|
|
69
|
-
pattern: string;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* @see {@link SignedPatternMatch}
|
|
73
|
-
*
|
|
74
|
-
* @since 0.9.1
|
|
75
|
-
*/
|
|
76
|
-
export interface MatchBaseErrorPattern<K extends string> extends MatchBasePattern<K> {
|
|
77
|
-
error: Error;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* @see {@link SignedPatternMatch}
|
|
81
|
-
*
|
|
82
|
-
* @since 0.9.1
|
|
83
|
-
*/
|
|
84
|
-
export interface MatchBaseSourcePattern<K extends string> extends MatchBasePattern<K>, MatchBaseSource<K> {
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* @see {@link signedPatternIgnores}
|
|
88
|
-
*
|
|
89
|
-
* @since 0.6.0
|
|
90
|
-
*/
|
|
91
|
-
export type SignedPatternMatch = MatchBase<"none" | "missing-source"> | MatchBaseSource<"no-match" | "broken-source" | "invalid-pattern"> | MatchBaseErrorPattern<"invalid-internal-pattern"> | MatchBasePattern<"internal"> | MatchBaseSourcePattern<"external">;
|
|
92
|
-
/**
|
|
93
|
-
* @see {@link signedPatternIgnores}
|
|
94
|
-
*
|
|
95
|
-
* @since 0.6.0
|
|
96
|
-
*/
|
|
97
|
-
export interface SignedPatternIgnoresOptions extends PatternFinderOptions {
|
|
98
|
-
/**
|
|
99
|
-
* Relative entry path.
|
|
100
|
-
*
|
|
101
|
-
* @example
|
|
102
|
-
* "dir/subdir"
|
|
103
|
-
* "dir/subdir/index.js"
|
|
104
|
-
*
|
|
105
|
-
* @since 0.6.0
|
|
106
|
-
*/
|
|
107
|
-
entry: string;
|
|
108
|
-
/**
|
|
109
|
-
* The internal pattern. Should be compiled.
|
|
110
|
-
*
|
|
111
|
-
* @since 0.6.0
|
|
112
|
-
*/
|
|
113
|
-
internal: SignedPattern[];
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Checks whether a given entry should be ignored based on internal and external patterns.
|
|
117
|
-
* Populates unknown sources using {@link resolveSources}.
|
|
118
|
-
*
|
|
119
|
-
* @since 0.6.0
|
|
120
|
-
*/
|
|
121
|
-
export declare function signedPatternIgnores(options: SignedPatternIgnoresOptions): Promise<SignedPatternMatch>;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { PatternMinimatch, Pattern } from "./pattern.js";
|
|
2
|
-
/**
|
|
3
|
-
* @since 0.8.0
|
|
4
|
-
*/
|
|
5
|
-
export type StringCompileOptions = {
|
|
6
|
-
/**
|
|
7
|
-
* Disables case sensitivity.
|
|
8
|
-
*
|
|
9
|
-
* @default false
|
|
10
|
-
*
|
|
11
|
-
* @since 0.8.0
|
|
12
|
-
*/
|
|
13
|
-
nocase?: boolean;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Compiles a string of the {@link Pattern}.
|
|
17
|
-
*
|
|
18
|
-
* @see {@link patternCompile}
|
|
19
|
-
*
|
|
20
|
-
* @since 0.8.0
|
|
21
|
-
*/
|
|
22
|
-
export declare function stringCompile(pattern: string, context?: Pattern, options?: StringCompileOptions): PatternMinimatch;
|