knip 5.50.3 → 5.50.4

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.
@@ -1,3 +1,4 @@
1
+ import { toDependency } from '../../util/input.js';
1
2
  import { hasDependency } from '../../util/plugin.js';
2
3
  const title = 'simple-git-hooks';
3
4
  const enablers = ['simple-git-hooks'];
@@ -13,7 +14,7 @@ const resolveConfig = async (config, options) => {
13
14
  for (const id of options.getInputsFromScripts(hook))
14
15
  inputs.add(id);
15
16
  }
16
- return Array.from(inputs);
17
+ return [toDependency('simple-git-hooks'), ...Array.from(inputs)];
17
18
  };
18
19
  export default {
19
20
  title,
@@ -4,8 +4,8 @@ import { debugLog } from './debug.js';
4
4
  import { isDirectory } from './fs.js';
5
5
  import { isInternal, join, toRelative } from './path.js';
6
6
  const defaultExtensions = `.{${DEFAULT_EXTENSIONS.map(ext => ext.slice(1)).join(',')}}`;
7
- const hasJSExt = /\.(m|c)js$/;
8
7
  const hasTSExt = /(?<!\.d)\.(m|c)?tsx?$/;
8
+ const hasDTSExt = /.d\.(m|c)?ts$/;
9
9
  const matchExt = /(\.d)?\.(m|c)?(j|t)s$/;
10
10
  export const augmentWorkspace = (workspace, dir, compilerOptions) => {
11
11
  const srcDir = join(dir, 'src');
@@ -15,13 +15,14 @@ export const augmentWorkspace = (workspace, dir, compilerOptions) => {
15
15
  export const getToSourcePathHandler = (chief) => {
16
16
  const toSourceMapCache = new Map();
17
17
  return (filePath) => {
18
- if (!isInternal(filePath) || hasJSExt.test(filePath) || hasTSExt.test(filePath))
18
+ if (!isInternal(filePath) || hasTSExt.test(filePath))
19
19
  return;
20
20
  if (toSourceMapCache.has(filePath))
21
21
  return toSourceMapCache.get(filePath);
22
22
  const workspace = chief.findWorkspaceByFilePath(filePath);
23
23
  if (workspace?.srcDir && workspace.outDir) {
24
- if (filePath.startsWith(workspace.outDir)) {
24
+ if ((!filePath.startsWith(workspace.srcDir) && filePath.startsWith(workspace.outDir)) ||
25
+ (workspace.srcDir === workspace.outDir && hasDTSExt.test(filePath))) {
25
26
  const pattern = filePath.replace(workspace.outDir, workspace.srcDir).replace(matchExt, defaultExtensions);
26
27
  const [srcFilePath] = fastGlob.sync(pattern);
27
28
  toSourceMapCache.set(filePath, srcFilePath);
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "5.50.3";
1
+ export declare const version = "5.50.4";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '5.50.3';
1
+ export const version = '5.50.4';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knip",
3
- "version": "5.50.3",
3
+ "version": "5.50.4",
4
4
  "description": "Find and fix unused files, dependencies and exports in your TypeScript and JavaScript projects",
5
5
  "homepage": "https://knip.dev",
6
6
  "repository": {