view-ignored 0.4.4 → 0.4.5

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 CHANGED
@@ -10,7 +10,7 @@ tools.
10
10
 
11
11
  ## Requirements
12
12
 
13
- Requires Node.js vXX or later.
13
+ Requires Node.js v18 or later.
14
14
 
15
15
  ## Highlights
16
16
 
@@ -48,6 +48,7 @@ view-ignored --help
48
48
  # scan: git (default) and npm
49
49
  viewig scan
50
50
  viewig scan --target=npm
51
+ viewig sc -t npm
51
52
  viewig scan --parsable
52
53
 
53
54
  # scan: plugins (space, comma or pipe separated)
package/bin/viewig CHANGED
File without changes
@@ -3,6 +3,7 @@ import { z } from 'zod';
3
3
  import { BadSourceError, Directory, InvalidPatternError, } from '../../index.js';
4
4
  import { ScannerGitignore } from '../scanner.js';
5
5
  import * as git from './git.js';
6
+ import stripJsonComments from 'strip-json-comments';
6
7
  const id = 'jsr';
7
8
  const name = 'JSR';
8
9
  const icon = {
@@ -24,7 +25,10 @@ export function isValidManifestJsr(value) {
24
25
  return z.object({
25
26
  name: z.string(),
26
27
  version: z.string(),
27
- exports: z.string(),
28
+ exports: z.union([
29
+ z.string(),
30
+ z.record(z.string(), z.string()),
31
+ ]).optional(),
28
32
  exclude: z.array(z.string()).optional(),
29
33
  include: z.array(z.string()).optional(),
30
34
  publish: z.object({
@@ -59,9 +63,13 @@ export const sourceSearch = (priority, scanner) => function (tree, o) {
59
63
  continue;
60
64
  }
61
65
  if (/^(deno|jsr).jsonc?$/.test(sourceFile.base)) {
62
- const manifest = JSON.parse(o.modules.fs.readFileSync(sourceFile.absolutePath).toString());
66
+ let manifestString = o.modules.fs.readFileSync(sourceFile.absolutePath).toString();
67
+ if (sourceFile.base[sourceFile.base.length - 1] === 'c') {
68
+ manifestString = stripJsonComments(manifestString, { whitespace: false, trailingCommas: false });
69
+ }
70
+ const manifest = JSON.parse(manifestString);
63
71
  if (!isValidManifestJsr(manifest)) {
64
- throw new BadSourceError(sourceFile, 'Must have \'name\', \'version\'.');
72
+ throw new BadSourceError(sourceFile, 'Must have \'name\', \'version\', valid \'export\', \'exclude\' and \'include\'.');
65
73
  }
66
74
  const { exclude, include, publish } = manifest;
67
75
  if (exclude === undefined && include === undefined
@@ -55,20 +55,16 @@ export class ScannerMinimatch {
55
55
  }
56
56
  isMatch(p, pattern, options) {
57
57
  const patternList = pattern.split('\n');
58
- const positiveList = [], negativeList = [];
59
- for (const pat of patternList) {
58
+ while (patternList.length) {
59
+ const pat = patternList.pop();
60
+ if (!/^[*/]$/.test(pat[pat.length - 1])) {
61
+ patternList.push(pat + '/**');
62
+ }
60
63
  if (pat[0] === '!') {
61
- negativeList.push(pat.substring(1));
62
- continue;
64
+ if (!isMatch(p, pat.substring(1), options))
65
+ continue;
66
+ return false;
63
67
  }
64
- positiveList.push(pat);
65
- }
66
- for (const pat of negativeList) {
67
- if (!isMatch(p, pat, options))
68
- continue;
69
- return false;
70
- }
71
- for (const pat of positiveList) {
72
68
  if (!isMatch(p, pat, options))
73
69
  continue;
74
70
  return true;
package/out/cli.js CHANGED
@@ -302,8 +302,8 @@ export async function actionScan() {
302
302
  if (bind.testCommand) {
303
303
  message += '\n';
304
304
  message += `${chalk.blue(infoSymbol)}You can use ${highlight(`'${bind.testCommand}'`, chalk)} to check if the list is valid.`;
305
+ message += '\n';
305
306
  }
306
- message += '\n';
307
307
  context.message = message;
308
308
  }
309
309
  catch (error) {
package/out/styling.js CHANGED
@@ -13,9 +13,9 @@ export function highlight(text, chalk) {
13
13
  const rbracketsSquare = /(\[|])/g;
14
14
  const rnumber = /\d+/g;
15
15
  const rspecial = /(true|false|null|Infinity)/g;
16
- const rall = new RegExp(`${[ansiRegex(), rstring, rseparator, rbracketsSquare, rnumber, rspecial]
16
+ const rall = new RegExp([ansiRegex(), rstring, rseparator, rbracketsSquare, rnumber, rspecial]
17
17
  .map(r => `(${typeof r === 'string' ? r : r.source})`)
18
- .join('|')}`, 'g');
18
+ .join('|'), 'g');
19
19
  const colored = text.replaceAll(rall, (match) => {
20
20
  if (match.match(ansiRegex()) !== null) {
21
21
  return match;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "view-ignored",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
4
4
  "description": "Retrieve list of files ignored/included by Git, NPM, Yarn, JSR, VSCE or other tools.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -11,7 +11,7 @@
11
11
  "prerelease": "bun run build:pub && bun run lint",
12
12
  "test": "bun run node --test out/**/*.test.js",
13
13
  "build": "bun run build:clean && bun run tsc -p src",
14
- "build:pub": "bun run build:clean && bun run tsc -p src --sourceMap false && rm **/*.test.d.ts",
14
+ "build:pub": "bun run build:clean && bun run tsc -p src --sourceMap false && rm -rf **/*.test.*",
15
15
  "build:watch": "bun run build:clean && bun run tsc -p src --watch",
16
16
  "build:clean": "rm -rf out",
17
17
  "lint": "bun run eslint .",
@@ -35,6 +35,9 @@
35
35
  "url": "https://github.com/Mopsgamer/view-ignored/issues"
36
36
  },
37
37
  "homepage": "https://github.com/Mopsgamer/view-ignored",
38
+ "engines": {
39
+ "node": ">=18"
40
+ },
38
41
  "exports": {
39
42
  ".": {
40
43
  "default": "./out/index.js",
@@ -81,6 +84,7 @@
81
84
  "minimatch": "^10.0.3",
82
85
  "ora": "^8.2.0",
83
86
  "p-limit": "^6.2.0",
87
+ "strip-json-comments": "^5.0.2",
84
88
  "treeify": "^1.1.0",
85
89
  "yaml": "^2.8.0",
86
90
  "zod": "^3.25.75"
@@ -89,7 +93,7 @@
89
93
  "@eslint/js": "^9.30.1",
90
94
  "@release-it/keep-a-changelog": "^7.0.0",
91
95
  "@stylistic/eslint-plugin": "^5.1.0",
92
- "@types/node": "^24.0.10",
96
+ "@types/node": "18",
93
97
  "@types/treeify": "^1.0.3",
94
98
  "eslint": "^9.30.1",
95
99
  "fs-fixture": "^2.8.1",