angular icon indicating copy to clipboard operation
angular copied to clipboard

refactor(localize): remove the dependency on `angular/compiler`

Open petebacondarwin opened this issue 3 years ago • 2 comments

The original plan for $localize was that it would be independent of Angular. Currently there is a dependency on @angular/compiler due to the computeMsgId() function.

This commit moves that function within @angular/localize and reverses the dependency between localize and the compiler. The localize package already re-exports this function as a private export anyway. To avoid too much coupling the encodeUtf8() function is duplicated across the two packages, as it was difficult to attribute ownership to either package.

Closes https://github.com/angular/angular/issues/48163

PR Checklist

Please check if your PR fulfills the following requirements:

  • [x] The commit message follows our guidelines: https://github.com/angular/angular/blob/main/CONTRIBUTING.md#commit
  • [x] Tests for the changes have been added (for bug fixes / features)
  • [ ] Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • [ ] Bugfix
  • [ ] Feature
  • [ ] Code style update (formatting, local variables)
  • [x] Refactoring (no functional changes, no api changes)
  • [ ] Build related changes
  • [ ] CI related changes
  • [ ] Documentation content changes
  • [ ] angular.io application / infrastructure changes
  • [ ] Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • [ ] Yes
  • [ ] No

Other information

petebacondarwin avatar Nov 22 '22 18:11 petebacondarwin

@petebacondarwin we've discussed this further with @clydin and the option to duplicate the computeMsgId function and supporting code (as you and @mhevery mentioned in https://github.com/angular/angular/issues/48163) is probably the best one at this moment. We just want to make sure there is a check (that we can run on CI) that would prevent the files from diverging. We can do some followup cleanups and see if there is a way to restructure the code more to avoid the duplication.

AndrewKushnir avatar Nov 23 '22 01:11 AndrewKushnir

Thank you.

mhevery avatar Nov 23 '22 03:11 mhevery

Closing in favor of https://github.com/angular/angular/pull/48799.

AndrewKushnir avatar Mar 10 '23 02:03 AndrewKushnir

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.