knip 3.11.0 → 3.13.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/dist/ConfigurationValidator.d.ts +112 -0
- package/dist/ConfigurationValidator.js +2 -0
- package/dist/WorkspaceWorker.d.ts +1 -1
- package/dist/constants.js +1 -0
- package/dist/plugins/eslint/helpers.js +1 -1
- package/dist/plugins/eslint/types.d.ts +1 -0
- package/dist/plugins/github-actions/index.js +22 -6
- package/dist/plugins/index.d.ts +2 -0
- package/dist/plugins/index.js +2 -0
- package/dist/plugins/unbuild/index.d.ts +6 -0
- package/dist/plugins/unbuild/index.js +18 -0
- package/dist/plugins/unbuild/types.d.ts +13 -0
- package/dist/plugins/unbuild/types.js +1 -0
- package/dist/plugins/vitest/index.js +1 -1
- package/dist/plugins/vue/index.d.ts +9 -0
- package/dist/plugins/vue/index.js +44 -0
- package/dist/plugins/vue/types.d.ts +5 -0
- package/dist/plugins/vue/types.js +1 -0
- package/dist/plugins/webpack/index.d.ts +8 -0
- package/dist/plugins/webpack/index.js +11 -7
- package/dist/util/compilers.d.ts +20 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/schema.json +62 -18
|
@@ -36,6 +36,19 @@ export declare const ConfigurationValidator: z.ZodObject<{
|
|
|
36
36
|
ignoreBinaries: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, "many">>;
|
|
37
37
|
ignoreDependencies: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, "many">>;
|
|
38
38
|
includeEntryExports: z.ZodOptional<z.ZodBoolean>;
|
|
39
|
+
vue: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
40
|
+
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
41
|
+
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
42
|
+
project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
config?: string | string[] | undefined;
|
|
45
|
+
entry?: string | string[] | undefined;
|
|
46
|
+
project?: string | string[] | undefined;
|
|
47
|
+
}, {
|
|
48
|
+
config?: string | string[] | undefined;
|
|
49
|
+
entry?: string | string[] | undefined;
|
|
50
|
+
project?: string | string[] | undefined;
|
|
51
|
+
}>]>>;
|
|
39
52
|
astro: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
40
53
|
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
41
54
|
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
@@ -608,6 +621,19 @@ export declare const ConfigurationValidator: z.ZodObject<{
|
|
|
608
621
|
entry?: string | string[] | undefined;
|
|
609
622
|
project?: string | string[] | undefined;
|
|
610
623
|
}>]>>;
|
|
624
|
+
unbuild: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
625
|
+
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
626
|
+
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
627
|
+
project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
628
|
+
}, "strip", z.ZodTypeAny, {
|
|
629
|
+
config?: string | string[] | undefined;
|
|
630
|
+
entry?: string | string[] | undefined;
|
|
631
|
+
project?: string | string[] | undefined;
|
|
632
|
+
}, {
|
|
633
|
+
config?: string | string[] | undefined;
|
|
634
|
+
entry?: string | string[] | undefined;
|
|
635
|
+
project?: string | string[] | undefined;
|
|
636
|
+
}>]>>;
|
|
611
637
|
vite: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
612
638
|
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
613
639
|
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
@@ -668,6 +694,11 @@ export declare const ConfigurationValidator: z.ZodObject<{
|
|
|
668
694
|
ignoreBinaries?: (string | RegExp)[] | undefined;
|
|
669
695
|
ignoreDependencies?: (string | RegExp)[] | undefined;
|
|
670
696
|
includeEntryExports?: boolean | undefined;
|
|
697
|
+
vue?: string | boolean | string[] | {
|
|
698
|
+
config?: string | string[] | undefined;
|
|
699
|
+
entry?: string | string[] | undefined;
|
|
700
|
+
project?: string | string[] | undefined;
|
|
701
|
+
} | undefined;
|
|
671
702
|
astro?: string | boolean | string[] | {
|
|
672
703
|
config?: string | string[] | undefined;
|
|
673
704
|
entry?: string | string[] | undefined;
|
|
@@ -888,6 +919,11 @@ export declare const ConfigurationValidator: z.ZodObject<{
|
|
|
888
919
|
entry?: string | string[] | undefined;
|
|
889
920
|
project?: string | string[] | undefined;
|
|
890
921
|
} | undefined;
|
|
922
|
+
unbuild?: string | boolean | string[] | {
|
|
923
|
+
config?: string | string[] | undefined;
|
|
924
|
+
entry?: string | string[] | undefined;
|
|
925
|
+
project?: string | string[] | undefined;
|
|
926
|
+
} | undefined;
|
|
891
927
|
vite?: string | boolean | string[] | {
|
|
892
928
|
config?: string | string[] | undefined;
|
|
893
929
|
entry?: string | string[] | undefined;
|
|
@@ -916,6 +952,11 @@ export declare const ConfigurationValidator: z.ZodObject<{
|
|
|
916
952
|
ignoreBinaries?: (string | RegExp)[] | undefined;
|
|
917
953
|
ignoreDependencies?: (string | RegExp)[] | undefined;
|
|
918
954
|
includeEntryExports?: boolean | undefined;
|
|
955
|
+
vue?: string | boolean | string[] | {
|
|
956
|
+
config?: string | string[] | undefined;
|
|
957
|
+
entry?: string | string[] | undefined;
|
|
958
|
+
project?: string | string[] | undefined;
|
|
959
|
+
} | undefined;
|
|
919
960
|
astro?: string | boolean | string[] | {
|
|
920
961
|
config?: string | string[] | undefined;
|
|
921
962
|
entry?: string | string[] | undefined;
|
|
@@ -1136,6 +1177,11 @@ export declare const ConfigurationValidator: z.ZodObject<{
|
|
|
1136
1177
|
entry?: string | string[] | undefined;
|
|
1137
1178
|
project?: string | string[] | undefined;
|
|
1138
1179
|
} | undefined;
|
|
1180
|
+
unbuild?: string | boolean | string[] | {
|
|
1181
|
+
config?: string | string[] | undefined;
|
|
1182
|
+
entry?: string | string[] | undefined;
|
|
1183
|
+
project?: string | string[] | undefined;
|
|
1184
|
+
} | undefined;
|
|
1139
1185
|
vite?: string | boolean | string[] | {
|
|
1140
1186
|
config?: string | string[] | undefined;
|
|
1141
1187
|
entry?: string | string[] | undefined;
|
|
@@ -1157,6 +1203,19 @@ export declare const ConfigurationValidator: z.ZodObject<{
|
|
|
1157
1203
|
project?: string | string[] | undefined;
|
|
1158
1204
|
} | undefined;
|
|
1159
1205
|
}>>>;
|
|
1206
|
+
vue: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
1207
|
+
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
1208
|
+
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
1209
|
+
project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
1210
|
+
}, "strip", z.ZodTypeAny, {
|
|
1211
|
+
config?: string | string[] | undefined;
|
|
1212
|
+
entry?: string | string[] | undefined;
|
|
1213
|
+
project?: string | string[] | undefined;
|
|
1214
|
+
}, {
|
|
1215
|
+
config?: string | string[] | undefined;
|
|
1216
|
+
entry?: string | string[] | undefined;
|
|
1217
|
+
project?: string | string[] | undefined;
|
|
1218
|
+
}>]>>;
|
|
1160
1219
|
astro: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
1161
1220
|
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
1162
1221
|
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
@@ -1729,6 +1788,19 @@ export declare const ConfigurationValidator: z.ZodObject<{
|
|
|
1729
1788
|
entry?: string | string[] | undefined;
|
|
1730
1789
|
project?: string | string[] | undefined;
|
|
1731
1790
|
}>]>>;
|
|
1791
|
+
unbuild: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
1792
|
+
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
1793
|
+
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
1794
|
+
project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
1795
|
+
}, "strip", z.ZodTypeAny, {
|
|
1796
|
+
config?: string | string[] | undefined;
|
|
1797
|
+
entry?: string | string[] | undefined;
|
|
1798
|
+
project?: string | string[] | undefined;
|
|
1799
|
+
}, {
|
|
1800
|
+
config?: string | string[] | undefined;
|
|
1801
|
+
entry?: string | string[] | undefined;
|
|
1802
|
+
project?: string | string[] | undefined;
|
|
1803
|
+
}>]>>;
|
|
1732
1804
|
vite: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
1733
1805
|
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
1734
1806
|
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
@@ -1805,6 +1877,11 @@ export declare const ConfigurationValidator: z.ZodObject<{
|
|
|
1805
1877
|
ignoreBinaries?: (string | RegExp)[] | undefined;
|
|
1806
1878
|
ignoreDependencies?: (string | RegExp)[] | undefined;
|
|
1807
1879
|
includeEntryExports?: boolean | undefined;
|
|
1880
|
+
vue?: string | boolean | string[] | {
|
|
1881
|
+
config?: string | string[] | undefined;
|
|
1882
|
+
entry?: string | string[] | undefined;
|
|
1883
|
+
project?: string | string[] | undefined;
|
|
1884
|
+
} | undefined;
|
|
1808
1885
|
astro?: string | boolean | string[] | {
|
|
1809
1886
|
config?: string | string[] | undefined;
|
|
1810
1887
|
entry?: string | string[] | undefined;
|
|
@@ -2025,6 +2102,11 @@ export declare const ConfigurationValidator: z.ZodObject<{
|
|
|
2025
2102
|
entry?: string | string[] | undefined;
|
|
2026
2103
|
project?: string | string[] | undefined;
|
|
2027
2104
|
} | undefined;
|
|
2105
|
+
unbuild?: string | boolean | string[] | {
|
|
2106
|
+
config?: string | string[] | undefined;
|
|
2107
|
+
entry?: string | string[] | undefined;
|
|
2108
|
+
project?: string | string[] | undefined;
|
|
2109
|
+
} | undefined;
|
|
2028
2110
|
vite?: string | boolean | string[] | {
|
|
2029
2111
|
config?: string | string[] | undefined;
|
|
2030
2112
|
entry?: string | string[] | undefined;
|
|
@@ -2046,6 +2128,11 @@ export declare const ConfigurationValidator: z.ZodObject<{
|
|
|
2046
2128
|
project?: string | string[] | undefined;
|
|
2047
2129
|
} | undefined;
|
|
2048
2130
|
}> | undefined;
|
|
2131
|
+
vue?: string | boolean | string[] | {
|
|
2132
|
+
config?: string | string[] | undefined;
|
|
2133
|
+
entry?: string | string[] | undefined;
|
|
2134
|
+
project?: string | string[] | undefined;
|
|
2135
|
+
} | undefined;
|
|
2049
2136
|
astro?: string | boolean | string[] | {
|
|
2050
2137
|
config?: string | string[] | undefined;
|
|
2051
2138
|
entry?: string | string[] | undefined;
|
|
@@ -2266,6 +2353,11 @@ export declare const ConfigurationValidator: z.ZodObject<{
|
|
|
2266
2353
|
entry?: string | string[] | undefined;
|
|
2267
2354
|
project?: string | string[] | undefined;
|
|
2268
2355
|
} | undefined;
|
|
2356
|
+
unbuild?: string | boolean | string[] | {
|
|
2357
|
+
config?: string | string[] | undefined;
|
|
2358
|
+
entry?: string | string[] | undefined;
|
|
2359
|
+
project?: string | string[] | undefined;
|
|
2360
|
+
} | undefined;
|
|
2269
2361
|
vite?: string | boolean | string[] | {
|
|
2270
2362
|
config?: string | string[] | undefined;
|
|
2271
2363
|
entry?: string | string[] | undefined;
|
|
@@ -2310,6 +2402,11 @@ export declare const ConfigurationValidator: z.ZodObject<{
|
|
|
2310
2402
|
ignoreBinaries?: (string | RegExp)[] | undefined;
|
|
2311
2403
|
ignoreDependencies?: (string | RegExp)[] | undefined;
|
|
2312
2404
|
includeEntryExports?: boolean | undefined;
|
|
2405
|
+
vue?: string | boolean | string[] | {
|
|
2406
|
+
config?: string | string[] | undefined;
|
|
2407
|
+
entry?: string | string[] | undefined;
|
|
2408
|
+
project?: string | string[] | undefined;
|
|
2409
|
+
} | undefined;
|
|
2313
2410
|
astro?: string | boolean | string[] | {
|
|
2314
2411
|
config?: string | string[] | undefined;
|
|
2315
2412
|
entry?: string | string[] | undefined;
|
|
@@ -2530,6 +2627,11 @@ export declare const ConfigurationValidator: z.ZodObject<{
|
|
|
2530
2627
|
entry?: string | string[] | undefined;
|
|
2531
2628
|
project?: string | string[] | undefined;
|
|
2532
2629
|
} | undefined;
|
|
2630
|
+
unbuild?: string | boolean | string[] | {
|
|
2631
|
+
config?: string | string[] | undefined;
|
|
2632
|
+
entry?: string | string[] | undefined;
|
|
2633
|
+
project?: string | string[] | undefined;
|
|
2634
|
+
} | undefined;
|
|
2533
2635
|
vite?: string | boolean | string[] | {
|
|
2534
2636
|
config?: string | string[] | undefined;
|
|
2535
2637
|
entry?: string | string[] | undefined;
|
|
@@ -2551,6 +2653,11 @@ export declare const ConfigurationValidator: z.ZodObject<{
|
|
|
2551
2653
|
project?: string | string[] | undefined;
|
|
2552
2654
|
} | undefined;
|
|
2553
2655
|
}> | undefined;
|
|
2656
|
+
vue?: string | boolean | string[] | {
|
|
2657
|
+
config?: string | string[] | undefined;
|
|
2658
|
+
entry?: string | string[] | undefined;
|
|
2659
|
+
project?: string | string[] | undefined;
|
|
2660
|
+
} | undefined;
|
|
2554
2661
|
astro?: string | boolean | string[] | {
|
|
2555
2662
|
config?: string | string[] | undefined;
|
|
2556
2663
|
entry?: string | string[] | undefined;
|
|
@@ -2771,6 +2878,11 @@ export declare const ConfigurationValidator: z.ZodObject<{
|
|
|
2771
2878
|
entry?: string | string[] | undefined;
|
|
2772
2879
|
project?: string | string[] | undefined;
|
|
2773
2880
|
} | undefined;
|
|
2881
|
+
unbuild?: string | boolean | string[] | {
|
|
2882
|
+
config?: string | string[] | undefined;
|
|
2883
|
+
entry?: string | string[] | undefined;
|
|
2884
|
+
project?: string | string[] | undefined;
|
|
2885
|
+
} | undefined;
|
|
2774
2886
|
vite?: string | boolean | string[] | {
|
|
2775
2887
|
config?: string | string[] | undefined;
|
|
2776
2888
|
entry?: string | string[] | undefined;
|
|
@@ -62,6 +62,7 @@ export const pluginSchema = z.union([
|
|
|
62
62
|
}),
|
|
63
63
|
]);
|
|
64
64
|
const pluginsSchema = z.object({
|
|
65
|
+
vue: pluginSchema,
|
|
65
66
|
astro: pluginSchema,
|
|
66
67
|
angular: pluginSchema,
|
|
67
68
|
ava: pluginSchema,
|
|
@@ -106,6 +107,7 @@ const pluginsSchema = z.object({
|
|
|
106
107
|
tsup: pluginSchema,
|
|
107
108
|
typedoc: pluginSchema,
|
|
108
109
|
typescript: pluginSchema,
|
|
110
|
+
unbuild: pluginSchema,
|
|
109
111
|
vite: pluginSchema,
|
|
110
112
|
vitest: pluginSchema,
|
|
111
113
|
webpack: pluginSchema,
|
|
@@ -52,7 +52,7 @@ export declare class WorkspaceWorker {
|
|
|
52
52
|
installedBinaries: InstalledBinaries;
|
|
53
53
|
referencedDependencies: ReferencedDependencies;
|
|
54
54
|
hasTypesIncluded: Set<string>;
|
|
55
|
-
enabledPlugins: ("astro" | "angular" | "ava" | "babel" | "capacitor" | "changesets" | "commitizen" | "commitlint" | "cspell" | "cypress" | "eleventy" | "eslint" | "gatsby" | "husky" | "jest" | "lefthook" | "linthtml" | "markdownlint" | "mocha" | "next" | "nx" | "nyc" | "playwright" | "postcss" | "prettier" | "remark" | "remix" | "rollup" | "sentry" | "storybook" | "stryker" | "stylelint" | "svelte" | "tailwind" | "tsup" | "typedoc" | "typescript" | "vite" | "vitest" | "webpack" | "wireit" | "drizzle" | "githubActions" | "graphqlCodegen" | "lintStaged" | "nodeTestRunner" | "npmPackageJsonLint" | "playwrightCt" | "releaseIt" | "semanticRelease")[];
|
|
55
|
+
enabledPlugins: ("vue" | "astro" | "angular" | "ava" | "babel" | "capacitor" | "changesets" | "commitizen" | "commitlint" | "cspell" | "cypress" | "eleventy" | "eslint" | "gatsby" | "husky" | "jest" | "lefthook" | "linthtml" | "markdownlint" | "mocha" | "next" | "nx" | "nyc" | "playwright" | "postcss" | "prettier" | "remark" | "remix" | "rollup" | "sentry" | "storybook" | "stryker" | "stylelint" | "svelte" | "tailwind" | "tsup" | "typedoc" | "typescript" | "unbuild" | "vite" | "vitest" | "webpack" | "wireit" | "drizzle" | "githubActions" | "graphqlCodegen" | "lintStaged" | "nodeTestRunner" | "npmPackageJsonLint" | "playwrightCt" | "releaseIt" | "semanticRelease")[];
|
|
56
56
|
entryFilePatterns: string[];
|
|
57
57
|
productionEntryFilePatterns: string[];
|
|
58
58
|
}>;
|
package/dist/constants.js
CHANGED
|
@@ -11,7 +11,7 @@ const getDependencies = (config) => {
|
|
|
11
11
|
if (extendsSpecifiers.some(specifier => specifier?.startsWith('eslint-plugin-prettier')))
|
|
12
12
|
extendsSpecifiers.push('eslint-config-prettier');
|
|
13
13
|
const plugins = config.plugins ? config.plugins.map(resolvePluginSpecifier) : [];
|
|
14
|
-
const parser = config.parser;
|
|
14
|
+
const parser = config.parser ?? config.parserOptions?.parser;
|
|
15
15
|
const babelDependencies = config.parserOptions?.babelOptions
|
|
16
16
|
? getDependenciesFromConfig(config.parserOptions.babelOptions)
|
|
17
17
|
: [];
|
|
@@ -1,23 +1,39 @@
|
|
|
1
1
|
import { _firstGlob } from '../../util/glob.js';
|
|
2
2
|
import { getValuesByKeyDeep } from '../../util/object.js';
|
|
3
|
+
import { basename, dirname, join } from '../../util/path.js';
|
|
3
4
|
import { timerify } from '../../util/Performance.js';
|
|
4
5
|
import { getDependenciesFromScripts, load } from '../../util/plugin.js';
|
|
6
|
+
function isString(value) {
|
|
7
|
+
return typeof value === 'string';
|
|
8
|
+
}
|
|
5
9
|
export const NAME = 'GitHub Actions';
|
|
6
10
|
export const ENABLERS = 'This plugin is enabled when a `.yml` or `.yaml` file is found in the `.github/workflows` folder.';
|
|
7
11
|
export const isEnabled = async ({ cwd }) => Boolean(await _firstGlob({ cwd, patterns: ['.github/workflows/*.{yml,yaml}'] }));
|
|
8
12
|
export const CONFIG_FILE_PATTERNS = ['.github/workflows/*.{yml,yaml}', '.github/**/action.{yml,yaml}'];
|
|
9
13
|
const findGithubActionsDependencies = async (configFilePath, options) => {
|
|
10
14
|
const { cwd, manifest, isProduction } = options;
|
|
15
|
+
const configFileName = basename(configFilePath);
|
|
11
16
|
if (isProduction)
|
|
12
17
|
return [];
|
|
13
18
|
const config = await load(configFilePath);
|
|
14
19
|
if (!config)
|
|
15
20
|
return [];
|
|
16
|
-
const scripts = getValuesByKeyDeep(config, 'run').filter(
|
|
17
|
-
return
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
const scripts = getValuesByKeyDeep(config, 'run').filter(isString);
|
|
22
|
+
return [
|
|
23
|
+
...getActionDependencies(),
|
|
24
|
+
...getDependenciesFromScripts(scripts, {
|
|
25
|
+
cwd,
|
|
26
|
+
manifest,
|
|
27
|
+
knownGlobalsOnly: true,
|
|
28
|
+
}),
|
|
29
|
+
];
|
|
30
|
+
function getActionDependencies() {
|
|
31
|
+
const isActionManifest = configFileName === 'action.yml' || configFileName === 'action.yaml';
|
|
32
|
+
if (!isActionManifest || !config?.runs?.using?.startsWith('node')) {
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
const scripts = [config.runs.pre, config.runs.main, config.runs.post].filter(isString);
|
|
36
|
+
return scripts.map(script => join(dirname(configFilePath), script));
|
|
37
|
+
}
|
|
22
38
|
};
|
|
23
39
|
export const findDependencies = timerify(findGithubActionsDependencies);
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -44,7 +44,9 @@ export * as tailwind from './tailwind/index.js';
|
|
|
44
44
|
export * as tsup from './tsup/index.js';
|
|
45
45
|
export * as typedoc from './typedoc/index.js';
|
|
46
46
|
export * as typescript from './typescript/index.js';
|
|
47
|
+
export * as unbuild from './unbuild/index.js';
|
|
47
48
|
export * as vite from './vite/index.js';
|
|
48
49
|
export * as vitest from './vitest/index.js';
|
|
49
50
|
export * as webpack from './webpack/index.js';
|
|
50
51
|
export * as wireit from './wireit/index.js';
|
|
52
|
+
export * as vue from './vue/index.js';
|
package/dist/plugins/index.js
CHANGED
|
@@ -44,7 +44,9 @@ export * as tailwind from './tailwind/index.js';
|
|
|
44
44
|
export * as tsup from './tsup/index.js';
|
|
45
45
|
export * as typedoc from './typedoc/index.js';
|
|
46
46
|
export * as typescript from './typescript/index.js';
|
|
47
|
+
export * as unbuild from './unbuild/index.js';
|
|
47
48
|
export * as vite from './vite/index.js';
|
|
48
49
|
export * as vitest from './vitest/index.js';
|
|
49
50
|
export * as webpack from './webpack/index.js';
|
|
50
51
|
export * as wireit from './wireit/index.js';
|
|
52
|
+
export * as vue from './vue/index.js';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IsPluginEnabledCallback, GenericPluginCallback } from '../../types/plugins.js';
|
|
2
|
+
export declare const NAME = "unbuild";
|
|
3
|
+
export declare const ENABLERS: string[];
|
|
4
|
+
export declare const isEnabled: IsPluginEnabledCallback;
|
|
5
|
+
export declare const CONFIG_FILE_PATTERNS: string[];
|
|
6
|
+
export declare const findDependencies: GenericPluginCallback;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { timerify } from '../../util/Performance.js';
|
|
2
|
+
import { hasDependency, load } from '../../util/plugin.js';
|
|
3
|
+
import { toEntryPattern } from '../../util/protocols.js';
|
|
4
|
+
export const NAME = 'unbuild';
|
|
5
|
+
export const ENABLERS = ['unbuild'];
|
|
6
|
+
export const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
|
|
7
|
+
export const CONFIG_FILE_PATTERNS = ['build.config.{js,cjs,mjs,ts,mts,cts,json}'];
|
|
8
|
+
const findUnbuildDependencies = async (configFilePath) => {
|
|
9
|
+
const localConfig = await load(configFilePath);
|
|
10
|
+
if (!localConfig)
|
|
11
|
+
return [];
|
|
12
|
+
return [localConfig]
|
|
13
|
+
.flat()
|
|
14
|
+
.map(obj => obj.entries)
|
|
15
|
+
.flatMap(entries => entries?.map(entry => (typeof entry === 'string' ? entry : entry.input)) ?? [])
|
|
16
|
+
.map(toEntryPattern);
|
|
17
|
+
};
|
|
18
|
+
export const findDependencies = timerify(findUnbuildDependencies);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type UnbuildConfigObject = Partial<{
|
|
2
|
+
name: string;
|
|
3
|
+
entries: string[] | {
|
|
4
|
+
builder: string;
|
|
5
|
+
input: string;
|
|
6
|
+
outDir: string;
|
|
7
|
+
}[];
|
|
8
|
+
outDir: string;
|
|
9
|
+
declaration: boolean;
|
|
10
|
+
rollup: Record<string, unknown>;
|
|
11
|
+
}>;
|
|
12
|
+
export type UnbuildConfig = UnbuildConfigObject | UnbuildConfigObject[];
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -11,7 +11,7 @@ export const CONFIG_FILE_PATTERNS = [
|
|
|
11
11
|
'vitest*.config.{js,mjs,ts,cjs,mts,cts}',
|
|
12
12
|
'vitest.{workspace,projects}.{ts,js,json}',
|
|
13
13
|
];
|
|
14
|
-
export const ENTRY_FILE_PATTERNS = ['**/*.{test,spec}.?(c|m)[jt]s?(x)'];
|
|
14
|
+
export const ENTRY_FILE_PATTERNS = ['**/*.{test,test-d,spec}.?(c|m)[jt]s?(x)'];
|
|
15
15
|
const resolveEntry = (containingFilePath, specifier) => {
|
|
16
16
|
const dir = dirname(containingFilePath);
|
|
17
17
|
const resolvedPath = isAbsolute(specifier) ? specifier : tryResolve(join(dir, specifier), containingFilePath);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IsPluginEnabledCallback, GenericPluginCallback } from '../../types/plugins.js';
|
|
2
|
+
export declare const NAME = "Vue";
|
|
3
|
+
export declare const ENABLERS: string[];
|
|
4
|
+
export declare const isEnabled: IsPluginEnabledCallback;
|
|
5
|
+
export declare const CONFIG_FILE_PATTERNS: string[];
|
|
6
|
+
export declare const ENTRY_FILE_PATTERNS: never[];
|
|
7
|
+
export declare const PRODUCTION_ENTRY_FILE_PATTERNS: never[];
|
|
8
|
+
export declare const PROJECT_FILE_PATTERNS: never[];
|
|
9
|
+
export declare const findDependencies: GenericPluginCallback;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { timerify } from '../../util/Performance.js';
|
|
2
|
+
import { hasDependency, load } from '../../util/plugin.js';
|
|
3
|
+
import { toEntryPattern, toProductionEntryPattern } from '../../util/protocols.js';
|
|
4
|
+
import { findWebpackDependenciesFromConfig } from '../webpack/index.js';
|
|
5
|
+
export const NAME = 'Vue';
|
|
6
|
+
export const ENABLERS = ['vue'];
|
|
7
|
+
export const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
|
|
8
|
+
export const CONFIG_FILE_PATTERNS = ['vue.config.{js,ts}'];
|
|
9
|
+
export const ENTRY_FILE_PATTERNS = [];
|
|
10
|
+
export const PRODUCTION_ENTRY_FILE_PATTERNS = [];
|
|
11
|
+
export const PROJECT_FILE_PATTERNS = [];
|
|
12
|
+
const findPluginDependencies = async (configFilePath, options) => {
|
|
13
|
+
const { config, isProduction, cwd, manifest } = options;
|
|
14
|
+
const localConfig = await load(configFilePath);
|
|
15
|
+
const deps = config.entry
|
|
16
|
+
? config.entry.map(toProductionEntryPattern)
|
|
17
|
+
: [...ENTRY_FILE_PATTERNS.map(toEntryPattern), ...PRODUCTION_ENTRY_FILE_PATTERNS.map(toProductionEntryPattern)];
|
|
18
|
+
if (isProduction || !localConfig)
|
|
19
|
+
return deps;
|
|
20
|
+
if (localConfig.configureWebpack) {
|
|
21
|
+
const baseConfig = {
|
|
22
|
+
mode: 'development',
|
|
23
|
+
entry: {},
|
|
24
|
+
resolve: {},
|
|
25
|
+
plugins: [],
|
|
26
|
+
module: { rules: [] },
|
|
27
|
+
};
|
|
28
|
+
const modifiedConfig = typeof localConfig.configureWebpack === 'function'
|
|
29
|
+
? localConfig.configureWebpack(baseConfig)
|
|
30
|
+
: localConfig.configureWebpack;
|
|
31
|
+
const { dependencies } = await findWebpackDependenciesFromConfig({
|
|
32
|
+
config: modifiedConfig ?? baseConfig,
|
|
33
|
+
cwd,
|
|
34
|
+
});
|
|
35
|
+
dependencies.forEach(dependency => deps.push(dependency));
|
|
36
|
+
}
|
|
37
|
+
if (!isProduction &&
|
|
38
|
+
manifest.scripts &&
|
|
39
|
+
Object.values(manifest.scripts).some(script => /(?<=^|\s)vue-cli-service(\s|\s.+\s)lint(?=\s|$)/.test(script))) {
|
|
40
|
+
deps.push('@vue/cli-plugin-eslint');
|
|
41
|
+
}
|
|
42
|
+
return deps;
|
|
43
|
+
};
|
|
44
|
+
export const findDependencies = timerify(findPluginDependencies);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
+
import type { WebpackConfig } from './types.js';
|
|
1
2
|
import type { IsPluginEnabledCallback, GenericPluginCallback } from '../../types/plugins.js';
|
|
2
3
|
export declare const NAME = "Webpack";
|
|
3
4
|
export declare const ENABLERS: string[];
|
|
4
5
|
export declare const isEnabled: IsPluginEnabledCallback;
|
|
5
6
|
export declare const CONFIG_FILE_PATTERNS: string[];
|
|
7
|
+
export declare const findWebpackDependenciesFromConfig: ({ config, cwd }: {
|
|
8
|
+
config: WebpackConfig;
|
|
9
|
+
cwd: string;
|
|
10
|
+
}) => Promise<{
|
|
11
|
+
dependencies: Set<string>;
|
|
12
|
+
entryPatterns: Set<string>;
|
|
13
|
+
}>;
|
|
6
14
|
export declare const findDependencies: GenericPluginCallback;
|
|
@@ -44,18 +44,14 @@ const resolveUseItem = (use) => {
|
|
|
44
44
|
return [use.loader];
|
|
45
45
|
return [];
|
|
46
46
|
};
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
const localConfig = await load(configFilePath);
|
|
50
|
-
if (!localConfig)
|
|
51
|
-
return [];
|
|
52
|
-
const passes = typeof localConfig === 'function' ? [false, true] : [false];
|
|
47
|
+
export const findWebpackDependenciesFromConfig = async ({ config, cwd }) => {
|
|
48
|
+
const passes = typeof config === 'function' ? [false, true] : [false];
|
|
53
49
|
const dependencies = new Set();
|
|
54
50
|
const entryPatterns = new Set();
|
|
55
51
|
for (const isProduction of passes) {
|
|
56
52
|
const env = { production: isProduction };
|
|
57
53
|
const argv = { mode: isProduction ? 'production' : 'development' };
|
|
58
|
-
const resolvedConfig = typeof
|
|
54
|
+
const resolvedConfig = typeof config === 'function' ? await config(env, argv) : config;
|
|
59
55
|
for (const options of [resolvedConfig].flat()) {
|
|
60
56
|
const entries = [];
|
|
61
57
|
for (const loader of options.module?.rules?.flatMap(resolveRuleSetDependencies) ?? []) {
|
|
@@ -84,6 +80,14 @@ const findWebpackDependencies = async (configFilePath, options) => {
|
|
|
84
80
|
});
|
|
85
81
|
}
|
|
86
82
|
}
|
|
83
|
+
return { dependencies, entryPatterns };
|
|
84
|
+
};
|
|
85
|
+
const findWebpackDependencies = async (configFilePath, options) => {
|
|
86
|
+
const { manifest, isProduction, cwd } = options;
|
|
87
|
+
const localConfig = await load(configFilePath);
|
|
88
|
+
if (!localConfig)
|
|
89
|
+
return [];
|
|
90
|
+
const { dependencies, entryPatterns } = await findWebpackDependenciesFromConfig({ config: localConfig, cwd });
|
|
87
91
|
if (isProduction)
|
|
88
92
|
return [...entryPatterns];
|
|
89
93
|
const scripts = Object.values(manifest.scripts ?? {});
|
package/dist/util/compilers.d.ts
CHANGED
|
@@ -24,6 +24,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
24
24
|
ignoreBinaries?: (string | RegExp)[] | undefined;
|
|
25
25
|
ignoreDependencies?: (string | RegExp)[] | undefined;
|
|
26
26
|
includeEntryExports?: boolean | undefined;
|
|
27
|
+
vue?: string | boolean | string[] | {
|
|
28
|
+
config?: string | string[] | undefined;
|
|
29
|
+
entry?: string | string[] | undefined;
|
|
30
|
+
project?: string | string[] | undefined;
|
|
31
|
+
} | undefined;
|
|
27
32
|
astro?: string | boolean | string[] | {
|
|
28
33
|
config?: string | string[] | undefined;
|
|
29
34
|
entry?: string | string[] | undefined;
|
|
@@ -244,6 +249,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
244
249
|
entry?: string | string[] | undefined;
|
|
245
250
|
project?: string | string[] | undefined;
|
|
246
251
|
} | undefined;
|
|
252
|
+
unbuild?: string | boolean | string[] | {
|
|
253
|
+
config?: string | string[] | undefined;
|
|
254
|
+
entry?: string | string[] | undefined;
|
|
255
|
+
project?: string | string[] | undefined;
|
|
256
|
+
} | undefined;
|
|
247
257
|
vite?: string | boolean | string[] | {
|
|
248
258
|
config?: string | string[] | undefined;
|
|
249
259
|
entry?: string | string[] | undefined;
|
|
@@ -265,6 +275,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
265
275
|
project?: string | string[] | undefined;
|
|
266
276
|
} | undefined;
|
|
267
277
|
}> | undefined;
|
|
278
|
+
vue?: string | boolean | string[] | {
|
|
279
|
+
config?: string | string[] | undefined;
|
|
280
|
+
entry?: string | string[] | undefined;
|
|
281
|
+
project?: string | string[] | undefined;
|
|
282
|
+
} | undefined;
|
|
268
283
|
astro?: string | boolean | string[] | {
|
|
269
284
|
config?: string | string[] | undefined;
|
|
270
285
|
entry?: string | string[] | undefined;
|
|
@@ -485,6 +500,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
485
500
|
entry?: string | string[] | undefined;
|
|
486
501
|
project?: string | string[] | undefined;
|
|
487
502
|
} | undefined;
|
|
503
|
+
unbuild?: string | boolean | string[] | {
|
|
504
|
+
config?: string | string[] | undefined;
|
|
505
|
+
entry?: string | string[] | undefined;
|
|
506
|
+
project?: string | string[] | undefined;
|
|
507
|
+
} | undefined;
|
|
488
508
|
vite?: string | boolean | string[] | {
|
|
489
509
|
config?: string | string[] | undefined;
|
|
490
510
|
entry?: string | string[] | undefined;
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "3.
|
|
1
|
+
export declare const version = "3.13.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '3.
|
|
1
|
+
export const version = '3.13.0';
|
package/package.json
CHANGED
package/schema.json
CHANGED
|
@@ -49,7 +49,9 @@
|
|
|
49
49
|
"ignoreExportsUsedInFile": {
|
|
50
50
|
"title": "Ignore exports used in file",
|
|
51
51
|
"examples": [
|
|
52
|
-
{
|
|
52
|
+
{
|
|
53
|
+
"ignoreExportsUsedInFile": true
|
|
54
|
+
},
|
|
53
55
|
{
|
|
54
56
|
"ignoreExportsUsedInFile": {
|
|
55
57
|
"interface": true,
|
|
@@ -64,12 +66,24 @@
|
|
|
64
66
|
{
|
|
65
67
|
"type": "object",
|
|
66
68
|
"properties": {
|
|
67
|
-
"class": {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
"class": {
|
|
70
|
+
"type": "boolean"
|
|
71
|
+
},
|
|
72
|
+
"enum": {
|
|
73
|
+
"type": "boolean"
|
|
74
|
+
},
|
|
75
|
+
"function": {
|
|
76
|
+
"type": "boolean"
|
|
77
|
+
},
|
|
78
|
+
"interface": {
|
|
79
|
+
"type": "boolean"
|
|
80
|
+
},
|
|
81
|
+
"member": {
|
|
82
|
+
"type": "boolean"
|
|
83
|
+
},
|
|
84
|
+
"type": {
|
|
85
|
+
"type": "boolean"
|
|
86
|
+
}
|
|
73
87
|
}
|
|
74
88
|
}
|
|
75
89
|
]
|
|
@@ -96,17 +110,39 @@
|
|
|
96
110
|
"rules": {
|
|
97
111
|
"type": "object",
|
|
98
112
|
"properties": {
|
|
99
|
-
"classMembers": {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
"
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
"
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
"
|
|
109
|
-
|
|
113
|
+
"classMembers": {
|
|
114
|
+
"$ref": "#/definitions/ruleValue"
|
|
115
|
+
},
|
|
116
|
+
"dependencies": {
|
|
117
|
+
"$ref": "#/definitions/ruleValue"
|
|
118
|
+
},
|
|
119
|
+
"duplicates": {
|
|
120
|
+
"$ref": "#/definitions/ruleValue"
|
|
121
|
+
},
|
|
122
|
+
"enumMembers": {
|
|
123
|
+
"$ref": "#/definitions/ruleValue"
|
|
124
|
+
},
|
|
125
|
+
"exports": {
|
|
126
|
+
"$ref": "#/definitions/ruleValue"
|
|
127
|
+
},
|
|
128
|
+
"files": {
|
|
129
|
+
"$ref": "#/definitions/ruleValue"
|
|
130
|
+
},
|
|
131
|
+
"nsExports": {
|
|
132
|
+
"$ref": "#/definitions/ruleValue"
|
|
133
|
+
},
|
|
134
|
+
"nsTypes": {
|
|
135
|
+
"$ref": "#/definitions/ruleValue"
|
|
136
|
+
},
|
|
137
|
+
"types": {
|
|
138
|
+
"$ref": "#/definitions/ruleValue"
|
|
139
|
+
},
|
|
140
|
+
"unlisted": {
|
|
141
|
+
"$ref": "#/definitions/ruleValue"
|
|
142
|
+
},
|
|
143
|
+
"unresolved": {
|
|
144
|
+
"$ref": "#/definitions/ruleValue"
|
|
145
|
+
}
|
|
110
146
|
}
|
|
111
147
|
}
|
|
112
148
|
},
|
|
@@ -414,6 +450,10 @@
|
|
|
414
450
|
"title": "TypeScript plugin configuration (https://github.com/webpro/knip/blob/main/src/plugins/typescript/README.md)",
|
|
415
451
|
"$ref": "#/definitions/plugin"
|
|
416
452
|
},
|
|
453
|
+
"unbuild": {
|
|
454
|
+
"title": "unbuild plugin configuration (https://github.com/webpro/knip/blob/main/src/plugins/unbuild/README.md)",
|
|
455
|
+
"$ref": "#/definitions/plugin"
|
|
456
|
+
},
|
|
417
457
|
"vite": {
|
|
418
458
|
"title": "vite plugin configuration (https://github.com/webpro/knip/blob/main/src/plugins/vite/README.md)",
|
|
419
459
|
"$ref": "#/definitions/plugin"
|
|
@@ -422,6 +462,10 @@
|
|
|
422
462
|
"title": "vitest plugin configuration (https://github.com/webpro/knip/blob/main/src/plugins/vitest/README.md)",
|
|
423
463
|
"$ref": "#/definitions/plugin"
|
|
424
464
|
},
|
|
465
|
+
"vue": {
|
|
466
|
+
"title": "vue plugin configuration (https://github.com/webpro/knip/blob/main/src/plugins/vue/README.md)",
|
|
467
|
+
"$ref": "#/definitions/plugin"
|
|
468
|
+
},
|
|
425
469
|
"webpack": {
|
|
426
470
|
"title": "Webpack plugin configuration (https://github.com/webpro/knip/blob/main/src/plugins/webpack/README.md)",
|
|
427
471
|
"$ref": "#/definitions/plugin"
|