-
Notifications
You must be signed in to change notification settings - Fork 26.2k
Migrate packages/compiler
and packages/elements
#61566
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
Conversation
Migrates `packages/compiler` to `ts_project`.
Compiler now would have `.js` files. Those aren't picked up as ESM, unless we install the `package.json` with `type: module`. Sounds great on paper, but doesn't work in reality because the way the compiler packages are available to `api-gen/` is via the old `rules_nodejs` linker, so the `packages/package.json` wouldn't work; nor do the `package.json`s of the e.g. compiler-cli package work- because those already contain the `exports` of the built npm package. We fix this in a much more reasonable way, and the whole module resolution problem by leveraging the pnpm linking here. This works as expected.
Migrates `packages/elements` to `ng_project`.
See associated pull request for more information.
This is necessary to support later versions of e.g. `rules_ts`.
…er-cli Currently when linking the `@angular/compiler-cli` package, the peer dependency to `compiler` is not resolved and we are trying to make the compiler dependency available via `data`. This is unidiomatic and brittle. This commit fixes this.
The `app_bundle` rule does not work after the migration of `packages/compiler` to `ts_project` because the `.mjs` extensions are now missing in the non npm-package output. This causes runtime errors as `.js` is not recognized as ESM. Switching to the real npm package for usage, fixes this issue.
84fb97b
to
7782a6e
Compare
Since we are going to replace our `app_bundle` rule (custom ESBuild + Terser pipeline) with the real Angular CLI where shared/lazy/common chunks may exist, we need to update the symbol extractor to support multiple files. We could have just merged all symbols, but this commit tries to do better by detecting what symbols are loaded eagerly vs. lazily. This will be very useful for e.g. defer tests or other lazy features we are introducing in the feature.
Instead of dev-infra maintaining a custom ESBuild + Terser pipeline that tries to emulate the Angular CLI, we are switching the bundling core tests to a new rule that really leverages the Angular CLI. This involves some file renames and small adjustments. In addition, we leverage the updated symbol tracking rule to output new goldens that can work with multiple bundle files (as generated by the Angular CLI; especially with defer and its "lazy" chunks).
…on rule We are dropping the custom ESBuild and Terser pipeline from dev-infra and instead leverage the Angular CLI directly. This commit adjusts the benchmarks to use this new rule.
These are also excluded on CI, and shouldn't run locally either as they are "manual debug" targets.
"importProvidersFrom", | ||
"inNotificationPhase", | ||
"includeViewProviders", |
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.
Interesting that there are way more symbols here compared to before. Maybe things aren't being tree shaken correctly?
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.
good callout. I did check with Charles and it seems to be expected because the Angular CLI purely relies on ESBuild for inlining, while Terser (used previously in CLI and in our custom pipeline) was much more aggressive here.
Caretaker note: Please checkout cl/764208851 and then run |
This PR was merged into the repository by commit 909e543. The changes were merged into the following branches: main |
Compiler now would have `.js` files. Those aren't picked up as ESM, unless we install the `package.json` with `type: module`. Sounds great on paper, but doesn't work in reality because the way the compiler packages are available to `api-gen/` is via the old `rules_nodejs` linker, so the `packages/package.json` wouldn't work; nor do the `package.json`s of the e.g. compiler-cli package work- because those already contain the `exports` of the built npm package. We fix this in a much more reasonable way, and the whole module resolution problem by leveraging the pnpm linking here. This works as expected. PR Close #61566
Migrates `packages/elements` to `ng_project`. PR Close #61566
See associated pull request for more information. PR Close #61566
This is necessary to support later versions of e.g. `rules_ts`. PR Close #61566
) The `app_bundle` rule does not work after the migration of `packages/compiler` to `ts_project` because the `.mjs` extensions are now missing in the non npm-package output. This causes runtime errors as `.js` is not recognized as ESM. Switching to the real npm package for usage, fixes this issue. PR Close #61566
Since we are going to replace our `app_bundle` rule (custom ESBuild + Terser pipeline) with the real Angular CLI where shared/lazy/common chunks may exist, we need to update the symbol extractor to support multiple files. We could have just merged all symbols, but this commit tries to do better by detecting what symbols are loaded eagerly vs. lazily. This will be very useful for e.g. defer tests or other lazy features we are introducing in the feature. PR Close #61566
Instead of dev-infra maintaining a custom ESBuild + Terser pipeline that tries to emulate the Angular CLI, we are switching the bundling core tests to a new rule that really leverages the Angular CLI. This involves some file renames and small adjustments. In addition, we leverage the updated symbol tracking rule to output new goldens that can work with multiple bundle files (as generated by the Angular CLI; especially with defer and its "lazy" chunks). PR Close #61566
See individual commits
Also replaces #61290