view-ignored 0.7.1 → 0.8.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 (47) hide show
  1. package/README.md +23 -17
  2. package/out/browser_scan.d.ts +1 -1
  3. package/out/browser_scan.js +15 -16
  4. package/out/browser_stream.js +1 -43
  5. package/out/patterns/gitignore.d.ts +8 -0
  6. package/out/patterns/gitignore.js +16 -2
  7. package/out/patterns/ignores.d.ts +2 -25
  8. package/out/patterns/index.d.ts +3 -0
  9. package/out/patterns/index.js +3 -0
  10. package/out/patterns/init.d.ts +9 -0
  11. package/out/patterns/init.js +1 -0
  12. package/out/patterns/initState.d.ts +31 -0
  13. package/out/patterns/initState.js +1 -0
  14. package/out/patterns/matcherContextPatch.js +3 -4
  15. package/out/patterns/matcherStream.d.ts +15 -0
  16. package/out/patterns/matcherStream.js +57 -0
  17. package/out/patterns/packagejson.d.ts +8 -0
  18. package/out/patterns/packagejson.js +27 -5
  19. package/out/patterns/pattern.d.ts +2 -1
  20. package/out/patterns/pattern.js +2 -2
  21. package/out/patterns/resolveSources.d.ts +2 -1
  22. package/out/patterns/resolveSources.js +14 -7
  23. package/out/patterns/stringCompile.d.ts +15 -2
  24. package/out/patterns/stringCompile.js +4 -3
  25. package/out/scan.d.ts +1 -1
  26. package/out/scan.js +1 -1
  27. package/out/targets/bun.d.ts +5 -0
  28. package/out/targets/bun.js +78 -0
  29. package/out/targets/deno.d.ts +5 -0
  30. package/out/targets/deno.js +40 -0
  31. package/out/targets/git.js +1 -0
  32. package/out/targets/index.d.ts +3 -0
  33. package/out/targets/index.js +3 -0
  34. package/out/targets/jsr.js +1 -8
  35. package/out/targets/npm.js +36 -13
  36. package/out/targets/target.d.ts +13 -0
  37. package/out/targets/vsce.js +34 -1
  38. package/out/targets/yarn.js +72 -26
  39. package/out/targets/yarnClassic.d.ts +5 -0
  40. package/out/targets/yarnClassic.js +77 -0
  41. package/out/types.d.ts +1 -1
  42. package/out/unixify.d.ts +3 -0
  43. package/out/unixify.js +33 -0
  44. package/out/walk.js +2 -2
  45. package/package.json +4 -1
  46. package/out/normalizeCwd.d.ts +0 -1
  47. package/out/normalizeCwd.js +0 -4
@@ -4,9 +4,9 @@ import { makeRe } from "minimatch";
4
4
  *
5
5
  * @see {@link patternCompile}
6
6
  *
7
- * @since 0.6.0
7
+ * @since 0.8.0
8
8
  */
9
- export function stringCompile(pattern, _ = -1, array = []) {
9
+ export function stringCompile(pattern, context = [], options) {
10
10
  const original = pattern;
11
11
  if (pattern.endsWith("/")) {
12
12
  pattern = pattern.substring(0, pattern.length - 1);
@@ -23,6 +23,7 @@ export function stringCompile(pattern, _ = -1, array = []) {
23
23
  nonegate: true,
24
24
  nocomment: true,
25
25
  nobrace: true,
26
+ nocase: options?.nocase ?? false,
26
27
  });
27
- return { re, pattern: original, patternContext: array };
28
+ return { re, pattern: original, patternContext: context };
28
29
  }
package/out/scan.d.ts CHANGED
@@ -4,7 +4,7 @@ export type * from "./types.js";
4
4
  /**
5
5
  * Scan the directory for included files based on the provided targets.
6
6
  *
7
- * Note that this function uses `fs/promises.readFile` and `fs/promises.opendir` without options within
7
+ * Note that this function uses `fs.promises.readFile` and `fs.promises.opendir` without options within
8
8
  * custom recursion, instead of `fs.promises.readdir` with `{ withFileTypes: true }.
9
9
  * It also normalizes paths to use forward slashes.
10
10
  * Please report any issues if you encounter problems related to this behavior.
package/out/scan.js CHANGED
@@ -4,7 +4,7 @@ import { scan as browserScan } from "./browser_scan.js";
4
4
  /**
5
5
  * Scan the directory for included files based on the provided targets.
6
6
  *
7
- * Note that this function uses `fs/promises.readFile` and `fs/promises.opendir` without options within
7
+ * Note that this function uses `fs.promises.readFile` and `fs.promises.opendir` without options within
8
8
  * custom recursion, instead of `fs.promises.readdir` with `{ withFileTypes: true }.
9
9
  * It also normalizes paths to use forward slashes.
10
10
  * Please report any issues if you encounter problems related to this behavior.
@@ -0,0 +1,5 @@
1
+ import type { Target } from "./target.js";
2
+ /**
3
+ * @since 0.8.1
4
+ */
5
+ export declare const Bun: Target;
@@ -0,0 +1,78 @@
1
+ import { signedPatternIgnores, signedPatternCompile, extractPackageJson, extractGitignore, } from "../patterns/index.js";
2
+ const extractors = [
3
+ {
4
+ extract: extractPackageJson,
5
+ path: "package.json",
6
+ },
7
+ {
8
+ extract: extractGitignore,
9
+ path: ".npmignore",
10
+ },
11
+ {
12
+ extract: extractGitignore,
13
+ path: ".gitignore",
14
+ },
15
+ ];
16
+ const internal = {
17
+ exclude: [
18
+ // https://github.com/oven-sh/bun/blob/main/src/cli/pack_command.zig#L180
19
+ "package-lock.json",
20
+ "yarn.lock",
21
+ "pnpm-lock.yaml",
22
+ "bun.lockb",
23
+ "bun.lock", // npm includes it
24
+ // https://github.com/oven-sh/bun/blob/main/src/cli/pack_command.zig#L189
25
+ ".*.swp",
26
+ "._*",
27
+ ".DS_Store",
28
+ ".git",
29
+ ".gitignore",
30
+ ".hg",
31
+ ".npmignore",
32
+ ".npmrc",
33
+ ".lock-wscript",
34
+ ".svn",
35
+ "wafpickle-*",
36
+ "CVS",
37
+ "npm-debug.log",
38
+ // bun says it is "mentioned in the docs but does not appear to be ignored by default"
39
+ // but we know it should be /build/config.gypi, not just config.gypi, haha
40
+ // "config.gypi",
41
+ ".env.production", // npm includes it
42
+ "bunfig.toml", // npm includes it
43
+ // https://github.com/oven-sh/bun/blob/main/src/cli/pack_command.zig#L284
44
+ // manifest should be included, but bun ignores it on this line
45
+ // bun forces it later: https://github.com/oven-sh/bun/blob/main/src/cli/pack_command.zig#L2586
46
+ // "package.json",
47
+ // https://github.com/oven-sh/bun/blob/main/src/cli/pack_command.zig#L285
48
+ "node_modules",
49
+ ],
50
+ include: [
51
+ // https://github.com/oven-sh/bun/blob/main/src/cli/pack_command.zig#L2586
52
+ "package.json",
53
+ // the special?.* check works this way: https://github.com/oven-sh/bun/blob/main/src/cli/pack_command.zig#L2599
54
+ "LICENSE",
55
+ "LICENSE.*",
56
+ "LICENCE",
57
+ "LICENCE.*",
58
+ "README",
59
+ "README.*",
60
+ ],
61
+ compiled: null,
62
+ };
63
+ signedPatternCompile(internal);
64
+ /**
65
+ * @since 0.8.1
66
+ */
67
+ export const Bun = {
68
+ // TODO: Bun should include some paths: bins, bundled deps, nothing else.
69
+ extractors,
70
+ ignores(o) {
71
+ return signedPatternIgnores({
72
+ ...o,
73
+ internal,
74
+ root: ".",
75
+ target: Bun,
76
+ });
77
+ },
78
+ };
@@ -0,0 +1,5 @@
1
+ import type { Target } from "./target.js";
2
+ /**
3
+ * @since 0.8.1
4
+ */
5
+ export declare const Deno: Target;
@@ -0,0 +1,40 @@
1
+ import { signedPatternIgnores, signedPatternCompile, extractJsrJson, extractJsrJsonc, } from "../patterns/index.js";
2
+ const extractors = [
3
+ {
4
+ extract: extractJsrJson,
5
+ path: "deno.json",
6
+ },
7
+ {
8
+ extract: extractJsrJsonc,
9
+ path: "deno.jsonc",
10
+ },
11
+ {
12
+ extract: extractJsrJson,
13
+ path: "jsr.json",
14
+ },
15
+ {
16
+ extract: extractJsrJsonc,
17
+ path: "jsr.jsonc",
18
+ },
19
+ ];
20
+ const internal = {
21
+ exclude: [".git", ".DS_Store"],
22
+ include: [],
23
+ compiled: null,
24
+ };
25
+ signedPatternCompile(internal);
26
+ /**
27
+ * @since 0.8.1
28
+ */
29
+ export const Deno = {
30
+ // TODO: Deno should validate manifest
31
+ extractors,
32
+ ignores(o) {
33
+ return signedPatternIgnores({
34
+ ...o,
35
+ internal,
36
+ root: ".",
37
+ target: Deno,
38
+ });
39
+ },
40
+ };
@@ -19,6 +19,7 @@ signedPatternCompile(internal);
19
19
  * @since 0.6.0
20
20
  */
21
21
  export const Git = {
22
+ // TODO: Git should read configs
22
23
  extractors,
23
24
  ignores(o) {
24
25
  return signedPatternIgnores({
@@ -1,6 +1,9 @@
1
+ export * from "./bun.js";
2
+ export * from "./deno.js";
1
3
  export * from "./git.js";
2
4
  export * from "./jsr.js";
3
5
  export * from "./npm.js";
4
6
  export * from "./target.js";
5
7
  export * from "./vsce.js";
6
8
  export * from "./yarn.js";
9
+ export * from "./yarnClassic.js";
@@ -1,6 +1,9 @@
1
+ export * from "./bun.js";
2
+ export * from "./deno.js";
1
3
  export * from "./git.js";
2
4
  export * from "./jsr.js";
3
5
  export * from "./npm.js";
4
6
  export * from "./target.js";
5
7
  export * from "./vsce.js";
6
8
  export * from "./yarn.js";
9
+ export * from "./yarnClassic.js";
@@ -1,13 +1,5 @@
1
1
  import { signedPatternIgnores, signedPatternCompile, extractJsrJson, extractJsrJsonc, } from "../patterns/index.js";
2
2
  const extractors = [
3
- {
4
- extract: extractJsrJson,
5
- path: "deno.json",
6
- },
7
- {
8
- extract: extractJsrJsonc,
9
- path: "deno.jsonc",
10
- },
11
3
  {
12
4
  extract: extractJsrJson,
13
5
  path: "jsr.json",
@@ -27,6 +19,7 @@ signedPatternCompile(internal);
27
19
  * @since 0.6.0
28
20
  */
29
21
  export const JSR = {
22
+ // TODO: JSR should validate manifest
30
23
  extractors,
31
24
  ignores(o) {
32
25
  return signedPatternIgnores({
@@ -15,25 +15,47 @@ const extractors = [
15
15
  ];
16
16
  const internal = {
17
17
  exclude: [
18
- ".git",
19
- ".DS_Store",
20
- "node_modules",
21
- ".*.swp",
22
- "._*",
23
- ".DS_Store",
24
- ".git",
18
+ // https://github.com/npm/npm-packlist/blob/main/lib/index.js#L16
19
+ ".npmignore",
25
20
  ".gitignore",
21
+ ".git",
22
+ ".svn",
26
23
  ".hg",
27
- ".npmignore",
28
- ".npmrc",
29
- ".lock-wscript",
24
+ "CVS",
25
+ ".git",
30
26
  ".svn",
31
- ".wafpickle-*",
32
- "config.gypi",
27
+ ".hg",
33
28
  "CVS",
29
+ "/.lock-wscript",
30
+ "/.wafpickle-*",
31
+ "/build/config.gypi",
34
32
  "npm-debug.log",
33
+ ".npmrc",
34
+ ".*.swp",
35
+ ".DS_Store",
36
+ "._*",
37
+ "*.orig",
38
+ "/archived-packages/**",
39
+ // https://github.com/npm/npm-packlist/blob/main/lib/index.js#L294
40
+ "/node_modules",
41
+ "/package-lock.json",
42
+ "/yarn.lock",
43
+ "/pnpm-lock.yaml",
44
+ "/bun.lockb",
45
+ ],
46
+ include: [
47
+ // https://github.com/npm/npm-packlist/blob/main/lib/index.js#L287
48
+ "bin",
49
+ "package.json",
50
+ "README",
51
+ "COPYING",
52
+ "LICENSE",
53
+ "LICENCE",
54
+ "README.*",
55
+ "COPYING.*",
56
+ "LICENSE.*",
57
+ "LICENCE.*",
35
58
  ],
36
- include: ["bin", "package.json", "README*", "LICENSE*", "LICENCE*"],
37
59
  compiled: null,
38
60
  };
39
61
  signedPatternCompile(internal);
@@ -41,6 +63,7 @@ signedPatternCompile(internal);
41
63
  * @since 0.6.0
42
64
  */
43
65
  export const NPM = {
66
+ // TODO: NPM should validate package.json
44
67
  extractors,
45
68
  ignores(o) {
46
69
  return signedPatternIgnores({
@@ -1,5 +1,6 @@
1
1
  import type { Extractor } from "../patterns/extractor.js";
2
2
  import type { Ignores } from "../patterns/ignores.js";
3
+ import type { Init } from "../patterns/init.js";
3
4
  /**
4
5
  * Contains the matcher used for scanning.
5
6
  *
@@ -21,4 +22,16 @@ export interface Target {
21
22
  * @since 0.6.0
22
23
  */
23
24
  ignores: Ignores;
25
+ /**
26
+ * Initialization function.
27
+ * Called by the scanner method.
28
+ *
29
+ * @example
30
+ * scan({ target: { ...Git, init: undefined } })
31
+ *
32
+ * @see {@link Init}
33
+ *
34
+ * @since 0.8.0
35
+ */
36
+ init?: Init;
24
37
  }
@@ -14,7 +14,40 @@ const extractors = [
14
14
  },
15
15
  ];
16
16
  const internal = {
17
- exclude: [".git", ".DS_Store"],
17
+ exclude: [
18
+ // https://github.com/microsoft/vscode-vsce/blob/main/src/package.ts#L1633
19
+ ".vscodeignore",
20
+ "package-lock.json",
21
+ "npm-debug.log",
22
+ "yarn.lock",
23
+ "yarn-error.log",
24
+ "npm-shrinkwrap.json",
25
+ ".editorconfig",
26
+ ".npmrc",
27
+ ".yarnrc",
28
+ ".gitattributes",
29
+ "*.todo",
30
+ "tslint.yaml",
31
+ ".eslintrc*",
32
+ ".babelrc*",
33
+ ".prettierrc*",
34
+ ".cz-config.js",
35
+ ".commitlintrc*",
36
+ "webpack.config.js",
37
+ "ISSUE_TEMPLATE.md",
38
+ "CONTRIBUTING.md",
39
+ "PULL_REQUEST_TEMPLATE.md",
40
+ "CODE_OF_CONDUCT.md",
41
+ ".github",
42
+ ".travis.yml",
43
+ "appveyor.yml",
44
+ ".git",
45
+ "*.vsix",
46
+ ".DS_Store",
47
+ "*.vsixmanifest",
48
+ ".vscode-test",
49
+ ".vscode-test-web",
50
+ ],
18
51
  include: [],
19
52
  compiled: null,
20
53
  };
@@ -1,52 +1,98 @@
1
- import { signedPatternIgnores, signedPatternCompile, extractPackageJson, extractGitignore, } from "../patterns/index.js";
1
+ import { type } from "arktype";
2
+ import { signedPatternIgnores, signedPatternCompile, extractPackageJsonNocase, extractGitignoreNocase, } from "../patterns/index.js";
3
+ import { join, unixify } from "../unixify.js";
2
4
  const extractors = [
3
5
  {
4
- extract: extractPackageJson,
6
+ extract: extractPackageJsonNocase,
5
7
  path: "package.json",
6
8
  },
7
9
  {
8
- extract: extractGitignore,
9
- path: ".yarnignore",
10
- },
11
- {
12
- extract: extractGitignore,
10
+ extract: extractGitignoreNocase,
13
11
  path: ".npmignore",
14
12
  },
15
13
  {
16
- extract: extractGitignore,
14
+ extract: extractGitignoreNocase,
17
15
  path: ".gitignore",
18
16
  },
19
17
  ];
18
+ const include = [
19
+ // https://github.com/yarnpkg/berry/blob/master/packages/plugin-pack/sources/packUtils.ts#L10
20
+ "/package.json",
21
+ "/README",
22
+ "/README.*",
23
+ "/LICENSE",
24
+ "/LICENSE.*",
25
+ "/LICENCE",
26
+ "/LICENCE.*",
27
+ ];
20
28
  const internal = {
21
29
  exclude: [
30
+ // https://github.com/yarnpkg/berry/blob/master/packages/plugin-pack/sources/packUtils.ts#L26
31
+ "/package.tgz",
32
+ ".github",
22
33
  ".git",
23
- ".DS_Store",
24
- "node_modules",
25
- ".*.swp",
26
- "._*",
27
- ".DS_Store",
28
- ".git",
29
- ".gitignore",
30
34
  ".hg",
35
+ "node_modules",
31
36
  ".npmignore",
32
- ".npmrc",
33
- ".lock-wscript",
34
- ".svn",
35
- ".wafpickle-*",
36
- "config.gypi",
37
- "CVS",
38
- "npm-debug.log",
39
- ".yarnignore",
40
- ".yarnrc",
37
+ ".gitignore",
38
+ ".#*",
39
+ ".DS_Store",
41
40
  ],
42
- include: ["bin", "package.json", "README*", "LICENSE*", "LICENCE*"],
41
+ include: [...include],
43
42
  compiled: null,
44
43
  };
45
- signedPatternCompile(internal);
44
+ signedPatternCompile(internal, { nocase: true });
45
+ const npmManifest = type({
46
+ "main?": "string",
47
+ "module?": "string",
48
+ "browser?": "string",
49
+ "bin?": "string | Record<string, string>",
50
+ });
51
+ const parse = type("string")
52
+ .pipe((s) => JSON.parse(s))
53
+ .pipe(npmManifest);
46
54
  /**
47
55
  * @since 0.6.0
48
56
  */
49
57
  export const Yarn = {
58
+ async init({ fs, cwd }) {
59
+ let content;
60
+ const normalCwd = unixify(cwd);
61
+ try {
62
+ content = await fs.promises.readFile(normalCwd + "/" + "package.json");
63
+ }
64
+ catch (error) {
65
+ if (error.code === "ENOENT") {
66
+ return; // no package.json
67
+ }
68
+ throw new Error("Error while initializing Yarn's ignoring implementation", { cause: error });
69
+ }
70
+ const dist = parse(content.toString());
71
+ if (dist instanceof type.errors) {
72
+ throw new Error("Invalid 'package.json': " + dist.summary, { cause: dist });
73
+ }
74
+ // https://github.com/yarnpkg/berry/blob/master/packages/plugin-pack/sources/packUtils.ts#L215-L231
75
+ const set = new Set(include);
76
+ function normal(path) {
77
+ const result = unixify(join(normalCwd, path)).substring(normalCwd.length);
78
+ return result;
79
+ }
80
+ if (dist.main)
81
+ set.add(normal(dist.main));
82
+ if (dist.module)
83
+ set.add(normal(dist.module));
84
+ if (dist.browser)
85
+ set.add(normal(dist.browser));
86
+ if (typeof dist.bin === "string") {
87
+ set.add(normal(dist.bin));
88
+ }
89
+ else if (typeof dist.bin === "object" && dist.bin !== null) {
90
+ Object.values(dist.bin).forEach((binPath) => set.add(normal(binPath)));
91
+ }
92
+ internal.include.length = 0;
93
+ internal.include.push(...set);
94
+ signedPatternCompile(internal, { nocase: true });
95
+ },
50
96
  extractors,
51
97
  ignores(o) {
52
98
  return signedPatternIgnores({
@@ -0,0 +1,5 @@
1
+ import type { Target } from "./target.js";
2
+ /**
3
+ * @since 0.8.0
4
+ */
5
+ export declare const YarnClassic: Target;
@@ -0,0 +1,77 @@
1
+ import { signedPatternIgnores, signedPatternCompile, extractPackageJsonNocase, extractGitignoreNocase, } from "../patterns/index.js";
2
+ const extractors = [
3
+ {
4
+ extract: extractPackageJsonNocase,
5
+ path: "package.json",
6
+ },
7
+ {
8
+ extract: extractGitignoreNocase,
9
+ path: ".yarnignore",
10
+ },
11
+ {
12
+ extract: extractGitignoreNocase,
13
+ path: ".npmignore",
14
+ },
15
+ {
16
+ extract: extractGitignoreNocase,
17
+ path: ".gitignore",
18
+ },
19
+ ];
20
+ const internal = {
21
+ exclude: [
22
+ // https://github.com/yarnpkg/berry/blob/master/packages/plugin-pack/sources/packUtils.ts#L26
23
+ ".git",
24
+ "CVS",
25
+ ".svn",
26
+ ".hg",
27
+ "node_modules",
28
+ "yarn.lock",
29
+ ".lock-wscript",
30
+ ".wafpickle-0",
31
+ ".wafpickle-1",
32
+ ".wafpickle-2",
33
+ ".wafpickle-3",
34
+ ".wafpickle-4",
35
+ ".wafpickle-5",
36
+ ".wafpickle-6",
37
+ ".wafpickle-7",
38
+ ".wafpickle-8",
39
+ ".wafpickle-9",
40
+ "*.swp",
41
+ "._*",
42
+ "npm-debug.log",
43
+ "yarn-error.log",
44
+ ".npmrc",
45
+ ".yarnrc",
46
+ ".yarnrc.yml",
47
+ ".npmignore",
48
+ ".gitignore",
49
+ ".DS_Store",
50
+ ],
51
+ include: [
52
+ // https://github.com/yarnpkg/berry/blob/master/packages/plugin-pack/sources/packUtils.ts#L10
53
+ "/package.json",
54
+ "/readme*",
55
+ "/license*",
56
+ "/licence*",
57
+ "/changes*",
58
+ "/changelog*",
59
+ "/history*",
60
+ ],
61
+ compiled: null,
62
+ };
63
+ signedPatternCompile(internal, { nocase: true });
64
+ /**
65
+ * @since 0.8.0
66
+ */
67
+ export const YarnClassic = {
68
+ extractors,
69
+ ignores(o) {
70
+ return signedPatternIgnores({
71
+ ...o,
72
+ internal,
73
+ root: ".",
74
+ target: YarnClassic,
75
+ });
76
+ },
77
+ };
package/out/types.d.ts CHANGED
@@ -26,7 +26,7 @@ export type ScanOptions = {
26
26
  /**
27
27
  * Current working directory to start the scan from.
28
28
  *
29
- * @default `normalizeCwd(process.cwd())`
29
+ * @default `unixify(process.cwd())`
30
30
  *
31
31
  * @since 0.6.0
32
32
  */
@@ -0,0 +1,3 @@
1
+ export declare function unixify(path: string): string;
2
+ export declare function join(from: string, p2: string): string;
3
+ export declare function relative(base: string, to: string): string;
package/out/unixify.js ADDED
@@ -0,0 +1,33 @@
1
+ const strippedCwd = strip(process.cwd());
2
+ export function unixify(path) {
3
+ let result = strip(path);
4
+ if (result.startsWith("./")) {
5
+ result = strippedCwd + result.substring(1);
6
+ }
7
+ else if (!result.startsWith("/")) {
8
+ result = strippedCwd + "/" + result;
9
+ }
10
+ return result;
11
+ }
12
+ export function join(from, p2) {
13
+ if (p2 === "." || p2 === "./") {
14
+ return from;
15
+ }
16
+ else if (p2.startsWith("./")) {
17
+ from += "/" + p2.substring(2);
18
+ }
19
+ else {
20
+ from += "/" + p2;
21
+ }
22
+ return from;
23
+ }
24
+ export function relative(base, to) {
25
+ if (!base.endsWith("/")) {
26
+ base += "/";
27
+ }
28
+ const result = to.replace(base, "");
29
+ return result;
30
+ }
31
+ function strip(path) {
32
+ return path.replaceAll("\\", "/").replace(/\w:/, "");
33
+ }
package/out/walk.js CHANGED
@@ -88,10 +88,10 @@ export async function walkIncludes(options) {
88
88
  if (lastSlash >= 0) {
89
89
  const dir = path.substring(0, lastSlash) + "/";
90
90
  const dirMatch = ctx.paths.get(dir);
91
- if (dirMatch?.ignored) {
91
+ if (dirMatch === undefined || dirMatch.ignored) {
92
92
  ctx.paths.set(dir, match);
93
93
  if (stream) {
94
- stream.emit("dirent", { dirent: entry, match, path: direntPath, ctx });
94
+ stream.emit("dirent", { dirent: entry, match, path: dir, ctx });
95
95
  }
96
96
  }
97
97
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "view-ignored",
3
- "version": "0.7.1",
3
+ "version": "0.8.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",
@@ -100,9 +100,12 @@
100
100
  "devDependencies": {
101
101
  "@release-it/keep-a-changelog": "^7.0.1",
102
102
  "@types/bun": "^1.3.8",
103
+ "@types/ignore-walk": "^4.0.3",
103
104
  "@types/node": "^18.19.130",
104
105
  "@typescript/native-preview": "^7.0.0-dev.20260209.1",
106
+ "ignore-walk": "^8.0.0",
105
107
  "memfs": "^4.56.10",
108
+ "mitata": "^1.0.34",
106
109
  "oxfmt": "^0.28.0",
107
110
  "oxlint": "^1.43.0",
108
111
  "oxlint-tsgolint": "^0.11.5",
@@ -1 +0,0 @@
1
- export declare function normalizeCwd(cwd: string): string;
@@ -1,4 +0,0 @@
1
- import { resolve } from "node:path";
2
- export function normalizeCwd(cwd) {
3
- return resolve(cwd).replaceAll("\\", "/").replace(/\w:/, "");
4
- }