knip 5.43.6 → 5.44.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/dist/ConfigurationChief.d.ts +6 -5
- package/dist/ConfigurationChief.js +9 -5
- package/dist/ConfigurationValidator.d.ts +56 -56
- package/dist/DependencyDeputy.d.ts +4 -2
- package/dist/DependencyDeputy.js +15 -9
- 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/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/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/plugins/stylelint/index.js +1 -1
- package/dist/plugins/stylelint/types.d.ts +1 -1
- 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/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 +3 -3
- 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,5 +1,5 @@
|
|
|
1
1
|
import type { Configuration, IgnorePatterns, WorkspaceConfiguration } from './types/config.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { PackageJson, WorkspacePackage } from './types/package-json.js';
|
|
3
3
|
import { type WorkspaceGraph } from './util/create-workspace-graph.js';
|
|
4
4
|
import { type CLIArguments } from './util/get-included-issue-types.js';
|
|
5
5
|
type ConfigurationManagerOptions = {
|
|
@@ -16,6 +16,7 @@ export type Workspace = {
|
|
|
16
16
|
ancestors: string[];
|
|
17
17
|
config: WorkspaceConfiguration;
|
|
18
18
|
manifestPath: string;
|
|
19
|
+
manifestStr: string;
|
|
19
20
|
ignoreMembers: IgnorePatterns;
|
|
20
21
|
srcDir?: string;
|
|
21
22
|
outDir?: string;
|
|
@@ -30,7 +31,7 @@ export declare class ConfigurationChief {
|
|
|
30
31
|
manifestPath?: string;
|
|
31
32
|
manifest?: PackageJson;
|
|
32
33
|
ignoredWorkspacePatterns: string[];
|
|
33
|
-
workspacePackages: Map<string,
|
|
34
|
+
workspacePackages: Map<string, WorkspacePackage>;
|
|
34
35
|
workspacesByPkgName: Map<string, Workspace>;
|
|
35
36
|
workspacesByName: Map<string, Workspace>;
|
|
36
37
|
additionalWorkspaceNames: Set<string>;
|
|
@@ -57,9 +58,9 @@ export declare class ConfigurationChief {
|
|
|
57
58
|
private getConfiguredWorkspaceKeys;
|
|
58
59
|
private getAdditionalWorkspaceNames;
|
|
59
60
|
private getAvailableWorkspaceNames;
|
|
60
|
-
private
|
|
61
|
+
private getIncludedWorkspaces;
|
|
61
62
|
getManifestForWorkspace(name: string): PackageJson | undefined;
|
|
62
|
-
|
|
63
|
+
getWorkspaces(): Workspace[];
|
|
63
64
|
private getDescendentWorkspaces;
|
|
64
65
|
getIgnoredWorkspacesFor(name: string): string[];
|
|
65
66
|
getNegatedWorkspacePatterns(name: string): string[];
|
|
@@ -111,7 +112,6 @@ export declare class ConfigurationChief {
|
|
|
111
112
|
nest?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
112
113
|
netlify?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
113
114
|
next?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
114
|
-
"node-test-runner"?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
115
115
|
nodemon?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
116
116
|
"npm-package-json-lint"?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
117
117
|
nuxt?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
@@ -126,6 +126,7 @@ export declare class ConfigurationChief {
|
|
|
126
126
|
preconstruct?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
127
127
|
prettier?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
128
128
|
"react-cosmos"?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
129
|
+
"react-router"?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
129
130
|
"release-it"?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
130
131
|
remark?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
131
132
|
remix?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
|
|
@@ -164,7 +164,7 @@ export class ConfigurationChief {
|
|
|
164
164
|
.reverse()
|
|
165
165
|
.map(dir => join(this.cwd, dir));
|
|
166
166
|
this.workspaceGraph = createWorkspaceGraph(this.cwd, this.availableWorkspaceNames, wsPkgNames, packages);
|
|
167
|
-
this.includedWorkspaces = this.
|
|
167
|
+
this.includedWorkspaces = this.getIncludedWorkspaces();
|
|
168
168
|
for (const workspace of this.includedWorkspaces) {
|
|
169
169
|
this.workspacesByPkgName.set(workspace.pkgName, workspace);
|
|
170
170
|
this.workspacesByName.set(workspace.name, workspace);
|
|
@@ -203,7 +203,7 @@ export class ConfigurationChief {
|
|
|
203
203
|
getAvailableWorkspaceNames(names) {
|
|
204
204
|
return [...names, ...this.additionalWorkspaceNames].filter(name => !picomatch.isMatch(name, this.ignoredWorkspacePatterns));
|
|
205
205
|
}
|
|
206
|
-
|
|
206
|
+
getIncludedWorkspaces() {
|
|
207
207
|
if (this.workspace) {
|
|
208
208
|
const dir = resolve(this.workspace);
|
|
209
209
|
if (!isDirectory(dir))
|
|
@@ -255,7 +255,10 @@ export class ConfigurationChief {
|
|
|
255
255
|
.sort(byPathDepth)
|
|
256
256
|
.map((name) => {
|
|
257
257
|
const dir = join(this.cwd, name);
|
|
258
|
-
const
|
|
258
|
+
const pkg = this.workspacePackages.get(name);
|
|
259
|
+
const pkgName = pkg?.pkgName ?? `KNIP_ADDED_${name}`;
|
|
260
|
+
const manifestPath = pkg?.manifestPath ?? join(dir, 'package.json');
|
|
261
|
+
const manifestStr = pkg?.manifestStr ?? '';
|
|
259
262
|
const workspaceConfig = this.getWorkspaceConfig(name);
|
|
260
263
|
const ignoreMembers = arrayify(workspaceConfig.ignoreMembers).map(toRegexOrString);
|
|
261
264
|
return {
|
|
@@ -264,7 +267,8 @@ export class ConfigurationChief {
|
|
|
264
267
|
dir,
|
|
265
268
|
config: this.getConfigForWorkspace(name),
|
|
266
269
|
ancestors: this.availableWorkspaceNames.reduce(getAncestors(name), []),
|
|
267
|
-
manifestPath
|
|
270
|
+
manifestPath,
|
|
271
|
+
manifestStr,
|
|
268
272
|
ignoreMembers,
|
|
269
273
|
};
|
|
270
274
|
});
|
|
@@ -272,7 +276,7 @@ export class ConfigurationChief {
|
|
|
272
276
|
getManifestForWorkspace(name) {
|
|
273
277
|
return this.workspacePackages.get(name)?.manifest;
|
|
274
278
|
}
|
|
275
|
-
|
|
279
|
+
getWorkspaces() {
|
|
276
280
|
return this.includedWorkspaces;
|
|
277
281
|
}
|
|
278
282
|
getDescendentWorkspaces(name) {
|
|
@@ -550,19 +550,6 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
550
550
|
entry?: string | string[] | undefined;
|
|
551
551
|
project?: string | string[] | undefined;
|
|
552
552
|
}>]>>;
|
|
553
|
-
'node-test-runner': z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
554
|
-
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
555
|
-
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
556
|
-
project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
557
|
-
}, "strip", z.ZodTypeAny, {
|
|
558
|
-
config?: string | string[] | undefined;
|
|
559
|
-
entry?: string | string[] | undefined;
|
|
560
|
-
project?: string | string[] | undefined;
|
|
561
|
-
}, {
|
|
562
|
-
config?: string | string[] | undefined;
|
|
563
|
-
entry?: string | string[] | undefined;
|
|
564
|
-
project?: string | string[] | undefined;
|
|
565
|
-
}>]>>;
|
|
566
553
|
nodemon: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
567
554
|
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
568
555
|
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
@@ -745,6 +732,19 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
745
732
|
entry?: string | string[] | undefined;
|
|
746
733
|
project?: string | string[] | undefined;
|
|
747
734
|
}>]>>;
|
|
735
|
+
'react-router': z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
736
|
+
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
737
|
+
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
738
|
+
project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
739
|
+
}, "strip", z.ZodTypeAny, {
|
|
740
|
+
config?: string | string[] | undefined;
|
|
741
|
+
entry?: string | string[] | undefined;
|
|
742
|
+
project?: string | string[] | undefined;
|
|
743
|
+
}, {
|
|
744
|
+
config?: string | string[] | undefined;
|
|
745
|
+
entry?: string | string[] | undefined;
|
|
746
|
+
project?: string | string[] | undefined;
|
|
747
|
+
}>]>>;
|
|
748
748
|
'release-it': z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
749
749
|
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
750
750
|
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
@@ -1416,11 +1416,6 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
1416
1416
|
entry?: string | string[] | undefined;
|
|
1417
1417
|
project?: string | string[] | undefined;
|
|
1418
1418
|
} | undefined;
|
|
1419
|
-
'node-test-runner'?: string | boolean | string[] | {
|
|
1420
|
-
config?: string | string[] | undefined;
|
|
1421
|
-
entry?: string | string[] | undefined;
|
|
1422
|
-
project?: string | string[] | undefined;
|
|
1423
|
-
} | undefined;
|
|
1424
1419
|
nodemon?: string | boolean | string[] | {
|
|
1425
1420
|
config?: string | string[] | undefined;
|
|
1426
1421
|
entry?: string | string[] | undefined;
|
|
@@ -1491,6 +1486,11 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
1491
1486
|
entry?: string | string[] | undefined;
|
|
1492
1487
|
project?: string | string[] | undefined;
|
|
1493
1488
|
} | undefined;
|
|
1489
|
+
'react-router'?: string | boolean | string[] | {
|
|
1490
|
+
config?: string | string[] | undefined;
|
|
1491
|
+
entry?: string | string[] | undefined;
|
|
1492
|
+
project?: string | string[] | undefined;
|
|
1493
|
+
} | undefined;
|
|
1494
1494
|
'release-it'?: string | boolean | string[] | {
|
|
1495
1495
|
config?: string | string[] | undefined;
|
|
1496
1496
|
entry?: string | string[] | undefined;
|
|
@@ -1881,11 +1881,6 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
1881
1881
|
entry?: string | string[] | undefined;
|
|
1882
1882
|
project?: string | string[] | undefined;
|
|
1883
1883
|
} | undefined;
|
|
1884
|
-
'node-test-runner'?: string | boolean | string[] | {
|
|
1885
|
-
config?: string | string[] | undefined;
|
|
1886
|
-
entry?: string | string[] | undefined;
|
|
1887
|
-
project?: string | string[] | undefined;
|
|
1888
|
-
} | undefined;
|
|
1889
1884
|
nodemon?: string | boolean | string[] | {
|
|
1890
1885
|
config?: string | string[] | undefined;
|
|
1891
1886
|
entry?: string | string[] | undefined;
|
|
@@ -1956,6 +1951,11 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
1956
1951
|
entry?: string | string[] | undefined;
|
|
1957
1952
|
project?: string | string[] | undefined;
|
|
1958
1953
|
} | undefined;
|
|
1954
|
+
'react-router'?: string | boolean | string[] | {
|
|
1955
|
+
config?: string | string[] | undefined;
|
|
1956
|
+
entry?: string | string[] | undefined;
|
|
1957
|
+
project?: string | string[] | undefined;
|
|
1958
|
+
} | undefined;
|
|
1959
1959
|
'release-it'?: string | boolean | string[] | {
|
|
1960
1960
|
config?: string | string[] | undefined;
|
|
1961
1961
|
entry?: string | string[] | undefined;
|
|
@@ -2665,19 +2665,6 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
2665
2665
|
entry?: string | string[] | undefined;
|
|
2666
2666
|
project?: string | string[] | undefined;
|
|
2667
2667
|
}>]>>;
|
|
2668
|
-
'node-test-runner': z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
2669
|
-
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
2670
|
-
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
2671
|
-
project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
2672
|
-
}, "strip", z.ZodTypeAny, {
|
|
2673
|
-
config?: string | string[] | undefined;
|
|
2674
|
-
entry?: string | string[] | undefined;
|
|
2675
|
-
project?: string | string[] | undefined;
|
|
2676
|
-
}, {
|
|
2677
|
-
config?: string | string[] | undefined;
|
|
2678
|
-
entry?: string | string[] | undefined;
|
|
2679
|
-
project?: string | string[] | undefined;
|
|
2680
|
-
}>]>>;
|
|
2681
2668
|
nodemon: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
2682
2669
|
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
2683
2670
|
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
@@ -2860,6 +2847,19 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
2860
2847
|
entry?: string | string[] | undefined;
|
|
2861
2848
|
project?: string | string[] | undefined;
|
|
2862
2849
|
}>]>>;
|
|
2850
|
+
'react-router': z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
2851
|
+
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
2852
|
+
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
2853
|
+
project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
2854
|
+
}, "strip", z.ZodTypeAny, {
|
|
2855
|
+
config?: string | string[] | undefined;
|
|
2856
|
+
entry?: string | string[] | undefined;
|
|
2857
|
+
project?: string | string[] | undefined;
|
|
2858
|
+
}, {
|
|
2859
|
+
config?: string | string[] | undefined;
|
|
2860
|
+
entry?: string | string[] | undefined;
|
|
2861
|
+
project?: string | string[] | undefined;
|
|
2862
|
+
}>]>>;
|
|
2863
2863
|
'release-it': z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
2864
2864
|
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
2865
2865
|
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
@@ -3533,11 +3533,6 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
3533
3533
|
entry?: string | string[] | undefined;
|
|
3534
3534
|
project?: string | string[] | undefined;
|
|
3535
3535
|
} | undefined;
|
|
3536
|
-
'node-test-runner'?: string | boolean | string[] | {
|
|
3537
|
-
config?: string | string[] | undefined;
|
|
3538
|
-
entry?: string | string[] | undefined;
|
|
3539
|
-
project?: string | string[] | undefined;
|
|
3540
|
-
} | undefined;
|
|
3541
3536
|
nodemon?: string | boolean | string[] | {
|
|
3542
3537
|
config?: string | string[] | undefined;
|
|
3543
3538
|
entry?: string | string[] | undefined;
|
|
@@ -3608,6 +3603,11 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
3608
3603
|
entry?: string | string[] | undefined;
|
|
3609
3604
|
project?: string | string[] | undefined;
|
|
3610
3605
|
} | undefined;
|
|
3606
|
+
'react-router'?: string | boolean | string[] | {
|
|
3607
|
+
config?: string | string[] | undefined;
|
|
3608
|
+
entry?: string | string[] | undefined;
|
|
3609
|
+
project?: string | string[] | undefined;
|
|
3610
|
+
} | undefined;
|
|
3611
3611
|
'release-it'?: string | boolean | string[] | {
|
|
3612
3612
|
config?: string | string[] | undefined;
|
|
3613
3613
|
entry?: string | string[] | undefined;
|
|
@@ -4004,11 +4004,6 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
4004
4004
|
entry?: string | string[] | undefined;
|
|
4005
4005
|
project?: string | string[] | undefined;
|
|
4006
4006
|
} | undefined;
|
|
4007
|
-
'node-test-runner'?: string | boolean | string[] | {
|
|
4008
|
-
config?: string | string[] | undefined;
|
|
4009
|
-
entry?: string | string[] | undefined;
|
|
4010
|
-
project?: string | string[] | undefined;
|
|
4011
|
-
} | undefined;
|
|
4012
4007
|
nodemon?: string | boolean | string[] | {
|
|
4013
4008
|
config?: string | string[] | undefined;
|
|
4014
4009
|
entry?: string | string[] | undefined;
|
|
@@ -4079,6 +4074,11 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
4079
4074
|
entry?: string | string[] | undefined;
|
|
4080
4075
|
project?: string | string[] | undefined;
|
|
4081
4076
|
} | undefined;
|
|
4077
|
+
'react-router'?: string | boolean | string[] | {
|
|
4078
|
+
config?: string | string[] | undefined;
|
|
4079
|
+
entry?: string | string[] | undefined;
|
|
4080
|
+
project?: string | string[] | undefined;
|
|
4081
|
+
} | undefined;
|
|
4082
4082
|
'release-it'?: string | boolean | string[] | {
|
|
4083
4083
|
config?: string | string[] | undefined;
|
|
4084
4084
|
entry?: string | string[] | undefined;
|
|
@@ -4472,11 +4472,6 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
4472
4472
|
entry?: string | string[] | undefined;
|
|
4473
4473
|
project?: string | string[] | undefined;
|
|
4474
4474
|
} | undefined;
|
|
4475
|
-
'node-test-runner'?: string | boolean | string[] | {
|
|
4476
|
-
config?: string | string[] | undefined;
|
|
4477
|
-
entry?: string | string[] | undefined;
|
|
4478
|
-
project?: string | string[] | undefined;
|
|
4479
|
-
} | undefined;
|
|
4480
4475
|
nodemon?: string | boolean | string[] | {
|
|
4481
4476
|
config?: string | string[] | undefined;
|
|
4482
4477
|
entry?: string | string[] | undefined;
|
|
@@ -4547,6 +4542,11 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
4547
4542
|
entry?: string | string[] | undefined;
|
|
4548
4543
|
project?: string | string[] | undefined;
|
|
4549
4544
|
} | undefined;
|
|
4545
|
+
'react-router'?: string | boolean | string[] | {
|
|
4546
|
+
config?: string | string[] | undefined;
|
|
4547
|
+
entry?: string | string[] | undefined;
|
|
4548
|
+
project?: string | string[] | undefined;
|
|
4549
|
+
} | undefined;
|
|
4550
4550
|
'release-it'?: string | boolean | string[] | {
|
|
4551
4551
|
config?: string | string[] | undefined;
|
|
4552
4552
|
entry?: string | string[] | undefined;
|
|
@@ -4943,11 +4943,6 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
4943
4943
|
entry?: string | string[] | undefined;
|
|
4944
4944
|
project?: string | string[] | undefined;
|
|
4945
4945
|
} | undefined;
|
|
4946
|
-
'node-test-runner'?: string | boolean | string[] | {
|
|
4947
|
-
config?: string | string[] | undefined;
|
|
4948
|
-
entry?: string | string[] | undefined;
|
|
4949
|
-
project?: string | string[] | undefined;
|
|
4950
|
-
} | undefined;
|
|
4951
4946
|
nodemon?: string | boolean | string[] | {
|
|
4952
4947
|
config?: string | string[] | undefined;
|
|
4953
4948
|
entry?: string | string[] | undefined;
|
|
@@ -5018,6 +5013,11 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
5018
5013
|
entry?: string | string[] | undefined;
|
|
5019
5014
|
project?: string | string[] | undefined;
|
|
5020
5015
|
} | undefined;
|
|
5016
|
+
'react-router'?: string | boolean | string[] | {
|
|
5017
|
+
config?: string | string[] | undefined;
|
|
5018
|
+
entry?: string | string[] | undefined;
|
|
5019
|
+
project?: string | string[] | undefined;
|
|
5020
|
+
} | undefined;
|
|
5021
5021
|
'release-it'?: string | boolean | string[] | {
|
|
5022
5022
|
config?: string | string[] | undefined;
|
|
5023
5023
|
entry?: string | string[] | undefined;
|
|
@@ -16,11 +16,12 @@ export declare class DependencyDeputy {
|
|
|
16
16
|
installedBinaries: Map<string, InstalledBinaries>;
|
|
17
17
|
hasTypesIncluded: Map<string, Set<string>>;
|
|
18
18
|
constructor({ isProduction, isStrict }: Options);
|
|
19
|
-
addWorkspace({ name, cwd, dir, manifestPath, manifest, ignoreDependencies, ignoreBinaries, ignoreUnresolved, }: {
|
|
19
|
+
addWorkspace({ name, cwd, dir, manifestPath, manifestStr, manifest, ignoreDependencies, ignoreBinaries, ignoreUnresolved, }: {
|
|
20
20
|
name: string;
|
|
21
21
|
cwd: string;
|
|
22
22
|
dir: string;
|
|
23
23
|
manifestPath: string;
|
|
24
|
+
manifestStr: string;
|
|
24
25
|
manifest: PackageJson;
|
|
25
26
|
ignoreDependencies: (string | RegExp)[];
|
|
26
27
|
ignoreBinaries: (string | RegExp)[];
|
|
@@ -29,6 +30,7 @@ export declare class DependencyDeputy {
|
|
|
29
30
|
getWorkspaceManifest(workspaceName: string): {
|
|
30
31
|
workspaceDir: string;
|
|
31
32
|
manifestPath: string;
|
|
33
|
+
manifestStr: string;
|
|
32
34
|
dependencies: DependencyArray;
|
|
33
35
|
devDependencies: DependencyArray;
|
|
34
36
|
peerDependencies: DependencySet;
|
|
@@ -47,7 +49,7 @@ export declare class DependencyDeputy {
|
|
|
47
49
|
setInstalledBinaries(workspaceName: string, installedBinaries: Map<string, Set<string>>): void;
|
|
48
50
|
getInstalledBinaries(workspaceName: string): InstalledBinaries | undefined;
|
|
49
51
|
setHasTypesIncluded(workspaceName: string, hasTypesIncluded: Set<string>): void;
|
|
50
|
-
getHasTypesIncluded(workspaceName: string):
|
|
52
|
+
getHasTypesIncluded(workspaceName: string): Set<string> | undefined;
|
|
51
53
|
addReferencedDependency(workspaceName: string, packageName: string): void;
|
|
52
54
|
addReferencedBinary(workspaceName: string, binaryName: string): void;
|
|
53
55
|
setHostDependencies(workspaceName: string, hostDependencies: HostDependencies): void;
|
package/dist/DependencyDeputy.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isBuiltin } from 'node:module';
|
|
2
|
+
import { PackageJsonPeeker } from './PackageJsonPeeker.js';
|
|
2
3
|
import { DT_SCOPE, IGNORED_DEPENDENCIES, IGNORED_GLOBAL_BINARIES, IGNORED_RUNTIME_DEPENDENCIES, IGNORE_DEFINITELY_TYPED, ROOT_WORKSPACE_NAME, } from './constants.js';
|
|
3
4
|
import { getDependencyMetaData } from './manifest/index.js';
|
|
4
5
|
import { getDefinitelyTypedFor, getPackageFromDefinitelyTyped, getPackageNameFromModuleSpecifier, isDefinitelyTyped, } from './util/modules.js';
|
|
@@ -21,7 +22,7 @@ export class DependencyDeputy {
|
|
|
21
22
|
this.installedBinaries = new Map();
|
|
22
23
|
this.hasTypesIncluded = new Map();
|
|
23
24
|
}
|
|
24
|
-
addWorkspace({ name, cwd, dir, manifestPath, manifest, ignoreDependencies, ignoreBinaries, ignoreUnresolved, }) {
|
|
25
|
+
addWorkspace({ name, cwd, dir, manifestPath, manifestStr, manifest, ignoreDependencies, ignoreBinaries, ignoreUnresolved, }) {
|
|
25
26
|
const dependencies = Object.keys(manifest.dependencies ?? {});
|
|
26
27
|
const peerDependencies = Object.keys(manifest.peerDependencies ?? {});
|
|
27
28
|
const optionalDependencies = Object.keys(manifest.optionalDependencies ?? {});
|
|
@@ -48,6 +49,7 @@ export class DependencyDeputy {
|
|
|
48
49
|
this._manifests.set(name, {
|
|
49
50
|
workspaceDir: dir,
|
|
50
51
|
manifestPath,
|
|
52
|
+
manifestStr,
|
|
51
53
|
ignoreDependencies: ignoreDependencies.map(toRegexOrString),
|
|
52
54
|
ignoreBinaries: ignoreBinaries.map(toRegexOrString),
|
|
53
55
|
ignoreUnresolved: ignoreUnresolved.map(toRegexOrString),
|
|
@@ -91,7 +93,7 @@ export class DependencyDeputy {
|
|
|
91
93
|
this.hasTypesIncluded.set(workspaceName, hasTypesIncluded);
|
|
92
94
|
}
|
|
93
95
|
getHasTypesIncluded(workspaceName) {
|
|
94
|
-
return this.
|
|
96
|
+
return this.hasTypesIncluded.get(workspaceName);
|
|
95
97
|
}
|
|
96
98
|
addReferencedDependency(workspaceName, packageName) {
|
|
97
99
|
if (!this.referencedDependencies.has(workspaceName)) {
|
|
@@ -131,7 +133,7 @@ export class DependencyDeputy {
|
|
|
131
133
|
if (closestWorkspaceName || closestWorkspaceNameForTypes) {
|
|
132
134
|
if (closestWorkspaceName)
|
|
133
135
|
this.addReferencedDependency(closestWorkspaceName, packageName);
|
|
134
|
-
if (closestWorkspaceNameForTypes)
|
|
136
|
+
if (closestWorkspaceNameForTypes && !this.hasTypesIncluded.get(closestWorkspaceNameForTypes)?.has(packageName))
|
|
135
137
|
this.addReferencedDependency(closestWorkspaceNameForTypes, typesPackageName);
|
|
136
138
|
return true;
|
|
137
139
|
}
|
|
@@ -168,9 +170,10 @@ export class DependencyDeputy {
|
|
|
168
170
|
const dependencyIssues = [];
|
|
169
171
|
const devDependencyIssues = [];
|
|
170
172
|
const optionalPeerDependencyIssues = [];
|
|
171
|
-
for (const [workspace, { manifestPath: filePath }] of this._manifests.entries()) {
|
|
173
|
+
for (const [workspace, { manifestPath: filePath, manifestStr }] of this._manifests.entries()) {
|
|
172
174
|
const referencedDependencies = this.referencedDependencies.get(workspace);
|
|
173
175
|
const hasTypesIncluded = this.getHasTypesIncluded(workspace);
|
|
176
|
+
const peeker = new PackageJsonPeeker(manifestStr);
|
|
174
177
|
const peerDepRecs = {};
|
|
175
178
|
const isReferencedDependency = (dependency, isPeerDep) => {
|
|
176
179
|
if (referencedDependencies?.has(dependency))
|
|
@@ -182,7 +185,7 @@ export class DependencyDeputy {
|
|
|
182
185
|
const typedPackageName = getPackageFromDefinitelyTyped(typedDependency);
|
|
183
186
|
if (IGNORE_DEFINITELY_TYPED.has(typedPackageName))
|
|
184
187
|
return true;
|
|
185
|
-
if (hasTypesIncluded?.has(
|
|
188
|
+
if (hasTypesIncluded?.has(typedPackageName))
|
|
186
189
|
return false;
|
|
187
190
|
const hostDependencies = [
|
|
188
191
|
...this.getHostDependenciesFor(workspace, dependency),
|
|
@@ -190,7 +193,7 @@ export class DependencyDeputy {
|
|
|
190
193
|
];
|
|
191
194
|
if (hostDependencies.length)
|
|
192
195
|
return !!hostDependencies.find(host => isReferencedDependency(host.name, true));
|
|
193
|
-
if (!referencedDependencies)
|
|
196
|
+
if (!referencedDependencies?.has(dependency))
|
|
194
197
|
return false;
|
|
195
198
|
return referencedDependencies.has(typedPackageName);
|
|
196
199
|
}
|
|
@@ -205,13 +208,16 @@ export class DependencyDeputy {
|
|
|
205
208
|
};
|
|
206
209
|
const isNotReferencedDependency = (dependency) => !isReferencedDependency(dependency, false);
|
|
207
210
|
for (const symbol of this.getProductionDependencies(workspace).filter(isNotReferencedDependency)) {
|
|
208
|
-
|
|
211
|
+
const position = peeker.getLocation('dependencies', symbol);
|
|
212
|
+
dependencyIssues.push({ type: 'dependencies', workspace, filePath, symbol, ...position });
|
|
209
213
|
}
|
|
210
214
|
for (const symbol of this.getDevDependencies(workspace).filter(isNotReferencedDependency)) {
|
|
211
|
-
|
|
215
|
+
const position = peeker.getLocation('devDependencies', symbol);
|
|
216
|
+
devDependencyIssues.push({ type: 'devDependencies', filePath, workspace, symbol, ...position });
|
|
212
217
|
}
|
|
213
218
|
for (const symbol of this.getOptionalPeerDependencies(workspace).filter(d => isReferencedDependency(d))) {
|
|
214
|
-
|
|
219
|
+
const pos = peeker.getLocation('optionalPeerDependencies', symbol);
|
|
220
|
+
optionalPeerDependencyIssues.push({ type: 'optionalPeerDependencies', filePath, workspace, symbol, ...pos });
|
|
215
221
|
}
|
|
216
222
|
}
|
|
217
223
|
return { dependencyIssues, devDependencyIssues, optionalPeerDependencyIssues };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare class PackageJsonPeeker {
|
|
2
|
+
private manifestStr;
|
|
3
|
+
private lines;
|
|
4
|
+
private sections;
|
|
5
|
+
private ready;
|
|
6
|
+
constructor(manifestStr: string);
|
|
7
|
+
private init;
|
|
8
|
+
getLocation(type: 'dependencies' | 'devDependencies' | 'optionalPeerDependencies', packageName: string): {
|
|
9
|
+
line: number;
|
|
10
|
+
col: number;
|
|
11
|
+
pos: number;
|
|
12
|
+
} | undefined;
|
|
13
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export class PackageJsonPeeker {
|
|
2
|
+
manifestStr;
|
|
3
|
+
lines = [];
|
|
4
|
+
sections = {};
|
|
5
|
+
ready = false;
|
|
6
|
+
constructor(manifestStr) {
|
|
7
|
+
this.manifestStr = manifestStr;
|
|
8
|
+
}
|
|
9
|
+
init() {
|
|
10
|
+
this.lines = this.manifestStr.split('\n');
|
|
11
|
+
let pos = 0;
|
|
12
|
+
for (let i = 0; i < this.lines.length; i++) {
|
|
13
|
+
const line = this.lines[i];
|
|
14
|
+
const section = line.indexOf('"dependencies"') !== -1
|
|
15
|
+
? 'dependencies'
|
|
16
|
+
: line.indexOf('"devDependencies"') !== -1
|
|
17
|
+
? 'devDependencies'
|
|
18
|
+
: line.indexOf('"optionalPeerDependencies"') !== -1
|
|
19
|
+
? 'optionalPeerDependencies'
|
|
20
|
+
: undefined;
|
|
21
|
+
if (section)
|
|
22
|
+
this.sections[section] = { startLine: i, startPos: pos };
|
|
23
|
+
pos += line.length + 1;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
getLocation(type, packageName) {
|
|
27
|
+
if (!this.ready)
|
|
28
|
+
this.init();
|
|
29
|
+
const lines = this.lines;
|
|
30
|
+
const section = this.sections[type];
|
|
31
|
+
if (lines.length === 0 || !section)
|
|
32
|
+
return;
|
|
33
|
+
let pos = section.startPos + lines[section.startLine].length + 1;
|
|
34
|
+
for (let i = section.startLine + 1; i < lines.length; i++) {
|
|
35
|
+
const line = lines[i];
|
|
36
|
+
if (line.includes(`"${packageName}"`)) {
|
|
37
|
+
const col = line.indexOf(packageName);
|
|
38
|
+
return { line: i + 1, col: col + 1, pos: pos + col };
|
|
39
|
+
}
|
|
40
|
+
pos += line.length + 1;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
package/dist/binaries/plugins.js
CHANGED
|
@@ -6,7 +6,7 @@ import { extractBinary } from '../util/modules.js';
|
|
|
6
6
|
import { resolve as fallbackResolve } from './fallback.js';
|
|
7
7
|
const isGlobLikeMatch = /(^!|[*+\\(|{^$])/;
|
|
8
8
|
const isGlobLike = (value) => isGlobLikeMatch.test(value);
|
|
9
|
-
const nodeLoadersArgs = { import: ['r', 'experimental-loader', 'require', 'loader'
|
|
9
|
+
const nodeLoadersArgs = { import: ['r', 'experimental-loader', 'require', 'loader'] };
|
|
10
10
|
export const resolve = (binary, _args, options) => {
|
|
11
11
|
const { fromArgs, containingFilePath } = options;
|
|
12
12
|
const [pluginName, pluginArgs] = pluginArgsMap.get(binary) ?? [];
|
|
@@ -208,11 +208,6 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
208
208
|
entry?: string | string[] | undefined;
|
|
209
209
|
project?: string | string[] | undefined;
|
|
210
210
|
} | undefined;
|
|
211
|
-
'node-test-runner'?: string | boolean | string[] | {
|
|
212
|
-
config?: string | string[] | undefined;
|
|
213
|
-
entry?: string | string[] | undefined;
|
|
214
|
-
project?: string | string[] | undefined;
|
|
215
|
-
} | undefined;
|
|
216
211
|
nodemon?: string | boolean | string[] | {
|
|
217
212
|
config?: string | string[] | undefined;
|
|
218
213
|
entry?: string | string[] | undefined;
|
|
@@ -283,6 +278,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
283
278
|
entry?: string | string[] | undefined;
|
|
284
279
|
project?: string | string[] | undefined;
|
|
285
280
|
} | undefined;
|
|
281
|
+
'react-router'?: string | boolean | string[] | {
|
|
282
|
+
config?: string | string[] | undefined;
|
|
283
|
+
entry?: string | string[] | undefined;
|
|
284
|
+
project?: string | string[] | undefined;
|
|
285
|
+
} | undefined;
|
|
286
286
|
'release-it'?: string | boolean | string[] | {
|
|
287
287
|
config?: string | string[] | undefined;
|
|
288
288
|
entry?: string | string[] | undefined;
|
|
@@ -677,11 +677,6 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
677
677
|
entry?: string | string[] | undefined;
|
|
678
678
|
project?: string | string[] | undefined;
|
|
679
679
|
} | undefined;
|
|
680
|
-
'node-test-runner'?: string | boolean | string[] | {
|
|
681
|
-
config?: string | string[] | undefined;
|
|
682
|
-
entry?: string | string[] | undefined;
|
|
683
|
-
project?: string | string[] | undefined;
|
|
684
|
-
} | undefined;
|
|
685
680
|
nodemon?: string | boolean | string[] | {
|
|
686
681
|
config?: string | string[] | undefined;
|
|
687
682
|
entry?: string | string[] | undefined;
|
|
@@ -752,6 +747,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
752
747
|
entry?: string | string[] | undefined;
|
|
753
748
|
project?: string | string[] | undefined;
|
|
754
749
|
} | undefined;
|
|
750
|
+
'react-router'?: string | boolean | string[] | {
|
|
751
|
+
config?: string | string[] | undefined;
|
|
752
|
+
entry?: string | string[] | undefined;
|
|
753
|
+
project?: string | string[] | undefined;
|
|
754
|
+
} | undefined;
|
|
755
755
|
'release-it'?: string | boolean | string[] | {
|
|
756
756
|
config?: string | string[] | undefined;
|
|
757
757
|
entry?: string | string[] | undefined;
|
package/dist/index.js
CHANGED
|
@@ -34,7 +34,7 @@ export const main = async (unresolvedConfiguration) => {
|
|
|
34
34
|
const streamer = new ConsoleStreamer({ isEnabled: isShowProgress });
|
|
35
35
|
streamer.cast('Reading workspace configuration(s)...');
|
|
36
36
|
await chief.init();
|
|
37
|
-
const workspaces = chief.
|
|
37
|
+
const workspaces = chief.getWorkspaces();
|
|
38
38
|
const report = chief.getIncludedIssueTypes({
|
|
39
39
|
includedIssueTypes,
|
|
40
40
|
excludedIssueTypes,
|
|
@@ -64,11 +64,11 @@ export const main = async (unresolvedConfiguration) => {
|
|
|
64
64
|
const shouldIgnore = getShouldIgnoreHandler(isProduction);
|
|
65
65
|
const shouldIgnoreTags = getShouldIgnoreTagHandler(tags);
|
|
66
66
|
for (const workspace of workspaces) {
|
|
67
|
-
const { name, dir, manifestPath } = workspace;
|
|
67
|
+
const { name, dir, manifestPath, manifestStr } = workspace;
|
|
68
68
|
const manifest = chief.getManifestForWorkspace(name);
|
|
69
69
|
if (!manifest)
|
|
70
70
|
continue;
|
|
71
|
-
deputy.addWorkspace({ name, cwd, dir, manifestPath, manifest, ...chief.getIgnores(name) });
|
|
71
|
+
deputy.addWorkspace({ name, cwd, dir, manifestPath, manifestStr, manifest, ...chief.getIgnores(name) });
|
|
72
72
|
}
|
|
73
73
|
for (const workspace of workspaces) {
|
|
74
74
|
const { name, dir, ancestors, pkgName } = workspace;
|
|
@@ -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
|
};
|
|
@@ -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 {};
|
|
@@ -8,7 +8,7 @@ const config = ['package.json', ...toCosmiconfig('stylelint')];
|
|
|
8
8
|
const resolve = (config) => {
|
|
9
9
|
const extend = config.extends ?? [];
|
|
10
10
|
const plugins = config.plugins ?? [];
|
|
11
|
-
const customSyntax = config.customSyntax ? [config.customSyntax] : [];
|
|
11
|
+
const customSyntax = typeof config.customSyntax === 'string' ? [config.customSyntax] : [];
|
|
12
12
|
const overrideConfigs = 'overrides' in config ? config.overrides.flatMap(resolve) : [];
|
|
13
13
|
return [...[extend, plugins, customSyntax].flat().map(toDeferResolve), ...overrideConfigs];
|
|
14
14
|
};
|
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 {};
|
|
@@ -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.1";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.
|
|
1
|
+
export const version = '5.44.1';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "knip",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.44.1",
|
|
4
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": {
|
|
@@ -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
|
-
};
|