knip 3.3.0 → 3.3.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.
|
@@ -48,7 +48,10 @@ export declare class DependencyDeputy {
|
|
|
48
48
|
addReferencedDependency(workspaceName: string, packageName: string): void;
|
|
49
49
|
addReferencedBinary(workspaceName: string, binaryName: string): void;
|
|
50
50
|
addHostDependencies(workspaceName: string, hostDependencies: HostDependencies): void;
|
|
51
|
-
getHostDependenciesFor(workspaceName: string, dependency: string):
|
|
51
|
+
getHostDependenciesFor(workspaceName: string, dependency: string): {
|
|
52
|
+
name: string;
|
|
53
|
+
isPeerOptional: boolean;
|
|
54
|
+
}[];
|
|
52
55
|
getPeerDependencies(workspaceName: string): string[];
|
|
53
56
|
getOptionalPeerDependencies(workspaceName: string): string[];
|
|
54
57
|
maybeAddReferencedExternalDependency(workspace: Workspace, packageName: string): boolean;
|
package/dist/DependencyDeputy.js
CHANGED
|
@@ -195,16 +195,16 @@ export class DependencyDeputy {
|
|
|
195
195
|
...this.getHostDependenciesFor(workspaceName, typedPackageName),
|
|
196
196
|
];
|
|
197
197
|
if (hostDependencies.length)
|
|
198
|
-
return !!hostDependencies.find(host => isReferencedDependency(host, true));
|
|
198
|
+
return !!hostDependencies.find(host => isReferencedDependency(host.name, true));
|
|
199
199
|
if (!referencedDependencies)
|
|
200
200
|
return false;
|
|
201
201
|
return referencedDependencies.has(typedPackageName);
|
|
202
202
|
}
|
|
203
203
|
const hostDependencies = this.getHostDependenciesFor(workspaceName, dependency);
|
|
204
|
-
hostDependencies.forEach(
|
|
205
|
-
return hostDependencies.some(
|
|
204
|
+
hostDependencies.forEach(({ name }) => (!peerDepRecs[name] ? (peerDepRecs[name] = 1) : peerDepRecs[name]++));
|
|
205
|
+
return hostDependencies.some(hostDependency => (isPeerDep === false || !hostDependency.isPeerOptional) && isReferencedDependency(hostDependency.name, true));
|
|
206
206
|
};
|
|
207
|
-
const isNotReferencedDependency = (dependency) => !isReferencedDependency(dependency);
|
|
207
|
+
const isNotReferencedDependency = (dependency) => !isReferencedDependency(dependency, false);
|
|
208
208
|
const pd = this.getProductionDependencies(workspaceName);
|
|
209
209
|
const dd = this.getDevDependencies(workspaceName);
|
|
210
210
|
const od = this.getOptionalPeerDependencies(workspaceName);
|
package/dist/manifest/index.js
CHANGED
|
@@ -39,14 +39,18 @@ const findManifestDependencies = async ({ manifest, isProduction, isStrict, dir,
|
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
41
|
const packagePeerDependencies = Object.keys(manifest.peerDependencies ?? {});
|
|
42
|
-
|
|
42
|
+
for (const packagePeerDependency of packagePeerDependencies) {
|
|
43
|
+
const hostDependency = {
|
|
44
|
+
name: packageName,
|
|
45
|
+
isPeerOptional: manifest.peerDependenciesMeta?.[packagePeerDependency]?.optional ?? false,
|
|
46
|
+
};
|
|
43
47
|
if (hostDependencies.has(packagePeerDependency)) {
|
|
44
|
-
hostDependencies.get(packagePeerDependency)?.add(
|
|
48
|
+
hostDependencies.get(packagePeerDependency)?.add(hostDependency);
|
|
45
49
|
}
|
|
46
50
|
else {
|
|
47
|
-
hostDependencies.set(packagePeerDependency, new Set([
|
|
51
|
+
hostDependencies.set(packagePeerDependency, new Set([hostDependency]));
|
|
48
52
|
}
|
|
49
|
-
}
|
|
53
|
+
}
|
|
50
54
|
if (!isDefinitelyTyped(packageName) && (manifest.types || manifest.typings))
|
|
51
55
|
hasTypesIncluded.add(packageName);
|
|
52
56
|
}
|
|
@@ -12,6 +12,9 @@ type WorkspaceManifest = {
|
|
|
12
12
|
ignoreBinaries: string[];
|
|
13
13
|
};
|
|
14
14
|
export type WorkspaceManifests = Map<string, WorkspaceManifest>;
|
|
15
|
-
export type HostDependencies = Map<string, Set<
|
|
15
|
+
export type HostDependencies = Map<string, Set<{
|
|
16
|
+
name: string;
|
|
17
|
+
isPeerOptional: boolean;
|
|
18
|
+
}>>;
|
|
16
19
|
export type InstalledBinaries = Map<string, Set<string>>;
|
|
17
20
|
export {};
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "3.3.
|
|
1
|
+
export declare const version = "3.3.1";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '3.3.
|
|
1
|
+
export const version = '3.3.1';
|