Skip to content

fix: directive compiler uses flat array format for hostDirectives input/output mappings#77

Merged
Brooooooklyn merged 2 commits intomainfrom
fix/directive-host-directive-mappings-array
Mar 5, 2026
Merged

fix: directive compiler uses flat array format for hostDirectives input/output mappings#77
Brooooooklyn merged 2 commits intomainfrom
fix/directive-host-directive-mappings-array

Conversation

@Brooooooklyn
Copy link
Member

@Brooooooklyn Brooooooklyn commented Mar 5, 2026

The directive compiler was using create_string_map() which generated object format
{publicName: "internalName"} for host directive mappings. Angular's runtime expects
flat array format ["publicName", "internalName"]. Replaced with
create_host_directive_mappings_array() matching the component compiler's implementation.

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com


Note

Medium Risk
Changes the emitted JS shape for directive hostDirectives mappings, which can affect runtime behavior for consumers relying on the previous (incorrect) object format; scope is limited to host-directive codegen and covered by new tests/fixtures.

Overview
Fixes @Directive hostDirectives input/output alias emission to match Angular’s expected flat array mapping format (e.g. inputs:["public","internal"]) instead of object maps, aligning directive output with the existing component compiler.

This extracts a shared create_host_directive_mappings_array helper (re-exported from directive) and removes the duplicate implementation from the component definition code, plus adds focused unit tests and new e2e fixtures covering directive hostDirectives mappings (inputs, outputs, and both).

Written by Cursor Bugbot for commit f1b1c4d. This will update automatically on new commits. Configure here.

…ut/output mappings

The directive compiler was using `create_string_map()` which generated object format
`{publicName: "internalName"}` for host directive mappings. Angular's runtime expects
flat array format `["publicName", "internalName"]`. Replaced with
`create_host_directive_mappings_array()` matching the component compiler's implementation.

- Fix #67

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

…ective/component

Mirrors Angular's structure where `createHostDirectivesMappingArray` is defined
once in `view/compiler.ts` and imported by `partial/directive.ts`. The shared
function now lives in `directive::compiler` (pub(crate)) and is imported by
`component::definition`, with the `with_capacity_in` optimization.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Brooooooklyn Brooooooklyn merged commit d95c236 into main Mar 5, 2026
4 checks passed
@Brooooooklyn Brooooooklyn deleted the fix/directive-host-directive-mappings-array branch March 5, 2026 04:26
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.

Directive compiler uses wrong format for hostDirectives input/output mappings

1 participant