knip 3.13.0 → 3.13.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.
@@ -5,14 +5,13 @@ export const ENABLERS = ['next'];
5
5
  export const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
6
6
  export const ENTRY_FILE_PATTERNS = ['next.config.{js,ts,cjs,mjs}'];
7
7
  const productionEntryFilePatternsWithoutSrc = [
8
- 'middleware.{js,ts}',
9
- 'app/**/route.{js,ts}',
8
+ '{instrumentation,middleware}.{js,ts}',
10
9
  'app/global-error.{js,jsx,ts,tsx}',
11
10
  'app/**/{error,layout,loading,not-found,page,template}.{js,jsx,ts,tsx}',
12
- 'instrumentation.{js,ts}',
11
+ 'app/**/{route,default}.{js,ts}',
13
12
  'app/{manifest,sitemap,robots}.{js,ts}',
14
- 'app/**/{icon,apple-icon}.{js,ts,tsx}',
15
- 'app/**/{opengraph,twitter}-image.{js,ts,tsx}',
13
+ 'app/**/{icon,apple-icon}.{js,jsx,ts,tsx}',
14
+ 'app/**/{opengraph,twitter}-image.{js,jsx,ts,tsx}',
16
15
  'pages/**/*.{js,jsx,ts,tsx}',
17
16
  ];
18
17
  export const PRODUCTION_ENTRY_FILE_PATTERNS = [
@@ -1,14 +1,14 @@
1
1
  import { compact } from '../../util/array.js';
2
2
  import { dirname, isInternal, toAbsolute } from '../../util/path.js';
3
3
  import { timerify } from '../../util/Performance.js';
4
- import { hasDependency, load } from '../../util/plugin.js';
4
+ import { hasDependency, loadJSON } from '../../util/plugin.js';
5
5
  import { loadTSConfig } from '../../util/tsconfig-loader.js';
6
6
  export const NAME = 'TypeScript';
7
7
  export const ENABLERS = ['typescript'];
8
8
  export const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
9
9
  export const CONFIG_FILE_PATTERNS = ['tsconfig.json', 'tsconfig.*.json'];
10
10
  const resolveExtensibleConfig = async (configFilePath) => {
11
- const localConfig = await load(configFilePath);
11
+ const localConfig = await loadJSON(configFilePath);
12
12
  if (!localConfig)
13
13
  return;
14
14
  localConfig.extends = localConfig.extends ? [localConfig.extends].flat() : [];
package/dist/util/fs.d.ts CHANGED
@@ -7,3 +7,4 @@ export declare const loadYAML: (filePath: string) => Promise<unknown>;
7
7
  export declare const parseJSON: (filePath: string, contents: string) => Promise<any>;
8
8
  export declare const parseYAML: (contents: string) => Promise<unknown>;
9
9
  export declare function isTypeModule(path: string): boolean;
10
+ export declare const _loadJSON: (filePath: string) => Promise<any>;
package/dist/util/fs.js CHANGED
@@ -3,7 +3,9 @@ import { readFile } from 'node:fs/promises';
3
3
  import yaml from 'js-yaml';
4
4
  import stripJsonComments from 'strip-json-comments';
5
5
  import { LoaderError } from './errors.js';
6
+ import { FAKE_PATH } from './loader.js';
6
7
  import { dirname, join } from './path.js';
8
+ import { timerify } from './Performance.js';
7
9
  export const isDirectory = (filePath) => {
8
10
  const stat = statSync(filePath, { throwIfNoEntry: false });
9
11
  return stat !== undefined && stat.isDirectory();
@@ -26,6 +28,8 @@ export const loadFile = async (filePath) => {
26
28
  }
27
29
  };
28
30
  export const loadJSON = async (filePath) => {
31
+ if (filePath === FAKE_PATH)
32
+ return;
29
33
  const contents = await loadFile(filePath);
30
34
  return parseJSON(filePath, contents);
31
35
  };
@@ -59,3 +63,4 @@ export function isTypeModule(path) {
59
63
  }
60
64
  return false;
61
65
  }
66
+ export const _loadJSON = timerify(loadJSON);
@@ -1,4 +1,5 @@
1
1
  export { _load as load, _loadFile as loadFile } from './loader.js';
2
+ export { _loadJSON as loadJSON } from './fs.js';
2
3
  export { _tryResolve as tryResolve } from './require.js';
3
4
  export { _getDependenciesFromScripts as getDependenciesFromScripts } from '../binaries/index.js';
4
5
  import type { RawPluginConfiguration } from '../types/config.js';
@@ -1,4 +1,5 @@
1
1
  export { _load as load, _loadFile as loadFile } from './loader.js';
2
+ export { _loadJSON as loadJSON } from './fs.js';
2
3
  export { _tryResolve as tryResolve } from './require.js';
3
4
  export { _getDependenciesFromScripts as getDependenciesFromScripts } from '../binaries/index.js';
4
5
  import { arrayify } from './array.js';
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "3.13.0";
1
+ export declare const version = "3.13.1";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '3.13.0';
1
+ export const version = '3.13.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knip",
3
- "version": "3.13.0",
3
+ "version": "3.13.1",
4
4
  "description": "Find unused files, dependencies and exports in your TypeScript and JavaScript projects",
5
5
  "homepage": "https://knip.dev",
6
6
  "repository": {