Skip to content

refactor(@angular/build): provide file dependencies map on compilation initialize result#31728

Merged
hybrist merged 1 commit intoangular:mainfrom
Deku-nattsu:file-dependencies
Nov 12, 2025
Merged

refactor(@angular/build): provide file dependencies map on compilation initialize result#31728
hybrist merged 1 commit intoangular:mainfrom
Deku-nattsu:file-dependencies

Conversation

@Deku-nattsu
Copy link
Contributor

I am writing a rsbuild plugin that compiles angular, it uses the compilation classes underneath and thanks to the exposure of createAngularCompilation its been fairly smooth to implement.

however I’ve encountered a blocker when wiring up a dev server that correctly associates component TypeScript files with their html template resources. for this a dependency map is needed and that's what getResourceDependencies provides. but it isn’t publicly accessible from the compilation which is fair.

so right now, the only option seems to be creating a second Angular compiler instance in my plugin solely to access that API, which isn’t ideal. (i could be missing something?)

the PR change stores the dependencies map and returns it in initialization result which worked well in my case, but i am not sure if this is the right approach or what overhead it could introduce.

@angular-robot angular-robot bot added detected: feature PR contains a feature commit area: @angular/build labels Nov 9, 2025
Copy link
Member

@clydin clydin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution.
Overall the change looks good.
Only concern, since this is an externally usable API, is the fileDependencies name. It may be overly broad of a term here since it's only the external resource files for the components in a given source file and not all the dependencies of a given file.

@alan-agius4 alan-agius4 added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews target: minor This PR is targeted for the next minor release labels Nov 9, 2025
@alan-agius4
Copy link
Collaborator

@Deku-nattsu, since this is a feature for a private API, and shouldn’t be part of the changelog maybe we can use a refactor type instead of a feat?

@Deku-nattsu Deku-nattsu changed the title feat(@angular/build): provide file dependencies map on compilation initialize result refactor(@angular/build): provide file dependencies map on compilation initialize result Nov 10, 2025
@Deku-nattsu
Copy link
Contributor Author

@alan-agius4 sure thing. any suggestions on the property name?

@alan-agius4
Copy link
Collaborator

@Deku-nattsu, some ideas componentResourcesDependencies, resourceDependencies, componentResources or something similar should do.

@Deku-nattsu
Copy link
Contributor Author

@alan-agius4 done.

@clydin clydin added target: rc This PR is targeted for the next release-candidate action: merge The PR is ready for merge by the caretaker and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews target: minor This PR is targeted for the next minor release labels Nov 11, 2025
@hybrist hybrist merged commit 576cfe0 into angular:main Nov 12, 2025
33 checks passed
@hybrist
Copy link
Contributor

hybrist commented Nov 12, 2025

This PR was merged into the repository. The changes were merged into the following branches:

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 13, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/build detected: feature PR contains a feature commit target: rc This PR is targeted for the next release-candidate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants