Skip to content

feat(transform): support @Service decorator in JIT downlevel transform (#311)#320

Merged
brandonroberts merged 2 commits into
mainfrom
claude/issue-311-SFByD
May 29, 2026
Merged

feat(transform): support @Service decorator in JIT downlevel transform (#311)#320
brandonroberts merged 2 commits into
mainfrom
claude/issue-311-SFByD

Conversation

@brandonroberts
Copy link
Copy Markdown
Collaborator

@brandonroberts brandonroberts commented May 28, 2026

Closes #311

Recognize Angular v22's @service decorator in the JIT downlevel pipeline so
the runtime JIT facade (compileService) can rediscover it. A @service class is
now restructured the same way as @Injectable: decorator removed, static
decorators/ctorParameters emitted, and lowered via __decorate(...).

  • Add Service variant to AngularDecoratorKind and match it in
    find_angular_decorator; include "Service" in ANGULAR_DECORATOR_NAMES.
  • Add AngularVersion::supports_service_decorator() (v22+) helper.
  • Version-gate: when targeting Angular < 22, emit a diagnostic and leave the
    @service decorator unchanged (pass-through), since the runtime lacks
    compileService. Unknown version defaults to "supports".
  • Tests: @service downlevels like @Injectable (snapshot); targeting v21
    surfaces a diagnostic and leaves the decorator in source.

https://claude.ai/code/session_01U6t6qXHNPsEUk5ZFEcB8NQ

#311)

Recognize Angular v22's @service decorator in the JIT downlevel pipeline so
the runtime JIT facade (compileService) can rediscover it. A @service class is
now restructured the same way as @Injectable: decorator removed, static
decorators/ctorParameters emitted, and lowered via __decorate(...).

- Add `Service` variant to `AngularDecoratorKind` and match it in
  `find_angular_decorator`; include `"Service"` in `ANGULAR_DECORATOR_NAMES`.
- Add `AngularVersion::supports_service_decorator()` (v22+) helper.
- Version-gate: when targeting Angular < 22, emit a diagnostic and leave the
  @service decorator unchanged (pass-through), since the runtime lacks
  compileService. Unknown version defaults to "supports".
- Tests: @service downlevels like @Injectable (snapshot); targeting v21
  surfaces a diagnostic and leaves the decorator in source.

https://claude.ai/code/session_01U6t6qXHNPsEUk5ZFEcB8NQ
@Brooooooklyn
Copy link
Copy Markdown
Member

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3637a89799

ℹ️ 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".

Comment thread crates/oxc_angular_compiler/src/component/transform.rs
@brandonroberts brandonroberts removed the request for review from Brooooooklyn May 29, 2026 16:33
…s kind

A bare `@Service()` matched by raw name only would shadow a real Angular
decorator on the same class. On pre-v22 targets the version gate would
then emit a misleading "requires v22" diagnostic and `continue` past the
sibling `@Component`/`@Injectable`, leaving it unlowered.

Thread the import map into `find_angular_decorator` and require the
`Service` identifier to resolve to `@angular/core`. Other Angular
decorator names are left as raw-name matches to preserve namespace-style
usage like `@core.Component()`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@brandonroberts brandonroberts enabled auto-merge (squash) May 29, 2026 16:58
@brandonroberts brandonroberts merged commit 3a4f3ea into main May 29, 2026
9 checks passed
@brandonroberts brandonroberts deleted the claude/issue-311-SFByD branch May 29, 2026 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: support @Service decorator in JIT downlevel transform

3 participants