Commit 82e7afe
feat(js): support nx.sync.ignoredDependencies in typescript-sync (#35401)
## Current Behavior
`@nx/js:typescript-sync` always materializes every project-graph edge of
a project as a TypeScript project reference in the corresponding runtime
tsconfig. The existing `nx.sync.ignoredReferences` opt-out keeps
user-authored reference paths from being pruned, but there is no way to
tell the generator "don't add a reference for this dependency in the
first place."
That becomes a problem when the project graph contains intentional
cycles — for example when `@nx/workspace` declares its lazy-loaded
plugin peers (`@nx/js`, `@nx/angular`, etc.) as optional peers, and
those same plugins depend back on `@nx/workspace`. Materializing both
edges as TS project references produces `TS6202: Project references may
not form a circular graph`. The only workaround today is
`implicitDependencies: ["!name", …]` in `project.json`, which removes
the edge from the project graph entirely and hides it from every other
consumer (dependency tooling, graph visualizations, supply-chain
audits).
## Expected Behavior
Tsconfig files now accept an `nx.sync.ignoredDependencies: string[]`
field (sibling of the existing `nx.sync.ignoredReferences`). When the
sync generator processes that tsconfig, any project-graph dependency
whose project name is in the set is skipped — no new reference is added
for it, and any existing reference for that dependency is pruned as
stale.
This lets a workspace keep real, cyclic project-graph edges (so the
package.json peer relationships stay visible) while opting the affected
tsconfig out of materializing the cycle into project references. The
task graph is kept acyclic separately via explicit `dependsOn` entries.
Co-authored-by: Claude <[email protected]>1 parent 7af6da1 commit 82e7afe
2 files changed
Lines changed: 44 additions & 0 deletions
Lines changed: 34 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
482 | 482 | | |
483 | 483 | | |
484 | 484 | | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
485 | 519 | | |
486 | 520 | | |
487 | 521 | | |
| |||
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
392 | 393 | | |
393 | 394 | | |
394 | 395 | | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
395 | 399 | | |
396 | 400 | | |
397 | 401 | | |
| |||
448 | 452 | | |
449 | 453 | | |
450 | 454 | | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
451 | 461 | | |
452 | 462 | | |
453 | 463 | | |
| |||
0 commit comments