knip 5.50.5 → 5.51.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.
- package/README.md +1 -1
- package/dist/ConfigurationChief.d.ts +4 -1
- package/dist/ConfigurationChief.js +3 -0
- package/dist/binaries/package-manager/bun.js +2 -0
- package/dist/binaries/package-manager/pnpm.js +7 -7
- package/dist/cli.js +3 -3
- package/dist/compilers/astro.js +5 -1
- package/dist/compilers/compilers.js +1 -1
- package/dist/compilers/index.d.ts +44 -13
- package/dist/compilers/index.js +9 -6
- package/dist/compilers/types.d.ts +1 -0
- package/dist/graph/build.js +12 -7
- package/dist/index.d.ts +1 -0
- package/dist/index.js +9 -1
- package/dist/plugins/astro/index.d.ts +1 -0
- package/dist/plugins/astro/index.js +1 -1
- package/dist/plugins/bun/index.d.ts +11 -0
- package/dist/plugins/bun/index.js +28 -0
- package/dist/plugins/eslint/index.js +1 -2
- package/dist/plugins/index.d.ts +37 -10
- package/dist/plugins/index.js +8 -2
- package/dist/plugins/lint-staged/index.d.ts +0 -1
- package/dist/plugins/lint-staged/index.js +0 -2
- package/dist/plugins/nano-staged/index.d.ts +10 -0
- package/dist/plugins/nano-staged/index.js +33 -0
- package/dist/plugins/nano-staged/types.d.ts +7 -0
- package/dist/plugins/next/index.js +2 -1
- package/dist/plugins/oxlint/index.d.ts +12 -0
- package/dist/plugins/oxlint/index.js +16 -0
- package/dist/plugins/preconstruct/index.js +2 -2
- package/dist/plugins/prettier/index.js +3 -3
- package/dist/plugins/relay/index.d.ts +15 -0
- package/dist/plugins/relay/index.js +31 -0
- package/dist/plugins/relay/types.d.ts +12 -0
- package/dist/plugins/relay/types.js +1 -0
- package/dist/plugins/starlight/index.js +1 -1
- package/dist/plugins/tsup/index.js +1 -1
- package/dist/plugins/xo/index.js +1 -1
- package/dist/schema/configuration.d.ts +241 -70
- package/dist/schema/configuration.js +2 -1
- package/dist/schema/plugins.d.ts +92 -23
- package/dist/schema/plugins.js +4 -1
- package/dist/types/PluginNames.d.ts +2 -2
- package/dist/types/PluginNames.js +4 -1
- package/dist/types/config.d.ts +1 -0
- package/dist/typescript/ast-helpers.d.ts +16 -3
- package/dist/typescript/ast-helpers.js +21 -15
- package/dist/typescript/visitors/dynamic-imports/importCall.js +47 -53
- package/dist/typescript/visitors/exports/exportAssignment.js +17 -2
- package/dist/typescript/visitors/exports/exportKeyword.js +3 -22
- package/dist/util/cli-arguments.d.ts +1 -1
- package/dist/util/cli-arguments.js +1 -1
- package/dist/util/codeowners.js +1 -1
- package/dist/util/glob-core.d.ts +0 -8
- package/dist/util/glob-core.js +16 -49
- package/dist/util/glob.d.ts +4 -0
- package/dist/util/glob.js +2 -0
- package/dist/util/input.d.ts +3 -1
- package/dist/util/package-json.d.ts +1 -4
- package/dist/util/package-json.js +2 -3
- package/dist/util/parse-and-convert-gitignores.d.ts +8 -0
- package/dist/util/parse-and-convert-gitignores.js +40 -0
- package/dist/util/to-source-path.d.ts +1 -0
- package/dist/util/to-source-path.js +23 -4
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -3
- package/schema.json +20 -4
- package/dist/plugins/tanstack-router/index.d.ts +0 -12
- package/dist/plugins/tanstack-router/index.js +0 -46
- package/dist/plugins/tanstack-router/resolveFromAST.d.ts +0 -2
- package/dist/plugins/tanstack-router/resolveFromAST.js +0 -28
- package/dist/plugins/tanstack-router/types.d.ts +0 -7
- /package/dist/plugins/{tanstack-router → nano-staged}/types.js +0 -0
package/dist/plugins/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { default as angular } from './angular/index.js';
|
|
|
2
2
|
import { default as astro } from './astro/index.js';
|
|
3
3
|
import { default as ava } from './ava/index.js';
|
|
4
4
|
import { default as babel } from './babel/index.js';
|
|
5
|
+
import { default as bun } from './bun/index.js';
|
|
5
6
|
import { default as c8 } from './c8/index.js';
|
|
6
7
|
import { default as capacitor } from './capacitor/index.js';
|
|
7
8
|
import { default as changesets } from './changesets/index.js';
|
|
@@ -37,6 +38,7 @@ import { default as metro } from './metro/index.js';
|
|
|
37
38
|
import { default as mocha } from './mocha/index.js';
|
|
38
39
|
import { default as moonrepo } from './moonrepo/index.js';
|
|
39
40
|
import { default as msw } from './msw/index.js';
|
|
41
|
+
import { default as nanoStaged } from './nano-staged/index.js';
|
|
40
42
|
import { default as nest } from './nest/index.js';
|
|
41
43
|
import { default as netlify } from './netlify/index.js';
|
|
42
44
|
import { default as next } from './next/index.js';
|
|
@@ -47,6 +49,7 @@ import { default as nuxt } from './nuxt/index.js';
|
|
|
47
49
|
import { default as nx } from './nx/index.js';
|
|
48
50
|
import { default as nyc } from './nyc/index.js';
|
|
49
51
|
import { default as oclif } from './oclif/index.js';
|
|
52
|
+
import { default as oxlint } from './oxlint/index.js';
|
|
50
53
|
import { default as playwrightCt } from './playwright-ct/index.js';
|
|
51
54
|
import { default as playwrightTest } from './playwright-test/index.js';
|
|
52
55
|
import { default as playwright } from './playwright/index.js';
|
|
@@ -56,6 +59,7 @@ import { default as preconstruct } from './preconstruct/index.js';
|
|
|
56
59
|
import { default as prettier } from './prettier/index.js';
|
|
57
60
|
import { default as reactCosmos } from './react-cosmos/index.js';
|
|
58
61
|
import { default as reactRouter } from './react-router/index.js';
|
|
62
|
+
import { default as relay } from './relay/index.js';
|
|
59
63
|
import { default as releaseIt } from './release-it/index.js';
|
|
60
64
|
import { default as remark } from './remark/index.js';
|
|
61
65
|
import { default as remix } from './remix/index.js';
|
|
@@ -74,7 +78,6 @@ import { default as stylelint } from './stylelint/index.js';
|
|
|
74
78
|
import { default as svelte } from './svelte/index.js';
|
|
75
79
|
import { default as syncpack } from './syncpack/index.js';
|
|
76
80
|
import { default as tailwind } from './tailwind/index.js';
|
|
77
|
-
import { default as tanstackRouter } from './tanstack-router/index.js';
|
|
78
81
|
import { default as travis } from './travis/index.js';
|
|
79
82
|
import { default as tsNode } from './ts-node/index.js';
|
|
80
83
|
import { default as tsup } from './tsup/index.js';
|
|
@@ -100,6 +103,7 @@ export const Plugins = {
|
|
|
100
103
|
astro,
|
|
101
104
|
ava,
|
|
102
105
|
babel,
|
|
106
|
+
bun,
|
|
103
107
|
c8,
|
|
104
108
|
capacitor,
|
|
105
109
|
changesets,
|
|
@@ -135,6 +139,7 @@ export const Plugins = {
|
|
|
135
139
|
mocha,
|
|
136
140
|
moonrepo,
|
|
137
141
|
msw,
|
|
142
|
+
'nano-staged': nanoStaged,
|
|
138
143
|
nest,
|
|
139
144
|
netlify,
|
|
140
145
|
next,
|
|
@@ -145,6 +150,7 @@ export const Plugins = {
|
|
|
145
150
|
nx,
|
|
146
151
|
nyc,
|
|
147
152
|
oclif,
|
|
153
|
+
oxlint,
|
|
148
154
|
playwright,
|
|
149
155
|
'playwright-ct': playwrightCt,
|
|
150
156
|
'playwright-test': playwrightTest,
|
|
@@ -154,6 +160,7 @@ export const Plugins = {
|
|
|
154
160
|
prettier,
|
|
155
161
|
'react-cosmos': reactCosmos,
|
|
156
162
|
'react-router': reactRouter,
|
|
163
|
+
relay,
|
|
157
164
|
'release-it': releaseIt,
|
|
158
165
|
remark,
|
|
159
166
|
remix,
|
|
@@ -172,7 +179,6 @@ export const Plugins = {
|
|
|
172
179
|
svelte,
|
|
173
180
|
syncpack,
|
|
174
181
|
tailwind,
|
|
175
|
-
'tanstack-router': tanstackRouter,
|
|
176
182
|
travis,
|
|
177
183
|
'ts-node': tsNode,
|
|
178
184
|
tsup,
|
|
@@ -3,7 +3,6 @@ import { hasDependency } from '../../util/plugin.js';
|
|
|
3
3
|
const title = 'lint-staged';
|
|
4
4
|
const enablers = ['lint-staged'];
|
|
5
5
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
6
|
-
const packageJsonPath = 'lint-staged';
|
|
7
6
|
const config = [
|
|
8
7
|
'package.json',
|
|
9
8
|
'package.yaml',
|
|
@@ -30,7 +29,6 @@ export default {
|
|
|
30
29
|
title,
|
|
31
30
|
enablers,
|
|
32
31
|
isEnabled,
|
|
33
|
-
packageJsonPath,
|
|
34
32
|
config,
|
|
35
33
|
resolveConfig,
|
|
36
34
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IsPluginEnabled, ResolveConfig } from '../../types/config.js';
|
|
2
|
+
import type { NanoStagedConfig } from './types.js';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
title: string;
|
|
5
|
+
enablers: string[];
|
|
6
|
+
isEnabled: IsPluginEnabled;
|
|
7
|
+
config: string[];
|
|
8
|
+
resolveConfig: ResolveConfig<NanoStagedConfig>;
|
|
9
|
+
};
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { hasDependency } from '../../util/plugin.js';
|
|
2
|
+
const title = 'Nano Staged';
|
|
3
|
+
const enablers = ['nano-staged'];
|
|
4
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
5
|
+
const config = [
|
|
6
|
+
'package.json',
|
|
7
|
+
'.nano-staged.{js,cjs,mjs,json}',
|
|
8
|
+
'nano-staged.{js,cjs,mjs,json}',
|
|
9
|
+
'.nanostagedrc',
|
|
10
|
+
];
|
|
11
|
+
const resolveConfig = async (config, options) => {
|
|
12
|
+
if (options.isProduction)
|
|
13
|
+
return [];
|
|
14
|
+
if (typeof config === 'function')
|
|
15
|
+
config = config();
|
|
16
|
+
if (!config)
|
|
17
|
+
return [];
|
|
18
|
+
const inputs = new Set();
|
|
19
|
+
for (const entry of Object.values(config).flat()) {
|
|
20
|
+
const api = { filenames: ['./example.js'] };
|
|
21
|
+
const scripts = [typeof entry === 'function' ? await entry(api) : entry].flat();
|
|
22
|
+
for (const id of options.getInputsFromScripts(scripts))
|
|
23
|
+
inputs.add(id);
|
|
24
|
+
}
|
|
25
|
+
return Array.from(inputs);
|
|
26
|
+
};
|
|
27
|
+
export default {
|
|
28
|
+
title,
|
|
29
|
+
enablers,
|
|
30
|
+
isEnabled,
|
|
31
|
+
config,
|
|
32
|
+
resolveConfig,
|
|
33
|
+
};
|
|
@@ -7,13 +7,14 @@ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
|
7
7
|
const config = ['next.config.{js,ts,cjs,mjs}'];
|
|
8
8
|
const defaultPageExtensions = ['{js,jsx,ts,tsx}'];
|
|
9
9
|
const productionEntryFilePatterns = [
|
|
10
|
-
'{instrumentation,middleware}.{js,ts}',
|
|
10
|
+
'{instrumentation,instrumentation-client,middleware}.{js,ts}',
|
|
11
11
|
'app/global-error.{js,jsx,ts,tsx}',
|
|
12
12
|
'app/**/{error,layout,loading,not-found,page,template,default}.{js,jsx,ts,tsx}',
|
|
13
13
|
'app/**/route.{js,jsx,ts,tsx}',
|
|
14
14
|
'app/{manifest,sitemap,robots}.{js,ts}',
|
|
15
15
|
'app/**/{icon,apple-icon}.{js,jsx,ts,tsx}',
|
|
16
16
|
'app/**/{opengraph,twitter}-image.{js,jsx,ts,tsx}',
|
|
17
|
+
'mdx-components.{js,jsx,ts,tsx}',
|
|
17
18
|
];
|
|
18
19
|
const getEntryFilePatterns = (pageExtensions = defaultPageExtensions) => {
|
|
19
20
|
const pages = pageExtensions.map(ext => `pages/**/*.${ext}`);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IsPluginEnabled } from '../../types/config.js';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
title: string;
|
|
4
|
+
enablers: string[];
|
|
5
|
+
isEnabled: IsPluginEnabled;
|
|
6
|
+
config: string[];
|
|
7
|
+
args: {
|
|
8
|
+
binaries: string[];
|
|
9
|
+
config: boolean;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { hasDependency } from '../../util/plugin.js';
|
|
2
|
+
const title = 'Oxlint';
|
|
3
|
+
const enablers = ['oxlint'];
|
|
4
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
5
|
+
const config = ['.oxlintrc.json'];
|
|
6
|
+
const args = {
|
|
7
|
+
binaries: ['oxlint'],
|
|
8
|
+
config: true,
|
|
9
|
+
};
|
|
10
|
+
export default {
|
|
11
|
+
title,
|
|
12
|
+
enablers,
|
|
13
|
+
isEnabled,
|
|
14
|
+
config,
|
|
15
|
+
args,
|
|
16
|
+
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { toProductionEntry } from '../../util/input.js';
|
|
2
2
|
import { hasDependency } from '../../util/plugin.js';
|
|
3
3
|
const title = 'Preconstruct';
|
|
4
4
|
const enablers = ['@preconstruct/cli'];
|
|
5
5
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
6
6
|
const config = ['package.json'];
|
|
7
7
|
const resolveEntryPaths = async (config) => {
|
|
8
|
-
return (config.entrypoints ?? []).map(id =>
|
|
8
|
+
return (config.entrypoints ?? []).map(id => toProductionEntry(id, { allowIncludeExports: true }));
|
|
9
9
|
};
|
|
10
10
|
export default {
|
|
11
11
|
title,
|
|
@@ -2,11 +2,11 @@ import { toDeferResolve, toDependency } from '../../util/input.js';
|
|
|
2
2
|
import { hasDependency } from '../../util/plugin.js';
|
|
3
3
|
const title = 'Prettier';
|
|
4
4
|
const enablers = ['prettier'];
|
|
5
|
-
const isEnabled = ({ dependencies
|
|
5
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
6
6
|
const config = [
|
|
7
7
|
'.prettierrc',
|
|
8
|
-
'.prettierrc.{json,js,cjs,mjs,yml,yaml,toml,json5}',
|
|
9
|
-
'prettier.config.{js,cjs,mjs}',
|
|
8
|
+
'.prettierrc.{json,js,cjs,mjs,ts,cts,mts,yml,yaml,toml,json5}',
|
|
9
|
+
'prettier.config.{js,cjs,mjs,ts,cts,mts}',
|
|
10
10
|
'package.{json,yaml}',
|
|
11
11
|
];
|
|
12
12
|
const resolveConfig = config => {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IsPluginEnabled, ResolveEntryPaths } from '../../types/config.js';
|
|
2
|
+
import type { RelayConfig } from './types.js';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
title: string;
|
|
5
|
+
enablers: string[];
|
|
6
|
+
isEnabled: IsPluginEnabled;
|
|
7
|
+
config: string[];
|
|
8
|
+
resolveEntryPaths: ResolveEntryPaths<RelayConfig>;
|
|
9
|
+
args: {
|
|
10
|
+
binaries: string[];
|
|
11
|
+
args: (args: string[]) => string[];
|
|
12
|
+
config: boolean;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import parseArgs from 'minimist';
|
|
2
|
+
import { toProductionEntry } from '../../util/input.js';
|
|
3
|
+
import { join } from '../../util/path.js';
|
|
4
|
+
import { hasDependency } from '../../util/plugin.js';
|
|
5
|
+
const title = 'Relay';
|
|
6
|
+
const enablers = ['vite-plugin-relay', '@swc/plugin-relay', 'babel-plugin-relay'];
|
|
7
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
8
|
+
const config = ['relay.config.json', 'relay.config.js'];
|
|
9
|
+
const resolveEntryPaths = async (config) => {
|
|
10
|
+
const projects = 'projects' in config ? Object.values(config.projects) : [config];
|
|
11
|
+
return projects.map(project => {
|
|
12
|
+
const artifactDirectory = project.artifactDirectory;
|
|
13
|
+
if (artifactDirectory == null) {
|
|
14
|
+
return toProductionEntry('**/__generated__/*');
|
|
15
|
+
}
|
|
16
|
+
return toProductionEntry(join(artifactDirectory, '**'));
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
const args = {
|
|
20
|
+
binaries: ['relay-compiler'],
|
|
21
|
+
args: (args) => ['-c', parseArgs(args)._[0]],
|
|
22
|
+
config: true,
|
|
23
|
+
};
|
|
24
|
+
export default {
|
|
25
|
+
title,
|
|
26
|
+
enablers,
|
|
27
|
+
isEnabled,
|
|
28
|
+
config,
|
|
29
|
+
resolveEntryPaths,
|
|
30
|
+
args,
|
|
31
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type RelayProject = {
|
|
2
|
+
artifactDirectory?: string;
|
|
3
|
+
requireCustomScalarTypes?: boolean;
|
|
4
|
+
customScalarTypes?: Record<string, string | {
|
|
5
|
+
name: string;
|
|
6
|
+
path: string;
|
|
7
|
+
}>;
|
|
8
|
+
};
|
|
9
|
+
export type RelayConfig = RelayProject | {
|
|
10
|
+
projects: Record<string, RelayProject>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { toProductionEntry } from '../../util/input.js';
|
|
2
2
|
import { hasDependency } from '../../util/plugin.js';
|
|
3
|
+
import { config } from '../astro/index.js';
|
|
3
4
|
import { getComponentPathsFromSourceFile } from './resolveFromAST.js';
|
|
4
5
|
const title = 'Starlight';
|
|
5
6
|
const enablers = ['@astrojs/starlight'];
|
|
6
7
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
7
|
-
const config = ['astro.config.{js,cjs,mjs,ts}'];
|
|
8
8
|
const resolveFromAST = (sourceFile) => {
|
|
9
9
|
const componentPaths = getComponentPathsFromSourceFile(sourceFile);
|
|
10
10
|
return Array.from(componentPaths).map(id => toProductionEntry(id));
|
|
@@ -16,7 +16,7 @@ const resolveConfig = async (config) => {
|
|
|
16
16
|
return config.entry;
|
|
17
17
|
return Object.values(config.entry);
|
|
18
18
|
})
|
|
19
|
-
.map(id => toProductionEntry(id));
|
|
19
|
+
.map(id => toProductionEntry(id, { allowIncludeExports: true }));
|
|
20
20
|
return entryPatterns;
|
|
21
21
|
};
|
|
22
22
|
const args = {
|
package/dist/plugins/xo/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { hasDependency } from '../../util/plugin.js';
|
|
|
2
2
|
import { getInputs } from '../eslint/helpers.js';
|
|
3
3
|
const title = 'xo';
|
|
4
4
|
const enablers = ['xo'];
|
|
5
|
-
const isEnabled = ({ dependencies
|
|
5
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
6
6
|
const config = ['package.json', '.xo-config', '.xo-config.{js,cjs,json}', 'xo.config.{js,cjs}'];
|
|
7
7
|
const entry = ['.xo-config.{js,cjs}', 'xo.config.{js,cjs}'];
|
|
8
8
|
const resolveConfig = async (config, options) => {
|