knip 6.20.0 → 6.22.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 +4 -4
- package/dist/ConfigurationChief.d.ts +6 -0
- package/dist/DependencyDeputy.js +1 -1
- package/dist/compilers/index.d.ts +10 -0
- package/dist/plugins/astro/index.js +13 -1
- package/dist/plugins/execa/visitors/execa.js +14 -3
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.js +2 -0
- package/dist/plugins/lunaria/index.d.ts +3 -0
- package/dist/plugins/lunaria/index.js +30 -0
- package/dist/plugins/lunaria/types.d.ts +16 -0
- package/dist/plugins/lunaria/types.js +1 -0
- package/dist/plugins/next/index.js +16 -4
- package/dist/plugins/vitest/index.js +13 -0
- package/dist/plugins/vitest/types.d.ts +4 -0
- package/dist/plugins/xo/index.js +9 -6
- package/dist/plugins.js +1 -1
- package/dist/schema/configuration.d.ts +15 -0
- package/dist/schema/plugins.d.ts +5 -0
- package/dist/schema/plugins.js +1 -0
- package/dist/types/PluginNames.d.ts +2 -2
- package/dist/types/PluginNames.js +1 -0
- package/dist/util/create-options.d.ts +10 -0
- package/dist/util/modules.js +2 -1
- package/dist/util/package-json.js +2 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/schema.json +4 -0
package/README.md
CHANGED
|
@@ -46,16 +46,16 @@ following projects:
|
|
|
46
46
|
- [file-entry-cache][22] ([MIT][23])
|
|
47
47
|
- [json-parse-even-better-errors][24] ([MIT][25])
|
|
48
48
|
|
|
49
|
-
[1]: https://www.
|
|
49
|
+
[1]: https://www.npmx.dev/package/knip
|
|
50
50
|
[2]: https://img.shields.io/npm/v/knip?color=f56e0f
|
|
51
51
|
[3]: https://img.shields.io/npm/dm/knip?color=f56e0f
|
|
52
52
|
[4]: https://github.com/webpro-nl/knip
|
|
53
53
|
[5]:
|
|
54
54
|
https://img.shields.io/github/stars/webpro-nl/knip?style=flat-square&color=f56e0f
|
|
55
55
|
[6]: https://knip.dev
|
|
56
|
-
[7]: https://www.
|
|
57
|
-
[8]: https://www.
|
|
58
|
-
[9]: https://www.
|
|
56
|
+
[7]: https://www.npmx.dev/package/@knip/create-config
|
|
57
|
+
[8]: https://www.npmx.dev/package/@knip/language-server
|
|
58
|
+
[9]: https://www.npmx.dev/package/@knip/mcp
|
|
59
59
|
[10]: https://marketplace.visualstudio.com/items?itemName=webpro.vscode-knip
|
|
60
60
|
[11]: https://open-vsx.org/extension/webpro/vscode-knip
|
|
61
61
|
[12]: https://github.com/webpro-nl/knip/blob/main/.github/CONTRIBUTING.md
|
|
@@ -312,6 +312,11 @@ export declare class ConfigurationChief {
|
|
|
312
312
|
entry?: string | string[] | undefined;
|
|
313
313
|
project?: string | string[] | undefined;
|
|
314
314
|
} | undefined;
|
|
315
|
+
lunaria?: string | boolean | string[] | {
|
|
316
|
+
config?: string | string[] | undefined;
|
|
317
|
+
entry?: string | string[] | undefined;
|
|
318
|
+
project?: string | string[] | undefined;
|
|
319
|
+
} | undefined;
|
|
315
320
|
markdownlint?: string | boolean | string[] | {
|
|
316
321
|
config?: string | string[] | undefined;
|
|
317
322
|
entry?: string | string[] | undefined;
|
|
@@ -910,6 +915,7 @@ export declare class ConfigurationChief {
|
|
|
910
915
|
lit?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
911
916
|
"lockfile-lint"?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
912
917
|
"lost-pixel"?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
918
|
+
lunaria?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
913
919
|
markdownlint?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
914
920
|
mdx?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
|
915
921
|
mdxlint?: (boolean | import("./types/config.ts").EnsuredPluginConfiguration) | undefined;
|
package/dist/DependencyDeputy.js
CHANGED
|
@@ -240,7 +240,7 @@ export class DependencyDeputy {
|
|
|
240
240
|
devDependencyIssues.push({ type: 'devDependencies', filePath, workspace, symbol, fixes: [], ...position });
|
|
241
241
|
}
|
|
242
242
|
for (const symbol of this.getOptionalPeerDependencies(workspace)) {
|
|
243
|
-
if (!
|
|
243
|
+
if (!referencedDependencies?.has(symbol))
|
|
244
244
|
continue;
|
|
245
245
|
if (manifest.dependencies.includes(symbol) || manifest.devDependencies.includes(symbol))
|
|
246
246
|
continue;
|
|
@@ -258,6 +258,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
258
258
|
entry?: string | string[] | undefined;
|
|
259
259
|
project?: string | string[] | undefined;
|
|
260
260
|
} | undefined;
|
|
261
|
+
lunaria?: string | boolean | string[] | {
|
|
262
|
+
config?: string | string[] | undefined;
|
|
263
|
+
entry?: string | string[] | undefined;
|
|
264
|
+
project?: string | string[] | undefined;
|
|
265
|
+
} | undefined;
|
|
261
266
|
markdownlint?: string | boolean | string[] | {
|
|
262
267
|
config?: string | string[] | undefined;
|
|
263
268
|
entry?: string | string[] | undefined;
|
|
@@ -1055,6 +1060,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
1055
1060
|
entry?: string | string[] | undefined;
|
|
1056
1061
|
project?: string | string[] | undefined;
|
|
1057
1062
|
} | undefined;
|
|
1063
|
+
lunaria?: string | boolean | string[] | {
|
|
1064
|
+
config?: string | string[] | undefined;
|
|
1065
|
+
entry?: string | string[] | undefined;
|
|
1066
|
+
project?: string | string[] | undefined;
|
|
1067
|
+
} | undefined;
|
|
1058
1068
|
markdownlint?: string | boolean | string[] | {
|
|
1059
1069
|
config?: string | string[] | undefined;
|
|
1060
1070
|
entry?: string | string[] | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { findCallArg, getDefaultImportName, getImportMap, getPropertyValues } from '../../typescript/ast-helpers.js';
|
|
2
|
+
import { toConfig, toDependency, toEntry, toProductionEntry } from '../../util/input.js';
|
|
2
3
|
import { hasDependency } from '../../util/plugin.js';
|
|
3
4
|
import { getAliasInputs } from '../vitest/helpers.js';
|
|
4
5
|
import compiler from './compiler.js';
|
|
@@ -28,6 +29,17 @@ const resolveFromAST = (program, options) => {
|
|
|
28
29
|
];
|
|
29
30
|
if (!usesPassthroughImageService(program))
|
|
30
31
|
inputs.push(toDependency('sharp', { optional: true }));
|
|
32
|
+
const importMap = getImportMap(program);
|
|
33
|
+
const lunariaImportName = getDefaultImportName(importMap, '@lunariajs/starlight');
|
|
34
|
+
if (lunariaImportName) {
|
|
35
|
+
const lunariaConfig = findCallArg(program, lunariaImportName);
|
|
36
|
+
if (lunariaConfig) {
|
|
37
|
+
const configPaths = getPropertyValues(lunariaConfig, 'configPath');
|
|
38
|
+
for (const id of configPaths) {
|
|
39
|
+
inputs.push(toConfig('lunaria', id));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
31
43
|
return inputs;
|
|
32
44
|
};
|
|
33
45
|
const registerCompilers = ({ registerCompiler, hasDependency }) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getSafeScriptFromArgs, getStringValue, isStringLiteral } from '../../../typescript/ast-nodes.js';
|
|
2
2
|
const tags = new Set(['$', '$sync']);
|
|
3
|
-
const methods = new Set(['execa', 'execaSync', 'execaCommand', 'execaCommandSync', '$sync']);
|
|
3
|
+
const methods = new Set(['execa', 'execaSync', 'execaCommand', 'execaCommandSync', 'execaNode', '$sync']);
|
|
4
4
|
export function createExecaVisitor(ctx) {
|
|
5
5
|
return {
|
|
6
6
|
TaggedTemplateExpression(node) {
|
|
@@ -10,7 +10,13 @@ export function createExecaVisitor(ctx) {
|
|
|
10
10
|
: tag.type === 'CallExpression' && tag.callee.type === 'Identifier'
|
|
11
11
|
? tag.callee.name
|
|
12
12
|
: undefined;
|
|
13
|
-
if (tagName
|
|
13
|
+
if (tagName === 'execaNode') {
|
|
14
|
+
for (const q of node.quasi.quasis) {
|
|
15
|
+
if (q.value.raw)
|
|
16
|
+
ctx.addScript(`node ${q.value.raw}`);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
else if (tagName && tags.has(tagName)) {
|
|
14
20
|
for (const q of node.quasi.quasis) {
|
|
15
21
|
if (q.value.raw)
|
|
16
22
|
ctx.addScript(q.value.raw);
|
|
@@ -21,7 +27,12 @@ export function createExecaVisitor(ctx) {
|
|
|
21
27
|
if (node.callee.type !== 'Identifier' || !methods.has(node.callee.name))
|
|
22
28
|
return;
|
|
23
29
|
const fnName = node.callee.name;
|
|
24
|
-
if (fnName
|
|
30
|
+
if (fnName === 'execaNode') {
|
|
31
|
+
const script = getSafeScriptFromArgs(node.arguments[0], node.arguments[1]);
|
|
32
|
+
if (script)
|
|
33
|
+
ctx.addScript(`node ${script}`);
|
|
34
|
+
}
|
|
35
|
+
else if (fnName.startsWith('execaCommand')) {
|
|
25
36
|
if (node.arguments[0] && isStringLiteral(node.arguments[0])) {
|
|
26
37
|
const val = getStringValue(node.arguments[0]);
|
|
27
38
|
if (val)
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -55,6 +55,7 @@ export declare const Plugins: {
|
|
|
55
55
|
lit: import("../types/config.ts").Plugin;
|
|
56
56
|
'lockfile-lint': import("../types/config.ts").Plugin;
|
|
57
57
|
'lost-pixel': import("../types/config.ts").Plugin;
|
|
58
|
+
lunaria: import("../types/config.ts").Plugin;
|
|
58
59
|
markdownlint: import("../types/config.ts").Plugin;
|
|
59
60
|
mdx: import("../types/config.ts").Plugin;
|
|
60
61
|
mdxlint: import("../types/config.ts").Plugin;
|
package/dist/plugins/index.js
CHANGED
|
@@ -49,6 +49,7 @@ import { default as linthtml } from './linthtml/index.js';
|
|
|
49
49
|
import { default as lit } from './lit/index.js';
|
|
50
50
|
import { default as lockfileLint } from './lockfile-lint/index.js';
|
|
51
51
|
import { default as lostPixel } from './lost-pixel/index.js';
|
|
52
|
+
import { default as lunaria } from './lunaria/index.js';
|
|
52
53
|
import { default as markdownlint } from './markdownlint/index.js';
|
|
53
54
|
import { default as mdx } from './mdx/index.js';
|
|
54
55
|
import { default as mdxlint } from './mdxlint/index.js';
|
|
@@ -205,6 +206,7 @@ export const Plugins = {
|
|
|
205
206
|
lit,
|
|
206
207
|
'lockfile-lint': lockfileLint,
|
|
207
208
|
'lost-pixel': lostPixel,
|
|
209
|
+
lunaria,
|
|
208
210
|
markdownlint,
|
|
209
211
|
mdx,
|
|
210
212
|
mdxlint,
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { isAbsolute, join } from '../../util/path.js';
|
|
2
|
+
import { toProductionEntry } from '../../util/input.js';
|
|
3
|
+
import { hasDependency } from '../../util/plugin.js';
|
|
4
|
+
const title = 'Lunaria';
|
|
5
|
+
const enablers = ['@lunariajs/core', '@lunariajs/starlight'];
|
|
6
|
+
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
7
|
+
const config = ['lunaria.config.json'];
|
|
8
|
+
const resolveConfig = async (localConfig, options) => {
|
|
9
|
+
if (!localConfig)
|
|
10
|
+
return [];
|
|
11
|
+
const files = localConfig.files?.map(f => f.location) ?? [];
|
|
12
|
+
const renderer = localConfig.renderer ? [localConfig.renderer] : [];
|
|
13
|
+
const customCss = localConfig.dashboard?.customCss ?? [];
|
|
14
|
+
const favicon = localConfig.dashboard?.favicon?.inline ? [localConfig.dashboard.favicon.inline] : [];
|
|
15
|
+
const baseDir = options.configFileDir;
|
|
16
|
+
return [...files, ...renderer, ...customCss, ...favicon].map(id => toProductionEntry(isAbsolute(id) ? id : join(baseDir, id)));
|
|
17
|
+
};
|
|
18
|
+
const args = {
|
|
19
|
+
binaries: ['lunaria'],
|
|
20
|
+
config: ['config'],
|
|
21
|
+
};
|
|
22
|
+
const plugin = {
|
|
23
|
+
title,
|
|
24
|
+
enablers,
|
|
25
|
+
isEnabled,
|
|
26
|
+
config,
|
|
27
|
+
resolveConfig,
|
|
28
|
+
args,
|
|
29
|
+
};
|
|
30
|
+
export default plugin;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
type TrackedFile = {
|
|
2
|
+
location: string;
|
|
3
|
+
};
|
|
4
|
+
type Favicon = {
|
|
5
|
+
inline?: string;
|
|
6
|
+
};
|
|
7
|
+
type Dashboard = {
|
|
8
|
+
customCss?: string[];
|
|
9
|
+
favicon?: Favicon;
|
|
10
|
+
};
|
|
11
|
+
export type LunariaConfig = {
|
|
12
|
+
files: TrackedFile[];
|
|
13
|
+
renderer?: string;
|
|
14
|
+
dashboard?: Dashboard;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { toProductionEntry } from '../../util/input.js';
|
|
1
|
+
import { toConfig, toProductionEntry } from '../../util/input.js';
|
|
2
|
+
import { join } from '../../util/path.js';
|
|
2
3
|
import { hasDependency } from '../../util/plugin.js';
|
|
3
4
|
import { getPageExtensions } from './resolveFromAST.js';
|
|
4
5
|
const title = 'Next.js';
|
|
@@ -23,11 +24,21 @@ const getEntryFilePatterns = (pageExtensions = defaultPageExtensions) => {
|
|
|
23
24
|
].flatMap(pattern => [pattern, `src/${pattern}`]);
|
|
24
25
|
};
|
|
25
26
|
const production = getEntryFilePatterns();
|
|
26
|
-
const resolveFromAST = program => {
|
|
27
|
+
const resolveFromAST = (program, { configFileDir }) => {
|
|
27
28
|
const pageExtensions = getPageExtensions(program);
|
|
28
29
|
const extensions = pageExtensions.length > 0 ? pageExtensions : defaultPageExtensions;
|
|
29
|
-
const patterns = getEntryFilePatterns(extensions);
|
|
30
|
-
return patterns.map(id => toProductionEntry(id));
|
|
30
|
+
const patterns = [...getEntryFilePatterns(extensions), 'next-env.d.ts'];
|
|
31
|
+
return patterns.map(id => toProductionEntry(join(configFileDir, id)));
|
|
32
|
+
};
|
|
33
|
+
const commands = new Set(['dev', 'build', 'start']);
|
|
34
|
+
const args = {
|
|
35
|
+
boolean: ['turbo', 'turbopack'],
|
|
36
|
+
resolveInputs: parsed => {
|
|
37
|
+
const dir = commands.has(parsed._[0]) ? parsed._[1] : undefined;
|
|
38
|
+
if (!dir)
|
|
39
|
+
return [];
|
|
40
|
+
return [toConfig('next', join(dir, 'next.config'))];
|
|
41
|
+
},
|
|
31
42
|
};
|
|
32
43
|
const plugin = {
|
|
33
44
|
title,
|
|
@@ -36,5 +47,6 @@ const plugin = {
|
|
|
36
47
|
config,
|
|
37
48
|
production,
|
|
38
49
|
resolveFromAST,
|
|
50
|
+
args,
|
|
39
51
|
};
|
|
40
52
|
export default plugin;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { DEFAULT_EXTENSIONS } from '../../constants.js';
|
|
2
2
|
import { _glob } from '../../util/glob.js';
|
|
3
3
|
import { toConfig, toDeferResolve, toDependency, toEntry } from '../../util/input.js';
|
|
4
|
+
import { getPackageNameFromModuleSpecifier } from '../../util/modules.js';
|
|
4
5
|
import { isAbsolute, isInternal, join, toAbsolute } from '../../util/path.js';
|
|
5
6
|
import { hasDependency } from '../../util/plugin.js';
|
|
6
7
|
import { getIndexHtmlEntries } from '../vite/helpers.js';
|
|
@@ -53,6 +54,11 @@ const findConfigDependencies = (localConfig, options, vitestRoot) => {
|
|
|
53
54
|
...projectsDependencies,
|
|
54
55
|
];
|
|
55
56
|
};
|
|
57
|
+
const getOptimizeDepsIncludePackageName = (specifier) => {
|
|
58
|
+
const separatorIndex = specifier.indexOf('>');
|
|
59
|
+
const id = (separatorIndex === -1 ? specifier : specifier.slice(0, separatorIndex)).trim();
|
|
60
|
+
return getPackageNameFromModuleSpecifier(id);
|
|
61
|
+
};
|
|
56
62
|
const getConfigs = async (localConfig) => {
|
|
57
63
|
const configs = [];
|
|
58
64
|
for (const config of [localConfig].flat()) {
|
|
@@ -136,6 +142,13 @@ export const resolveConfig = async (localConfig, options) => {
|
|
|
136
142
|
}
|
|
137
143
|
if (cfg.resolve?.alias)
|
|
138
144
|
addAliases(cfg.resolve.alias);
|
|
145
|
+
for (const dependency of cfg.resolve?.dedupe ?? [])
|
|
146
|
+
inputs.add(toDependency(dependency));
|
|
147
|
+
for (const dependency of cfg.optimizeDeps?.include ?? []) {
|
|
148
|
+
const packageName = getOptimizeDepsIncludePackageName(dependency);
|
|
149
|
+
if (packageName)
|
|
150
|
+
inputs.add(toDependency(packageName));
|
|
151
|
+
}
|
|
139
152
|
if (cfg.resolve?.extensions) {
|
|
140
153
|
const customExtensions = cfg.resolve.extensions.filter(ext => ext.startsWith('.') && !DEFAULT_EXTENSIONS.has(ext));
|
|
141
154
|
for (const ext of customExtensions) {
|
package/dist/plugins/xo/index.js
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import { hasDependency } from '../../util/plugin.js';
|
|
2
2
|
import { getInputs } from '../eslint/helpers.js';
|
|
3
|
+
import { getInputsFromFlatConfigAST } from '../eslint/resolveFromAST.js';
|
|
3
4
|
const title = 'xo';
|
|
4
5
|
const enablers = ['xo'];
|
|
5
6
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
6
|
-
const config = ['package.json', '.xo-config', '.xo-config.{js,cjs,json}', 'xo.config.{js,cjs}'];
|
|
7
|
-
const entry = ['.xo-config.{js,cjs}', 'xo.config.{js,cjs}'];
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
const config = ['package.json', '.xo-config', '.xo-config.{js,cjs,json}', 'xo.config.{js,cjs,mjs,ts,cts,mts}'];
|
|
8
|
+
const entry = ['.xo-config.{js,cjs}', 'xo.config.{js,cjs,mjs,ts,cts,mts}'];
|
|
9
|
+
const isFlatConfig = ({ manifest }) => (manifest.getMajor('xo') ?? 1) >= 1;
|
|
10
|
+
const isLoadConfig = options => !isFlatConfig(options);
|
|
11
|
+
const resolveConfig = (config, options) => getInputs(config, options);
|
|
12
|
+
const resolveFromAST = (program, options) => isFlatConfig(options) ? getInputsFromFlatConfigAST(program) : [];
|
|
12
13
|
const plugin = {
|
|
13
14
|
title,
|
|
14
15
|
enablers,
|
|
15
16
|
isEnabled,
|
|
16
17
|
entry,
|
|
17
18
|
config,
|
|
19
|
+
isLoadConfig,
|
|
18
20
|
resolveConfig,
|
|
21
|
+
resolveFromAST,
|
|
19
22
|
};
|
|
20
23
|
export default plugin;
|
package/dist/plugins.js
CHANGED
|
@@ -4,7 +4,7 @@ import { timerify } from './util/Performance.js';
|
|
|
4
4
|
const PMap = Plugins;
|
|
5
5
|
const { values } = parseArgs({ strict: false, options: { performance: { type: 'boolean' } } });
|
|
6
6
|
const isEnabled = !!values.performance;
|
|
7
|
-
const timerifyMethods = ['resolve', 'resolveConfig', '
|
|
7
|
+
const timerifyMethods = ['resolve', 'resolveConfig', 'resolveFromAST'];
|
|
8
8
|
const PluginEntries = Object.entries(PMap);
|
|
9
9
|
if (isEnabled) {
|
|
10
10
|
for (const [, plugin] of PluginEntries) {
|
|
@@ -256,6 +256,11 @@ export declare const workspaceConfigurationSchema: z.ZodMiniObject<{
|
|
|
256
256
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
257
257
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
258
258
|
}, z.core.$strip>]>>;
|
|
259
|
+
lunaria: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
260
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
261
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
262
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
263
|
+
}, z.core.$strip>]>>;
|
|
259
264
|
markdownlint: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
260
265
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
261
266
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
@@ -1047,6 +1052,11 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
|
|
|
1047
1052
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1048
1053
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1049
1054
|
}, z.core.$strip>]>>;
|
|
1055
|
+
lunaria: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
1056
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1057
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1058
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1059
|
+
}, z.core.$strip>]>>;
|
|
1050
1060
|
markdownlint: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
1051
1061
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1052
1062
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
@@ -1852,6 +1862,11 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
|
|
|
1852
1862
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1853
1863
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1854
1864
|
}, z.core.$strip>]>>;
|
|
1865
|
+
lunaria: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
1866
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1867
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1868
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1869
|
+
}, z.core.$strip>]>>;
|
|
1855
1870
|
markdownlint: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
1856
1871
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
1857
1872
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
package/dist/schema/plugins.d.ts
CHANGED
|
@@ -261,6 +261,11 @@ export declare const pluginsSchema: z.ZodMiniObject<{
|
|
|
261
261
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
262
262
|
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
263
263
|
}, z.core.$strip>]>;
|
|
264
|
+
lunaria: z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
265
|
+
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
266
|
+
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
267
|
+
project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
268
|
+
}, z.core.$strip>]>;
|
|
264
269
|
markdownlint: z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
|
|
265
270
|
config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
|
266
271
|
entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
|
package/dist/schema/plugins.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type PluginName = 'angular' | 'astro' | 'astro-db' | 'astro-og-canvas' | 'ava' | 'babel' | 'biome' | 'bumpp' | 'bun' | 'c8' | 'capacitor' | 'catalyst' | 'changelogen' | 'changelogithub' | 'changesets' | 'commitizen' | 'commitlint' | 'convex' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | 'danger' | 'dependency-cruiser' | 'docusaurus' | 'dotenv' | 'drizzle' | 'eleventy' | 'eslint' | 'execa' | 'expo' | 'expressive-code' | 'fast' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'hardhat' | 'husky' | 'i18next-parser' | 'jest' | 'karma' | 'knex' | 'ladle' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lit' | 'lockfile-lint' | 'lost-pixel' | 'markdownlint' | 'mdx' | 'mdxlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nano-spawn' | 'nano-staged' | 'nest' | 'netlify' | 'next' | 'next-intl' | 'next-mdx' | 'nitro' | 'node' | 'node-modules-inspector' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nx' | 'nyc' | 'oclif' | 'openapi-ts' | 'orval' | 'oxfmt' | 'oxlint' | 'panda-css' | 'parcel' | 'payload' | 'pino' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'pm2' | 'pnpm' | 'postcss' | 'preconstruct' | 'prettier' | 'prisma' | 'qwik' | 'raycast' | 'react-cosmos' | 'react-email' | 'react-native' | 'react-router' | 'relay' | 'release-it' | 'remark' | 'remix' | 'rolldown' | 'rollup' | 'rsbuild' | 'rslib' | 'rspack' | 'rstest' | 'sanity' | 'semantic-release' | 'sentry' | 'serverless-framework' | 'simple-git-hooks' | 'size-limit' | 'sst' | 'starlight' | 'stencil' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'sveltejs-package' | 'sveltekit' | 'svgo' | 'svgr' | 'swc' | 'syncpack' | 'tailwind' | 'tanstack-router' | 'taskfile' | 'travis' | 'ts-node' | 'tsdown' | 'tsup' | 'tsx' | 'typedoc' | 'typescript' | 'unbuild' | 'unocss' | 'vercel' | 'vercel-og' | 'vike' | 'vite' | 'vitepress' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'wxt' | 'xo' | 'yarn' | 'yorkie' | 'zx';
|
|
2
|
-
export declare const pluginNames: readonly ['angular', 'astro', 'astro-db', 'astro-og-canvas', 'ava', 'babel', 'biome', 'bumpp', 'bun', 'c8', 'capacitor', 'catalyst', 'changelogen', 'changelogithub', 'changesets', 'commitizen', 'commitlint', 'convex', 'create-typescript-app', 'cspell', 'cucumber', 'cypress', 'danger', 'dependency-cruiser', 'docusaurus', 'dotenv', 'drizzle', 'eleventy', 'eslint', 'execa', 'expo', 'expressive-code', 'fast', 'gatsby', 'github-action', 'github-actions', 'glob', 'graphql-codegen', 'hardhat', 'husky', 'i18next-parser', 'jest', 'karma', 'knex', 'ladle', 'lefthook', 'lint-staged', 'linthtml', 'lit', 'lockfile-lint', 'lost-pixel', 'markdownlint', 'mdx', 'mdxlint', 'metro', 'mocha', 'moonrepo', 'msw', 'nano-spawn', 'nano-staged', 'nest', 'netlify', 'next', 'next-intl', 'next-mdx', 'nitro', 'node', 'node-modules-inspector', 'nodemon', 'npm-package-json-lint', 'nuxt', 'nx', 'nyc', 'oclif', 'openapi-ts', 'orval', 'oxfmt', 'oxlint', 'panda-css', 'parcel', 'payload', 'pino', 'playwright', 'playwright-ct', 'playwright-test', 'plop', 'pm2', 'pnpm', 'postcss', 'preconstruct', 'prettier', 'prisma', 'qwik', 'raycast', 'react-cosmos', 'react-email', 'react-native', 'react-router', 'relay', 'release-it', 'remark', 'remix', 'rolldown', 'rollup', 'rsbuild', 'rslib', 'rspack', 'rstest', 'sanity', 'semantic-release', 'sentry', 'serverless-framework', 'simple-git-hooks', 'size-limit', 'sst', 'starlight', 'stencil', 'storybook', 'stryker', 'stylelint', 'svelte', 'sveltejs-package', 'sveltekit', 'svgo', 'svgr', 'swc', 'syncpack', 'tailwind', 'tanstack-router', 'taskfile', 'travis', 'ts-node', 'tsdown', 'tsup', 'tsx', 'typedoc', 'typescript', 'unbuild', 'unocss', 'vercel', 'vercel-og', 'vike', 'vite', 'vitepress', 'vitest', 'vue', 'webdriver-io', 'webpack', 'wireit', 'wrangler', 'wxt', 'xo', 'yarn', 'yorkie', 'zx'];
|
|
1
|
+
export type PluginName = 'angular' | 'astro' | 'astro-db' | 'astro-og-canvas' | 'ava' | 'babel' | 'biome' | 'bumpp' | 'bun' | 'c8' | 'capacitor' | 'catalyst' | 'changelogen' | 'changelogithub' | 'changesets' | 'commitizen' | 'commitlint' | 'convex' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | 'danger' | 'dependency-cruiser' | 'docusaurus' | 'dotenv' | 'drizzle' | 'eleventy' | 'eslint' | 'execa' | 'expo' | 'expressive-code' | 'fast' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'hardhat' | 'husky' | 'i18next-parser' | 'jest' | 'karma' | 'knex' | 'ladle' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lit' | 'lockfile-lint' | 'lost-pixel' | 'lunaria' | 'markdownlint' | 'mdx' | 'mdxlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nano-spawn' | 'nano-staged' | 'nest' | 'netlify' | 'next' | 'next-intl' | 'next-mdx' | 'nitro' | 'node' | 'node-modules-inspector' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nx' | 'nyc' | 'oclif' | 'openapi-ts' | 'orval' | 'oxfmt' | 'oxlint' | 'panda-css' | 'parcel' | 'payload' | 'pino' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'pm2' | 'pnpm' | 'postcss' | 'preconstruct' | 'prettier' | 'prisma' | 'qwik' | 'raycast' | 'react-cosmos' | 'react-email' | 'react-native' | 'react-router' | 'relay' | 'release-it' | 'remark' | 'remix' | 'rolldown' | 'rollup' | 'rsbuild' | 'rslib' | 'rspack' | 'rstest' | 'sanity' | 'semantic-release' | 'sentry' | 'serverless-framework' | 'simple-git-hooks' | 'size-limit' | 'sst' | 'starlight' | 'stencil' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'sveltejs-package' | 'sveltekit' | 'svgo' | 'svgr' | 'swc' | 'syncpack' | 'tailwind' | 'tanstack-router' | 'taskfile' | 'travis' | 'ts-node' | 'tsdown' | 'tsup' | 'tsx' | 'typedoc' | 'typescript' | 'unbuild' | 'unocss' | 'vercel' | 'vercel-og' | 'vike' | 'vite' | 'vitepress' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'wxt' | 'xo' | 'yarn' | 'yorkie' | 'zx';
|
|
2
|
+
export declare const pluginNames: readonly ['angular', 'astro', 'astro-db', 'astro-og-canvas', 'ava', 'babel', 'biome', 'bumpp', 'bun', 'c8', 'capacitor', 'catalyst', 'changelogen', 'changelogithub', 'changesets', 'commitizen', 'commitlint', 'convex', 'create-typescript-app', 'cspell', 'cucumber', 'cypress', 'danger', 'dependency-cruiser', 'docusaurus', 'dotenv', 'drizzle', 'eleventy', 'eslint', 'execa', 'expo', 'expressive-code', 'fast', 'gatsby', 'github-action', 'github-actions', 'glob', 'graphql-codegen', 'hardhat', 'husky', 'i18next-parser', 'jest', 'karma', 'knex', 'ladle', 'lefthook', 'lint-staged', 'linthtml', 'lit', 'lockfile-lint', 'lost-pixel', 'lunaria', 'markdownlint', 'mdx', 'mdxlint', 'metro', 'mocha', 'moonrepo', 'msw', 'nano-spawn', 'nano-staged', 'nest', 'netlify', 'next', 'next-intl', 'next-mdx', 'nitro', 'node', 'node-modules-inspector', 'nodemon', 'npm-package-json-lint', 'nuxt', 'nx', 'nyc', 'oclif', 'openapi-ts', 'orval', 'oxfmt', 'oxlint', 'panda-css', 'parcel', 'payload', 'pino', 'playwright', 'playwright-ct', 'playwright-test', 'plop', 'pm2', 'pnpm', 'postcss', 'preconstruct', 'prettier', 'prisma', 'qwik', 'raycast', 'react-cosmos', 'react-email', 'react-native', 'react-router', 'relay', 'release-it', 'remark', 'remix', 'rolldown', 'rollup', 'rsbuild', 'rslib', 'rspack', 'rstest', 'sanity', 'semantic-release', 'sentry', 'serverless-framework', 'simple-git-hooks', 'size-limit', 'sst', 'starlight', 'stencil', 'storybook', 'stryker', 'stylelint', 'svelte', 'sveltejs-package', 'sveltekit', 'svgo', 'svgr', 'swc', 'syncpack', 'tailwind', 'tanstack-router', 'taskfile', 'travis', 'ts-node', 'tsdown', 'tsup', 'tsx', 'typedoc', 'typescript', 'unbuild', 'unocss', 'vercel', 'vercel-og', 'vike', 'vite', 'vitepress', 'vitest', 'vue', 'webdriver-io', 'webpack', 'wireit', 'wrangler', 'wxt', 'xo', 'yarn', 'yorkie', 'zx'];
|
|
@@ -298,6 +298,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
|
|
|
298
298
|
entry?: string | string[] | undefined;
|
|
299
299
|
project?: string | string[] | undefined;
|
|
300
300
|
} | undefined;
|
|
301
|
+
lunaria?: string | boolean | string[] | {
|
|
302
|
+
config?: string | string[] | undefined;
|
|
303
|
+
entry?: string | string[] | undefined;
|
|
304
|
+
project?: string | string[] | undefined;
|
|
305
|
+
} | undefined;
|
|
301
306
|
markdownlint?: string | boolean | string[] | {
|
|
302
307
|
config?: string | string[] | undefined;
|
|
303
308
|
entry?: string | string[] | undefined;
|
|
@@ -1097,6 +1102,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
|
|
|
1097
1102
|
entry?: string | string[] | undefined;
|
|
1098
1103
|
project?: string | string[] | undefined;
|
|
1099
1104
|
} | undefined;
|
|
1105
|
+
lunaria?: string | boolean | string[] | {
|
|
1106
|
+
config?: string | string[] | undefined;
|
|
1107
|
+
entry?: string | string[] | undefined;
|
|
1108
|
+
project?: string | string[] | undefined;
|
|
1109
|
+
} | undefined;
|
|
1100
1110
|
markdownlint?: string | boolean | string[] | {
|
|
1101
1111
|
config?: string | string[] | undefined;
|
|
1102
1112
|
entry?: string | string[] | undefined;
|
package/dist/util/modules.js
CHANGED
|
@@ -68,6 +68,7 @@ export const sanitizeSpecifier = (specifier) => {
|
|
|
68
68
|
specifier.startsWith(PROTOCOL_VIRTUAL)) {
|
|
69
69
|
return specifier;
|
|
70
70
|
}
|
|
71
|
+
const isSubpathImport = specifier.charCodeAt(0) === CHAR_HASH;
|
|
71
72
|
const len = specifier.length;
|
|
72
73
|
let start = 0;
|
|
73
74
|
let end = len;
|
|
@@ -82,7 +83,7 @@ export const sanitizeSpecifier = (specifier) => {
|
|
|
82
83
|
if (ch === CHAR_SLASH && colon === -1) {
|
|
83
84
|
hasSlash = true;
|
|
84
85
|
}
|
|
85
|
-
if (colon === -1 && ch === CHAR_COLON && !hasSlash) {
|
|
86
|
+
if (colon === -1 && ch === CHAR_COLON && !hasSlash && !isSubpathImport) {
|
|
86
87
|
colon = i;
|
|
87
88
|
}
|
|
88
89
|
if (ch === CHAR_EXCLAMATION || ch === CHAR_QUESTION || (ch === CHAR_HASH && i > start)) {
|
|
@@ -26,7 +26,8 @@ const getEntriesFromExports = (obj) => {
|
|
|
26
26
|
values.push(obj[prop]);
|
|
27
27
|
}
|
|
28
28
|
else if (obj[prop] === null) {
|
|
29
|
-
|
|
29
|
+
if (prop !== '.')
|
|
30
|
+
values.push(`!${prop}`);
|
|
30
31
|
}
|
|
31
32
|
else if (typeof obj[prop] === 'object') {
|
|
32
33
|
values = values.concat(getEntriesFromExports(obj[prop]));
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "6.
|
|
1
|
+
export declare const version = "6.22.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '6.
|
|
1
|
+
export const version = '6.22.0';
|
package/package.json
CHANGED
package/schema.json
CHANGED
|
@@ -563,6 +563,10 @@
|
|
|
563
563
|
"title": "lost-pixel plugin configuration (https://knip.dev/reference/plugins/lost-pixel)",
|
|
564
564
|
"$ref": "#/definitions/plugin"
|
|
565
565
|
},
|
|
566
|
+
"lunaria": {
|
|
567
|
+
"title": "lunaria plugin configuration (https://knip.dev/reference/plugins/lunaria)",
|
|
568
|
+
"$ref": "#/definitions/plugin"
|
|
569
|
+
},
|
|
566
570
|
"markdownlint": {
|
|
567
571
|
"title": "markdownlint plugin configuration (https://knip.dev/reference/plugins/markdownlint)",
|
|
568
572
|
"$ref": "#/definitions/plugin"
|