knip 5.43.5 → 5.44.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.
- package/README.md +6 -6
- package/dist/ConfigurationChief.d.ts +6 -5
- package/dist/ConfigurationChief.js +9 -5
- package/dist/ConfigurationValidator.d.ts +56 -56
- package/dist/DependencyDeputy.d.ts +3 -1
- package/dist/DependencyDeputy.js +11 -5
- package/dist/PackageJsonPeeker.d.ts +13 -0
- package/dist/PackageJsonPeeker.js +43 -0
- package/dist/binaries/plugins.js +1 -1
- package/dist/compilers/index.d.ts +10 -10
- package/dist/index.js +3 -3
- package/dist/plugins/expo/helpers.d.ts +19 -3
- package/dist/plugins/expo/helpers.js +16 -3
- package/dist/plugins/expo/index.js +4 -4
- package/dist/plugins/expo/types.d.ts +10 -4
- package/dist/plugins/graphql-codegen/index.d.ts +1 -1
- package/dist/plugins/index.d.ts +14 -7
- package/dist/plugins/index.js +2 -2
- package/dist/plugins/node/index.d.ts +8 -0
- package/dist/plugins/node/index.js +18 -0
- package/dist/plugins/nyc/index.js +1 -1
- package/dist/plugins/react-router/index.d.ts +10 -0
- package/dist/plugins/react-router/index.js +41 -0
- package/dist/plugins/react-router/types.d.ts +7 -0
- package/dist/plugins/react-router/types.js +1 -0
- package/dist/reporters/json.js +3 -3
- package/dist/reporters/symbols.js +2 -2
- package/dist/reporters/util.d.ts +1 -0
- package/dist/reporters/util.js +2 -1
- package/dist/reporters/watch.js +1 -1
- package/dist/schema/plugins.d.ts +23 -23
- package/dist/schema/plugins.js +1 -1
- package/dist/types/PluginNames.d.ts +2 -2
- package/dist/types/PluginNames.js +1 -1
- package/dist/types/config.d.ts +1 -1
- package/dist/types/package-json.d.ts +3 -1
- package/dist/types/workspace.d.ts +1 -0
- package/dist/util/input.d.ts +0 -1
- package/dist/util/map-workspaces.d.ts +2 -2
- package/dist/util/map-workspaces.js +7 -6
- package/dist/util/to-source-path.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
- package/schema.json +4 -0
- package/dist/plugins/node-test-runner/index.d.ts +0 -8
- package/dist/plugins/node-test-runner/index.js +0 -10
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type
|
|
1
|
+
type BaseConfig = {
|
|
2
2
|
platforms?: ('ios' | 'android' | 'web')[];
|
|
3
3
|
notification?: Record<string, unknown>;
|
|
4
4
|
updates?: {
|
|
@@ -15,8 +15,14 @@ type AppConfig = {
|
|
|
15
15
|
androidNavigationBar?: Record<string, unknown>;
|
|
16
16
|
plugins?: (string | [string, Record<string, unknown>])[];
|
|
17
17
|
};
|
|
18
|
-
type
|
|
19
|
-
|
|
18
|
+
type ConfigContext = {
|
|
19
|
+
projectRoot: string;
|
|
20
|
+
staticConfigPath: string | null;
|
|
21
|
+
packageJsonPath: string | null;
|
|
22
|
+
config: Partial<BaseConfig>;
|
|
20
23
|
};
|
|
21
|
-
|
|
24
|
+
type ExpoConfigOrProp = BaseConfig | {
|
|
25
|
+
expo: BaseConfig;
|
|
26
|
+
};
|
|
27
|
+
export type ExpoConfig = ExpoConfigOrProp | ((cfg: ConfigContext) => ExpoConfigOrProp);
|
|
22
28
|
export {};
|
|
@@ -4,7 +4,7 @@ declare const _default: {
|
|
|
4
4
|
title: string;
|
|
5
5
|
enablers: (string | RegExp)[];
|
|
6
6
|
isEnabled: IsPluginEnabled;
|
|
7
|
-
packageJsonPath: (manifest: import("../../types/package-json.js").PackageJson) =>
|
|
7
|
+
packageJsonPath: (manifest: import("../../types/package-json.js").PackageJson) => unknown;
|
|
8
8
|
config: string[];
|
|
9
9
|
resolveConfig: ResolveConfig<GraphqlCodegenTypes | GraphqlConfigTypes | GraphqlProjectsConfigTypes>;
|
|
10
10
|
};
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -174,7 +174,7 @@ export declare const Plugins: {
|
|
|
174
174
|
title: string;
|
|
175
175
|
enablers: (string | RegExp)[];
|
|
176
176
|
isEnabled: import("../types/config.js").IsPluginEnabled;
|
|
177
|
-
packageJsonPath: (manifest: import("../types/package-json.js").PackageJson) =>
|
|
177
|
+
packageJsonPath: (manifest: import("../types/package-json.js").PackageJson) => unknown;
|
|
178
178
|
config: string[];
|
|
179
179
|
resolveConfig: import("../types/config.js").ResolveConfig<import("./graphql-codegen/types.js").GraphqlCodegenTypes | import("./graphql-codegen/types.js").GraphqlConfigTypes | import("./graphql-codegen/types.js").GraphqlProjectsConfigTypes>;
|
|
180
180
|
};
|
|
@@ -320,17 +320,17 @@ export declare const Plugins: {
|
|
|
320
320
|
};
|
|
321
321
|
node: {
|
|
322
322
|
title: string;
|
|
323
|
+
isEnabled: import("../types/config.js").IsPluginEnabled;
|
|
324
|
+
packageJsonPath: (id: import("../types/package-json.js").PackageJson) => import("../types/package-json.js").PackageJson;
|
|
325
|
+
config: string[];
|
|
326
|
+
resolveEntryPaths: import("../types/config.js").ResolveEntryPaths<import("../types/package-json.js").PackageJson>;
|
|
323
327
|
args: {
|
|
324
328
|
positional: boolean;
|
|
325
329
|
nodeImportArgs: boolean;
|
|
330
|
+
resolve: string[];
|
|
331
|
+
args: (args: string[]) => string[];
|
|
326
332
|
};
|
|
327
333
|
};
|
|
328
|
-
'node-test-runner': {
|
|
329
|
-
title: string;
|
|
330
|
-
enablers: string;
|
|
331
|
-
isEnabled: import("../types/config.js").IsPluginEnabled;
|
|
332
|
-
entry: string[];
|
|
333
|
-
};
|
|
334
334
|
nodemon: {
|
|
335
335
|
title: string;
|
|
336
336
|
args: {
|
|
@@ -457,6 +457,13 @@ export declare const Plugins: {
|
|
|
457
457
|
resolveConfig: import("../types/config.js").ResolveConfig<import("./react-cosmos/types.js").ReactCosmosConfig>;
|
|
458
458
|
resolveEntryPaths: import("../types/config.js").ResolveEntryPaths<import("./react-cosmos/types.js").ReactCosmosConfig>;
|
|
459
459
|
};
|
|
460
|
+
'react-router': {
|
|
461
|
+
title: string;
|
|
462
|
+
enablers: string[];
|
|
463
|
+
isEnabled: import("../types/config.js").IsPluginEnabled;
|
|
464
|
+
config: string[];
|
|
465
|
+
resolveEntryPaths: import("../types/config.js").ResolveEntryPaths<import("./react-router/types.js").PluginConfig>;
|
|
466
|
+
};
|
|
460
467
|
'release-it': {
|
|
461
468
|
title: string;
|
|
462
469
|
enablers: string[];
|
package/dist/plugins/index.js
CHANGED
|
@@ -37,7 +37,6 @@ import { default as msw } from './msw/index.js';
|
|
|
37
37
|
import { default as nest } from './nest/index.js';
|
|
38
38
|
import { default as netlify } from './netlify/index.js';
|
|
39
39
|
import { default as next } from './next/index.js';
|
|
40
|
-
import { default as nodeTestRunner } from './node-test-runner/index.js';
|
|
41
40
|
import { default as node } from './node/index.js';
|
|
42
41
|
import { default as nodemon } from './nodemon/index.js';
|
|
43
42
|
import { default as npmPackageJsonLint } from './npm-package-json-lint/index.js';
|
|
@@ -53,6 +52,7 @@ import { default as postcss } from './postcss/index.js';
|
|
|
53
52
|
import { default as preconstruct } from './preconstruct/index.js';
|
|
54
53
|
import { default as prettier } from './prettier/index.js';
|
|
55
54
|
import { default as reactCosmos } from './react-cosmos/index.js';
|
|
55
|
+
import { default as reactRouter } from './react-router/index.js';
|
|
56
56
|
import { default as releaseIt } from './release-it/index.js';
|
|
57
57
|
import { default as remark } from './remark/index.js';
|
|
58
58
|
import { default as remix } from './remix/index.js';
|
|
@@ -130,7 +130,6 @@ export const Plugins = {
|
|
|
130
130
|
netlify,
|
|
131
131
|
next,
|
|
132
132
|
node,
|
|
133
|
-
'node-test-runner': nodeTestRunner,
|
|
134
133
|
nodemon,
|
|
135
134
|
'npm-package-json-lint': npmPackageJsonLint,
|
|
136
135
|
nuxt,
|
|
@@ -145,6 +144,7 @@ export const Plugins = {
|
|
|
145
144
|
preconstruct,
|
|
146
145
|
prettier,
|
|
147
146
|
'react-cosmos': reactCosmos,
|
|
147
|
+
'react-router': reactRouter,
|
|
148
148
|
'release-it': releaseIt,
|
|
149
149
|
remark,
|
|
150
150
|
remix,
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
+
import type { IsPluginEnabled, ResolveEntryPaths } from '../../types/config.js';
|
|
2
|
+
import type { PackageJson } from '../../types/package-json.js';
|
|
1
3
|
declare const _default: {
|
|
2
4
|
title: string;
|
|
5
|
+
isEnabled: IsPluginEnabled;
|
|
6
|
+
packageJsonPath: (id: PackageJson) => PackageJson;
|
|
7
|
+
config: string[];
|
|
8
|
+
resolveEntryPaths: ResolveEntryPaths<PackageJson>;
|
|
3
9
|
args: {
|
|
4
10
|
positional: boolean;
|
|
5
11
|
nodeImportArgs: boolean;
|
|
12
|
+
resolve: string[];
|
|
13
|
+
args: (args: string[]) => string[];
|
|
6
14
|
};
|
|
7
15
|
};
|
|
8
16
|
export default _default;
|
|
@@ -1,9 +1,27 @@
|
|
|
1
|
+
import { toEntry } from '../../util/input.js';
|
|
1
2
|
const title = 'Node.js';
|
|
3
|
+
const isEnabled = () => true;
|
|
4
|
+
const config = ['package.json'];
|
|
5
|
+
const packageJsonPath = (id) => id;
|
|
6
|
+
const resolveEntryPaths = localConfig => {
|
|
7
|
+
const scripts = localConfig.scripts;
|
|
8
|
+
const entry = ['server.js'];
|
|
9
|
+
if (scripts && Object.keys(scripts).some(script => /(?<=^|\s)node\s(.*)--test/.test(scripts[script]))) {
|
|
10
|
+
entry.push(...['**/*{.,-,_}test.?(c|m)js', '**/test-*.?(c|m)js', '**/test.?(c|m)js', '**/test/**/*.?(c|m)js']);
|
|
11
|
+
}
|
|
12
|
+
return entry.map(toEntry);
|
|
13
|
+
};
|
|
2
14
|
const args = {
|
|
3
15
|
positional: true,
|
|
4
16
|
nodeImportArgs: true,
|
|
17
|
+
resolve: ['test-reporter'],
|
|
18
|
+
args: (args) => args.filter(arg => !/--test-reporter[= ](spec|tap|dot|junit|lcov)/.test(arg)),
|
|
5
19
|
};
|
|
6
20
|
export default {
|
|
7
21
|
title,
|
|
22
|
+
isEnabled,
|
|
23
|
+
packageJsonPath,
|
|
24
|
+
config,
|
|
25
|
+
resolveEntryPaths,
|
|
8
26
|
args,
|
|
9
27
|
};
|
|
@@ -3,7 +3,7 @@ import { hasDependency } from '../../util/plugin.js';
|
|
|
3
3
|
const title = 'nyc';
|
|
4
4
|
const enablers = ['nyc'];
|
|
5
5
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
6
|
-
const config = ['.nycrc', '.nycrc.json
|
|
6
|
+
const config = ['.nycrc', '.nycrc.{json,yml,yaml}', 'nyc.config.js', 'package.json'];
|
|
7
7
|
const resolveConfig = config => {
|
|
8
8
|
const extend = config?.extends ?? [];
|
|
9
9
|
const requires = config?.require ?? [];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IsPluginEnabled, ResolveEntryPaths } from '../../types/config.js';
|
|
2
|
+
import type { PluginConfig } from './types.js';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
title: string;
|
|
5
|
+
enablers: string[];
|
|
6
|
+
isEnabled: IsPluginEnabled;
|
|
7
|
+
config: string[];
|
|
8
|
+
resolveEntryPaths: ResolveEntryPaths<PluginConfig>;
|
|
9
|
+
};
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { toEntry } from '../../util/input.js';
|
|
3
|
+
import { join } from '../../util/path.js';
|
|
4
|
+
import { hasDependency, load } from '../../util/plugin.js';
|
|
5
|
+
import vite from '../vite/index.js';
|
|
6
|
+
const title = 'react-router';
|
|
7
|
+
const enablers = ['@react-router/dev'];
|
|
8
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
9
|
+
const config = ['react-router.config.{js,ts}', ...vite.config];
|
|
10
|
+
const resolveEntryPaths = async (localConfig, options) => {
|
|
11
|
+
const { configFileDir } = options;
|
|
12
|
+
const appDirectory = localConfig.appDirectory ?? 'app';
|
|
13
|
+
const appDir = join(configFileDir, appDirectory);
|
|
14
|
+
globalThis.__reactRouterAppDirectory = appDir;
|
|
15
|
+
let routeConfig = [];
|
|
16
|
+
const routesPathTs = join(appDir, 'routes.ts');
|
|
17
|
+
const routesPathJs = join(appDir, 'routes.js');
|
|
18
|
+
if (existsSync(routesPathTs)) {
|
|
19
|
+
routeConfig = await load(routesPathTs);
|
|
20
|
+
}
|
|
21
|
+
else if (existsSync(routesPathJs)) {
|
|
22
|
+
routeConfig = await load(routesPathJs);
|
|
23
|
+
}
|
|
24
|
+
const mapRoute = (route) => {
|
|
25
|
+
return [join(appDir, route.file), ...(route.children ? route.children.flatMap(mapRoute) : [])];
|
|
26
|
+
};
|
|
27
|
+
const routes = routeConfig.flatMap(mapRoute);
|
|
28
|
+
return [
|
|
29
|
+
join(appDir, 'routes.{js,ts}'),
|
|
30
|
+
join(appDir, 'root.{jsx,tsx}'),
|
|
31
|
+
join(appDir, 'entry.{client,server}.{js,jsx,ts,tsx}'),
|
|
32
|
+
...routes,
|
|
33
|
+
].map(toEntry);
|
|
34
|
+
};
|
|
35
|
+
export default {
|
|
36
|
+
title,
|
|
37
|
+
enablers,
|
|
38
|
+
isEnabled,
|
|
39
|
+
config,
|
|
40
|
+
resolveEntryPaths,
|
|
41
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/reporters/json.js
CHANGED
|
@@ -54,11 +54,11 @@ export default async ({ report, issues, options }) => {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
else {
|
|
57
|
-
if (['
|
|
58
|
-
json[filePath][type]?.push(
|
|
57
|
+
if (['unlisted', 'binaries'].includes(type)) {
|
|
58
|
+
json[filePath][type]?.push({ name: symbol });
|
|
59
59
|
}
|
|
60
60
|
else {
|
|
61
|
-
json[filePath][type]?.push(
|
|
61
|
+
json[filePath][type]?.push(convert(issue));
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
}
|
|
@@ -3,7 +3,7 @@ import picocolors from 'picocolors';
|
|
|
3
3
|
import { ROOT_WORKSPACE_NAME } from '../constants.js';
|
|
4
4
|
import { relative, toRelative } from '../util/path.js';
|
|
5
5
|
import { truncate } from '../util/string.js';
|
|
6
|
-
import { getTitle, identity, logTitle } from './util.js';
|
|
6
|
+
import { getTitle, identity, logTitle, logTitleDimmed } from './util.js';
|
|
7
7
|
const dim = picocolors.gray;
|
|
8
8
|
const bright = picocolors.whiteBright;
|
|
9
9
|
const TRUNCATE_WIDTH = 40;
|
|
@@ -77,7 +77,7 @@ export default ({ report, issues, tagHints, configurationHints, noConfigHints, i
|
|
|
77
77
|
}
|
|
78
78
|
if (!noConfigHints) {
|
|
79
79
|
if (configurationHints.size > 0) {
|
|
80
|
-
|
|
80
|
+
logTitleDimmed('Configuration hints');
|
|
81
81
|
for (const hint of configurationHints) {
|
|
82
82
|
const { type, workspaceName, identifier } = hint;
|
|
83
83
|
const message = `Unused item in ${type}`;
|
package/dist/reporters/util.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { Issue, IssueSeverity, IssueSymbol } from '../types/issues.js';
|
|
|
3
3
|
export declare const identity: (text: string) => string;
|
|
4
4
|
export declare const getTitle: (reportType: keyof typeof ISSUE_TYPE_TITLE) => string;
|
|
5
5
|
export declare const logTitle: (title: string, count: number) => void;
|
|
6
|
+
export declare const logTitleDimmed: (title: string) => void;
|
|
6
7
|
type LogIssueLine = {
|
|
7
8
|
owner?: string;
|
|
8
9
|
filePath: string;
|
package/dist/reporters/util.js
CHANGED
|
@@ -5,7 +5,8 @@ export const identity = (text) => text;
|
|
|
5
5
|
export const getTitle = (reportType) => {
|
|
6
6
|
return ISSUE_TYPE_TITLE[reportType];
|
|
7
7
|
};
|
|
8
|
-
export const logTitle = (title, count) => console.log(`${picocolors.
|
|
8
|
+
export const logTitle = (title, count) => console.log(`${picocolors.yellowBright(picocolors.underline(title))} (${count})`);
|
|
9
|
+
export const logTitleDimmed = (title) => console.log(`${picocolors.yellow(picocolors.underline(`${title}`))}`);
|
|
9
10
|
export const logIssueLine = ({ owner, filePath, symbols, parentSymbol, severity }) => {
|
|
10
11
|
const symbol = symbols ? `: ${symbols.map(s => s.symbol).join(', ')}` : '';
|
|
11
12
|
const parent = parentSymbol ? ` (${parentSymbol})` : '';
|
package/dist/reporters/watch.js
CHANGED
|
@@ -18,7 +18,7 @@ export default ({ report, issues, streamer, startTime, size, isDebug }) => {
|
|
|
18
18
|
: Object.values(issues[reportType]).flatMap(Object.values);
|
|
19
19
|
if (issuesForType.length > 0) {
|
|
20
20
|
if (title) {
|
|
21
|
-
lines.push(`${picocolors.
|
|
21
|
+
lines.push(`${picocolors.yellowBright(picocolors.underline(title))} (${issuesForType.length})`);
|
|
22
22
|
}
|
|
23
23
|
if (typeof issuesForType[0] === 'string') {
|
|
24
24
|
lines.push(...issuesForType.map(filePath => relative(filePath)));
|
package/dist/schema/plugins.d.ts
CHANGED
|
@@ -534,19 +534,6 @@ export declare const pluginsSchema: z.ZodObject<{
|
|
|
534
534
|
entry?: string | string[] | undefined;
|
|
535
535
|
project?: string | string[] | undefined;
|
|
536
536
|
}>]>;
|
|
537
|
-
'node-test-runner': z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
538
|
-
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
539
|
-
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
540
|
-
project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
541
|
-
}, "strip", z.ZodTypeAny, {
|
|
542
|
-
config?: string | string[] | undefined;
|
|
543
|
-
entry?: string | string[] | undefined;
|
|
544
|
-
project?: string | string[] | undefined;
|
|
545
|
-
}, {
|
|
546
|
-
config?: string | string[] | undefined;
|
|
547
|
-
entry?: string | string[] | undefined;
|
|
548
|
-
project?: string | string[] | undefined;
|
|
549
|
-
}>]>;
|
|
550
537
|
nodemon: z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
551
538
|
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
552
539
|
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
@@ -729,6 +716,19 @@ export declare const pluginsSchema: z.ZodObject<{
|
|
|
729
716
|
entry?: string | string[] | undefined;
|
|
730
717
|
project?: string | string[] | undefined;
|
|
731
718
|
}>]>;
|
|
719
|
+
'react-router': z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
720
|
+
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
721
|
+
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
722
|
+
project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
723
|
+
}, "strip", z.ZodTypeAny, {
|
|
724
|
+
config?: string | string[] | undefined;
|
|
725
|
+
entry?: string | string[] | undefined;
|
|
726
|
+
project?: string | string[] | undefined;
|
|
727
|
+
}, {
|
|
728
|
+
config?: string | string[] | undefined;
|
|
729
|
+
entry?: string | string[] | undefined;
|
|
730
|
+
project?: string | string[] | undefined;
|
|
731
|
+
}>]>;
|
|
732
732
|
'release-it': z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
733
733
|
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
734
734
|
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
@@ -1398,11 +1398,6 @@ export declare const pluginsSchema: z.ZodObject<{
|
|
|
1398
1398
|
entry?: string | string[] | undefined;
|
|
1399
1399
|
project?: string | string[] | undefined;
|
|
1400
1400
|
};
|
|
1401
|
-
'node-test-runner': string | boolean | string[] | {
|
|
1402
|
-
config?: string | string[] | undefined;
|
|
1403
|
-
entry?: string | string[] | undefined;
|
|
1404
|
-
project?: string | string[] | undefined;
|
|
1405
|
-
};
|
|
1406
1401
|
nodemon: string | boolean | string[] | {
|
|
1407
1402
|
config?: string | string[] | undefined;
|
|
1408
1403
|
entry?: string | string[] | undefined;
|
|
@@ -1473,6 +1468,11 @@ export declare const pluginsSchema: z.ZodObject<{
|
|
|
1473
1468
|
entry?: string | string[] | undefined;
|
|
1474
1469
|
project?: string | string[] | undefined;
|
|
1475
1470
|
};
|
|
1471
|
+
'react-router': string | boolean | string[] | {
|
|
1472
|
+
config?: string | string[] | undefined;
|
|
1473
|
+
entry?: string | string[] | undefined;
|
|
1474
|
+
project?: string | string[] | undefined;
|
|
1475
|
+
};
|
|
1476
1476
|
'release-it': string | boolean | string[] | {
|
|
1477
1477
|
config?: string | string[] | undefined;
|
|
1478
1478
|
entry?: string | string[] | undefined;
|
|
@@ -1854,11 +1854,6 @@ export declare const pluginsSchema: z.ZodObject<{
|
|
|
1854
1854
|
entry?: string | string[] | undefined;
|
|
1855
1855
|
project?: string | string[] | undefined;
|
|
1856
1856
|
};
|
|
1857
|
-
'node-test-runner': string | boolean | string[] | {
|
|
1858
|
-
config?: string | string[] | undefined;
|
|
1859
|
-
entry?: string | string[] | undefined;
|
|
1860
|
-
project?: string | string[] | undefined;
|
|
1861
|
-
};
|
|
1862
1857
|
nodemon: string | boolean | string[] | {
|
|
1863
1858
|
config?: string | string[] | undefined;
|
|
1864
1859
|
entry?: string | string[] | undefined;
|
|
@@ -1929,6 +1924,11 @@ export declare const pluginsSchema: z.ZodObject<{
|
|
|
1929
1924
|
entry?: string | string[] | undefined;
|
|
1930
1925
|
project?: string | string[] | undefined;
|
|
1931
1926
|
};
|
|
1927
|
+
'react-router': string | boolean | string[] | {
|
|
1928
|
+
config?: string | string[] | undefined;
|
|
1929
|
+
entry?: string | string[] | undefined;
|
|
1930
|
+
project?: string | string[] | undefined;
|
|
1931
|
+
};
|
|
1932
1932
|
'release-it': string | boolean | string[] | {
|
|
1933
1933
|
config?: string | string[] | undefined;
|
|
1934
1934
|
entry?: string | string[] | undefined;
|
package/dist/schema/plugins.js
CHANGED
|
@@ -50,7 +50,6 @@ export const pluginsSchema = z.object({
|
|
|
50
50
|
netlify: pluginSchema,
|
|
51
51
|
next: pluginSchema,
|
|
52
52
|
node: pluginSchema,
|
|
53
|
-
'node-test-runner': pluginSchema,
|
|
54
53
|
nodemon: pluginSchema,
|
|
55
54
|
'npm-package-json-lint': pluginSchema,
|
|
56
55
|
nuxt: pluginSchema,
|
|
@@ -65,6 +64,7 @@ export const pluginsSchema = z.object({
|
|
|
65
64
|
preconstruct: pluginSchema,
|
|
66
65
|
prettier: pluginSchema,
|
|
67
66
|
'react-cosmos': pluginSchema,
|
|
67
|
+
'react-router': pluginSchema,
|
|
68
68
|
'release-it': pluginSchema,
|
|
69
69
|
remark: pluginSchema,
|
|
70
70
|
remix: pluginSchema,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type PluginName = 'angular' | 'astro' | 'ava' | 'babel' | 'c8' | 'capacitor' | 'changesets' | 'commitizen' | 'commitlint' | 'cspell' | 'cucumber' | 'cypress' | 'dependency-cruiser' | 'dotenv' | 'drizzle' | 'eleventy' | 'eslint' | 'expo' | 'gatsby' | 'github-actions' | 'glob' | 'graphql-codegen' | 'husky' | 'jest' | 'karma' | 'ladle' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lockfile-lint' | 'lost-pixel' | 'markdownlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nest' | 'netlify' | 'next' | 'node' | '
|
|
2
|
-
export declare const pluginNames: readonly ["angular", "astro", "ava", "babel", "c8", "capacitor", "changesets", "commitizen", "commitlint", "cspell", "cucumber", "cypress", "dependency-cruiser", "dotenv", "drizzle", "eleventy", "eslint", "expo", "gatsby", "github-actions", "glob", "graphql-codegen", "husky", "jest", "karma", "ladle", "lefthook", "lint-staged", "linthtml", "lockfile-lint", "lost-pixel", "markdownlint", "metro", "mocha", "moonrepo", "msw", "nest", "netlify", "next", "node", "
|
|
1
|
+
export type PluginName = 'angular' | 'astro' | 'ava' | 'babel' | 'c8' | 'capacitor' | 'changesets' | 'commitizen' | 'commitlint' | 'cspell' | 'cucumber' | 'cypress' | 'dependency-cruiser' | 'dotenv' | 'drizzle' | 'eleventy' | 'eslint' | 'expo' | 'gatsby' | 'github-actions' | 'glob' | 'graphql-codegen' | 'husky' | 'jest' | 'karma' | 'ladle' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lockfile-lint' | 'lost-pixel' | 'markdownlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nest' | 'netlify' | 'next' | 'node' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nx' | 'nyc' | 'oclif' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'postcss' | 'preconstruct' | 'prettier' | 'react-cosmos' | 'react-router' | 'release-it' | 'remark' | 'remix' | 'rollup' | 'rsbuild' | 'rspack' | 'semantic-release' | 'sentry' | 'simple-git-hooks' | 'size-limit' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'syncpack' | 'tailwind' | 'travis' | 'ts-node' | 'tsup' | 'tsx' | 'typedoc' | 'typescript' | 'unbuild' | 'unocss' | 'vercel-og' | 'vike' | 'vite' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'xo' | 'yarn' | 'yorkie';
|
|
2
|
+
export declare const pluginNames: readonly ["angular", "astro", "ava", "babel", "c8", "capacitor", "changesets", "commitizen", "commitlint", "cspell", "cucumber", "cypress", "dependency-cruiser", "dotenv", "drizzle", "eleventy", "eslint", "expo", "gatsby", "github-actions", "glob", "graphql-codegen", "husky", "jest", "karma", "ladle", "lefthook", "lint-staged", "linthtml", "lockfile-lint", "lost-pixel", "markdownlint", "metro", "mocha", "moonrepo", "msw", "nest", "netlify", "next", "node", "nodemon", "npm-package-json-lint", "nuxt", "nx", "nyc", "oclif", "playwright", "playwright-ct", "playwright-test", "plop", "postcss", "preconstruct", "prettier", "react-cosmos", "react-router", "release-it", "remark", "remix", "rollup", "rsbuild", "rspack", "semantic-release", "sentry", "simple-git-hooks", "size-limit", "storybook", "stryker", "stylelint", "svelte", "syncpack", "tailwind", "travis", "ts-node", "tsup", "tsx", "typedoc", "typescript", "unbuild", "unocss", "vercel-og", "vike", "vite", "vitest", "vue", "webdriver-io", "webpack", "wireit", "wrangler", "xo", "yarn", "yorkie"];
|
|
@@ -39,7 +39,6 @@ export const pluginNames = [
|
|
|
39
39
|
'netlify',
|
|
40
40
|
'next',
|
|
41
41
|
'node',
|
|
42
|
-
'node-test-runner',
|
|
43
42
|
'nodemon',
|
|
44
43
|
'npm-package-json-lint',
|
|
45
44
|
'nuxt',
|
|
@@ -54,6 +53,7 @@ export const pluginNames = [
|
|
|
54
53
|
'preconstruct',
|
|
55
54
|
'prettier',
|
|
56
55
|
'react-cosmos',
|
|
56
|
+
'react-router',
|
|
57
57
|
'release-it',
|
|
58
58
|
'remark',
|
|
59
59
|
'remix',
|
package/dist/types/config.d.ts
CHANGED
|
@@ -93,7 +93,7 @@ export type Resolve = (options: PluginOptions) => Promise<Input[]> | Input[];
|
|
|
93
93
|
export interface Plugin {
|
|
94
94
|
title: string;
|
|
95
95
|
args?: Args;
|
|
96
|
-
packageJsonPath?: string | ((manifest: PackageJson) =>
|
|
96
|
+
packageJsonPath?: string | ((manifest: PackageJson) => unknown);
|
|
97
97
|
enablers?: IgnorePatterns | string;
|
|
98
98
|
isEnabled?: IsPluginEnabled;
|
|
99
99
|
isRootOnly?: boolean;
|
|
@@ -42,10 +42,12 @@ export type PackageJson = {
|
|
|
42
42
|
types?: string;
|
|
43
43
|
typings?: string;
|
|
44
44
|
} & Plugins;
|
|
45
|
-
export type
|
|
45
|
+
export type WorkspacePackage = {
|
|
46
46
|
dir: string;
|
|
47
47
|
name: string;
|
|
48
48
|
pkgName: string | undefined;
|
|
49
49
|
manifest: PackageJson;
|
|
50
|
+
manifestPath: string;
|
|
51
|
+
manifestStr: string;
|
|
50
52
|
};
|
|
51
53
|
export {};
|
package/dist/util/input.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
type Packages = Map<string,
|
|
1
|
+
import type { WorkspacePackage } from '../types/package-json.js';
|
|
2
|
+
type Packages = Map<string, WorkspacePackage>;
|
|
3
3
|
type WorkspacePkgNames = Set<string>;
|
|
4
4
|
export default function mapWorkspaces(cwd: string, workspaces: string[]): Promise<[Packages, WorkspacePkgNames]>;
|
|
5
5
|
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
1
2
|
import fg from 'fast-glob';
|
|
2
3
|
import { partition } from './array.js';
|
|
3
4
|
import { debugLog } from './debug.js';
|
|
4
5
|
import { ConfigurationError } from './errors.js';
|
|
5
6
|
import { getPackageName } from './package-name.js';
|
|
6
7
|
import { join } from './path.js';
|
|
7
|
-
import { _require } from './require.js';
|
|
8
8
|
export default async function mapWorkspaces(cwd, workspaces) {
|
|
9
9
|
const [negatedPatterns, patterns] = partition(workspaces, p => p.match(/^!/));
|
|
10
10
|
const packages = new Map();
|
|
@@ -18,19 +18,20 @@ export default async function mapWorkspaces(cwd, workspaces) {
|
|
|
18
18
|
});
|
|
19
19
|
for (const name of matches) {
|
|
20
20
|
const dir = join(cwd, name);
|
|
21
|
-
const
|
|
21
|
+
const manifestPath = join(dir, 'package.json');
|
|
22
22
|
try {
|
|
23
|
-
const
|
|
23
|
+
const manifestStr = await readFile(manifestPath, 'utf8');
|
|
24
|
+
const manifest = JSON.parse(manifestStr);
|
|
24
25
|
const pkgName = getPackageName(manifest, dir);
|
|
25
|
-
const pkg = { dir, name, pkgName, manifest };
|
|
26
|
+
const pkg = { dir, name, pkgName, manifestPath, manifestStr, manifest };
|
|
26
27
|
packages.set(name, pkg);
|
|
27
28
|
if (pkgName)
|
|
28
29
|
wsPkgNames.add(pkgName);
|
|
29
30
|
else
|
|
30
|
-
throw new ConfigurationError(`Missing package name in ${
|
|
31
|
+
throw new ConfigurationError(`Missing package name in ${manifestPath}`);
|
|
31
32
|
}
|
|
32
33
|
catch (error) {
|
|
33
|
-
if (error?.code === '
|
|
34
|
+
if (error?.code === 'ENOENT')
|
|
34
35
|
debugLog('*', `Unable to load package.json for ${name}`);
|
|
35
36
|
else
|
|
36
37
|
throw error;
|
|
@@ -9,7 +9,7 @@ const hasTSExt = /(?<!\.d)\.(m|c)?tsx?$/;
|
|
|
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');
|
|
12
|
-
workspace.srcDir =
|
|
12
|
+
workspace.srcDir = compilerOptions.rootDir ?? (isDirectory(srcDir) ? srcDir : dir);
|
|
13
13
|
workspace.outDir = compilerOptions.outDir || workspace.srcDir;
|
|
14
14
|
};
|
|
15
15
|
export const getToSourcePathHandler = (chief) => {
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.
|
|
1
|
+
export declare const version = "5.44.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.
|
|
1
|
+
export const version = '5.44.0';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "knip",
|
|
3
|
-
"version": "5.
|
|
4
|
-
"description": "Find unused files, dependencies and exports in your TypeScript and JavaScript projects",
|
|
3
|
+
"version": "5.44.0",
|
|
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": {
|
|
7
7
|
"type": "git",
|
|
@@ -82,8 +82,8 @@
|
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
84
|
"@jest/types": "^29.6.3",
|
|
85
|
-
"@release-it/bumper": "^7.0.
|
|
86
|
-
"@types/bun": "^1.2.
|
|
85
|
+
"@release-it/bumper": "^7.0.1",
|
|
86
|
+
"@types/bun": "^1.2.2",
|
|
87
87
|
"@types/js-yaml": "^4.0.9",
|
|
88
88
|
"@types/minimist": "^1.2.5",
|
|
89
89
|
"@types/picomatch": "3.0.1",
|
package/schema.json
CHANGED
|
@@ -502,6 +502,10 @@
|
|
|
502
502
|
"title": "react-cosmos plugin configuration (https://knip.dev/reference/plugins/react-cosmos)",
|
|
503
503
|
"$ref": "#/definitions/plugin"
|
|
504
504
|
},
|
|
505
|
+
"react-router": {
|
|
506
|
+
"title": "react-router plugin configuration (https://knip.dev/reference/plugins/react-router)",
|
|
507
|
+
"$ref": "#/definitions/plugin"
|
|
508
|
+
},
|
|
505
509
|
"release-it": {
|
|
506
510
|
"title": "Release It plugin configuration (https://knip.dev/reference/plugins/release-it)",
|
|
507
511
|
"$ref": "#/definitions/plugin"
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
const title = 'Node.js Test Runner';
|
|
2
|
-
const enablers = 'This plugin is enabled when any script in `package.json` includes `node --test`';
|
|
3
|
-
const isEnabled = ({ manifest }) => Object.keys(manifest.scripts ?? {}).some(script => manifest.scripts && /(?<=^|\s)node (.*)--test/.test(manifest.scripts[script]));
|
|
4
|
-
const entry = ['**/*{.,-,_}test.?(c|m)js', '**/test-*.?(c|m)js', '**/test.?(c|m)js', '**/test/**/*.?(c|m)js'];
|
|
5
|
-
export default {
|
|
6
|
-
title,
|
|
7
|
-
enablers,
|
|
8
|
-
isEnabled,
|
|
9
|
-
entry,
|
|
10
|
-
};
|