knip 5.84.0 → 5.84.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.
@@ -63,7 +63,7 @@ const commands = [
63
63
  ];
64
64
  export const resolve = (_binary, args, options) => {
65
65
  const parsed = parseArgs(args, {
66
- boolean: ['recursive', 'silent', 'shell-mode'],
66
+ boolean: ['aggregate-output', 'if-present', 'parallel', 'recursive', 'reverse', 'shell-mode', 'silent', 'stream'],
67
67
  alias: { recursive: 'r', silent: 's', 'shell-mode': 'c', filter: 'F' },
68
68
  '--': true,
69
69
  });
@@ -97,6 +97,22 @@ export default visit(() => true, node => {
97
97
  namespace: undefined,
98
98
  }));
99
99
  }
100
+ const hasFunctionBoundary = findAncestor(node, _node => {
101
+ if (_node === variableDeclaration)
102
+ return 'STOP';
103
+ return ts.isArrowFunction(_node);
104
+ });
105
+ if (hasFunctionBoundary) {
106
+ return {
107
+ identifier: undefined,
108
+ specifier,
109
+ pos: node.arguments[0].pos,
110
+ modifiers: IMPORT_FLAGS.OPAQUE,
111
+ alias: undefined,
112
+ namespace: undefined,
113
+ symbol: undefined,
114
+ };
115
+ }
100
116
  return {
101
117
  identifier: 'default',
102
118
  alias,
@@ -10,7 +10,14 @@ export default visit(sourceFile => sourceFile.statements.some(isNodeModuleImport
10
10
  isPropertyAccessCall(node, 'module.register')) {
11
11
  if (node.arguments[0] && ts.isStringLiteralLike(node.arguments[0])) {
12
12
  const specifier = node.arguments[0].text;
13
- if (specifier)
13
+ const arg1 = node.arguments[1];
14
+ if (specifier &&
15
+ (!specifier.startsWith('.') ||
16
+ (arg1 &&
17
+ ts.isPropertyAccessExpression(arg1) &&
18
+ ts.isMetaProperty(arg1.expression) &&
19
+ arg1.expression.keywordToken === ts.SyntaxKind.ImportKeyword &&
20
+ arg1.name.text === 'url')))
14
21
  return {
15
22
  specifier,
16
23
  identifier: undefined,
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "5.84.0";
1
+ export declare const version = "5.84.1";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '5.84.0';
1
+ export const version = '5.84.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knip",
3
- "version": "5.84.0",
3
+ "version": "5.84.1",
4
4
  "description": "Find and fix unused dependencies, exports and files in your TypeScript and JavaScript projects",
5
5
  "homepage": "https://knip.dev",
6
6
  "repository": {