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
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { dirname } from "node:path";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { join, base } from "../unixify.js";
|
|
3
|
+
import { patternListCompile } from "./patternList.js";
|
|
4
4
|
/**
|
|
5
|
-
* Compiles the {@link
|
|
5
|
+
* Compiles the {@link Rule} (forced).
|
|
6
6
|
* Can be compiled at any time.
|
|
7
7
|
* Extractors are compiling it.
|
|
8
8
|
*
|
|
9
|
-
* @see {@link
|
|
9
|
+
* @see {@link patternListCompile}
|
|
10
10
|
*
|
|
11
11
|
* @since 0.6.0
|
|
12
12
|
*/
|
|
13
|
-
export function
|
|
14
|
-
signedPattern.compiled =
|
|
13
|
+
export function ruleCompile(signedPattern, options) {
|
|
14
|
+
signedPattern.compiled = patternListCompile(signedPattern.pattern, options);
|
|
15
15
|
return signedPattern;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
@@ -20,7 +20,7 @@ export function signedPatternCompile(signedPattern, options) {
|
|
|
20
20
|
* @since 0.6.0
|
|
21
21
|
*/
|
|
22
22
|
export async function resolveSources(options) {
|
|
23
|
-
const { fs, ctx, cwd,
|
|
23
|
+
const { fs, ctx, cwd, signal, target } = options;
|
|
24
24
|
let dir = options.dir;
|
|
25
25
|
if (ctx.external.has(dir)) {
|
|
26
26
|
return;
|
|
@@ -42,7 +42,7 @@ export async function resolveSources(options) {
|
|
|
42
42
|
}
|
|
43
43
|
noSourceDirList.push(dir);
|
|
44
44
|
const parent = dirname(dir);
|
|
45
|
-
if (dir ===
|
|
45
|
+
if (dir === parent)
|
|
46
46
|
break;
|
|
47
47
|
dir = parent;
|
|
48
48
|
continue;
|
|
@@ -50,25 +50,25 @@ export async function resolveSources(options) {
|
|
|
50
50
|
}
|
|
51
51
|
// else
|
|
52
52
|
// find non-cwd source [root > cwd) and populate [cwd > ... > dir]
|
|
53
|
-
// root, root/cwd[0], root/cwd[0]/cwd[2]
|
|
54
53
|
const preCwdSegments = [];
|
|
55
|
-
{
|
|
54
|
+
if (target.root.startsWith("/")) {
|
|
56
55
|
let c = dirname(cwd);
|
|
57
56
|
while (true) {
|
|
58
57
|
signal?.throwIfAborted();
|
|
59
58
|
preCwdSegments.push(c);
|
|
60
|
-
if (c ===
|
|
59
|
+
if (c === target.root)
|
|
61
60
|
break;
|
|
62
61
|
const parent = dirname(c);
|
|
63
62
|
c = parent;
|
|
64
63
|
}
|
|
65
64
|
preCwdSegments.reverse();
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
65
|
+
source = await findSourceForAbsoluteDirs(preCwdSegments, ctx, fs, target, signal);
|
|
66
|
+
if (typeof source === "object") {
|
|
67
|
+
for (const noSourceDir of noSourceDirList) {
|
|
68
|
+
signal?.throwIfAborted();
|
|
69
|
+
ctx.external.set(noSourceDir, source);
|
|
70
|
+
}
|
|
71
|
+
return;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
const absPaths = noSourceDirList.map((rel) => join(cwd, rel));
|
|
@@ -97,18 +97,11 @@ async function findSourceForAbsoluteDirs(paths, ctx, fs, target, signal) {
|
|
|
97
97
|
return "none";
|
|
98
98
|
}
|
|
99
99
|
async function tryExtractor(cwd, fs, ctx, extractor) {
|
|
100
|
-
let abs =
|
|
101
|
-
|
|
102
|
-
abs += extractor.path;
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
abs += "/" + extractor.path;
|
|
106
|
-
}
|
|
107
|
-
const path = relative(cwd, abs);
|
|
108
|
-
const name = path.substring(path.lastIndexOf("/") + 1);
|
|
100
|
+
let abs = join(cwd, extractor.path);
|
|
101
|
+
const name = base(extractor.path);
|
|
109
102
|
const newSource = {
|
|
110
103
|
name,
|
|
111
|
-
path,
|
|
104
|
+
path: extractor.path,
|
|
112
105
|
inverted: false,
|
|
113
106
|
pattern: [],
|
|
114
107
|
};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type { PatternFinderOptions } from "./extractor.js";
|
|
2
|
+
import type { Source } from "./source.js";
|
|
3
|
+
import { type PatternList, type PatternCache } from "./patternList.js";
|
|
4
|
+
/**
|
|
5
|
+
* Represents a set of include and exclude patterns.
|
|
6
|
+
* These patterns are positive minimatch patterns.
|
|
7
|
+
*
|
|
8
|
+
* @see {@link ruleTest} provides the ignoring algorithm.
|
|
9
|
+
* @see {@link ruleCompile} compiles the signed pattern.
|
|
10
|
+
* Use this or an extractor's method to compile.
|
|
11
|
+
*
|
|
12
|
+
* @since 0.6.0
|
|
13
|
+
*/
|
|
14
|
+
export type Rule = {
|
|
15
|
+
/**
|
|
16
|
+
* Provides ignored or included file and directory patterns.
|
|
17
|
+
*
|
|
18
|
+
* @see {@link ruleTest} provides the ignoring algorithm.
|
|
19
|
+
*
|
|
20
|
+
* @since 0.9.0
|
|
21
|
+
*/
|
|
22
|
+
pattern: PatternList;
|
|
23
|
+
/**
|
|
24
|
+
* If `true`, pattern "test" will exclude file named "test".
|
|
25
|
+
*
|
|
26
|
+
* @see {@link ruleTest} 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 ruleTest} provides the ignoring algorithm.
|
|
35
|
+
*
|
|
36
|
+
* @since 0.6.0
|
|
37
|
+
*/
|
|
38
|
+
compiled: null | PatternCache[];
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* The kind of a pattern match.
|
|
42
|
+
*
|
|
43
|
+
* @since 0.9.1
|
|
44
|
+
*/
|
|
45
|
+
export type MatchKind = RuleMatch["kind"];
|
|
46
|
+
/**
|
|
47
|
+
* @see {@link RuleMatch}
|
|
48
|
+
*
|
|
49
|
+
* @since 0.9.1
|
|
50
|
+
*/
|
|
51
|
+
export interface RuleMatchBase<K extends string> {
|
|
52
|
+
kind: K;
|
|
53
|
+
ignored: boolean;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* @see {@link RuleMatch}
|
|
57
|
+
*
|
|
58
|
+
* @since 0.9.1
|
|
59
|
+
*/
|
|
60
|
+
export interface RuleMatchBaseSource<K extends string> extends RuleMatchBase<K> {
|
|
61
|
+
source: Source;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* @see {@link RuleMatch}
|
|
65
|
+
*
|
|
66
|
+
* @since 0.9.1
|
|
67
|
+
*/
|
|
68
|
+
export interface RuleMatchBasePattern<K extends string> extends RuleMatchBase<K> {
|
|
69
|
+
pattern: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* @see {@link RuleMatch}
|
|
73
|
+
*
|
|
74
|
+
* @since 0.9.1
|
|
75
|
+
*/
|
|
76
|
+
export interface RuleMatchBaseErrorPattern<K extends string> extends RuleMatchBasePattern<K> {
|
|
77
|
+
error: Error;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* @see {@link RuleMatch}
|
|
81
|
+
*
|
|
82
|
+
* @since 0.9.1
|
|
83
|
+
*/
|
|
84
|
+
export interface RuleMatchBaseSourcePattern<K extends string> extends RuleMatchBasePattern<K>, RuleMatchBaseSource<K> {
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* @see {@link ruleTest}
|
|
88
|
+
*
|
|
89
|
+
* @since 0.6.0
|
|
90
|
+
*/
|
|
91
|
+
export type RuleMatch = RuleMatchBase<"none" | "missing-source"> | RuleMatchBaseSource<"no-match" | "broken-source" | "invalid-pattern"> | RuleMatchBaseErrorPattern<"invalid-internal-pattern"> | RuleMatchBasePattern<"internal"> | RuleMatchBaseSourcePattern<"external">;
|
|
92
|
+
/**
|
|
93
|
+
* @see {@link ruleTest}
|
|
94
|
+
*
|
|
95
|
+
* @since 0.6.0
|
|
96
|
+
*/
|
|
97
|
+
export interface RuleTestOptions 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
|
+
/**
|
|
110
|
+
* Checks whether a given entry should be ignored based on internal and external patterns.
|
|
111
|
+
* Populates unknown sources using {@link resolveSources}.
|
|
112
|
+
*
|
|
113
|
+
* @since 0.6.0
|
|
114
|
+
*/
|
|
115
|
+
export declare function ruleTest(options: RuleTestOptions): Promise<RuleMatch>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { dirname } from "node:path/posix";
|
|
2
|
-
import {
|
|
2
|
+
import { patternCacheTest } from "./patternList.js";
|
|
3
3
|
import { resolveSources } from "./resolveSources.js";
|
|
4
|
-
function
|
|
4
|
+
function cacheTest(rs, path) {
|
|
5
5
|
for (const r of rs) {
|
|
6
6
|
try {
|
|
7
|
-
if (
|
|
7
|
+
if (patternCacheTest(r, path)) {
|
|
8
8
|
return [r.pattern, undefined];
|
|
9
9
|
}
|
|
10
10
|
}
|
|
@@ -14,12 +14,12 @@ function patternRegExpTest(path, rs) {
|
|
|
14
14
|
}
|
|
15
15
|
return ["", undefined];
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
for (const si of options.
|
|
17
|
+
function testInternal(options, path) {
|
|
18
|
+
for (const si of options.target.internalRules) {
|
|
19
19
|
const compiled = si.compiled;
|
|
20
20
|
if (compiled === null)
|
|
21
21
|
continue;
|
|
22
|
-
let [patternMatch, error] =
|
|
22
|
+
let [patternMatch, error] = cacheTest(compiled, path);
|
|
23
23
|
if (error)
|
|
24
24
|
return {
|
|
25
25
|
kind: "invalid-internal-pattern",
|
|
@@ -36,13 +36,13 @@ function signedPatternCompiledMatchInternal(options, path) {
|
|
|
36
36
|
}
|
|
37
37
|
return null;
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function testExternal(options, path, source) {
|
|
40
40
|
for (const si of source.pattern) {
|
|
41
41
|
const compiled = si.compiled;
|
|
42
42
|
if (compiled === null) {
|
|
43
43
|
continue;
|
|
44
44
|
}
|
|
45
|
-
let [patternMatch, err] =
|
|
45
|
+
let [patternMatch, err] = cacheTest(compiled, path);
|
|
46
46
|
if (err) {
|
|
47
47
|
source.error = err;
|
|
48
48
|
options.ctx?.failed.push(source);
|
|
@@ -72,23 +72,26 @@ function signedPatternCompiledMatchExternal(options, path, source) {
|
|
|
72
72
|
*
|
|
73
73
|
* @since 0.6.0
|
|
74
74
|
*/
|
|
75
|
-
export async function
|
|
75
|
+
export async function ruleTest(options) {
|
|
76
76
|
const parent = dirname(options.entry);
|
|
77
77
|
let source = options.ctx?.external.get(parent);
|
|
78
78
|
if (source === undefined) {
|
|
79
|
-
await resolveSources({ ...options, dir: parent
|
|
79
|
+
await resolveSources({ ...options, dir: parent });
|
|
80
80
|
source = options.ctx.external.get(parent);
|
|
81
81
|
}
|
|
82
|
-
if (source === undefined
|
|
82
|
+
if (source === undefined) {
|
|
83
|
+
throw new Error("view-ignored has crashed: no source cached.");
|
|
84
|
+
}
|
|
85
|
+
if (source === "none") {
|
|
83
86
|
return { kind: "missing-source", ignored: false };
|
|
84
87
|
}
|
|
85
88
|
if (typeof source === "object" && source.error) {
|
|
86
89
|
return { kind: "broken-source", ignored: true, source };
|
|
87
90
|
}
|
|
88
|
-
let internalMatch =
|
|
91
|
+
let internalMatch = testInternal(options, options.entry);
|
|
89
92
|
if (internalMatch !== null) {
|
|
90
93
|
return internalMatch;
|
|
91
94
|
}
|
|
92
|
-
const externalMatch =
|
|
95
|
+
const externalMatch = testExternal(options, options.entry, source);
|
|
93
96
|
return externalMatch;
|
|
94
97
|
}
|
package/out/patterns/source.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Rule } from "./rule.js";
|
|
2
2
|
/**
|
|
3
3
|
* Represents a source of external patterns.
|
|
4
4
|
*
|
|
@@ -9,11 +9,11 @@ export type Source = {
|
|
|
9
9
|
* Patterns defined within the source file.
|
|
10
10
|
* Those patterns are for ignoring files.
|
|
11
11
|
*
|
|
12
|
-
* @see {@link
|
|
12
|
+
* @see {@link ruleTest}
|
|
13
13
|
*
|
|
14
14
|
* @since 0.6.0
|
|
15
15
|
*/
|
|
16
|
-
pattern:
|
|
16
|
+
pattern: Rule[];
|
|
17
17
|
/**
|
|
18
18
|
* Name of the source file.
|
|
19
19
|
*
|
|
@@ -31,7 +31,7 @@ export type Source = {
|
|
|
31
31
|
* For example, `package.json` `files` field inverts the matching logic,
|
|
32
32
|
* because it specifies files to include rather than exclude.
|
|
33
33
|
*
|
|
34
|
-
* @see {@link
|
|
34
|
+
* @see {@link ruleTest}
|
|
35
35
|
*
|
|
36
36
|
* @since 0.6.0
|
|
37
37
|
*/
|
|
@@ -46,10 +46,13 @@ export type Source = {
|
|
|
46
46
|
error?: Error;
|
|
47
47
|
};
|
|
48
48
|
/**
|
|
49
|
-
* Adds a negatable pattern to the source's
|
|
49
|
+
* Adds a negatable pattern to the source's rules.
|
|
50
50
|
* Strips the leading '!' for include patterns,
|
|
51
51
|
* and adds to exclude patterns otherwise.
|
|
52
52
|
*
|
|
53
|
+
* Expecting the rules
|
|
54
|
+
* to be added into the source and then compiled.
|
|
55
|
+
*
|
|
53
56
|
* @since 0.6.0
|
|
54
57
|
*/
|
|
55
|
-
export declare function
|
|
58
|
+
export declare function resolveNegatable(pattern: string, invert: boolean, include: Rule, exclude: Rule): void;
|
package/out/patterns/source.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Adds a negatable pattern to the source's
|
|
2
|
+
* Adds a negatable pattern to the source's rules.
|
|
3
3
|
* Strips the leading '!' for include patterns,
|
|
4
4
|
* and adds to exclude patterns otherwise.
|
|
5
5
|
*
|
|
6
|
+
* Expecting the rules
|
|
7
|
+
* to be added into the source and then compiled.
|
|
8
|
+
*
|
|
6
9
|
* @since 0.6.0
|
|
7
10
|
*/
|
|
8
|
-
export function
|
|
11
|
+
export function resolveNegatable(pattern, invert, include, exclude) {
|
|
9
12
|
if (invert) {
|
|
10
13
|
;
|
|
11
14
|
[exclude, include] = [include, exclude];
|
package/out/targets/bun.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 { 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/oven-sh/bun/blob/main/src/cli/pack_command.zig#L180
|
|
@@ -60,7 +60,7 @@ const internal = [
|
|
|
60
60
|
],
|
|
61
61
|
compiled: null,
|
|
62
62
|
}), // nocase should be false here
|
|
63
|
-
|
|
63
|
+
ruleCompile({
|
|
64
64
|
excludes: true,
|
|
65
65
|
pattern: [
|
|
66
66
|
// https://github.com/oven-sh/bun/blob/main/src/cli/pack_command.zig#L2586
|
|
@@ -80,6 +80,9 @@ const internal = [
|
|
|
80
80
|
* @since 0.8.1
|
|
81
81
|
*/
|
|
82
82
|
export const Bun = {
|
|
83
|
+
internalRules: internal,
|
|
84
|
+
extractors,
|
|
85
|
+
root: ".",
|
|
83
86
|
async init({ fs, cwd }) {
|
|
84
87
|
let content;
|
|
85
88
|
const normalCwd = unixify(cwd);
|
|
@@ -109,15 +112,7 @@ export const Bun = {
|
|
|
109
112
|
// nothing else
|
|
110
113
|
// link zig code
|
|
111
114
|
internalInclude.pattern = Array.from(set);
|
|
112
|
-
|
|
113
|
-
},
|
|
114
|
-
extractors,
|
|
115
|
-
ignores(o) {
|
|
116
|
-
return signedPatternIgnores({
|
|
117
|
-
...o,
|
|
118
|
-
internal,
|
|
119
|
-
root: ".",
|
|
120
|
-
target: Bun,
|
|
121
|
-
});
|
|
115
|
+
ruleCompile(internalInclude, { nocase: true });
|
|
122
116
|
},
|
|
117
|
+
ignores: ruleTest,
|
|
123
118
|
};
|
package/out/targets/deno.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type } from "arktype";
|
|
2
|
-
import {
|
|
2
|
+
import { ruleTest, ruleCompile, extractJsrJson, extractJsrJsonc, extractPackageJson, } from "../patterns/index.js";
|
|
3
3
|
import { unixify } from "../unixify.js";
|
|
4
4
|
import { jsrManifestParse } from "./jsrManifest.js";
|
|
5
5
|
const extractors = [
|
|
@@ -25,7 +25,7 @@ const extractors = [
|
|
|
25
25
|
},
|
|
26
26
|
];
|
|
27
27
|
const internal = [
|
|
28
|
-
|
|
28
|
+
ruleCompile({
|
|
29
29
|
excludes: true,
|
|
30
30
|
pattern: [".git", ".DS_Store"],
|
|
31
31
|
compiled: null,
|
|
@@ -35,6 +35,9 @@ const internal = [
|
|
|
35
35
|
* @since 0.8.1
|
|
36
36
|
*/
|
|
37
37
|
export const Deno = {
|
|
38
|
+
internalRules: internal,
|
|
39
|
+
extractors,
|
|
40
|
+
root: ".",
|
|
38
41
|
async init({ fs, cwd }) {
|
|
39
42
|
let content;
|
|
40
43
|
const normalCwd = unixify(cwd);
|
|
@@ -58,13 +61,5 @@ export const Deno = {
|
|
|
58
61
|
throw new Error("Invalid '" + path + "': " + dist.summary, { cause: dist });
|
|
59
62
|
}
|
|
60
63
|
},
|
|
61
|
-
|
|
62
|
-
ignores(o) {
|
|
63
|
-
return signedPatternIgnores({
|
|
64
|
-
...o,
|
|
65
|
-
internal,
|
|
66
|
-
root: ".",
|
|
67
|
-
target: Deno,
|
|
68
|
-
});
|
|
69
|
-
},
|
|
64
|
+
ignores: ruleTest,
|
|
70
65
|
};
|
package/out/targets/git.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { extractGitignore,
|
|
1
|
+
import { extractGitignore, ruleTest, ruleCompile, } from "../patterns/index.js";
|
|
2
2
|
const extractors = [
|
|
3
3
|
{
|
|
4
4
|
extract: extractGitignore,
|
|
@@ -10,7 +10,7 @@ const extractors = [
|
|
|
10
10
|
},
|
|
11
11
|
];
|
|
12
12
|
const internal = [
|
|
13
|
-
|
|
13
|
+
ruleCompile({
|
|
14
14
|
excludes: true,
|
|
15
15
|
pattern: [".git", ".DS_Store"],
|
|
16
16
|
compiled: null,
|
|
@@ -20,14 +20,9 @@ const internal = [
|
|
|
20
20
|
* @since 0.6.0
|
|
21
21
|
*/
|
|
22
22
|
export const Git = {
|
|
23
|
-
|
|
23
|
+
internalRules: internal,
|
|
24
24
|
extractors,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
internal,
|
|
29
|
-
root: "/",
|
|
30
|
-
target: Git,
|
|
31
|
-
});
|
|
32
|
-
},
|
|
25
|
+
root: "/",
|
|
26
|
+
// TODO: Git should read configs
|
|
27
|
+
ignores: ruleTest,
|
|
33
28
|
};
|
package/out/targets/jsr.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type } from "arktype";
|
|
2
|
-
import {
|
|
2
|
+
import { ruleTest, ruleCompile, extractJsrJson, extractJsrJsonc, } from "../patterns/index.js";
|
|
3
3
|
import { unixify } from "../unixify.js";
|
|
4
4
|
import { jsrManifestParse } from "./jsrManifest.js";
|
|
5
5
|
const extractors = [
|
|
@@ -13,7 +13,7 @@ const extractors = [
|
|
|
13
13
|
},
|
|
14
14
|
];
|
|
15
15
|
const internal = [
|
|
16
|
-
|
|
16
|
+
ruleCompile({
|
|
17
17
|
excludes: true,
|
|
18
18
|
pattern: [".git", ".DS_Store"],
|
|
19
19
|
compiled: null,
|
|
@@ -23,6 +23,9 @@ const internal = [
|
|
|
23
23
|
* @since 0.6.0
|
|
24
24
|
*/
|
|
25
25
|
export const JSR = {
|
|
26
|
+
internalRules: internal,
|
|
27
|
+
extractors,
|
|
28
|
+
root: ".",
|
|
26
29
|
async init({ fs, cwd }) {
|
|
27
30
|
let content;
|
|
28
31
|
const normalCwd = unixify(cwd);
|
|
@@ -46,13 +49,5 @@ export const JSR = {
|
|
|
46
49
|
throw new Error("Invalid '" + path + "': " + dist.summary, { cause: dist });
|
|
47
50
|
}
|
|
48
51
|
},
|
|
49
|
-
|
|
50
|
-
ignores(o) {
|
|
51
|
-
return signedPatternIgnores({
|
|
52
|
-
...o,
|
|
53
|
-
internal,
|
|
54
|
-
root: ".",
|
|
55
|
-
target: JSR,
|
|
56
|
-
});
|
|
57
|
-
},
|
|
52
|
+
ignores: ruleTest,
|
|
58
53
|
};
|
package/out/targets/npm.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 { 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/npm/npm-packlist/blob/main/lib/index.js#L16
|
|
@@ -56,7 +56,7 @@ const internal = [
|
|
|
56
56
|
],
|
|
57
57
|
compiled: null,
|
|
58
58
|
}),
|
|
59
|
-
|
|
59
|
+
ruleCompile({
|
|
60
60
|
excludes: false,
|
|
61
61
|
pattern: [
|
|
62
62
|
// https://github.com/npm/npm-packlist/blob/main/lib/index.js#L287
|
|
@@ -78,6 +78,9 @@ const internal = [
|
|
|
78
78
|
* @since 0.6.0
|
|
79
79
|
*/
|
|
80
80
|
export const NPM = {
|
|
81
|
+
internalRules: internal,
|
|
82
|
+
extractors,
|
|
83
|
+
root: ".",
|
|
81
84
|
async init({ fs, cwd }) {
|
|
82
85
|
let content;
|
|
83
86
|
const normalCwd = unixify(cwd);
|
|
@@ -94,15 +97,7 @@ export const NPM = {
|
|
|
94
97
|
// const set = new Set<string>()
|
|
95
98
|
// TODO: NPM should include bundled deps
|
|
96
99
|
// internalInclude.pattern = Array.from(set)
|
|
97
|
-
//
|
|
98
|
-
},
|
|
99
|
-
extractors,
|
|
100
|
-
ignores(o) {
|
|
101
|
-
return signedPatternIgnores({
|
|
102
|
-
...o,
|
|
103
|
-
internal,
|
|
104
|
-
root: ".",
|
|
105
|
-
target: NPM,
|
|
106
|
-
});
|
|
100
|
+
// ruleCompile(internalInclude, { nocase: true })
|
|
107
101
|
},
|
|
102
|
+
ignores: ruleTest,
|
|
108
103
|
};
|
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
|
};
|