Repository navigation
fix(defer): support named deferredImports blocks (Angular 22.2) - #669
Conversation
Angular 22.2 changed `@Component.deferredImports` to an object that maps block names to classes, picked with `@defer (name blk)`. OXC failed with "Unrecognized trigger" and read only the array form. - Parse the `name` parameter with Angular's errors (22.2.0-next.4+). - Read the object form; each named block gets its own dependency function in full mode and its own `deferBlockDependencies` entry in partial mode. The linker now links these blocks too. - Report ngtsc's errors: missing `name`, unknown block, `name` without `deferredImports`, array form on 22.2.0-next.5+, object form before. - Array form (before 22.2): partial mode now emits `deferBlockDependencies`, so linked blocks load their classes. - Remove the static import of a class `@defer` loads, when `deferredImports` is the only place the file names it. Closes #654 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ngtsc can't lazy-load a namespace member and gives the block `() => [i1.X]`. OXC dropped the entry, so the block loaded nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2f63f00c3a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…able With block names, a component defers no `imports` entry, so its entries stay static references. The file-wide prepass still counted them, and another component in the file could remove an import the first one still used. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Closes #654
Angular 22.2 changed
@Component.deferredImportsto an object that maps block names to classes, picked with@defer (name blk). OXC failed withUnrecognized trigger, and read only the old array form.What changed
Unrecognized triggerimports:[C]+ named block using Cimportsentry)ns.Xin a block list() => [ns.X]@deferwithoutname/ unknown name /namewithoutdeferredImports'deferredImports' must be an array ...deferBlockDependenciesdeferredImportsis the file's only use of itnameparse errors use Angular's text:Cannot specify multiple name parameters,Block names cannot be quoted in @defer blocks,Invalid block name "...".Version gate
angularVersionnameUnrecognized triggerangularVersiononly when the user sets it. So a project on Angular ≤ 22.1 that usesdeferredImports: [A]and does not setangularVersionnow gets error 1010. Unset means "latest", the same as the other version gates.Known differences from ngtsc (not changed here)
@defer) and 2010 (not standalone) are not checked.deferredImports: CONSTis not evaluated; a named block then gives 11102, like ngtsc local mode.Verification
tests/deferred_imports_named_test.rs(21 tests). Old array-form tests now setangularVersion22.1.cargo testwith and without--all-features, conformance 1264/1264, napipnpm test419/419,pnpm check.🤖 Generated with Claude Code