knip 4.2.1 → 4.2.3

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.
@@ -7,6 +7,7 @@ const withoutPositional = parsed => [parsed.require].flat();
7
7
  const withoutRequire = () => [];
8
8
  const argFilters = {
9
9
  adb: withoutRequire,
10
+ deploy: withoutRequire,
10
11
  'babel-node': withPositional,
11
12
  esbuild: withPositional,
12
13
  execa: withPositional,
@@ -8,7 +8,8 @@ const ENABLERS = ['typescript'];
8
8
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
9
9
  const CONFIG_FILE_PATTERNS = ['tsconfig.json', 'tsconfig.*.json'];
10
10
  const resolveExtensibleConfig = async (configFilePath) => {
11
- const localConfig = await loadJSON(configFilePath);
11
+ const filePath = configFilePath.replace(/(\.json)?$/, '.json');
12
+ const localConfig = await loadJSON(filePath);
12
13
  if (!localConfig)
13
14
  return;
14
15
  localConfig.extends = localConfig.extends ? [localConfig.extends].flat() : [];
@@ -3,7 +3,7 @@ import ts from 'typescript';
3
3
  import { isStartsLikePackageName, sanitizeSpecifier } from '../util/modules.js';
4
4
  import { isInNodeModules } from '../util/path.js';
5
5
  import { timerify } from '../util/Performance.js';
6
- import { isDeclarationFileExtension, isAccessExpression, getJSDocTags, getLineAndCharacterOfPosition, getMemberStringLiterals, } from './ast-helpers.js';
6
+ import { isAccessExpression, getJSDocTags, getLineAndCharacterOfPosition, getMemberStringLiterals, } from './ast-helpers.js';
7
7
  import getDynamicImportVisitors from './visitors/dynamic-imports/index.js';
8
8
  import getExportVisitors from './visitors/exports/index.js';
9
9
  import { getJSXImplicitImportBase } from './visitors/helpers.js';
@@ -93,12 +93,7 @@ const getImportsAndExports = (sourceFile, getResolvedModule, typeChecker, option
93
93
  if (!isStartsLikePackageName(sanitizedSpecifier)) {
94
94
  return;
95
95
  }
96
- if (isDeclarationFileExtension(module.resolvedModule.extension)) {
97
- externalImports.add(sanitizedSpecifier);
98
- }
99
- else {
100
- externalImports.add(module.resolvedModule.packageId?.name ?? sanitizedSpecifier);
101
- }
96
+ externalImports.add(sanitizedSpecifier);
102
97
  }
103
98
  else {
104
99
  addInternalImport({ ...options, identifier, filePath, isReExport });
@@ -1,4 +1,4 @@
1
- import { parseArgs } from './parse-args.js';
1
+ import { parseArgs } from 'node:util';
2
2
  export const helpText = `✂️ Find unused files, dependencies and exports in your JavaScript and TypeScript projects
3
3
 
4
4
  Usage: knip [options]
@@ -1,3 +1,3 @@
1
- export declare const FAKE_PATH = "__FAKE__";
1
+ export declare const FAKE_PATH = "__FAKE__.json";
2
2
  export declare const _load: (filePath: string) => Promise<any>;
3
3
  export declare const _loadFile: (filePath: string) => Promise<string | undefined>;
@@ -5,7 +5,7 @@ import { isTypeModule } from './fs.js';
5
5
  import { extname } from './path.js';
6
6
  import { timerify } from './Performance.js';
7
7
  import { jitiCJS, jitiESM } from './register.js';
8
- export const FAKE_PATH = '__FAKE__';
8
+ export const FAKE_PATH = '__FAKE__.json';
9
9
  const load = async (filePath) => {
10
10
  if (filePath === FAKE_PATH)
11
11
  return;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "4.2.1";
1
+ export declare const version = "4.2.3";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '4.2.1';
1
+ export const version = '4.2.3';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knip",
3
- "version": "4.2.1",
3
+ "version": "4.2.3",
4
4
  "description": "Find unused files, dependencies and exports in your TypeScript and JavaScript projects",
5
5
  "homepage": "https://knip.dev",
6
6
  "repository": {
@@ -57,9 +57,8 @@
57
57
  "@nodelib/fs.walk": "2.0.0",
58
58
  "@npmcli/map-workspaces": "3.0.4",
59
59
  "@npmcli/package-json": "5.0.0",
60
- "@pkgjs/parseargs": "0.11.0",
61
60
  "@pnpm/logger": "5.0.0",
62
- "@pnpm/workspace.pkgs-graph": "^2.0.13",
61
+ "@pnpm/workspace.pkgs-graph": "^2.0.14",
63
62
  "@snyk/github-codeowners": "1.1.0",
64
63
  "@types/picomatch": "2.3.3",
65
64
  "easy-table": "1.2.0",
@@ -70,8 +69,8 @@
70
69
  "minimist": "1.2.8",
71
70
  "picocolors": "1.0.0",
72
71
  "picomatch": "3.0.1",
73
- "pretty-ms": "8.0.0",
74
- "smol-toml": "1.1.3",
72
+ "pretty-ms": "9.0.0",
73
+ "smol-toml": "1.1.4",
75
74
  "strip-json-comments": "5.0.1",
76
75
  "summary": "2.1.0",
77
76
  "zod": "3.22.4",
@@ -85,22 +84,21 @@
85
84
  "@jest/types": "29.6.3",
86
85
  "@knip/eslint-config": "0.0.0",
87
86
  "@release-it/bumper": "^6.0.1",
88
- "@swc/cli": "^0.1.63",
89
- "@swc/core": "^1.3.104",
87
+ "@swc/cli": "^0.1.65",
88
+ "@swc/core": "^1.3.107",
90
89
  "@types/js-yaml": "^4.0.9",
91
90
  "@types/micromatch": "^4.0.6",
92
91
  "@types/minimist": "^1.2.5",
93
92
  "@types/npmcli__map-workspaces": "^3.0.4",
94
93
  "@types/npmcli__package-json": "^4.0.3",
95
- "@types/pkgjs__parseargs": "^0.10.3",
96
94
  "@types/webpack": "^5.28.5",
97
95
  "c8": "9.1.0",
98
96
  "eslint": "^8.56.0",
99
- "playwright": "^1.41.0",
97
+ "playwright": "^1.41.1",
100
98
  "prettier": "^3.2.4",
101
- "release-it": "^17.0.1",
99
+ "release-it": "^17.0.3",
102
100
  "tsx": "^4.7.0",
103
- "type-fest": "^4.9.0",
101
+ "type-fest": "^4.10.1",
104
102
  "typescript": "5.3.3"
105
103
  },
106
104
  "engines": {
@@ -1,3 +0,0 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- declare let parseArgs: typeof import('node:util').parseArgs;
3
- export { parseArgs };
@@ -1,8 +0,0 @@
1
- let parseArgs;
2
- if (process.versions.bun) {
3
- parseArgs = (await import('@pkgjs/parseargs')).parseArgs;
4
- }
5
- else {
6
- parseArgs = (await import('node:util')).parseArgs;
7
- }
8
- export { parseArgs };