@rsdk/yarn.constraints 6.0.0-next.39 → 6.0.0-next.40
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/DEPENDENCY_MODEL.md +452 -0
- package/README.MD +24 -0
- package/__tests__/compatibility.test.ts +321 -0
- package/__tests__/engine.test.ts +1002 -0
- package/__tests__/fixtures/imports/bin.js +4 -0
- package/__tests__/fixtures/imports/export-entry.mjs +1 -0
- package/__tests__/fixtures/imports/root-entry.js +3 -0
- package/__tests__/fixtures/imports/src/common.cjs +3 -0
- package/__tests__/fixtures/imports/src/common.cts +3 -0
- package/__tests__/fixtures/imports/src/component.tsx +4 -0
- package/__tests__/fixtures/imports/src/index.ts +13 -0
- package/__tests__/fixtures/imports/src/module.mjs +3 -0
- package/__tests__/fixtures/imports/src/module.mts +3 -0
- package/__tests__/fixtures/imports/src/plain.js +3 -0
- package/__tests__/fixtures/imports/src/test-only-usage.ts +1 -0
- package/__tests__/imports.test.ts +206 -0
- package/__tests__/manifest-writer.test.ts +157 -0
- package/dist/ansi.d.ts +9 -0
- package/dist/ansi.js +24 -0
- package/dist/ansi.js.map +1 -0
- package/dist/bin/depdoc.d.ts +2 -0
- package/dist/bin/depdoc.js +157 -0
- package/dist/bin/depdoc.js.map +1 -0
- package/dist/collectors/config.d.ts +2 -0
- package/dist/collectors/config.js +25 -0
- package/dist/collectors/config.js.map +1 -0
- package/dist/collectors/external-metadata.d.ts +5 -0
- package/dist/collectors/external-metadata.js +110 -0
- package/dist/collectors/external-metadata.js.map +1 -0
- package/dist/collectors/package-extensions.d.ts +3 -0
- package/dist/collectors/package-extensions.js +43 -0
- package/dist/collectors/package-extensions.js.map +1 -0
- package/dist/collectors/type-providers.d.ts +3 -0
- package/dist/collectors/type-providers.js +46 -0
- package/dist/collectors/type-providers.js.map +1 -0
- package/dist/collectors/workspaces.d.ts +2 -0
- package/dist/collectors/workspaces.js +88 -0
- package/dist/collectors/workspaces.js.map +1 -0
- package/dist/dependency-model.d.ts +11 -0
- package/dist/dependency-model.js +18 -0
- package/dist/dependency-model.js.map +1 -0
- package/dist/index.d.ts +9 -5
- package/dist/index.js +13 -33
- package/dist/index.js.map +1 -1
- package/dist/lib/imports.d.ts +9 -0
- package/dist/lib/imports.js +249 -0
- package/dist/lib/imports.js.map +1 -0
- package/dist/lib/package-json.d.ts +21 -0
- package/dist/lib/package-json.js +32 -0
- package/dist/lib/package-json.js.map +1 -0
- package/dist/model/diagnostics.d.ts +4 -0
- package/dist/model/diagnostics.js +273 -0
- package/dist/model/diagnostics.js.map +1 -0
- package/dist/model/engine.d.ts +5 -0
- package/dist/model/engine.js +52 -0
- package/dist/model/engine.js.map +1 -0
- package/dist/model/expected.d.ts +20 -0
- package/dist/model/expected.js +89 -0
- package/dist/model/expected.js.map +1 -0
- package/dist/model/peer-propagation.d.ts +2 -0
- package/dist/model/peer-propagation.js +124 -0
- package/dist/model/peer-propagation.js.map +1 -0
- package/dist/model/placement.d.ts +9 -0
- package/dist/model/placement.js +205 -0
- package/dist/model/placement.js.map +1 -0
- package/dist/model/rules.d.ts +14 -0
- package/dist/model/rules.js +46 -0
- package/dist/model/rules.js.map +1 -0
- package/dist/model/types.d.ts +117 -0
- package/dist/model/types.js +9 -0
- package/dist/model/types.js.map +1 -0
- package/dist/model/versions.d.ts +3 -0
- package/dist/model/versions.js +73 -0
- package/dist/model/versions.js.map +1 -0
- package/dist/reporting.d.ts +3 -0
- package/dist/reporting.js +80 -0
- package/dist/reporting.js.map +1 -0
- package/dist/runner.d.ts +2 -0
- package/dist/runner.js +70 -0
- package/dist/runner.js.map +1 -0
- package/dist/writer/manifest-writer.d.ts +2 -0
- package/dist/writer/manifest-writer.js +72 -0
- package/dist/writer/manifest-writer.js.map +1 -0
- package/eslint.config.cjs +3 -0
- package/jest.config.js +1 -0
- package/package.json +7 -3
- package/src/ansi.ts +23 -0
- package/src/bin/depdoc.ts +213 -0
- package/src/collectors/config.ts +26 -0
- package/src/collectors/external-metadata.ts +148 -0
- package/src/collectors/package-extensions.ts +52 -0
- package/src/collectors/type-providers.ts +51 -0
- package/src/collectors/workspaces.ts +99 -0
- package/src/dependency-model.ts +26 -0
- package/src/index.ts +28 -45
- package/src/lib/imports.ts +293 -0
- package/src/lib/package-json.ts +46 -0
- package/src/model/diagnostics.ts +328 -0
- package/src/model/engine.ts +120 -0
- package/src/model/expected.ts +141 -0
- package/src/model/peer-propagation.ts +199 -0
- package/src/model/placement.ts +372 -0
- package/src/model/rules.ts +73 -0
- package/src/model/types.ts +164 -0
- package/src/model/versions.ts +109 -0
- package/src/reporting.ts +117 -0
- package/src/runner.ts +102 -0
- package/src/writer/manifest-writer.ts +111 -0
- package/tsconfig.build.json +1 -0
- package/tsconfig.json +6 -1
- package/dist/constraint-schema.d.ts +0 -1
- package/dist/constraint-schema.js +0 -17
- package/dist/constraint-schema.js.map +0 -1
- package/dist/dependency-checker.d.ts +0 -8
- package/dist/dependency-checker.js +0 -40
- package/dist/dependency-checker.js.map +0 -1
- package/src/constraint-schema.ts +0 -20
- package/src/dependency-checker.ts +0 -41
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure dependency model engine.
|
|
3
|
+
*
|
|
4
|
+
* The engine receives complete facts and derives expected manifests plus
|
|
5
|
+
* diagnostics. It must not read files, execute Yarn, or inspect `node_modules`;
|
|
6
|
+
* those concerns belong to collectors and the runner.
|
|
7
|
+
*/
|
|
8
|
+
import { compareManifest, dedupeViolations, validateBasicShape } from './diagnostics';
|
|
9
|
+
import { emptySections } from './expected';
|
|
10
|
+
import { propagatePeers } from './peer-propagation';
|
|
11
|
+
import {
|
|
12
|
+
addRequiredRuleDependencies,
|
|
13
|
+
addUsageDependencies,
|
|
14
|
+
rebuildLibraryMirrors,
|
|
15
|
+
seedRootDevDependencies,
|
|
16
|
+
} from './placement';
|
|
17
|
+
import type {
|
|
18
|
+
DependencyModelFacts,
|
|
19
|
+
DependencyModelOutput,
|
|
20
|
+
DependencyRule,
|
|
21
|
+
ExpectedWorkspace,
|
|
22
|
+
WorkspaceFacts,
|
|
23
|
+
} from './types';
|
|
24
|
+
import {
|
|
25
|
+
applyVersionRules,
|
|
26
|
+
collectUnconstrainedVersionViolations,
|
|
27
|
+
} from './versions';
|
|
28
|
+
|
|
29
|
+
export function buildExpected(
|
|
30
|
+
workspaces: WorkspaceFacts[],
|
|
31
|
+
rules: DependencyRule[],
|
|
32
|
+
externalPeerMetadata: Map<string, Map<string, string> | null>,
|
|
33
|
+
externalTypeMetadata: Map<string, { hasBundledTypes: boolean }>,
|
|
34
|
+
typeProviderPackages: Set<string>,
|
|
35
|
+
): Map<string, ExpectedWorkspace> {
|
|
36
|
+
const expectedByLocation = new Map<string, ExpectedWorkspace>();
|
|
37
|
+
const root = workspaces[0]!;
|
|
38
|
+
const workspaceNames = new Set(
|
|
39
|
+
workspaces.filter((ws) => !ws.isRoot).map((ws) => ws.name),
|
|
40
|
+
);
|
|
41
|
+
const workspacesByName = new Map(
|
|
42
|
+
workspaces.filter((ws) => !ws.isRoot).map((ws) => [ws.name, ws]),
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
for (const workspace of workspaces) {
|
|
46
|
+
expectedByLocation.set(workspace.location, {
|
|
47
|
+
workspace,
|
|
48
|
+
sections: emptySections(),
|
|
49
|
+
reasons: new Map(),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
seedRootDevDependencies(expectedByLocation, workspaceNames, rules);
|
|
54
|
+
addUsageDependencies(
|
|
55
|
+
expectedByLocation,
|
|
56
|
+
root,
|
|
57
|
+
workspaceNames,
|
|
58
|
+
rules,
|
|
59
|
+
externalTypeMetadata,
|
|
60
|
+
typeProviderPackages,
|
|
61
|
+
);
|
|
62
|
+
addRequiredRuleDependencies(
|
|
63
|
+
expectedByLocation,
|
|
64
|
+
root,
|
|
65
|
+
workspaceNames,
|
|
66
|
+
rules,
|
|
67
|
+
);
|
|
68
|
+
propagatePeers(
|
|
69
|
+
expectedByLocation,
|
|
70
|
+
workspacesByName,
|
|
71
|
+
workspaceNames,
|
|
72
|
+
externalPeerMetadata,
|
|
73
|
+
rules,
|
|
74
|
+
);
|
|
75
|
+
applyVersionRules(expectedByLocation, root, workspaceNames, rules);
|
|
76
|
+
rebuildLibraryMirrors(expectedByLocation);
|
|
77
|
+
|
|
78
|
+
return expectedByLocation;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function deriveDependencyModel(
|
|
82
|
+
facts: DependencyModelFacts,
|
|
83
|
+
): DependencyModelOutput {
|
|
84
|
+
const {
|
|
85
|
+
workspaces,
|
|
86
|
+
externalPeerMetadata,
|
|
87
|
+
externalTypeMetadata = new Map(),
|
|
88
|
+
typeProviderPackages = new Set(),
|
|
89
|
+
rules,
|
|
90
|
+
withDts = false,
|
|
91
|
+
} = facts;
|
|
92
|
+
const expected = buildExpected(
|
|
93
|
+
workspaces,
|
|
94
|
+
rules,
|
|
95
|
+
externalPeerMetadata,
|
|
96
|
+
externalTypeMetadata,
|
|
97
|
+
typeProviderPackages,
|
|
98
|
+
);
|
|
99
|
+
const violations: DependencyModelOutput['violations'] = [];
|
|
100
|
+
const warnings: DependencyModelOutput['warnings'] = [];
|
|
101
|
+
|
|
102
|
+
validateBasicShape(
|
|
103
|
+
workspaces,
|
|
104
|
+
expected,
|
|
105
|
+
rules,
|
|
106
|
+
violations,
|
|
107
|
+
warnings,
|
|
108
|
+
withDts,
|
|
109
|
+
);
|
|
110
|
+
for (const item of expected.values()) compareManifest(item, violations);
|
|
111
|
+
violations.push(
|
|
112
|
+
...collectUnconstrainedVersionViolations(workspaces, expected, rules),
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
return {
|
|
116
|
+
violations: dedupeViolations(violations),
|
|
117
|
+
warnings,
|
|
118
|
+
expected,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpers for expected dependency sections and their explanations.
|
|
3
|
+
*
|
|
4
|
+
* The model derives a fresh expected manifest for each workspace. This module
|
|
5
|
+
* owns the small mutation primitives for those expected sections and keeps the
|
|
6
|
+
* reason trail used by `depdoc explain`.
|
|
7
|
+
*/
|
|
8
|
+
import type { PackageJson } from '../lib/package-json';
|
|
9
|
+
|
|
10
|
+
import { getEffectiveRule } from './rules';
|
|
11
|
+
import {
|
|
12
|
+
type DependencyRule,
|
|
13
|
+
type ExpectedWorkspace,
|
|
14
|
+
type Reason,
|
|
15
|
+
SECTIONS,
|
|
16
|
+
type SectionType,
|
|
17
|
+
type WorkspaceFacts,
|
|
18
|
+
} from './types';
|
|
19
|
+
|
|
20
|
+
export function emptySections(): Record<SectionType, Map<string, string>> {
|
|
21
|
+
return {
|
|
22
|
+
dependencies: new Map(),
|
|
23
|
+
peerDependencies: new Map(),
|
|
24
|
+
devDependencies: new Map(),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function getDeclaredSection(
|
|
29
|
+
pkg: PackageJson,
|
|
30
|
+
depIdent: string,
|
|
31
|
+
): SectionType | null {
|
|
32
|
+
for (const section of SECTIONS) {
|
|
33
|
+
if (pkg[section]?.[depIdent] !== undefined) return section;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function getDeclaredRange(
|
|
40
|
+
pkg: PackageJson,
|
|
41
|
+
depIdent: string,
|
|
42
|
+
): string | null {
|
|
43
|
+
const section = getDeclaredSection(pkg, depIdent);
|
|
44
|
+
|
|
45
|
+
return section ? (pkg[section]?.[depIdent] ?? null) : null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function addReason(
|
|
49
|
+
expected: ExpectedWorkspace,
|
|
50
|
+
depIdent: string,
|
|
51
|
+
reason: Reason,
|
|
52
|
+
): void {
|
|
53
|
+
if (!expected.reasons.has(depIdent)) expected.reasons.set(depIdent, []);
|
|
54
|
+
const list = expected.reasons.get(depIdent)!;
|
|
55
|
+
if (!list.some((r) => r.kind === reason.kind && r.detail === reason.detail)) {
|
|
56
|
+
list.push(reason);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function addRuleReason(
|
|
61
|
+
expected: ExpectedWorkspace,
|
|
62
|
+
depIdent: string,
|
|
63
|
+
rule: ReturnType<typeof getEffectiveRule>,
|
|
64
|
+
): void {
|
|
65
|
+
const details: string[] = [];
|
|
66
|
+
if (rule.section) details.push(`section: ${rule.section}`);
|
|
67
|
+
if (rule.version !== undefined) details.push(`version: ${rule.version}`);
|
|
68
|
+
if (rule.rootOnly) details.push('rootOnly: true');
|
|
69
|
+
if (rule.required) details.push('required: true');
|
|
70
|
+
if (details.length === 0) return;
|
|
71
|
+
|
|
72
|
+
addReason(expected, depIdent, {
|
|
73
|
+
kind: 'rule',
|
|
74
|
+
detail: `${depIdent} matched rule (${details.join(', ')})`,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function setExpectedDependency(
|
|
79
|
+
expected: ExpectedWorkspace,
|
|
80
|
+
section: SectionType,
|
|
81
|
+
depIdent: string,
|
|
82
|
+
range: string,
|
|
83
|
+
reason: Reason,
|
|
84
|
+
): void {
|
|
85
|
+
for (const other of SECTIONS) {
|
|
86
|
+
if (other !== section) expected.sections[other].delete(depIdent);
|
|
87
|
+
}
|
|
88
|
+
expected.sections[section].set(depIdent, range);
|
|
89
|
+
addReason(expected, depIdent, reason);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function addExpectedMirrorDependency(
|
|
93
|
+
expected: ExpectedWorkspace,
|
|
94
|
+
depIdent: string,
|
|
95
|
+
range: string,
|
|
96
|
+
reason: Reason,
|
|
97
|
+
): void {
|
|
98
|
+
expected.sections.devDependencies.set(depIdent, range);
|
|
99
|
+
addReason(expected, depIdent, reason);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export function getExpectedSection(
|
|
103
|
+
expected: ExpectedWorkspace,
|
|
104
|
+
depIdent: string,
|
|
105
|
+
): SectionType | null {
|
|
106
|
+
for (const section of SECTIONS) {
|
|
107
|
+
if (expected.sections[section].has(depIdent)) return section;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function getExpectedRange(
|
|
114
|
+
expected: ExpectedWorkspace,
|
|
115
|
+
depIdent: string,
|
|
116
|
+
): string | null {
|
|
117
|
+
const section = getExpectedSection(expected, depIdent);
|
|
118
|
+
|
|
119
|
+
return section ? (expected.sections[section].get(depIdent) ?? null) : null;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export function getRangeSource(
|
|
123
|
+
root: WorkspaceFacts,
|
|
124
|
+
workspace: WorkspaceFacts,
|
|
125
|
+
depIdent: string,
|
|
126
|
+
rules: DependencyRule[],
|
|
127
|
+
): string {
|
|
128
|
+
const rule = getEffectiveRule(
|
|
129
|
+
rules,
|
|
130
|
+
depIdent,
|
|
131
|
+
workspace.name,
|
|
132
|
+
workspace.location,
|
|
133
|
+
);
|
|
134
|
+
if (rule.version !== undefined) return rule.version;
|
|
135
|
+
|
|
136
|
+
return (
|
|
137
|
+
getDeclaredRange(workspace.pkg, depIdent) ??
|
|
138
|
+
getDeclaredRange(root.pkg, depIdent) ??
|
|
139
|
+
'*'
|
|
140
|
+
);
|
|
141
|
+
}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Peer propagation across dependency edges.
|
|
3
|
+
*
|
|
4
|
+
* This module applies peer requirements from local libraries and external
|
|
5
|
+
* packages to the current workspace. It consumes already collected peer
|
|
6
|
+
* metadata and does not inspect `node_modules` itself.
|
|
7
|
+
*/
|
|
8
|
+
import {
|
|
9
|
+
addExpectedMirrorDependency,
|
|
10
|
+
addReason,
|
|
11
|
+
addRuleReason,
|
|
12
|
+
getExpectedRange,
|
|
13
|
+
getExpectedSection,
|
|
14
|
+
setExpectedDependency,
|
|
15
|
+
} from './expected';
|
|
16
|
+
import { getEffectiveRule } from './rules';
|
|
17
|
+
import type {
|
|
18
|
+
DependencyRule,
|
|
19
|
+
ExpectedWorkspace,
|
|
20
|
+
WorkspaceFacts,
|
|
21
|
+
} from './types';
|
|
22
|
+
|
|
23
|
+
function providePeer(
|
|
24
|
+
expected: ExpectedWorkspace,
|
|
25
|
+
rootExpected: ExpectedWorkspace,
|
|
26
|
+
workspaceNames: Set<string>,
|
|
27
|
+
rules: DependencyRule[],
|
|
28
|
+
depIdent: string,
|
|
29
|
+
range: string,
|
|
30
|
+
provider: string,
|
|
31
|
+
): boolean {
|
|
32
|
+
if (workspaceNames.has(depIdent)) return false;
|
|
33
|
+
if (expected.sections.dependencies.has(depIdent)) return false;
|
|
34
|
+
|
|
35
|
+
const beforeSection = getExpectedSection(expected, depIdent);
|
|
36
|
+
const beforeRange = getExpectedRange(expected, depIdent);
|
|
37
|
+
const rule = getEffectiveRule(
|
|
38
|
+
rules,
|
|
39
|
+
depIdent,
|
|
40
|
+
expected.workspace.name,
|
|
41
|
+
expected.workspace.location,
|
|
42
|
+
);
|
|
43
|
+
const resolvedRange = rule.version ?? range;
|
|
44
|
+
|
|
45
|
+
addRuleReason(expected, depIdent, rule);
|
|
46
|
+
|
|
47
|
+
if (rule.rootOnly) {
|
|
48
|
+
setExpectedDependency(
|
|
49
|
+
rootExpected,
|
|
50
|
+
'devDependencies',
|
|
51
|
+
depIdent,
|
|
52
|
+
resolvedRange,
|
|
53
|
+
{
|
|
54
|
+
kind: 'root-only',
|
|
55
|
+
detail: `${depIdent} is required by ${provider} but marked rootOnly`,
|
|
56
|
+
},
|
|
57
|
+
);
|
|
58
|
+
addReason(expected, depIdent, {
|
|
59
|
+
kind: 'root-only',
|
|
60
|
+
detail: `${depIdent} is required by ${provider} but marked rootOnly`,
|
|
61
|
+
});
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (
|
|
66
|
+
expected.workspace.role === 'library' &&
|
|
67
|
+
rule.section !== 'dependencies'
|
|
68
|
+
) {
|
|
69
|
+
setExpectedDependency(
|
|
70
|
+
expected,
|
|
71
|
+
'peerDependencies',
|
|
72
|
+
depIdent,
|
|
73
|
+
resolvedRange,
|
|
74
|
+
{
|
|
75
|
+
kind: 'peer-propagation',
|
|
76
|
+
detail: `${depIdent} is required peer of ${provider}`,
|
|
77
|
+
},
|
|
78
|
+
);
|
|
79
|
+
addExpectedMirrorDependency(expected, depIdent, resolvedRange, {
|
|
80
|
+
kind: 'mirror',
|
|
81
|
+
detail: `${depIdent} mirrors propagated peer`,
|
|
82
|
+
});
|
|
83
|
+
} else {
|
|
84
|
+
setExpectedDependency(expected, 'dependencies', depIdent, resolvedRange, {
|
|
85
|
+
kind: 'peer-propagation',
|
|
86
|
+
detail: `${depIdent} is required peer of ${provider}`,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
beforeSection !== getExpectedSection(expected, depIdent) ||
|
|
92
|
+
beforeRange !== getExpectedRange(expected, depIdent)
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function propagatePeers(
|
|
97
|
+
expectedByLocation: Map<string, ExpectedWorkspace>,
|
|
98
|
+
workspacesByName: Map<string, WorkspaceFacts>,
|
|
99
|
+
workspaceNames: Set<string>,
|
|
100
|
+
externalPeerMetadata: Map<string, Map<string, string> | null>,
|
|
101
|
+
rules: DependencyRule[],
|
|
102
|
+
): void {
|
|
103
|
+
const rootExpected = expectedByLocation.get('.')!;
|
|
104
|
+
let changed = true;
|
|
105
|
+
let passes = 0;
|
|
106
|
+
|
|
107
|
+
while (changed && passes < 10) {
|
|
108
|
+
changed = false;
|
|
109
|
+
passes++;
|
|
110
|
+
|
|
111
|
+
for (const expected of expectedByLocation.values()) {
|
|
112
|
+
const workspace = expected.workspace;
|
|
113
|
+
const providerDeps = new Map<string, string>();
|
|
114
|
+
|
|
115
|
+
for (const [depIdent, range] of expected.sections.dependencies) {
|
|
116
|
+
providerDeps.set(depIdent, range);
|
|
117
|
+
}
|
|
118
|
+
for (const [depIdent, range] of expected.sections.peerDependencies) {
|
|
119
|
+
providerDeps.set(depIdent, range);
|
|
120
|
+
}
|
|
121
|
+
if (workspace.isRoot) {
|
|
122
|
+
for (const [depIdent, range] of expected.sections.devDependencies) {
|
|
123
|
+
providerDeps.set(depIdent, range);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
for (const [providerIdent] of providerDeps) {
|
|
128
|
+
if (workspaceNames.has(providerIdent)) {
|
|
129
|
+
const provider = workspacesByName.get(providerIdent);
|
|
130
|
+
if (!provider || provider.role !== 'library') continue;
|
|
131
|
+
const providerExpected = expectedByLocation.get(provider.location);
|
|
132
|
+
if (!providerExpected) continue;
|
|
133
|
+
|
|
134
|
+
for (const [peerIdent, peerRange] of providerExpected.sections
|
|
135
|
+
.peerDependencies) {
|
|
136
|
+
if (provider.pkg.peerDependenciesMeta?.[peerIdent]?.optional) {
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
if (workspaceNames.has(peerIdent)) continue;
|
|
140
|
+
if (workspace.isRoot) {
|
|
141
|
+
setExpectedDependency(
|
|
142
|
+
rootExpected,
|
|
143
|
+
'devDependencies',
|
|
144
|
+
peerIdent,
|
|
145
|
+
peerRange,
|
|
146
|
+
{
|
|
147
|
+
kind: 'peer-propagation',
|
|
148
|
+
detail: `${peerIdent} is required by ${providerIdent}`,
|
|
149
|
+
},
|
|
150
|
+
);
|
|
151
|
+
} else {
|
|
152
|
+
changed =
|
|
153
|
+
providePeer(
|
|
154
|
+
expected,
|
|
155
|
+
rootExpected,
|
|
156
|
+
workspaceNames,
|
|
157
|
+
rules,
|
|
158
|
+
peerIdent,
|
|
159
|
+
peerRange,
|
|
160
|
+
providerIdent,
|
|
161
|
+
) || changed;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const externalPeers = externalPeerMetadata.get(providerIdent) ?? null;
|
|
168
|
+
if (!externalPeers) continue;
|
|
169
|
+
|
|
170
|
+
for (const [peerIdent, peerRange] of externalPeers) {
|
|
171
|
+
if (workspaceNames.has(peerIdent)) continue;
|
|
172
|
+
if (workspace.isRoot) {
|
|
173
|
+
setExpectedDependency(
|
|
174
|
+
rootExpected,
|
|
175
|
+
'devDependencies',
|
|
176
|
+
peerIdent,
|
|
177
|
+
peerRange,
|
|
178
|
+
{
|
|
179
|
+
kind: 'peer-propagation',
|
|
180
|
+
detail: `${peerIdent} is required by ${providerIdent}`,
|
|
181
|
+
},
|
|
182
|
+
);
|
|
183
|
+
} else {
|
|
184
|
+
changed =
|
|
185
|
+
providePeer(
|
|
186
|
+
expected,
|
|
187
|
+
rootExpected,
|
|
188
|
+
workspaceNames,
|
|
189
|
+
rules,
|
|
190
|
+
peerIdent,
|
|
191
|
+
peerRange,
|
|
192
|
+
providerIdent,
|
|
193
|
+
) || changed;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|