knip 5.86.0 → 5.88.0

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.
Files changed (66) hide show
  1. package/dist/ConfigurationChief.d.ts +18 -0
  2. package/dist/DependencyDeputy.js +11 -1
  3. package/dist/binaries/bash-parser.js +3 -3
  4. package/dist/binaries/resolvers/find.js +19 -0
  5. package/dist/binaries/{package-manager → resolvers}/index.d.ts +1 -0
  6. package/dist/binaries/{package-manager → resolvers}/index.js +2 -0
  7. package/dist/binaries/{package-manager → resolvers}/pnpm.js +1 -0
  8. package/dist/binaries/resolvers/yarn.d.ts +2 -0
  9. package/dist/compilers/index.d.ts +30 -0
  10. package/dist/graph/analyze.js +2 -0
  11. package/dist/graph/build.js +3 -1
  12. package/dist/plugins/babel/index.js +3 -0
  13. package/dist/plugins/changesets/index.js +8 -1
  14. package/dist/plugins/changesets/types.d.ts +1 -0
  15. package/dist/plugins/docusaurus/index.js +15 -0
  16. package/dist/plugins/docusaurus/types.d.ts +16 -0
  17. package/dist/plugins/index.d.ts +3 -0
  18. package/dist/plugins/index.js +6 -0
  19. package/dist/plugins/nuxt/index.js +6 -3
  20. package/dist/plugins/nx/index.js +10 -8
  21. package/dist/plugins/nx/types.d.ts +1 -0
  22. package/dist/plugins/openapi-ts/index.js +0 -9
  23. package/dist/plugins/oxfmt/index.d.ts +3 -0
  24. package/dist/plugins/oxfmt/index.js +16 -0
  25. package/dist/plugins/oxlint/index.js +1 -1
  26. package/dist/plugins/raycast/index.d.ts +3 -0
  27. package/dist/plugins/raycast/index.js +25 -0
  28. package/dist/plugins/raycast/types.d.ts +10 -0
  29. package/dist/plugins/sanity/index.d.ts +3 -0
  30. package/dist/plugins/sanity/index.js +12 -0
  31. package/dist/schema/configuration.d.ts +45 -0
  32. package/dist/schema/plugins.d.ts +15 -0
  33. package/dist/schema/plugins.js +3 -0
  34. package/dist/types/PluginNames.d.ts +2 -2
  35. package/dist/types/PluginNames.js +3 -0
  36. package/dist/typescript/resolve-module-names.js +2 -2
  37. package/dist/util/Performance.d.ts +3 -5
  38. package/dist/util/Performance.js +35 -18
  39. package/dist/util/create-input-handler.js +2 -2
  40. package/dist/util/create-options.d.ts +30 -0
  41. package/dist/util/glob-core.js +34 -9
  42. package/dist/util/modules.d.ts +1 -1
  43. package/dist/util/modules.js +16 -6
  44. package/dist/util/path.js +1 -1
  45. package/dist/util/resolve.d.ts +2 -3
  46. package/dist/util/resolve.js +4 -3
  47. package/dist/util/watch.js +4 -2
  48. package/dist/version.d.ts +1 -1
  49. package/dist/version.js +1 -1
  50. package/package.json +1 -1
  51. package/schema.json +8 -0
  52. package/dist/plugins/openapi-ts/types.d.ts +0 -8
  53. /package/dist/binaries/{package-manager → resolvers}/bun.d.ts +0 -0
  54. /package/dist/binaries/{package-manager → resolvers}/bun.js +0 -0
  55. /package/dist/binaries/{package-manager → resolvers}/bunx.d.ts +0 -0
  56. /package/dist/binaries/{package-manager → resolvers}/bunx.js +0 -0
  57. /package/dist/binaries/{package-manager/npm.d.ts → resolvers/find.d.ts} +0 -0
  58. /package/dist/binaries/{package-manager/npx.d.ts → resolvers/npm.d.ts} +0 -0
  59. /package/dist/binaries/{package-manager → resolvers}/npm.js +0 -0
  60. /package/dist/binaries/{package-manager/pnpm.d.ts → resolvers/npx.d.ts} +0 -0
  61. /package/dist/binaries/{package-manager → resolvers}/npx.js +0 -0
  62. /package/dist/binaries/{package-manager/yarn.d.ts → resolvers/pnpm.d.ts} +0 -0
  63. /package/dist/binaries/{package-manager → resolvers}/pnpx.d.ts +0 -0
  64. /package/dist/binaries/{package-manager → resolvers}/pnpx.js +0 -0
  65. /package/dist/binaries/{package-manager → resolvers}/yarn.js +0 -0
  66. /package/dist/plugins/{openapi-ts → raycast}/types.js +0 -0
package/dist/util/path.js CHANGED
@@ -5,7 +5,7 @@ export const dirname = path.posix.dirname;
5
5
  export const extname = path.posix.extname;
6
6
  export const basename = path.posix.basename;
7
7
  export const join = path.posix.join;
8
- export const toPosix = (value) => value.split(path.sep).join(path.posix.sep);
8
+ export const toPosix = isWin ? (value) => value.split(path.sep).join(path.posix.sep) : (value) => value;
9
9
  export const resolve = path.posix.resolve;
10
10
  export const relative = (from, to) => {
11
11
  if (to.startsWith(from)) {
@@ -1,5 +1,4 @@
1
1
  declare const createSyncModuleResolver: (extensions: string[]) => (specifier: string, basePath: string) => string | undefined;
2
- export declare const _resolveModuleSync: (specifier: string, basePath: string) => string | undefined;
3
- export declare const _createSyncModuleResolver: typeof createSyncModuleResolver;
2
+ export declare const resolveModuleSync: (specifier: string, basePath: string) => string | undefined;
3
+ export { createSyncModuleResolver };
4
4
  export declare const _resolveSync: (specifier: string, baseDir: string) => string | undefined;
5
- export {};
@@ -13,6 +13,7 @@ const createSyncModuleResolver = (extensions) => {
13
13
  '.cjs': ['.cjs', '.cts'],
14
14
  },
15
15
  conditionNames: ['require', 'import', 'node', 'default'],
16
+ nodePath: false,
16
17
  });
17
18
  return function resolveSync(specifier, basePath) {
18
19
  try {
@@ -23,13 +24,13 @@ const createSyncModuleResolver = (extensions) => {
23
24
  catch (_error) { }
24
25
  };
25
26
  };
26
- const resolveModuleSync = createSyncModuleResolver([...DEFAULT_EXTENSIONS, '.json', '.jsonc']);
27
- export const _resolveModuleSync = timerify(resolveModuleSync, 'resolveModuleSync');
28
- export const _createSyncModuleResolver = extensions => timerify(createSyncModuleResolver(extensions), 'resolveModuleSync');
27
+ export const resolveModuleSync = createSyncModuleResolver([...DEFAULT_EXTENSIONS, '.json', '.jsonc']);
28
+ export { createSyncModuleResolver };
29
29
  const createSyncResolver = (extensions) => {
30
30
  const resolver = new ResolverFactory({
31
31
  extensions,
32
32
  conditionNames: ['require', 'import', 'node', 'default'],
33
+ nodePath: false,
33
34
  });
34
35
  return function resolveSync(specifier, baseDir) {
35
36
  try {
@@ -30,9 +30,10 @@ export const getSessionHandler = async (options, { analyzedFiles, analyzeSourceF
30
30
  continue;
31
31
  switch (change.type) {
32
32
  case 'added':
33
- added.add(filePath);
34
33
  principal.addProjectPath(filePath);
35
34
  principal.deletedFiles.delete(filePath);
35
+ if (principal.projectPaths.has(filePath))
36
+ added.add(filePath);
36
37
  debugLog(workspace.name, `Watcher: + ${relativePath}`);
37
38
  break;
38
39
  case 'deleted':
@@ -106,8 +107,9 @@ export const getSessionHandler = async (options, { analyzedFiles, analyzeSourceF
106
107
  const workspace = chief.findWorkspaceByFilePath(filePath);
107
108
  if (workspace) {
108
109
  const principal = factory.getPrincipalByPackageName(workspace.pkgName);
109
- if (principal)
110
+ if (principal && (principal.projectPaths.has(filePath) || graph.has(filePath))) {
110
111
  analyzeSourceFile(filePath, principal);
112
+ }
111
113
  }
112
114
  }
113
115
  }
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "5.86.0";
1
+ export declare const version = "5.88.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '5.86.0';
1
+ export const version = '5.88.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knip",
3
- "version": "5.86.0",
3
+ "version": "5.88.0",
4
4
  "description": "Find and fix unused dependencies, exports and files in your TypeScript and JavaScript projects",
5
5
  "keywords": [
6
6
  "analysis",
package/schema.json CHANGED
@@ -628,6 +628,10 @@
628
628
  "title": "oxlint plugin configuration (https://knip.dev/reference/plugins/oxlint)",
629
629
  "$ref": "#/definitions/plugin"
630
630
  },
631
+ "oxfmt": {
632
+ "title": "oxfmt plugin configuration (https://knip.dev/reference/plugins/oxfmt)",
633
+ "$ref": "#/definitions/plugin"
634
+ },
631
635
  "payload": {
632
636
  "title": "payload plugin configuration (https://knip.dev/reference/plugins/payload)",
633
637
  "$ref": "#/definitions/plugin"
@@ -720,6 +724,10 @@
720
724
  "title": "rstest plugin configuration (https://knip.dev/reference/plugins/rstest)",
721
725
  "$ref": "#/definitions/plugin"
722
726
  },
727
+ "sanity": {
728
+ "title": "sanity plugin configuration (https://knip.dev/reference/plugins/sanity)",
729
+ "$ref": "#/definitions/plugin"
730
+ },
723
731
  "semantic-release": {
724
732
  "title": "semantic-release plugin configuration (https://knip.dev/reference/plugins/semantic-release)",
725
733
  "$ref": "#/definitions/plugin"
@@ -1,8 +0,0 @@
1
- type PluginRef = string | {
2
- name: string;
3
- };
4
- type Config = {
5
- plugins?: PluginRef[];
6
- };
7
- export type OpenApiTsConfig = Config | Config[];
8
- export {};
File without changes