knip 2.19.6 → 2.19.7

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.
@@ -58,6 +58,7 @@ export declare class ProjectPrincipal {
58
58
  };
59
59
  findUnusedMembers(filePath: string, members: ExportItemMember[]): string[];
60
60
  private findReferences;
61
- isPublicExport(exportedItem: ExportItem): ts.JSDocPublicTag | undefined;
61
+ isPublicExport(exportedItem: ExportItem): boolean;
62
+ getJSDocTags(exportedItem: ExportItem): string[];
62
63
  }
63
64
  export {};
@@ -195,6 +195,10 @@ export class ProjectPrincipal {
195
195
  return this.backend.lsFindReferences(filePath, node.getStart()) ?? [];
196
196
  }
197
197
  isPublicExport(exportedItem) {
198
- return ts.getJSDocPublicTag(exportedItem.node);
198
+ const tags = this.getJSDocTags(exportedItem);
199
+ return tags.includes('@public');
200
+ }
201
+ getJSDocTags(exportedItem) {
202
+ return ts.getJSDocTags(exportedItem.node).map(node => node.getText().match(/@\S+/)[0]);
199
203
  }
200
204
  }
@@ -2,38 +2,54 @@ import parseArgs from 'minimist';
2
2
  import { toBinary } from '../util.js';
3
3
  const commands = [
4
4
  'add',
5
+ 'audit',
6
+ 'bin',
7
+ 'config',
5
8
  'dedupe',
9
+ 'deploy',
6
10
  'dlx',
7
- 'run',
11
+ 'doctor',
12
+ 'env',
13
+ 'fetch',
8
14
  'i',
9
- 'install',
10
- 'up',
11
- 'update',
12
- 'upgrade',
13
- 'remove',
14
- 'rm',
15
- 'uninstall',
16
- 'un',
17
- 'link',
18
- 'ln',
19
- 'unlink',
20
15
  'import',
21
- 'rebuild',
22
- 'rb',
23
- 'prune',
24
- 'fetch',
16
+ 'init',
25
17
  'install-test',
18
+ 'install',
26
19
  'it',
27
- 'patch',
28
- 'patch-commit',
29
- 'audit',
20
+ 'licenses',
21
+ 'link',
30
22
  'list',
23
+ 'ln',
31
24
  'ls',
32
25
  'outdated',
33
- 'why',
34
- 'test',
26
+ 'outdated',
27
+ 'pack',
28
+ 'patch-commit',
29
+ 'patch-remove',
30
+ 'patch',
31
+ 'prune',
32
+ 'publish',
33
+ 'rb',
34
+ 'rebuild',
35
+ 'remove',
36
+ 'rm',
37
+ 'root',
38
+ 'run',
39
+ 'server',
40
+ 'setup',
41
+ 'start',
42
+ 'store',
35
43
  't',
44
+ 'test',
36
45
  'tst',
46
+ 'un',
47
+ 'uninstall',
48
+ 'unlink',
49
+ 'up',
50
+ 'update',
51
+ 'upgrade',
52
+ 'why',
37
53
  ];
38
54
  export const resolve = (_binary, args, { manifest }) => {
39
55
  const scripts = manifest.scripts ? Object.keys(manifest.scripts) : [];
@@ -14,8 +14,8 @@ const commands = [
14
14
  'install',
15
15
  'link',
16
16
  'pack',
17
- 'patch',
18
17
  'patch-commit',
18
+ 'patch',
19
19
  'plugin',
20
20
  'rebuild',
21
21
  'remove',
@@ -25,8 +25,8 @@ const commands = [
25
25
  'unlink',
26
26
  'unplug',
27
27
  'up',
28
- 'upgrade',
29
28
  'upgrade-interactive',
29
+ 'upgrade',
30
30
  'version',
31
31
  'why',
32
32
  'workspace',
package/dist/index.js CHANGED
@@ -267,7 +267,8 @@ export const main = async (unresolvedConfiguration) => {
267
267
  continue;
268
268
  const importedModule = importedSymbols.get(filePath);
269
269
  for (const [symbol, exportedItem] of exportItems.entries()) {
270
- if (principal.isPublicExport(exportedItem))
270
+ const jsDocTags = principal.getJSDocTags(exportedItem);
271
+ if (jsDocTags.includes('@public') || jsDocTags.includes('@beta'))
271
272
  continue;
272
273
  if (importedModule?.symbols.has(symbol)) {
273
274
  if (importedModule.isReExport && isExportedInEntryFile(importedModule))
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "2.19.6";
1
+ export declare const version = "2.19.7";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '2.19.6';
1
+ export const version = '2.19.7';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knip",
3
- "version": "2.19.6",
3
+ "version": "2.19.7",
4
4
  "description": "Find unused files, dependencies and exports in your TypeScript and JavaScript projects",
5
5
  "homepage": "https://github.com/webpro/knip",
6
6
  "repository": "github:webpro/knip",