view-ignored 0.6.0 → 0.7.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/out/browser_scan.d.ts +1 -1
- package/out/browser_scan.js +14 -9
- package/out/browser_stream.d.ts +1 -1
- package/out/browser_stream.js +14 -9
- package/out/patterns/extractor.d.ts +10 -10
- package/out/patterns/gitignore.d.ts +1 -1
- package/out/patterns/gitignore.js +1 -1
- package/out/patterns/ignores.d.ts +1 -1
- package/out/patterns/jsrjson.d.ts +2 -2
- package/out/patterns/jsrjson.js +2 -2
- package/out/patterns/matcherContext.d.ts +8 -8
- package/out/patterns/matcherContextPatch.d.ts +2 -2
- package/out/patterns/matcherContextPatch.js +13 -8
- package/out/patterns/matcherStream.d.ts +9 -9
- package/out/patterns/matcherStream.js +1 -1
- package/out/patterns/packagejson.d.ts +1 -1
- package/out/patterns/packagejson.js +1 -1
- package/out/patterns/pattern.d.ts +6 -6
- package/out/patterns/pattern.js +2 -2
- package/out/patterns/patternMatcher.d.ts +3 -3
- package/out/patterns/resolveSources.d.ts +4 -4
- package/out/patterns/resolveSources.js +7 -14
- package/out/patterns/signedPattern.d.ts +21 -12
- package/out/patterns/signedPattern.js +60 -25
- package/out/patterns/source.d.ts +7 -7
- package/out/patterns/source.js +1 -1
- package/out/patterns/stringCompile.d.ts +1 -1
- package/out/patterns/stringCompile.js +1 -1
- package/out/scan.d.ts +1 -1
- package/out/scan.js +1 -1
- package/out/stream.d.ts +1 -1
- package/out/stream.js +1 -1
- package/out/targets/git.d.ts +1 -1
- package/out/targets/git.js +1 -1
- package/out/targets/jsr.d.ts +1 -1
- package/out/targets/jsr.js +1 -1
- package/out/targets/npm.d.ts +1 -1
- package/out/targets/npm.js +1 -1
- package/out/targets/target.d.ts +3 -3
- package/out/targets/vsce.d.ts +1 -1
- package/out/targets/vsce.js +1 -1
- package/out/targets/yarn.d.ts +1 -1
- package/out/targets/yarn.js +1 -1
- package/out/types.d.ts +11 -11
- package/out/walk.d.ts +1 -0
- package/out/walk.js +2 -5
- package/package.json +1 -1
|
@@ -10,7 +10,7 @@ import type { Source } from "./source.js";
|
|
|
10
10
|
* @see {@link signedPatternCompile} compiles the signed pattern.
|
|
11
11
|
* Use this or an extractor's method to compile.
|
|
12
12
|
*
|
|
13
|
-
* @since 0.0
|
|
13
|
+
* @since 0.6.0
|
|
14
14
|
*/
|
|
15
15
|
export type SignedPattern = {
|
|
16
16
|
/**
|
|
@@ -18,7 +18,7 @@ export type SignedPattern = {
|
|
|
18
18
|
*
|
|
19
19
|
* @see {@link signedPatternIgnores} provides the ignoring algorithm.
|
|
20
20
|
*
|
|
21
|
-
* @since 0.0
|
|
21
|
+
* @since 0.6.0
|
|
22
22
|
*/
|
|
23
23
|
include: Pattern;
|
|
24
24
|
/**
|
|
@@ -26,7 +26,7 @@ export type SignedPattern = {
|
|
|
26
26
|
*
|
|
27
27
|
* @see {@link signedPatternIgnores} provides the ignoring algorithm.
|
|
28
28
|
*
|
|
29
|
-
* @since 0.0
|
|
29
|
+
* @since 0.6.0
|
|
30
30
|
*/
|
|
31
31
|
exclude: Pattern;
|
|
32
32
|
/**
|
|
@@ -34,7 +34,7 @@ export type SignedPattern = {
|
|
|
34
34
|
*
|
|
35
35
|
* @see {@link signedPatternIgnores} provides the ignoring algorithm.
|
|
36
36
|
*
|
|
37
|
-
* @since 0.0
|
|
37
|
+
* @since 0.6.0
|
|
38
38
|
*/
|
|
39
39
|
compiled: null | {
|
|
40
40
|
/**
|
|
@@ -42,7 +42,7 @@ export type SignedPattern = {
|
|
|
42
42
|
*
|
|
43
43
|
* @see {@link signedPatternIgnores} provides the ignoring algorithm.
|
|
44
44
|
*
|
|
45
|
-
* @since 0.0
|
|
45
|
+
* @since 0.6.0
|
|
46
46
|
*/
|
|
47
47
|
include: PatternMinimatch[];
|
|
48
48
|
/**
|
|
@@ -50,7 +50,7 @@ export type SignedPattern = {
|
|
|
50
50
|
*
|
|
51
51
|
* @see {@link signedPatternIgnores} provides the ignoring algorithm.
|
|
52
52
|
*
|
|
53
|
-
* @since 0.0
|
|
53
|
+
* @since 0.6.0
|
|
54
54
|
*/
|
|
55
55
|
exclude: PatternMinimatch[];
|
|
56
56
|
};
|
|
@@ -58,10 +58,19 @@ export type SignedPattern = {
|
|
|
58
58
|
/**
|
|
59
59
|
* @see {@link signedPatternIgnores}
|
|
60
60
|
*
|
|
61
|
-
* @since 0.0
|
|
61
|
+
* @since 0.6.0
|
|
62
62
|
*/
|
|
63
63
|
export type SignedPatternMatch = {
|
|
64
|
-
kind: "none" | "
|
|
64
|
+
kind: "none" | "missing-source";
|
|
65
|
+
ignored: boolean;
|
|
66
|
+
} | {
|
|
67
|
+
kind: "no-match" | "broken-source" | "invalid-pattern";
|
|
68
|
+
ignored: boolean;
|
|
69
|
+
source: Source;
|
|
70
|
+
} | {
|
|
71
|
+
kind: "invalid-internal-pattern";
|
|
72
|
+
pattern: string;
|
|
73
|
+
error: Error;
|
|
65
74
|
ignored: boolean;
|
|
66
75
|
} | {
|
|
67
76
|
kind: "internal";
|
|
@@ -76,7 +85,7 @@ export type SignedPatternMatch = {
|
|
|
76
85
|
/**
|
|
77
86
|
* @see {@link signedPatternIgnores}
|
|
78
87
|
*
|
|
79
|
-
* @since 0.0
|
|
88
|
+
* @since 0.6.0
|
|
80
89
|
*/
|
|
81
90
|
export interface SignedPatternIgnoresOptions extends PatternFinderOptions {
|
|
82
91
|
/**
|
|
@@ -86,13 +95,13 @@ export interface SignedPatternIgnoresOptions extends PatternFinderOptions {
|
|
|
86
95
|
* "dir/subdir"
|
|
87
96
|
* "dir/subdir/index.js"
|
|
88
97
|
*
|
|
89
|
-
* @since 0.0
|
|
98
|
+
* @since 0.6.0
|
|
90
99
|
*/
|
|
91
100
|
entry: string;
|
|
92
101
|
/**
|
|
93
102
|
* The internal pattern. Should be compiled.
|
|
94
103
|
*
|
|
95
|
-
* @since 0.0
|
|
104
|
+
* @since 0.6.0
|
|
96
105
|
*/
|
|
97
106
|
internal: SignedPattern;
|
|
98
107
|
}
|
|
@@ -112,6 +121,6 @@ export interface SignedPatternIgnoresOptions extends PatternFinderOptions {
|
|
|
112
121
|
* b. Check external include patterns. If matched, return false.
|
|
113
122
|
* 4. If no patterns matched, return the inverted state.
|
|
114
123
|
*
|
|
115
|
-
* @since 0.0
|
|
124
|
+
* @since 0.6.0
|
|
116
125
|
*/
|
|
117
126
|
export declare function signedPatternIgnores(options: SignedPatternIgnoresOptions): Promise<SignedPatternMatch>;
|
|
@@ -3,59 +3,95 @@ import { patternMinimatchTest } from "./pattern.js";
|
|
|
3
3
|
import { resolveSources } from "./resolveSources.js";
|
|
4
4
|
function patternRegExpTest(path, rs) {
|
|
5
5
|
for (const r of rs) {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
try {
|
|
7
|
+
if (patternMinimatchTest(r, path)) {
|
|
8
|
+
return [r.pattern, undefined];
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
catch (err) {
|
|
12
|
+
return [r.pattern, err];
|
|
8
13
|
}
|
|
9
14
|
}
|
|
10
|
-
return "";
|
|
15
|
+
return ["", undefined];
|
|
11
16
|
}
|
|
12
17
|
function signedPatternCompiledMatchInternal(options, path) {
|
|
13
18
|
let patternMatch = "";
|
|
19
|
+
let err;
|
|
14
20
|
const kind = "internal";
|
|
15
21
|
const signedPattern = options.internal;
|
|
16
22
|
const compiled = signedPattern.compiled; // no null
|
|
17
23
|
try {
|
|
18
|
-
|
|
24
|
+
;
|
|
25
|
+
[patternMatch, err] = patternRegExpTest(path, compiled.exclude);
|
|
26
|
+
if (err) {
|
|
27
|
+
throw err;
|
|
28
|
+
}
|
|
19
29
|
if (patternMatch) {
|
|
20
30
|
// return true
|
|
21
31
|
return { kind, pattern: patternMatch, ignored: true };
|
|
22
32
|
}
|
|
23
|
-
|
|
33
|
+
;
|
|
34
|
+
[patternMatch, err] = patternRegExpTest(path, compiled.include);
|
|
35
|
+
if (err) {
|
|
36
|
+
throw err;
|
|
37
|
+
}
|
|
24
38
|
if (patternMatch) {
|
|
25
39
|
// return false
|
|
26
40
|
return { kind, pattern: patternMatch, ignored: false };
|
|
27
41
|
}
|
|
28
42
|
}
|
|
29
|
-
catch {
|
|
30
|
-
return {
|
|
43
|
+
catch (error) {
|
|
44
|
+
return {
|
|
45
|
+
kind: "invalid-internal-pattern",
|
|
46
|
+
pattern: patternMatch,
|
|
47
|
+
error: error,
|
|
48
|
+
ignored: false,
|
|
49
|
+
};
|
|
31
50
|
}
|
|
32
|
-
return
|
|
51
|
+
return null;
|
|
33
52
|
}
|
|
34
53
|
function signedPatternCompiledMatchExternal(options, path, source) {
|
|
35
54
|
let patternMatch = "";
|
|
55
|
+
let err;
|
|
36
56
|
const kind = "external";
|
|
37
57
|
const signedPattern = source.pattern;
|
|
38
58
|
const compiled = signedPattern.compiled; // no null
|
|
39
59
|
try {
|
|
40
60
|
if (source.inverted) {
|
|
41
|
-
|
|
61
|
+
;
|
|
62
|
+
[patternMatch, err] = patternRegExpTest(path, compiled.exclude);
|
|
63
|
+
if (err) {
|
|
64
|
+
throw err;
|
|
65
|
+
}
|
|
42
66
|
if (patternMatch) {
|
|
43
67
|
// return true
|
|
44
68
|
return { kind, source, pattern: patternMatch, ignored: true };
|
|
45
69
|
}
|
|
46
|
-
|
|
70
|
+
;
|
|
71
|
+
[patternMatch, err] = patternRegExpTest(path, compiled.include);
|
|
72
|
+
if (err) {
|
|
73
|
+
throw err;
|
|
74
|
+
}
|
|
47
75
|
if (patternMatch) {
|
|
48
76
|
// return false
|
|
49
77
|
return { kind, source, pattern: patternMatch, ignored: false };
|
|
50
78
|
}
|
|
51
79
|
}
|
|
52
80
|
else {
|
|
53
|
-
|
|
81
|
+
;
|
|
82
|
+
[patternMatch, err] = patternRegExpTest(path, compiled.include);
|
|
83
|
+
if (err) {
|
|
84
|
+
throw err;
|
|
85
|
+
}
|
|
54
86
|
if (patternMatch) {
|
|
55
87
|
// return false
|
|
56
88
|
return { kind, source, pattern: patternMatch, ignored: false };
|
|
57
89
|
}
|
|
58
|
-
|
|
90
|
+
;
|
|
91
|
+
[patternMatch, err] = patternRegExpTest(path, compiled.exclude);
|
|
92
|
+
if (err) {
|
|
93
|
+
throw err;
|
|
94
|
+
}
|
|
59
95
|
if (patternMatch) {
|
|
60
96
|
// return true
|
|
61
97
|
return { kind, source, pattern: patternMatch, ignored: true };
|
|
@@ -64,10 +100,10 @@ function signedPatternCompiledMatchExternal(options, path, source) {
|
|
|
64
100
|
}
|
|
65
101
|
catch (err) {
|
|
66
102
|
source.error = err;
|
|
67
|
-
options.ctx
|
|
68
|
-
return { kind: "invalid-pattern", ignored: false };
|
|
103
|
+
options.ctx?.failed.push(source);
|
|
104
|
+
return { kind: "invalid-pattern", ignored: false, source };
|
|
69
105
|
}
|
|
70
|
-
return { kind: "no-match", ignored: source.inverted };
|
|
106
|
+
return { kind: "no-match", ignored: source.inverted, source };
|
|
71
107
|
}
|
|
72
108
|
/**
|
|
73
109
|
* Checks whether a given entry should be ignored based on internal and external patterns.
|
|
@@ -85,26 +121,25 @@ function signedPatternCompiledMatchExternal(options, path, source) {
|
|
|
85
121
|
* b. Check external include patterns. If matched, return false.
|
|
86
122
|
* 4. If no patterns matched, return the inverted state.
|
|
87
123
|
*
|
|
88
|
-
* @since 0.0
|
|
124
|
+
* @since 0.6.0
|
|
89
125
|
*/
|
|
90
126
|
export async function signedPatternIgnores(options) {
|
|
91
127
|
const parent = dirname(options.entry);
|
|
92
|
-
let source = options.ctx
|
|
128
|
+
let source = options.ctx?.external.get(parent);
|
|
93
129
|
if (source === undefined) {
|
|
94
|
-
const failedPrev = options.ctx.failed.length;
|
|
95
130
|
await resolveSources({ ...options, dir: parent, root: options.root });
|
|
96
|
-
if (failedPrev < options.ctx.failed.length) {
|
|
97
|
-
return { kind: "broken-source", ignored: false };
|
|
98
|
-
}
|
|
99
131
|
source = options.ctx.external.get(parent);
|
|
100
132
|
}
|
|
133
|
+
if (source === undefined || source === "none") {
|
|
134
|
+
return { kind: "missing-source", ignored: true };
|
|
135
|
+
}
|
|
136
|
+
if (typeof source === "object" && source.error) {
|
|
137
|
+
return { kind: "broken-source", ignored: true, source };
|
|
138
|
+
}
|
|
101
139
|
let internalMatch = signedPatternCompiledMatchInternal(options, options.entry);
|
|
102
|
-
if (internalMatch
|
|
140
|
+
if (internalMatch !== null) {
|
|
103
141
|
return internalMatch;
|
|
104
142
|
}
|
|
105
|
-
if (source === undefined || source === "none") {
|
|
106
|
-
return { kind: "no-match", ignored: false };
|
|
107
|
-
}
|
|
108
143
|
const externalMatch = signedPatternCompiledMatchExternal(options, options.entry, source);
|
|
109
144
|
return externalMatch;
|
|
110
145
|
}
|
package/out/patterns/source.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { SignedPattern } from "./signedPattern.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Represents a source of external patterns.
|
|
4
4
|
*
|
|
5
|
-
* @since 0.0
|
|
5
|
+
* @since 0.6.0
|
|
6
6
|
*/
|
|
7
7
|
export type Source = {
|
|
8
8
|
/**
|
|
@@ -12,19 +12,19 @@ export type Source = {
|
|
|
12
12
|
* @see {@link PatternMatcher}
|
|
13
13
|
* @see {@link signedPatternIgnores}
|
|
14
14
|
*
|
|
15
|
-
* @since 0.0
|
|
15
|
+
* @since 0.6.0
|
|
16
16
|
*/
|
|
17
17
|
pattern: SignedPattern;
|
|
18
18
|
/**
|
|
19
19
|
* Name of the source file.
|
|
20
20
|
*
|
|
21
|
-
* @since 0.0
|
|
21
|
+
* @since 0.6.0
|
|
22
22
|
*/
|
|
23
23
|
name: string;
|
|
24
24
|
/**
|
|
25
25
|
* Relative path to the source file.
|
|
26
26
|
*
|
|
27
|
-
* @since 0.0
|
|
27
|
+
* @since 0.6.0
|
|
28
28
|
*/
|
|
29
29
|
path: string;
|
|
30
30
|
/**
|
|
@@ -35,7 +35,7 @@ export type Source = {
|
|
|
35
35
|
* @see {@link PatternMatcher}
|
|
36
36
|
* @see {@link signedPatternIgnores}
|
|
37
37
|
*
|
|
38
|
-
* @since 0.0
|
|
38
|
+
* @since 0.6.0
|
|
39
39
|
*/
|
|
40
40
|
inverted: boolean;
|
|
41
41
|
/**
|
|
@@ -43,7 +43,7 @@ export type Source = {
|
|
|
43
43
|
*
|
|
44
44
|
* @see {@link ExtractorFn}
|
|
45
45
|
*
|
|
46
|
-
* @since 0.0
|
|
46
|
+
* @since 0.6.0
|
|
47
47
|
*/
|
|
48
48
|
error?: Error;
|
|
49
49
|
};
|
|
@@ -52,6 +52,6 @@ export type Source = {
|
|
|
52
52
|
* Strips the leading '!' for include patterns,
|
|
53
53
|
* and adds to exclude patterns otherwise.
|
|
54
54
|
*
|
|
55
|
-
* @since 0.0
|
|
55
|
+
* @since 0.6.0
|
|
56
56
|
*/
|
|
57
57
|
export declare function sourcePushNegatable(source: Source, pattern: string): void;
|
package/out/patterns/source.js
CHANGED
package/out/scan.d.ts
CHANGED
|
@@ -12,6 +12,6 @@ export type * from "./types.js";
|
|
|
12
12
|
* @param options Scan options.
|
|
13
13
|
* @returns A promise that resolves to a {@link MatcherContext} containing the scan results.
|
|
14
14
|
*
|
|
15
|
-
* @since 0.0
|
|
15
|
+
* @since 0.6.0
|
|
16
16
|
*/
|
|
17
17
|
export declare function scan(options: ScanOptions): Promise<MatcherContext>;
|
package/out/scan.js
CHANGED
|
@@ -12,7 +12,7 @@ import { scan as browserScan } from "./browser_scan.js";
|
|
|
12
12
|
* @param options Scan options.
|
|
13
13
|
* @returns A promise that resolves to a {@link MatcherContext} containing the scan results.
|
|
14
14
|
*
|
|
15
|
-
* @since 0.0
|
|
15
|
+
* @since 0.6.0
|
|
16
16
|
*/
|
|
17
17
|
export function scan(options) {
|
|
18
18
|
const { cwd = process.cwd(), fs = nodefs } = options;
|
package/out/stream.d.ts
CHANGED
package/out/stream.js
CHANGED
package/out/targets/git.d.ts
CHANGED
package/out/targets/git.js
CHANGED
package/out/targets/jsr.d.ts
CHANGED
package/out/targets/jsr.js
CHANGED
package/out/targets/npm.d.ts
CHANGED
package/out/targets/npm.js
CHANGED
package/out/targets/target.d.ts
CHANGED
|
@@ -3,14 +3,14 @@ import type { Ignores } from "../patterns/ignores.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* Contains the matcher used for scanning.
|
|
5
5
|
*
|
|
6
|
-
* @since 0.0
|
|
6
|
+
* @since 0.6.0
|
|
7
7
|
*/
|
|
8
8
|
export interface Target {
|
|
9
9
|
/**
|
|
10
10
|
* The set of extractors.
|
|
11
11
|
* Required for context-patching APIs (ctx add/remove path).
|
|
12
12
|
*
|
|
13
|
-
* @since 0.0
|
|
13
|
+
* @since 0.6.0
|
|
14
14
|
*/
|
|
15
15
|
extractors: Extractor[];
|
|
16
16
|
/**
|
|
@@ -18,7 +18,7 @@ export interface Target {
|
|
|
18
18
|
*
|
|
19
19
|
* @see {@link Ignores}
|
|
20
20
|
*
|
|
21
|
-
* @since 0.0
|
|
21
|
+
* @since 0.6.0
|
|
22
22
|
*/
|
|
23
23
|
ignores: Ignores;
|
|
24
24
|
}
|
package/out/targets/vsce.d.ts
CHANGED
package/out/targets/vsce.js
CHANGED
package/out/targets/yarn.d.ts
CHANGED
package/out/targets/yarn.js
CHANGED
package/out/types.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { Target } from "./targets/target.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* Minimal FS implementation needed for `scan`, `scanStream`, and their browser versions.
|
|
5
5
|
*
|
|
6
|
-
* @since 0.0
|
|
6
|
+
* @since 0.6.0
|
|
7
7
|
*/
|
|
8
8
|
export interface FsAdapter {
|
|
9
9
|
promises: {
|
|
@@ -14,13 +14,13 @@ export interface FsAdapter {
|
|
|
14
14
|
/**
|
|
15
15
|
* Used in multiple methods, primarily `scan`, `scanStream`, and their browser versions.
|
|
16
16
|
*
|
|
17
|
-
* @since 0.0
|
|
17
|
+
* @since 0.6.0
|
|
18
18
|
*/
|
|
19
19
|
export type ScanOptions = {
|
|
20
20
|
/**
|
|
21
21
|
* Provides the matcher to use for scanning.
|
|
22
22
|
*
|
|
23
|
-
* @since 0.0
|
|
23
|
+
* @since 0.6.0
|
|
24
24
|
*/
|
|
25
25
|
target: Target;
|
|
26
26
|
/**
|
|
@@ -28,7 +28,7 @@ export type ScanOptions = {
|
|
|
28
28
|
*
|
|
29
29
|
* @default `normalizeCwd(process.cwd())`
|
|
30
30
|
*
|
|
31
|
-
* @since 0.0
|
|
31
|
+
* @since 0.6.0
|
|
32
32
|
*/
|
|
33
33
|
cwd?: string;
|
|
34
34
|
/**
|
|
@@ -39,7 +39,7 @@ export type ScanOptions = {
|
|
|
39
39
|
*
|
|
40
40
|
* @default `"."`
|
|
41
41
|
*
|
|
42
|
-
* @since 0.0
|
|
42
|
+
* @since 0.6.0
|
|
43
43
|
*/
|
|
44
44
|
within?: string;
|
|
45
45
|
/**
|
|
@@ -47,7 +47,7 @@ export type ScanOptions = {
|
|
|
47
47
|
*
|
|
48
48
|
* @default `false`
|
|
49
49
|
*
|
|
50
|
-
* @since 0.0
|
|
50
|
+
* @since 0.6.0
|
|
51
51
|
*/
|
|
52
52
|
invert?: boolean;
|
|
53
53
|
/**
|
|
@@ -56,7 +56,7 @@ export type ScanOptions = {
|
|
|
56
56
|
*
|
|
57
57
|
* @default `Infinity`
|
|
58
58
|
*
|
|
59
|
-
* @since 0.0
|
|
59
|
+
* @since 0.6.0
|
|
60
60
|
*/
|
|
61
61
|
depth?: number;
|
|
62
62
|
/**
|
|
@@ -64,7 +64,7 @@ export type ScanOptions = {
|
|
|
64
64
|
*
|
|
65
65
|
* @default `undefined`
|
|
66
66
|
*
|
|
67
|
-
* @since 0.0
|
|
67
|
+
* @since 0.6.0
|
|
68
68
|
*/
|
|
69
69
|
signal?: AbortSignal | null;
|
|
70
70
|
/**
|
|
@@ -83,7 +83,7 @@ export type ScanOptions = {
|
|
|
83
83
|
*
|
|
84
84
|
* @default `false`
|
|
85
85
|
*
|
|
86
|
-
* @since 0.0
|
|
86
|
+
* @since 0.6.0
|
|
87
87
|
*/
|
|
88
88
|
fastDepth?: boolean;
|
|
89
89
|
/**
|
|
@@ -102,7 +102,7 @@ export type ScanOptions = {
|
|
|
102
102
|
*
|
|
103
103
|
* @default `false`
|
|
104
104
|
*
|
|
105
|
-
* @since 0.0
|
|
105
|
+
* @since 0.6.0
|
|
106
106
|
*/
|
|
107
107
|
fastInternal?: boolean;
|
|
108
108
|
/**
|
|
@@ -110,7 +110,7 @@ export type ScanOptions = {
|
|
|
110
110
|
*
|
|
111
111
|
* @default `await import("node:fs")`
|
|
112
112
|
*
|
|
113
|
-
* @since 0.0
|
|
113
|
+
* @since 0.6.0
|
|
114
114
|
*/
|
|
115
115
|
fs?: FsAdapter;
|
|
116
116
|
};
|
package/out/walk.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { MatcherContext } from "./patterns/matcherContext.js";
|
|
|
3
3
|
import type { MatcherStream } from "./patterns/matcherStream.js";
|
|
4
4
|
import type { ScanOptions } from "./types.js";
|
|
5
5
|
export type WalkOptions = {
|
|
6
|
+
path: string;
|
|
6
7
|
entry: Dirent;
|
|
7
8
|
ctx: MatcherContext;
|
|
8
9
|
stream: MatcherStream | undefined;
|
package/out/walk.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { relative } from "node:path/posix";
|
|
2
1
|
import { getDepth } from "./getDepth.js";
|
|
3
|
-
import { normalizeCwd } from "./normalizeCwd.js";
|
|
4
2
|
export async function walkIncludes(options) {
|
|
5
|
-
const { entry, ctx, stream, scanOptions } = options;
|
|
3
|
+
const { entry, ctx, stream, scanOptions, path } = options;
|
|
6
4
|
const { fs, target, cwd, depth: maxDepth, invert, signal, fastDepth, fastInternal } = scanOptions;
|
|
7
5
|
signal?.throwIfAborted();
|
|
8
|
-
const path = relative(cwd, normalizeCwd(entry.parentPath) + "/" + entry.name);
|
|
9
6
|
const isDir = entry.isDirectory();
|
|
10
7
|
let direntPath;
|
|
11
8
|
if (isDir) {
|
|
@@ -91,7 +88,7 @@ export async function walkIncludes(options) {
|
|
|
91
88
|
if (lastSlash >= 0) {
|
|
92
89
|
const dir = path.substring(0, lastSlash) + "/";
|
|
93
90
|
const dirMatch = ctx.paths.get(dir);
|
|
94
|
-
if (
|
|
91
|
+
if (dirMatch?.ignored) {
|
|
95
92
|
ctx.paths.set(dir, match);
|
|
96
93
|
if (stream) {
|
|
97
94
|
stream.emit("dirent", { dirent: entry, match, path: direntPath, ctx });
|