New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(ngcc): cope with packages following APF v14+ #45833
Conversation
You can preview cda0f67 at https://pr45833-cda0f67.ngbuilds.io/. |
cda0f67
to
c92207d
Compare
You can preview c92207d at https://pr45833-c92207d.ngbuilds.io/. |
c92207d
to
330569e
Compare
You can preview 330569e at https://pr45833-330569e.ngbuilds.io/. |
You can preview 7c75b0b at https://pr45833-7c75b0b.ngbuilds.io/. |
You can preview 1ab8b94 at https://pr45833-1ab8b94.ngbuilds.io/. |
You can preview d4c3a78 at https://pr45833-d4c3a78.ngbuilds.io/. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
Remove some unused dependencies from `ngcc` source code.
Move the `loadPackageJson()` helper (and associated generic types, such as `JsonObject`) from `packages/entry_point.ts` to `utils.ts` and also rename it to `loadJson()`. This way, they can be used in other places in future commits, without introducing cyclical dependencies.
In PR angular#45405, the Angular Package Format (APF) was updated so that secondary entry-points (such as `@angular/common/http`) do not have their own `package.json` file, as they used to. Instead, the paths to their various formats and types are exposed via the primary `package.json` file's `exports` property. As an example, see the v13 [@angular/common/http/package.json][1] and compare it with the v14 [@angular/common/package.json > exports][2]. Previously, `ngcc` was not able to analyze such v14+ entry-points and would instead error as it considered such entry-points missing. This commit addresses the issue by detecting this situation and synthesizing a `package.json` file for the secondary entry-points based on the `exports` property of the primary `package.json` file. This data is only used by `ngcc` in order to determine that the entry-point does not need further processing, since it is already in Ivy format. [1]: https://unpkg.com/browse/@angular/common@13.3.5/http/package.json [2]: https://unpkg.com/browse/@angular/common@14.0.0-next.15/package.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
You can preview 3686a06 at https://pr45833-3686a06.ngbuilds.io/. |
This PR was merged into the repository by commit d4e949f. |
…ts` (#45833) Move the `loadPackageJson()` helper (and associated generic types, such as `JsonObject`) from `packages/entry_point.ts` to `utils.ts` and also rename it to `loadJson()`. This way, they can be used in other places in future commits, without introducing cyclical dependencies. PR Close #45833
In PR #45405, the Angular Package Format (APF) was updated so that secondary entry-points (such as `@angular/common/http`) do not have their own `package.json` file, as they used to. Instead, the paths to their various formats and types are exposed via the primary `package.json` file's `exports` property. As an example, see the v13 [@angular/common/http/package.json][1] and compare it with the v14 [@angular/common/package.json > exports][2]. Previously, `ngcc` was not able to analyze such v14+ entry-points and would instead error as it considered such entry-points missing. This commit addresses the issue by detecting this situation and synthesizing a `package.json` file for the secondary entry-points based on the `exports` property of the primary `package.json` file. This data is only used by `ngcc` in order to determine that the entry-point does not need further processing, since it is already in Ivy format. [1]: https://unpkg.com/browse/@angular/common@13.3.5/http/package.json [2]: https://unpkg.com/browse/@angular/common@14.0.0-next.15/package.json PR Close #45833
Remove some unused dependencies from `ngcc` source code. PR Close #45833
…ts` (#45833) Move the `loadPackageJson()` helper (and associated generic types, such as `JsonObject`) from `packages/entry_point.ts` to `utils.ts` and also rename it to `loadJson()`. This way, they can be used in other places in future commits, without introducing cyclical dependencies. PR Close #45833
In PR #45405, the Angular Package Format (APF) was updated so that secondary entry-points (such as `@angular/common/http`) do not have their own `package.json` file, as they used to. Instead, the paths to their various formats and types are exposed via the primary `package.json` file's `exports` property. As an example, see the v13 [@angular/common/http/package.json][1] and compare it with the v14 [@angular/common/package.json > exports][2]. Previously, `ngcc` was not able to analyze such v14+ entry-points and would instead error as it considered such entry-points missing. This commit addresses the issue by detecting this situation and synthesizing a `package.json` file for the secondary entry-points based on the `exports` property of the primary `package.json` file. This data is only used by `ngcc` in order to determine that the entry-point does not need further processing, since it is already in Ivy format. [1]: https://unpkg.com/browse/@angular/common@13.3.5/http/package.json [2]: https://unpkg.com/browse/@angular/common@14.0.0-next.15/package.json PR Close #45833
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
In PR #45405, the Angular Package Format (APF) was updated so that secondary entry-points (such as
@angular/common/http
) do not have their ownpackage.json
file, as they used to. Instead, the paths to their various formats and types are exposed via the primarypackage.json
file'sexports
property. As an example, see the v13 @angular/common/http/package.json and compare it with the v14 @angular/common/package.json > exports.Previously,
ngcc
was not able to analyze such v14+ entry-points and would instead error as it considered such entry-points missing.This commit addresses the issue by detecting this situation and synthesizing a
package.json
file for the secondary entry-points based on theexports
property of the primarypackage.json
file. This data is only used byngcc
in order to determine that the entry-point does not need further processing, since it is already in Ivy format.FYI, I have tested this on
ngcc-validation
and it makes CI green: CI run