knip 3.3.3 → 3.3.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.
@@ -18,7 +18,7 @@ import { getKeysByValue } from './util/object.js';
18
18
  import { join, relative, toPosix } from './util/path.js';
19
19
  import { normalizePluginConfig, toCamelCase } from './util/plugin.js';
20
20
  import { _require } from './util/require.js';
21
- import { unwrapFunction } from './util/unwrapFunction.js';
21
+ import { unwrapFunction } from './util/unwrap-function.js';
22
22
  import { byPathDepth } from './util/workspace.js';
23
23
  const { config: rawConfigArg, workspace: rawWorkspaceArg, include = [], exclude = [], dependencies = false, exports = false, } = parsedArgValues;
24
24
  const workspaceArg = rawWorkspaceArg ? toPosix(rawWorkspaceArg).replace(/^\.\//, '').replace(/\/$/, '') : undefined;
@@ -20,7 +20,9 @@ const fileExists = (name, containingFile) => {
20
20
  export function createCustomModuleResolver(customSys, compilerOptions, virtualFileExtensions) {
21
21
  function resolveModuleNames(moduleNames, containingFile) {
22
22
  return moduleNames.map(moduleName => {
23
- const key = `${containingFile}:${moduleName}`;
23
+ const key = moduleName.startsWith('.')
24
+ ? join(dirname(containingFile), moduleName)
25
+ : `${containingFile}:${moduleName}`;
24
26
  if (resolutionCache.has(key))
25
27
  return resolutionCache.get(key);
26
28
  const resolvedModule = resolveModuleName(moduleName, containingFile);
@@ -1,4 +1,4 @@
1
- import { parseArgs } from './parseArgs.js';
1
+ import { parseArgs } from './parse-args.js';
2
2
  export const helpText = `✂️ Find unused files, dependencies and exports in your JavaScript and TypeScript projects
3
3
 
4
4
  Usage: knip [options]
package/dist/util/git.js CHANGED
@@ -8,7 +8,7 @@ const hookFileNames = [
8
8
  ];
9
9
  const getGitHooksPath = (defaultPath = '.git/hooks') => {
10
10
  try {
11
- return execSync('git config --get core.hooksPath', { encoding: 'utf8' }).trim();
11
+ return execSync('git config --get core.hooksPath 2>/dev/null', { encoding: 'utf8' }).trim();
12
12
  }
13
13
  catch (error) {
14
14
  return defaultPath;
@@ -0,0 +1 @@
1
+ export declare const unwrapFunction: (maybeFunction: unknown) => Promise<any>;
@@ -1,13 +1,13 @@
1
1
  import { debugLogObject } from './debug.js';
2
- export const unwrapFunction = async (possibleFunction) => {
3
- if (typeof possibleFunction === 'function') {
2
+ export const unwrapFunction = async (maybeFunction) => {
3
+ if (typeof maybeFunction === 'function') {
4
4
  try {
5
- return await possibleFunction();
5
+ return await maybeFunction();
6
6
  }
7
7
  catch (error) {
8
8
  debugLogObject('*', 'Error executing function:', error);
9
9
  throw error;
10
10
  }
11
11
  }
12
- return possibleFunction;
12
+ return maybeFunction;
13
13
  };
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "3.3.3";
1
+ export declare const version = "3.3.5";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '3.3.3';
1
+ export const version = '3.3.5';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knip",
3
- "version": "3.3.3",
3
+ "version": "3.3.5",
4
4
  "description": "Find unused files, dependencies and exports in your TypeScript and JavaScript projects",
5
5
  "homepage": "https://knip.dev",
6
6
  "repository": {
@@ -72,21 +72,21 @@
72
72
  "@npmcli/package-json": "5.0.0",
73
73
  "@release-it/bumper": "^6.0.1",
74
74
  "@swc/cli": "^0.1.63",
75
- "@swc/core": "^1.3.99",
75
+ "@swc/core": "^1.3.100",
76
76
  "@types/js-yaml": "^4.0.9",
77
77
  "@types/micromatch": "^4.0.6",
78
78
  "@types/minimist": "^1.2.5",
79
- "@types/node": "^20.10.0",
79
+ "@types/node": "^20.10.1",
80
80
  "@types/npmcli__map-workspaces": "^3.0.4",
81
81
  "@types/npmcli__package-json": "^4.0.3",
82
82
  "@types/pkgjs__parseargs": "^0.10.3",
83
83
  "@types/webpack": "^5.28.5",
84
84
  "c8": "8.0.1",
85
85
  "eslint": "^8.54.0",
86
- "playwright": "^1.40.0",
86
+ "playwright": "^1.40.1",
87
87
  "prettier": "^3.1.0",
88
88
  "release-it": "^17.0.0",
89
- "tsx": "^4.5.0",
89
+ "tsx": "^4.6.1",
90
90
  "type-fest": "^4.8.2",
91
91
  "typescript": "5.3.2"
92
92
  },
@@ -1 +0,0 @@
1
- export declare const unwrapFunction: (possibleFunction: unknown) => Promise<any>;
File without changes
File without changes