view-ignored 0.9.1 → 0.10.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 +18 -19
- package/out/browser_scan.js +5 -5
- package/out/opendir.d.ts +3 -3
- package/out/opendir.js +24 -14
- 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 +9 -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 +18 -14
- 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/patternCompile.js +62 -0
- package/out/patterns/patternList.d.ts +52 -0
- package/out/patterns/patternList.js +20 -0
- package/out/patterns/resolveSources.d.ts +5 -5
- package/out/patterns/resolveSources.js +20 -27
- package/out/patterns/rule.d.ts +121 -0
- package/out/patterns/{signedPattern.js → rule.js} +18 -17
- 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.d.ts +1 -0
- package/out/walk.js +11 -3
- package/package.json +5 -4
- package/out/patterns/pattern.d.ts +0 -50
- 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/patterns/stringCompile.js +0 -31
package/out/targets/target.d.ts
CHANGED
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
import type { Extractor } from "../patterns/extractor.js";
|
|
2
2
|
import type { Ignores } from "../patterns/ignores.js";
|
|
3
3
|
import type { Init } from "../patterns/init.js";
|
|
4
|
+
import type { Rule } from "../patterns/rule.js";
|
|
4
5
|
/**
|
|
5
6
|
* Contains the matcher used for scanning.
|
|
6
7
|
*
|
|
7
8
|
* @since 0.6.0
|
|
8
9
|
*/
|
|
9
10
|
export interface Target {
|
|
11
|
+
/**
|
|
12
|
+
* Should be compiled.
|
|
13
|
+
*
|
|
14
|
+
* @since 0.10.0
|
|
15
|
+
*/
|
|
16
|
+
internalRules: Rule[];
|
|
17
|
+
/**
|
|
18
|
+
* Initial search directory.
|
|
19
|
+
* Relative to the `cwd` path or absolute path.
|
|
20
|
+
*
|
|
21
|
+
* @since 0.10.0
|
|
22
|
+
*/
|
|
23
|
+
root: string;
|
|
10
24
|
/**
|
|
11
25
|
* The set of extractors.
|
|
12
26
|
* Required for context-patching APIs (ctx add/remove path).
|
package/out/targets/vsce.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type } from "arktype";
|
|
2
|
-
import {
|
|
2
|
+
import { ruleTest, ruleCompile, extractPackageJson, extractGitignore, } from "../patterns/index.js";
|
|
3
3
|
import { unixify } from "../unixify.js";
|
|
4
4
|
import { npmManifest } from "./npmManifest.js";
|
|
5
5
|
const extractors = [
|
|
@@ -17,7 +17,7 @@ const extractors = [
|
|
|
17
17
|
},
|
|
18
18
|
];
|
|
19
19
|
const internal = [
|
|
20
|
-
|
|
20
|
+
ruleCompile({
|
|
21
21
|
excludes: true,
|
|
22
22
|
pattern: [
|
|
23
23
|
// https://github.com/microsoft/vscode-vsce/blob/main/src/package.ts#L1633
|
|
@@ -69,6 +69,9 @@ const vsceManifestParse = type("string")
|
|
|
69
69
|
* @since 0.6.0
|
|
70
70
|
*/
|
|
71
71
|
export const VSCE = {
|
|
72
|
+
internalRules: internal,
|
|
73
|
+
extractors,
|
|
74
|
+
root: ".",
|
|
72
75
|
async init({ fs, cwd }) {
|
|
73
76
|
let content;
|
|
74
77
|
const normalCwd = unixify(cwd);
|
|
@@ -83,13 +86,5 @@ export const VSCE = {
|
|
|
83
86
|
throw new Error("Invalid 'package.json': " + dist.summary, { cause: dist });
|
|
84
87
|
}
|
|
85
88
|
},
|
|
86
|
-
|
|
87
|
-
ignores(o) {
|
|
88
|
-
return signedPatternIgnores({
|
|
89
|
-
...o,
|
|
90
|
-
internal,
|
|
91
|
-
root: ".",
|
|
92
|
-
target: VSCE,
|
|
93
|
-
});
|
|
94
|
-
},
|
|
89
|
+
ignores: ruleTest,
|
|
95
90
|
};
|
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.d.ts
CHANGED
package/out/walk.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getDepth } from "./getDepth.js";
|
|
2
2
|
export async function walkIncludes(options) {
|
|
3
|
-
const { entry, ctx, stream, scanOptions, path } = options;
|
|
3
|
+
const { entry, ctx, stream, scanOptions, path, parentPath } = options;
|
|
4
4
|
const { fs, target, cwd, depth: maxDepth, invert, signal, fastDepth, fastInternal } = scanOptions;
|
|
5
5
|
signal?.throwIfAborted();
|
|
6
6
|
const isDir = entry.isDirectory();
|
|
@@ -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, parentPath });
|
|
21
21
|
if (invert) {
|
|
22
22
|
match.ignored = !match.ignored;
|
|
23
23
|
}
|
|
@@ -45,7 +45,15 @@ export async function walkIncludes(options) {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
const failedPrev = ctx.failed.length;
|
|
48
|
-
let match = await target.ignores({
|
|
48
|
+
let match = await target.ignores({
|
|
49
|
+
fs,
|
|
50
|
+
cwd,
|
|
51
|
+
entry: path,
|
|
52
|
+
ctx,
|
|
53
|
+
signal,
|
|
54
|
+
target,
|
|
55
|
+
parentPath: parentPath,
|
|
56
|
+
});
|
|
49
57
|
if (invert) {
|
|
50
58
|
match.ignored = !match.ignored;
|
|
51
59
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "view-ignored",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1",
|
|
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",
|
|
@@ -97,13 +97,14 @@
|
|
|
97
97
|
},
|
|
98
98
|
"dependencies": {
|
|
99
99
|
"arktype": "^2.1.29",
|
|
100
|
-
"
|
|
100
|
+
"micromatch": "^4.0.8",
|
|
101
101
|
"strip-json-comments": "^5.0.3"
|
|
102
102
|
},
|
|
103
103
|
"devDependencies": {
|
|
104
104
|
"@release-it/keep-a-changelog": "^7.0.1",
|
|
105
105
|
"@types/bun": "^1.3.9",
|
|
106
106
|
"@types/ignore-walk": "^4.0.3",
|
|
107
|
+
"@types/micromatch": "^4.0.10",
|
|
107
108
|
"@types/node": "^18.19.130",
|
|
108
109
|
"@typescript/native-preview": "^7.0.0-dev.20260223.1",
|
|
109
110
|
"ignore-walk": "^8.0.0",
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { type StringCompileOptions } from "./stringCompile.js";
|
|
2
|
-
/**
|
|
3
|
-
* Compiled pattern.
|
|
4
|
-
*
|
|
5
|
-
* @see {@link stringCompile}
|
|
6
|
-
* @see {@link signedPatternCompile}
|
|
7
|
-
*
|
|
8
|
-
* @since 0.6.0
|
|
9
|
-
*/
|
|
10
|
-
export type PatternMinimatch = {
|
|
11
|
-
/**
|
|
12
|
-
* The regular expression instance.
|
|
13
|
-
*
|
|
14
|
-
* @since 0.6.0
|
|
15
|
-
*/
|
|
16
|
-
re: RegExp;
|
|
17
|
-
/**
|
|
18
|
-
* The original pattern string this minimatch was compiled from.
|
|
19
|
-
*
|
|
20
|
-
* @since 0.6.0
|
|
21
|
-
*/
|
|
22
|
-
pattern: string;
|
|
23
|
-
/**
|
|
24
|
-
* The original pattern list this pattern was compiled from.
|
|
25
|
-
*
|
|
26
|
-
* @since 0.6.0
|
|
27
|
-
*/
|
|
28
|
-
patternContext: Pattern;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Safely calls RegExp.test.
|
|
32
|
-
*
|
|
33
|
-
* @since 0.6.0
|
|
34
|
-
*/
|
|
35
|
-
export declare function patternMinimatchTest(pattern: PatternMinimatch, path: string): boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Represents a list of positive minimatch patterns.
|
|
38
|
-
*
|
|
39
|
-
* @since 0.6.0
|
|
40
|
-
*/
|
|
41
|
-
export type Pattern = string[];
|
|
42
|
-
/**
|
|
43
|
-
* Compiles the {@link Pattern}.
|
|
44
|
-
*
|
|
45
|
-
* @see {@link stringCompile}
|
|
46
|
-
* @see {@link signedPatternCompile}
|
|
47
|
-
*
|
|
48
|
-
* @since 0.6.0
|
|
49
|
-
*/
|
|
50
|
-
export declare function patternCompile(pattern: Pattern, options?: StringCompileOptions): PatternMinimatch[];
|
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;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { makeRe } from "minimatch";
|
|
2
|
-
/**
|
|
3
|
-
* Compiles a string of the {@link Pattern}.
|
|
4
|
-
*
|
|
5
|
-
* @see {@link patternCompile}
|
|
6
|
-
*
|
|
7
|
-
* @since 0.8.0
|
|
8
|
-
*/
|
|
9
|
-
export function stringCompile(pattern, context = [], options) {
|
|
10
|
-
const original = pattern;
|
|
11
|
-
if (pattern.endsWith("/")) {
|
|
12
|
-
pattern = pattern.substring(0, pattern.length - 1);
|
|
13
|
-
}
|
|
14
|
-
if (pattern.startsWith("/")) {
|
|
15
|
-
pattern = pattern.substring(1);
|
|
16
|
-
}
|
|
17
|
-
else if (!pattern.startsWith("**/")) {
|
|
18
|
-
pattern = "**/" + pattern;
|
|
19
|
-
}
|
|
20
|
-
if (!pattern.endsWith("/**")) {
|
|
21
|
-
pattern += "/**";
|
|
22
|
-
}
|
|
23
|
-
const re = makeRe(pattern, {
|
|
24
|
-
dot: true,
|
|
25
|
-
nonegate: true,
|
|
26
|
-
nocomment: true,
|
|
27
|
-
nobrace: true,
|
|
28
|
-
nocase: options?.nocase ?? false,
|
|
29
|
-
});
|
|
30
|
-
return { re, pattern: original, patternContext: context };
|
|
31
|
-
}
|