- 
 
 - 
  Notifications
 
You must be signed in to change notification settings  - Fork 2
 
Commit 635b5ca
Exposes packages to constraints (#5555)
**What's the problem this PR addresses?**
Constraints can only operate on the workspaces' listed dependencies, but
have no idea about the shape of the global dependency tree. In general
it's enough, but I wanted to write a constraint autofixing missing peer
dependencies, and this wasn't possible without knowing the dependencies
of our dependencies.
**How did you fix it?**
I added a concept of "package" to the constraint API. Some of their
characteristics:
- They are based on the resolved dependency tree; as a result, there is
no direct concept of devDependency / dependency (just like in the core
`Package` type).
- They somewhat look like the `Package` type, but with fewer information
(just the dependencies & peer dependencies, at the moment), and with a
slightly different format (no need for serialization, so it directly
references other data structure rather than go through string hashes).
- They don't provide any autofix (or even reporting) capability at the
moment. Perhaps later I'll add an `error` API, like regular
dependencies, but that'll probably require to enhance them so they are
able to access the packages' filesystems, so it'll have to be a
follow-up.
Testing is currently lacking ... like the rest of the JS constraints
engine 😶🌫️
**Checklist**
<!--- Don't worry if you miss something, chores are automatically
tested. -->
<!--- This checklist exists to help you remember doing the chores when
you submit a PR. -->
<!--- Put an `x` in all the boxes that apply. -->
- [x] I have read the [Contributing
Guide](https://yarnpkg.com/advanced/contributing).
<!-- See
https://yarnpkg.com/advanced/contributing#preparing-your-pr-to-be-released
for more details. -->
<!-- Check with `yarn version check` and fix with `yarn version check
-i` -->
- [x] I have set the packages that need to be released for my changes to
be effective.
<!-- The "Testing chores" workflow validates that your PR follows our
guidelines. -->
<!-- If it doesn't pass, click on it to see details as to what your PR
might be missing. -->
- [x] I will check that all automated PR checks pass before the PR gets
reviewed.1 parent 1031f31 commit 635b5ca
File tree
16 files changed
+418
-199
lines changed- .yarn/versions
 - packages
- acceptance-tests/pkg-tests-specs/sources/commands
- __snapshots__
 - constraints
- __snapshots__
 
 
 - docusaurus
 - eslint-config
 - plugin-constraints/sources
- commands
 
 - yarnpkg-types/sources
 
 
16 files changed
+418
-199
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub. 
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
 | |||
1 | + | ||
2 | + | ||
3 | + | ||
4 | + | ||
5 | + | ||
6 | + | ||
7 | + | ||
8 | + | ||
9 | + | ||
10 | + | ||
11 | + | ||
12 | + | ||
13 | + | ||
14 | + | ||
15 | + | ||
16 | + | ||
17 | + | ||
18 | + | ||
19 | + | ||
20 | + | ||
21 | + | ||
22 | + | ||
23 | + | ||
24 | + | ||
25 | + | ||
0 commit comments