view-ignored 0.8.0 → 0.9.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.
@@ -1,4 +1,7 @@
1
+ import { type } from "arktype";
1
2
  import { signedPatternIgnores, signedPatternCompile, extractPackageJsonNocase, extractGitignoreNocase, } from "../patterns/index.js";
3
+ import { unixify } from "../unixify.js";
4
+ import { npmManifestParse } from "./npmManifest.js";
2
5
  const extractors = [
3
6
  {
4
7
  extract: extractPackageJsonNocase,
@@ -17,54 +20,74 @@ const extractors = [
17
20
  path: ".gitignore",
18
21
  },
19
22
  ];
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 });
23
+ const internal = [
24
+ signedPatternCompile({
25
+ excludes: true,
26
+ pattern: [
27
+ // https://github.com/yarnpkg/berry/blob/master/packages/plugin-pack/sources/packUtils.ts#L26
28
+ ".git",
29
+ "CVS",
30
+ ".svn",
31
+ ".hg",
32
+ "node_modules",
33
+ "yarn.lock",
34
+ ".lock-wscript",
35
+ ".wafpickle-0",
36
+ ".wafpickle-1",
37
+ ".wafpickle-2",
38
+ ".wafpickle-3",
39
+ ".wafpickle-4",
40
+ ".wafpickle-5",
41
+ ".wafpickle-6",
42
+ ".wafpickle-7",
43
+ ".wafpickle-8",
44
+ ".wafpickle-9",
45
+ "*.swp",
46
+ "._*",
47
+ "npm-debug.log",
48
+ "yarn-error.log",
49
+ ".npmrc",
50
+ ".yarnrc",
51
+ ".yarnrc.yml",
52
+ ".npmignore",
53
+ ".gitignore",
54
+ ".DS_Store",
55
+ ],
56
+ compiled: null,
57
+ }, { nocase: true }),
58
+ signedPatternCompile({
59
+ excludes: false,
60
+ pattern: [
61
+ // https://github.com/yarnpkg/berry/blob/master/packages/plugin-pack/sources/packUtils.ts#L10
62
+ "/package.json",
63
+ "/readme*",
64
+ "/license*",
65
+ "/licence*",
66
+ "/changes*",
67
+ "/changelog*",
68
+ "/history*",
69
+ ],
70
+ compiled: null,
71
+ }, { nocase: true }),
72
+ ];
64
73
  /**
65
74
  * @since 0.8.0
66
75
  */
67
76
  export const YarnClassic = {
77
+ async init({ fs, cwd }) {
78
+ let content;
79
+ const normalCwd = unixify(cwd);
80
+ try {
81
+ content = await fs.promises.readFile(normalCwd + "/" + "package.json");
82
+ }
83
+ catch (error) {
84
+ throw new Error("Error while initializing Yarn classic", { cause: error });
85
+ }
86
+ const dist = npmManifestParse(content.toString());
87
+ if (dist instanceof type.errors) {
88
+ throw new Error("Invalid 'package.json': " + dist.summary, { cause: dist });
89
+ }
90
+ },
68
91
  extractors,
69
92
  ignores(o) {
70
93
  return signedPatternIgnores({
package/out/unixify.d.ts CHANGED
@@ -1,3 +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;
package/out/unixify.js CHANGED
@@ -28,6 +28,9 @@ export function relative(base, to) {
28
28
  const result = to.replace(base, "");
29
29
  return result;
30
30
  }
31
+ export function base(path) {
32
+ return path.substring(path.lastIndexOf("/") + 1);
33
+ }
31
34
  function strip(path) {
32
35
  return path.replaceAll("\\", "/").replace(/\w:/, "");
33
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "view-ignored",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "Retrieve list of files ignored/included by Git, NPM, Yarn, JSR, VSCE or other tools.",
5
5
  "keywords": [
6
6
  ".gitignore",
@@ -77,6 +77,9 @@
77
77
  },
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
+ "cpu": "bun run cpu:igw; bun run cpu:me",
81
+ "cpu:igw": "bun run --cpu-prof-md --cpu-prof-name CPU.igw.md scripts/ignoreWalk.js",
82
+ "cpu:me": "bun run --cpu-prof-md --cpu-prof-name CPU.me.md scripts/scan.js --fastInternal",
80
83
  "test": "bun test src",
81
84
  "test:patterns": "bun test src/patterns",
82
85
  "test:targets": "bun test src/targets",
@@ -94,21 +97,21 @@
94
97
  },
95
98
  "dependencies": {
96
99
  "arktype": "^2.1.29",
97
- "minimatch": "^10.1.2",
100
+ "minimatch": "^10.2.2",
98
101
  "strip-json-comments": "^5.0.3"
99
102
  },
100
103
  "devDependencies": {
101
104
  "@release-it/keep-a-changelog": "^7.0.1",
102
- "@types/bun": "^1.3.8",
105
+ "@types/bun": "^1.3.9",
103
106
  "@types/ignore-walk": "^4.0.3",
104
107
  "@types/node": "^18.19.130",
105
- "@typescript/native-preview": "^7.0.0-dev.20260209.1",
108
+ "@typescript/native-preview": "^7.0.0-dev.20260223.1",
106
109
  "ignore-walk": "^8.0.0",
107
110
  "memfs": "^4.56.10",
108
111
  "mitata": "^1.0.34",
109
- "oxfmt": "^0.28.0",
110
- "oxlint": "^1.43.0",
111
- "oxlint-tsgolint": "^0.11.5",
112
+ "oxfmt": "^0.35.0",
113
+ "oxlint": "^1.50.0",
114
+ "oxlint-tsgolint": "^0.14.2",
112
115
  "publint": "^0.3.17",
113
116
  "release-it": "^19.2.4"
114
117
  },