fix: factor in root dependencies into ... filters (#8465)
### Description
Dependency and dependent filters should factor in root dependencies
since they're implicit dependencies of all packages in the workspace.
We cannot add the root deps to `immediate_dependencies` or
`immediate_ancestors` as these are used during a graph traversal and
adding in the root deps can easily cause cycles.
The transitive versions of these are safe to add the root dependencies
to since they return entire closures.
### Testing Instructions
Added integration tests
Manual testing:
```
[0 olszewski@chriss-mbp] /tmp/pnpm-test $ turbo_dev build --filter='web...' --dry=json | jq '.packages'
WARNING No locally installed `turbo` found. Using version: 2.0.4-canary.2.
[
"@repo/eslint-config",
"@repo/typescript-config",
"@repo/ui",
"@repo/util",
"web"
]
[0 olszewski@chriss-mbp] /tmp/pnpm-test $ turbo_dev build --filter='...web' --dry=json | jq '.packages'
WARNING No locally installed `turbo` found. Using version: 2.0.4-canary.2.
[
"web"
]
[0 olszewski@chriss-mbp] /tmp/pnpm-test $ turbo_dev build --filter='...@repo/util' --dry=json | jq '.packages'
WARNING No locally installed `turbo` found. Using version: 2.0.4-canary.2.
[
"//",
"@repo/eslint-config",
"@repo/typescript-config",
"@repo/ui",
"@repo/util",
"docs",
"web"
]
[0 olszewski@chriss-mbp] /tmp/pnpm-test $ bat package.json
───────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ File: package.json
───────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ {
2 │ "name": "pnpm-test",
3 │ "private": true,
4 │ "scripts": {
5 │ "build": "turbo build",
6 │ "dev": "turbo dev",
7 │ "lint": "turbo lint",
8 │ "format": "prettier --write \"**/*.{ts,tsx,md}\""
9 │ },
10 + │ "dependencies": {
11 + │ "@repo/util": "workspace:*"
12 + │ },
13 │ "devDependencies": {
14 _ │ "prettier": "^3.2.5",
15 │ "typescript": "^5.4.5"
16 │ },
17 │ "packageManager": "pnpm@8.15.6",
18 │ "engines": {
19 │ "node": ">=18"
20 │ }
21 │ }
```