Charles Lyding 8ee9520035 refactor(compiler-cli): cache module resolutions and track unresolved imports in preprocessor
Previously, `QueryEngine` invoked `AnalysisHost::resolve` directly on every
syntactic dependency scan, cross-file constant evaluation, export-map walk,
and NgModule scope traversal without an engine-level cache. For asynchronous
bundler hosts, repeating identical `(importer, specifier, kind, type_only,
attributes)` lookups across queries and rebuilds would generate redundant
cross-boundary round-trips. In addition, failed module resolutions only
recorded `UNRESOLVED_IMPORTS_FILE_ID` during the Stage-1 static dependency
scan of `.ts` sources. That scan does not resolve the specifiers of `.d.ts`
files, so a failed lookup made from one, such as a re-export to a missing
target, was untracked and not re-run when the target was later created.
Deleting a resolved file also left importers holding stale cached dependency
edges.

Introduce `ResolutionCache` on `QueryEngine` to memoize completed module
resolution outcomes per importer `FileId` and request key while maintaining
both a target-to-importer reverse index and an unresolved-importer index.
Route query-time module lookups through `QueryContext::resolve_request`,
`resolve_from_id`, and `resolve_from_path` so every resolution records the
importer dependency and every failed lookup—including negative cache hits—
records `UNRESOLVED_IMPORTS_FILE_ID`. Classify pure re-exports in
`analyze_file_syntax` with `ImportKind::ReExport` so syntactic dependency
discovery shares cached resolutions with cross-file evaluation and export-map
queries.

On `invalidate_file_id`, drop only the edited importer's cached resolutions
so edits to a leaf module preserve cached resolutions across its importers.
On `FileUpdateType::Deleted`, evict queries derived from importers that had
resolved to the deleted target while keeping their `ParseFile` results
cached. On `invalidate_module_resolution`, stop serving every cached
resolution and re-run importers with previously unresolved specifiers. The
superseded entries are kept as stale rather than dropped, so the reverse
index still covers importers whose queries stay cached and that therefore do
not resolve again, and a lookup that the host answers after the change is
not memoized.

When a host resolution changes a module's `IdKind`, also evict the importers
whose cached resolutions report the previous kind. The resolution that
changed the kind is not memoized, so the query re-run that follows asks the
host again.
2026-11-13 16:02:29 -08:00
…
2026-09-09 21:48:04 +02:00
2026-11-10 09:33:44 -08:00
2025-11-06 10:03:05 -08:00
2026-01-07 12:28:34 -05:00
2026-04-27 17:08:02 -07:00
2026-10-28 11:40:51 -07:00

Angular - The modern web developer's platform

angular-logo
Angular is a development platform for building mobile and desktop web applications
using TypeScript/JavaScript and other languages.

angular.dev

Contributing Guidelines · Submit an Issue · Blog

Angular on npm


Documentation

Get started with Angular, learn the fundamentals and explore advanced topics on our documentation website.

Advanced

Local Development

To contribute to the Angular Docs, check out the Angular.dev README

Development Setup

Prerequisites

Setting Up a Project

Install the Angular CLI globally:

npm install -g @angular/cli

Create a workspace:

ng new [PROJECT NAME]

Run the application:

cd [PROJECT NAME]
ng serve

Angular is cross-platform, fast, scalable, has incredible tooling, and is loved by millions.

Quickstart

Get started in 5 minutes.

Ecosystem

angular ecosystem logos

Changelog

Learn about the latest improvements.

Upgrading

Check out our upgrade guide to find out the best way to upgrade your project.

Contributing

Contributing Guidelines

Read through our contributing guidelines to learn about our submission process, coding rules, and more.

Want to Help?

Want to report a bug, contribute some code, or improve the documentation? Excellent! Read up on our guidelines for contributing and then check out one of our issues labeled as help wanted or good first issue.

Code of Conduct

Help us keep Angular open and inclusive. Please read and follow our Code of Conduct.

Community

Join the conversation and help the community.

Love Angular badge

Love Angular? Give our repo a star ⭐ ⬆️.

Languages
TypeScript 73.1%
JavaScript 15.7%
Rust 6.6%
HTML 1.6%
Starlark 1.6%
Other 1.4%