view-ignored 0.10.1 → 0.11.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.
Files changed (70) hide show
  1. package/README.md +116 -66
  2. package/out/browser.d.ts +1 -0
  3. package/out/browser.js +1 -0
  4. package/out/browser_scan.d.ts +1 -3
  5. package/out/browser_scan.js +11 -46
  6. package/out/browser_stream.d.ts +6 -1
  7. package/out/browser_stream.js +6 -1
  8. package/out/index.d.ts +1 -0
  9. package/out/index.js +1 -0
  10. package/out/patterns/extractor.d.ts +7 -7
  11. package/out/patterns/gitignore.d.ts +2 -2
  12. package/out/patterns/gitignore.js +14 -6
  13. package/out/patterns/ignores.d.ts +17 -8
  14. package/out/patterns/index.d.ts +1 -0
  15. package/out/patterns/index.js +1 -0
  16. package/out/patterns/init.d.ts +2 -2
  17. package/out/patterns/initState.d.ts +0 -7
  18. package/out/patterns/jsrjson.d.ts +2 -3
  19. package/out/patterns/jsrjson.js +25 -38
  20. package/out/patterns/matcherContext.d.ts +12 -9
  21. package/out/patterns/matcherContextPatch.js +153 -73
  22. package/out/patterns/matcherStream.d.ts +19 -59
  23. package/out/patterns/matcherStream.js +75 -25
  24. package/out/patterns/matcherStreamTypes.d.ts +65 -0
  25. package/out/patterns/matcherStreamTypes.js +1 -0
  26. package/out/patterns/packagejson.d.ts +2 -2
  27. package/out/patterns/packagejson.js +11 -14
  28. package/out/patterns/patternCompile.js +35 -37
  29. package/out/patterns/patternList.d.ts +6 -2
  30. package/out/patterns/patternList.js +8 -3
  31. package/out/patterns/resolveSources.d.ts +22 -5
  32. package/out/patterns/resolveSources.js +153 -97
  33. package/out/patterns/resource.d.ts +16 -0
  34. package/out/patterns/resource.js +1 -0
  35. package/out/patterns/rule.d.ts +59 -11
  36. package/out/patterns/rule.js +101 -64
  37. package/out/patterns/source.d.ts +9 -17
  38. package/out/scan.d.ts +11 -3
  39. package/out/scan.js +16 -4
  40. package/out/scanCb.d.ts +16 -0
  41. package/out/scanCb.js +73 -0
  42. package/out/scanParallel.d.ts +18 -0
  43. package/out/scanParallel.js +146 -0
  44. package/out/stream.d.ts +6 -1
  45. package/out/stream.js +7 -2
  46. package/out/targets/bun.js +43 -36
  47. package/out/targets/deno.js +25 -23
  48. package/out/targets/git.js +3 -3
  49. package/out/targets/jsr.js +25 -23
  50. package/out/targets/jsrManifest.d.ts +8 -7
  51. package/out/targets/jsrManifest.js +40 -9
  52. package/out/targets/npm.js +30 -23
  53. package/out/targets/npmManifest.d.ts +18 -46
  54. package/out/targets/npmManifest.js +96 -23
  55. package/out/targets/target.d.ts +8 -16
  56. package/out/targets/vsce.js +20 -27
  57. package/out/targets/vsceManifest.d.ts +7 -0
  58. package/out/targets/vsceManifest.js +18 -0
  59. package/out/targets/yarn.js +48 -39
  60. package/out/targets/yarnClassic.js +20 -18
  61. package/out/types.d.ts +8 -7
  62. package/out/unixify.d.ts +1 -1
  63. package/out/unixify.js +40 -21
  64. package/out/walk.d.ts +42 -4
  65. package/out/walk.js +146 -92
  66. package/package.json +42 -27
  67. package/out/getDepth.d.ts +0 -4
  68. package/out/getDepth.js +0 -21
  69. package/out/opendir.d.ts +0 -3
  70. package/out/opendir.js +0 -28
@@ -1,4 +1,3 @@
1
- import { type } from "arktype";
2
1
  import { ruleTest, ruleCompile, extractPackageJsonNocase, extractGitignoreNocase, } from "../patterns/index.js";
3
2
  import { unixify } from "../unixify.js";
4
3
  import { npmManifestParse } from "./npmManifest.js";
@@ -22,6 +21,7 @@ const extractors = [
22
21
  ];
23
22
  const internal = [
24
23
  ruleCompile({
24
+ compiled: null,
25
25
  excludes: true,
26
26
  pattern: [
27
27
  // https://github.com/yarnpkg/berry/blob/master/packages/plugin-pack/sources/packUtils.ts#L26
@@ -53,9 +53,9 @@ const internal = [
53
53
  ".gitignore",
54
54
  ".DS_Store",
55
55
  ],
56
- compiled: null,
57
56
  }, { nocase: true }),
58
57
  ruleCompile({
58
+ compiled: null,
59
59
  excludes: false,
60
60
  pattern: [
61
61
  // https://github.com/yarnpkg/berry/blob/master/packages/plugin-pack/sources/packUtils.ts#L10
@@ -67,29 +67,31 @@ const internal = [
67
67
  "/changelog*",
68
68
  "/history*",
69
69
  ],
70
- compiled: null,
71
70
  }, { nocase: true }),
72
71
  ];
73
72
  /**
74
73
  * @since 0.8.0
75
74
  */
76
75
  export const YarnClassic = {
77
- internalRules: internal,
78
76
  extractors,
79
- root: ".",
80
- async init({ fs, cwd }) {
81
- let content;
77
+ ignores: ruleTest,
78
+ init({ fs, cwd }, cb) {
82
79
  const normalCwd = unixify(cwd);
83
- try {
84
- content = await fs.promises.readFile(normalCwd + "/" + "package.json");
85
- }
86
- catch (error) {
87
- throw new Error("Error while initializing Yarn classic", { cause: error });
88
- }
89
- const dist = npmManifestParse(content.toString());
90
- if (dist instanceof type.errors) {
91
- throw new Error("Invalid 'package.json': " + dist.summary, { cause: dist });
92
- }
80
+ fs.readFile(normalCwd + "/package.json", (err, content) => {
81
+ if (err) {
82
+ cb(new Error("Error while initializing Yarn classic", { cause: err }));
83
+ return;
84
+ }
85
+ try {
86
+ npmManifestParse(content.toString());
87
+ }
88
+ catch (error) {
89
+ cb(new Error("Invalid 'package.json'", { cause: error }));
90
+ return;
91
+ }
92
+ cb();
93
+ });
93
94
  },
94
- ignores: ruleTest,
95
+ internalRules: internal,
96
+ root: ".",
95
97
  };
package/out/types.d.ts CHANGED
@@ -6,10 +6,11 @@ import type { Target } from "./targets/target.js";
6
6
  * @since 0.6.0
7
7
  */
8
8
  export interface FsAdapter {
9
- promises: {
10
- opendir: typeof fs.promises.opendir;
11
- readFile: typeof fs.promises.readFile;
12
- };
9
+ /**
10
+ * `readdir` is better than `opendir`.
11
+ */
12
+ readdir: typeof fs.readdir;
13
+ readFile: typeof fs.readFile;
13
14
  }
14
15
  /**
15
16
  * Used in multiple methods, primarily `scan`, `scanStream`, and their browser versions.
@@ -76,10 +77,10 @@ export type ScanOptions = {
76
77
  * {@link MatcherContext.totalDirs},
77
78
  * {@link MatcherContext.totalFiles},
78
79
  * {@link MatcherContext.totalMatchedFiles}
79
- * and {@link MatcherContext.depthPaths}.
80
+ * and {@link MatcherContext.depthPaths} numbers.
80
81
  *
81
82
  * It's recommended to use this option unless you
82
- * need precise statistics
83
+ * care about these stats.
83
84
  *
84
85
  * @default `false`
85
86
  *
@@ -97,7 +98,7 @@ export type ScanOptions = {
97
98
  * and {@link MatcherContext.depthPaths}.
98
99
  *
99
100
  * It's recommended to use this option unless the target
100
- * allows overriding internal patterns.
101
+ * allows overriding internal patterns and you don't care about these stats.
101
102
  * This option should never affect {@link MatcherContext.totalMatchedFiles}.
102
103
  *
103
104
  * @default `false`
package/out/unixify.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export declare function unixify(path: string): string;
2
2
  export declare function join(from: string, p2: string): string;
3
3
  export declare function relative(base: string, to: string): string;
4
- export declare function base(path: string): string;
4
+ export declare function dirname(path: string): string;
package/out/unixify.js CHANGED
@@ -1,38 +1,57 @@
1
1
  const strippedCwd = strip(process.cwd());
2
2
  export function unixify(path) {
3
- let result = strip(path);
4
- if (result.startsWith("./")) {
5
- result = strippedCwd + result.substring(1);
3
+ const result = strip(path);
4
+ const c0 = result.charCodeAt(0);
5
+ if (c0 === 46 && result.charCodeAt(1) === 47) {
6
+ // "./"
7
+ return strippedCwd + result.substring(1);
6
8
  }
7
- else if (!result.startsWith("/")) {
8
- result = strippedCwd + "/" + result;
9
+ if (c0 !== 47 && c0 !== 92) {
10
+ // not starts with "/" or "\"
11
+ return strippedCwd + "/" + result;
9
12
  }
10
13
  return result;
11
14
  }
12
15
  export function join(from, p2) {
13
- if (p2 === "." || p2 === "./") {
16
+ if (p2 === "." || p2 === "./")
14
17
  return from;
18
+ const p2startsDotSlash = p2.charCodeAt(0) === 46 && p2.charCodeAt(1) === 47;
19
+ const start = p2startsDotSlash ? 2 : 0;
20
+ let res = from;
21
+ if (from.charCodeAt(0) === 46 && from.charCodeAt(1) === 47) {
22
+ res = from.substring(2);
15
23
  }
16
- let start = 0;
17
- if (p2.startsWith("./")) {
18
- start = 2;
24
+ const resLen = res.length;
25
+ if (resLen > 0 && res.charCodeAt(resLen - 1) !== 47) {
26
+ res += "/";
19
27
  }
20
- if (!from.endsWith("/")) {
21
- from += "/";
22
- }
23
- from += p2.substring(start);
24
- return from;
28
+ return res + p2.substring(start);
25
29
  }
26
30
  export function relative(base, to) {
27
- if (!base.endsWith("/")) {
31
+ const blen = base.length;
32
+ if (blen > 0 && base.charCodeAt(blen - 1) !== 47) {
28
33
  base += "/";
29
34
  }
30
- const result = to.replace(base, "");
31
- return result;
32
- }
33
- export function base(path) {
34
- return path.substring(path.lastIndexOf("/") + 1);
35
+ return to.replace(base, "");
35
36
  }
36
37
  function strip(path) {
37
- return path.replaceAll("\\", "/").replace(/^[a-zA-Z]:/, "");
38
+ let res = path.indexOf("\\") === -1 ? path : path.replaceAll("\\", "/");
39
+ if (res.length > 1 && res.charCodeAt(1) === 58) {
40
+ // X:
41
+ res = res.substring(2);
42
+ }
43
+ return res;
44
+ }
45
+ export function dirname(path) {
46
+ if (path === "/" || path === ".")
47
+ return path;
48
+ const len = path.length;
49
+ const lastIdx = len - 1;
50
+ const endsWithSlash = path.charCodeAt(lastIdx) === 47;
51
+ const lastSlash = path.lastIndexOf("/", endsWithSlash ? lastIdx - 1 : lastIdx);
52
+ if (lastSlash === -1)
53
+ return ".";
54
+ if (lastSlash === 0)
55
+ return "/";
56
+ return path.substring(0, lastSlash);
38
57
  }
package/out/walk.d.ts CHANGED
@@ -1,13 +1,51 @@
1
1
  import type { Dirent } from "node:fs";
2
- import type { MatcherContext } from "./patterns/matcherContext.js";
2
+ import type { MatcherContext, Total } from "./patterns/matcherContext.js";
3
3
  import type { MatcherStream } from "./patterns/matcherStream.js";
4
+ import type { Resource } from "./patterns/resource.js";
4
5
  import type { ScanOptions } from "./types.js";
6
+ import { type RuleMatch } from "./patterns/rule.js";
5
7
  export type WalkOptions = {
6
- path: string;
8
+ relPath: string;
9
+ lowerRelPath?: string;
7
10
  parentPath: string;
8
11
  entry: Dirent;
9
- ctx: MatcherContext;
12
+ resource: Resource;
10
13
  stream: MatcherStream | undefined;
11
14
  scanOptions: Required<ScanOptions>;
15
+ depth: number;
16
+ };
17
+ export type WalkResult = {
18
+ path: string;
19
+ parentPath: string;
20
+ match: RuleMatch;
21
+ includeParent: boolean;
22
+ tooDeep: boolean;
23
+ next: 0 | 1;
24
+ depth: number;
25
+ isDir: boolean;
26
+ };
27
+ export type WalkTotal = {
28
+ type?: "total";
29
+ dir: string;
30
+ files: number;
31
+ matched: number;
32
+ dirs: number;
33
+ depth: number;
34
+ ignored: boolean;
12
35
  };
13
- export declare function walkIncludes(options: WalkOptions): Promise<0 | 1 | 2>;
36
+ /**
37
+ * @since 0.11.0
38
+ */
39
+ export declare function walkIncludes(options: WalkOptions, cb: (err: Error | null, result: WalkResult) => void): void;
40
+ /**
41
+ * Patches the {@link MatcherContext} with the given result.
42
+ */
43
+ export declare function walkPatchResult(ctx: MatcherContext, r: WalkResult): void;
44
+ /**
45
+ * Patches the {@link MatcherContext} with the given total.
46
+ */
47
+ export declare function walkPatchTotal(ctx: MatcherContext, maxDepth: number, t: WalkTotal): void;
48
+ /**
49
+ * Propagates totals from child directories to their parents.
50
+ */
51
+ export declare function propagateTotals(total: Map<string, Total>): void;
package/out/walk.js CHANGED
@@ -1,112 +1,166 @@
1
- import { getDepth } from "./getDepth.js";
2
- export async function walkIncludes(options) {
3
- const { entry, ctx, stream, scanOptions, path, parentPath } = options;
4
- const { fs, target, cwd, depth: maxDepth, invert, signal, fastDepth, fastInternal } = scanOptions;
5
- signal?.throwIfAborted();
1
+ import { isRuleMatchInvalid } from "./patterns/rule.js";
2
+ /**
3
+ * @since 0.11.0
4
+ */
5
+ export function walkIncludes(options, cb) {
6
+ const { entry, stream, scanOptions, relPath: path, lowerRelPath, parentPath, resource, depth, } = options;
7
+ const { target, depth: maxDepth, invert, fastDepth, fastInternal, fs, cwd, signal } = scanOptions;
6
8
  const isDir = entry.isDirectory();
7
- let direntPath;
8
- if (isDir) {
9
- direntPath = path + "/";
10
- ctx.totalDirs++;
11
- }
12
- else {
13
- direntPath = path;
14
- ctx.totalFiles++;
15
- }
16
- if (fastDepth) {
17
- const { depth, depthSlash } = getDepth(path, maxDepth);
18
- if (depth > maxDepth) {
19
- const failedPrev = ctx.failed.length;
20
- let match = await target.ignores({ fs, cwd, entry: path, ctx, signal, target, parentPath });
21
- if (invert) {
9
+ const direntPath = isDir ? path + "/" : path;
10
+ const lowerEntry = lowerRelPath || path.toLowerCase();
11
+ const testOptions = {
12
+ cwd,
13
+ entry: path,
14
+ fs,
15
+ lowerEntry,
16
+ parentPath,
17
+ resource,
18
+ signal,
19
+ target,
20
+ };
21
+ if (fastDepth && depth > maxDepth) {
22
+ return target.ignores(testOptions, (err, match) => {
23
+ if (err)
24
+ return cb(err, null);
25
+ if (invert)
22
26
  match.ignored = !match.ignored;
23
- }
24
- if (failedPrev < ctx.failed.length) {
27
+ const result = {
28
+ depth,
29
+ includeParent: false,
30
+ isDir,
31
+ match,
32
+ next: 0,
33
+ parentPath,
34
+ path: direntPath,
35
+ tooDeep: true,
36
+ };
37
+ if (isRuleMatchInvalid(match)) {
25
38
  if (stream) {
26
- stream.emit("dirent", { dirent: entry, match, path: direntPath, ctx });
39
+ stream.dispatchEvent(new CustomEvent("dirent", { detail: { dirent: entry, match, path: direntPath } }));
27
40
  }
28
- return 2;
41
+ return cb(null, result);
29
42
  }
30
43
  if (match.ignored) {
31
- if (isDir && fastInternal && match.kind === "internal") {
32
- return 1;
33
- }
34
- return 0;
44
+ if (stream)
45
+ stream.dispatchEvent(new CustomEvent("dirent", { detail: { dirent: entry, match, path: direntPath } }));
46
+ if (isDir && fastInternal)
47
+ result.next = 1;
48
+ return cb(null, result);
49
+ }
50
+ result.next = isDir ? 0 : 1;
51
+ cb(null, result);
52
+ });
53
+ }
54
+ target.ignores(testOptions, (err, match) => {
55
+ if (err)
56
+ return cb(err, null);
57
+ if (invert)
58
+ match.ignored = !match.ignored;
59
+ const result = {
60
+ depth,
61
+ includeParent: false,
62
+ isDir,
63
+ match,
64
+ next: 0,
65
+ parentPath,
66
+ path: direntPath,
67
+ tooDeep: false,
68
+ };
69
+ if (isRuleMatchInvalid(match)) {
70
+ if (stream)
71
+ stream.dispatchEvent(new CustomEvent("dirent", { detail: { dirent: entry, match, path: direntPath } }));
72
+ return cb(null, result);
73
+ }
74
+ if (match.ignored) {
75
+ if (stream)
76
+ stream.dispatchEvent(new CustomEvent("dirent", { detail: { dirent: entry, match, path: direntPath } }));
77
+ if (isDir && fastInternal)
78
+ result.next = 1;
79
+ return cb(null, result);
80
+ }
81
+ if (isDir) {
82
+ if (depth <= maxDepth) {
83
+ if (stream)
84
+ stream.dispatchEvent(new CustomEvent("dirent", { detail: { dirent: entry, match, path: direntPath } }));
35
85
  }
36
- if (isDir) {
37
- // ctx.totalMatchedDirs++;
38
- // ctx.depthPaths.set(path, (ctx.depthPaths.get(path) ?? 0) + 1);
39
- return 0;
86
+ else {
87
+ result.tooDeep = true;
40
88
  }
41
- ctx.totalMatchedFiles++;
42
- const dir = path.substring(0, depthSlash);
43
- ctx.depthPaths.set(dir, (ctx.depthPaths.get(dir) ?? 0) + 1);
44
- return 1;
89
+ return cb(null, result);
45
90
  }
46
- }
47
- const failedPrev = ctx.failed.length;
48
- let match = await target.ignores({
49
- fs,
50
- cwd,
51
- entry: path,
52
- ctx,
53
- signal,
54
- target,
55
- parentPath: parentPath,
56
- });
57
- if (invert) {
58
- match.ignored = !match.ignored;
59
- }
60
- if (failedPrev < ctx.failed.length) {
61
- if (stream) {
62
- stream.emit("dirent", { dirent: entry, match, path: direntPath, ctx });
91
+ if (depth > maxDepth) {
92
+ result.tooDeep = true;
93
+ return cb(null, result);
63
94
  }
64
- return 2;
65
- }
66
- if (match.ignored) {
95
+ const lastSlash = path.lastIndexOf("/");
96
+ if (lastSlash >= 0)
97
+ result.includeParent = true;
67
98
  if (stream) {
68
- stream.emit("dirent", { dirent: entry, match, path: direntPath, ctx });
99
+ if (result.includeParent)
100
+ stream.dispatchEvent(new CustomEvent("dirent", { detail: { dirent: entry, match, path: parentPath + "/" } }));
101
+ stream.dispatchEvent(new CustomEvent("dirent", { detail: { dirent: entry, match, path: direntPath } }));
69
102
  }
70
- if (isDir && fastInternal && match.kind === "internal") {
71
- return 1;
72
- }
73
- return 0;
74
- }
103
+ cb(null, result);
104
+ });
105
+ }
106
+ /**
107
+ * Patches the {@link MatcherContext} with the given result.
108
+ */
109
+ export function walkPatchResult(ctx, r) {
110
+ const { path, parentPath, match, isDir, tooDeep, includeParent } = r;
75
111
  if (isDir) {
76
- // ctx.totalMatchedDirs++;
77
- // ctx.depthPaths.set(path, (ctx.depthPaths.get(path) ?? 0) + 1);
78
- const { depth } = getDepth(path, maxDepth);
79
- if (depth <= maxDepth) {
80
- ctx.paths.set(direntPath, match);
81
- if (stream) {
82
- stream.emit("dirent", { dirent: entry, match, path: direntPath, ctx });
83
- }
112
+ if (!match.ignored && !tooDeep)
113
+ ctx.paths.set(path, match);
114
+ }
115
+ else {
116
+ if (!match.ignored) {
117
+ if (!tooDeep)
118
+ ctx.paths.set(path, match);
84
119
  }
85
- return 0;
86
120
  }
87
- ctx.totalMatchedFiles++;
88
- const { depth, depthSlash } = getDepth(path, maxDepth);
89
- if (depth > maxDepth) {
90
- const dir = path.substring(0, depthSlash);
91
- ctx.depthPaths.set(dir, (ctx.depthPaths.get(dir) ?? 0) + 1);
92
- return 0;
121
+ if (includeParent && !match.ignored)
122
+ if (!ctx.paths.has(parentPath + "/"))
123
+ ctx.paths.set(parentPath + "/", match);
124
+ }
125
+ /**
126
+ * Patches the {@link MatcherContext} with the given total.
127
+ */
128
+ export function walkPatchTotal(ctx, maxDepth, t) {
129
+ const { dir, files, matched, dirs, ignored } = t;
130
+ const dirTotal = ctx.total.get(dir);
131
+ if (dirTotal) {
132
+ dirTotal.totalFiles += files;
133
+ dirTotal.totalDirs += dirs;
134
+ dirTotal.totalMatchedFiles += matched;
93
135
  }
94
- if (depth <= maxDepth) {
95
- const lastSlash = path.lastIndexOf("/");
96
- if (lastSlash >= 0) {
97
- const dir = path.substring(0, lastSlash) + "/";
98
- const dirMatch = ctx.paths.get(dir);
99
- if (dirMatch === undefined || dirMatch.ignored) {
100
- ctx.paths.set(dir, match);
101
- if (stream) {
102
- stream.emit("dirent", { dirent: entry, match, path: dir, ctx });
103
- }
104
- }
136
+ else if (t.depth <= maxDepth && !ignored) {
137
+ ctx.total.set(dir, { totalDirs: dirs, totalFiles: files, totalMatchedFiles: matched });
138
+ }
139
+ }
140
+ /**
141
+ * Propagates totals from child directories to their parents.
142
+ */
143
+ export function propagateTotals(total) {
144
+ const dirs = Array.from(total.keys()).sort((a, b) => b.length - a.length);
145
+ for (let i = 0, len = dirs.length; i < len; i++) {
146
+ const dir = dirs[i];
147
+ if (dir === "." || dir === "/")
148
+ continue;
149
+ const dirTotal = total.get(dir);
150
+ const lastSlash = dir.lastIndexOf("/");
151
+ const parent = lastSlash === -1 ? "." : dir.slice(0, lastSlash) || "/";
152
+ const parentTotal = total.get(parent);
153
+ if (parentTotal) {
154
+ parentTotal.totalFiles += dirTotal.totalFiles;
155
+ parentTotal.totalDirs += dirTotal.totalDirs;
156
+ parentTotal.totalMatchedFiles += dirTotal.totalMatchedFiles;
105
157
  }
106
- ctx.paths.set(path, match);
107
- if (stream) {
108
- stream.emit("dirent", { dirent: entry, match, path: direntPath, ctx });
158
+ else {
159
+ total.set(parent, {
160
+ totalDirs: dirTotal.totalDirs,
161
+ totalFiles: dirTotal.totalFiles,
162
+ totalMatchedFiles: dirTotal.totalMatchedFiles,
163
+ });
109
164
  }
110
165
  }
111
- return 0;
112
166
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "view-ignored",
3
- "version": "0.10.1",
4
- "description": "Retrieve list of files ignored/included by Git, NPM, Yarn, JSR, VSCE or other tools.",
3
+ "version": "0.11.1",
4
+ "description": "Retrieve list of files ignored/included by Git, NPM, Yarn, JSR, Deno, Bun, VSCode extension CLI and other tools.",
5
5
  "keywords": [
6
6
  ".gitignore",
7
7
  ".npmignore",
@@ -76,10 +76,13 @@
76
76
  "access": "public"
77
77
  },
78
78
  "scripts": {
79
- "prerelease": "bun run test && bun run prod && bun run lint && bun run fmt --check && bun publint --pack bun --strict",
80
- "cpu": "bun run cpu:igw; bun run 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",
79
+ "prerelease": "bun run test && bun run prod && bun run lint && bun run fmt --check && bun run ts-compat && bun publint --pack bun --strict",
80
+ "heap": "bun scripts/scanHeap.js --snapshot",
81
+ "heap:node": "node scripts/scanHeap.js --snapshot",
82
+ "cpu": "bun run --expose-gc --cpu-prof --cpu-prof-md --cpu-prof-name CPU.me scripts/scan.js --fastInternal",
83
+ "cpu:node": "node --expose-gc --cpu-prof --cpu-prof-name CPU.me.node.cpuprofile scripts/scan.js --fastInternal",
84
+ "bench": "bun run --expose-gc benchmarks/git.js && bun run --expose-gc benchmarks/npm.js",
85
+ "bench:node": "node --expose-gc benchmarks/git.js && node --expose-gc benchmarks/npm.js",
83
86
  "test": "bun test src",
84
87
  "test:patterns": "bun test src/patterns",
85
88
  "test:targets": "bun test src/targets",
@@ -89,34 +92,46 @@
89
92
  "test:self:npm": "bun test src/testSelfNPM.test.ts",
90
93
  "lint": "bun run oxlint --type-aware",
91
94
  "fmt": "bun run oxfmt",
92
- "check": "bun tsgo -p . --noEmit",
93
- "prod": "rm -rf out && tsgo -p tsconfig.prod.json",
94
- "release:major": "bun run release-it --increment=major",
95
- "release:minor": "bun run release-it --increment=minor",
96
- "release:patch": "bun run release-it --increment=patch"
95
+ "check": "bun tsgo -p src --noEmit",
96
+ "dev": "bun tsgo -p src",
97
+ "prod": "rm -rf out && bun tsgo -p src/tsconfig.prod.json",
98
+ "node-compat": "bun node-compat-22 && bun node-compat-24",
99
+ "ts-compat": "bun run ts-compat-6 && bun run ts-compat-5",
100
+ "node-compat-24": "bun node_modules/typescript6/bin/tsc -p src/tsconfig.prod24.json --noEmit",
101
+ "node-compat-22": "bun node_modules/typescript6/bin/tsc -p src/tsconfig.prod22.json --noEmit",
102
+ "ts-compat-5": "bun node_modules/typescript5/bin/tsc -p src/tsconfig.prod.json --noEmit",
103
+ "ts-compat-6": "bun node_modules/typescript6/bin/tsc -p src/tsconfig.prod.json --noEmit",
104
+ "release:major": "bun run --bun release-it --increment=major",
105
+ "release:minor": "bun run --bun release-it --increment=minor",
106
+ "release:patch": "bun run --bun release-it --increment=patch"
97
107
  },
98
108
  "dependencies": {
99
- "arktype": "^2.1.29",
100
109
  "micromatch": "^4.0.8",
101
110
  "strip-json-comments": "^5.0.3"
102
111
  },
103
112
  "devDependencies": {
104
- "@release-it/keep-a-changelog": "^7.0.1",
105
- "@types/bun": "^1.3.9",
106
- "@types/ignore-walk": "^4.0.3",
107
- "@types/micromatch": "^4.0.10",
108
- "@types/node": "^18.19.130",
109
- "@typescript/native-preview": "^7.0.0-dev.20260223.1",
110
- "ignore-walk": "^8.0.0",
111
- "memfs": "^4.56.10",
112
- "mitata": "^1.0.34",
113
- "oxfmt": "^0.35.0",
114
- "oxlint": "^1.50.0",
115
- "oxlint-tsgolint": "^0.14.2",
116
- "publint": "^0.3.17",
117
- "release-it": "^19.2.4"
113
+ "@release-it/keep-a-changelog": "latest",
114
+ "@types/braces": "*",
115
+ "@types/bun": "latest",
116
+ "@types/ignore-walk": "npm:@types/ignore-walk@^4.0.3",
117
+ "@types/micromatch": "npm:@types/micromatch@^4.0.10",
118
+ "@types/node": "npm:@types/node@latest",
119
+ "@types/node-22": "npm:@types/node@22.x",
120
+ "@types/node-24": "npm:@types/node@24.x",
121
+ "@typescript/native-preview": "latest",
122
+ "ignore-walk": "latest",
123
+ "memfs": "latest",
124
+ "mitata": "latest",
125
+ "oxfmt": "latest",
126
+ "oxlint": "latest",
127
+ "oxlint-tsgolint": "latest",
128
+ "publint": "latest",
129
+ "release-it": "latest",
130
+ "typescript5": "npm:typescript@5.7.x",
131
+ "typescript6": "npm:typescript@6.x",
132
+ "undici-types": "*"
118
133
  },
119
134
  "engines": {
120
- "node": ">=18"
135
+ "node": ">=22"
121
136
  }
122
137
  }
package/out/getDepth.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export declare function getDepth(path: string, maxDepth: number): {
2
- depth: number;
3
- depthSlash: number;
4
- };
package/out/getDepth.js DELETED
@@ -1,21 +0,0 @@
1
- export function getDepth(path, maxDepth) {
2
- if (path.endsWith("/")) {
3
- path = path.substring(0, path.length - 1);
4
- }
5
- const result = {
6
- depth: 0,
7
- depthSlash: -1,
8
- };
9
- let i = -1;
10
- for (const c of path) {
11
- i++;
12
- if (c !== "/") {
13
- continue;
14
- }
15
- if (result.depth === maxDepth) {
16
- result.depthSlash = i;
17
- }
18
- result.depth++;
19
- }
20
- return result;
21
- }
package/out/opendir.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import type { Dirent } from "node:fs";
2
- import type { PatternFinderOptions } from "./patterns/extractor.js";
3
- export declare function opendir(options: PatternFinderOptions, place: string, cb: (dirent: Dirent, parentPath: string, path: string) => Promise<0 | 1 | 2>): Promise<boolean>;