angular/packages/compiler-cli/linker/src/file_linker
Kristiyan Kostadinov 54ceed53e2 refactor(compiler): add support for host directives (#46868)
This is the compile-time implementation of the `hostDirectives` feature plus a little bit of runtime code to illustrate how the newly-generated code will plug into the runtime. It works by creating a call to the new `ɵɵHostDirectivesFeature` feature whenever a directive has a `hostDirectives` field. Afterwards `ɵɵHostDirectivesFeature` will patch a new function onto the directive definition that will be invoked during directive matching.

For example, if we take the following definition:

```ts
@Directive({
  hostDirectives: [HostA, {directive: HostB, inputs: ['input: alias']}]
})
class MyDir {}
```

Will compile to:

```js
MyDir.ɵdir = ɵɵdefineComponent({
  features: [ɵɵHostDirectivesFeature([HostA, {
    directive: HostB,
    inputs: {
      input: "alias"
    }
  }])]
});
```

The template type checking is implemented during directive matching by adding the host directives applied on the host to the array of matched directives whenever the host is matched in a template.

Relates to #8785.

PR Close #46868
2022-08-22 16:00:35 -07:00
..
emit_scopes refactor(compiler-cli): linker honors associated statements for a field (#45024) 2022-03-22 11:11:53 -07:00
partial_linkers refactor(compiler): add support for host directives (#46868) 2022-08-22 16:00:35 -07:00
declaration_scope.ts refactor(compiler-cli): rename $ngDeclareDirective/$ngDeclareComponent to use ɵɵ prefix (#39518) 2020-11-04 10:44:37 -08:00
file_linker.ts refactor(compiler-cli): linker honors associated statements for a field (#45024) 2022-03-22 11:11:53 -07:00
get_source_file.ts refactor(compiler-cli): support external template source-mapping when linking (#40237) 2021-01-07 13:12:53 -08:00
linker_environment.ts refactor(compiler-cli): change how partial-linkers are matched to declaration versions (#41578) 2021-04-14 11:00:40 -07:00
linker_options.ts refactor(compiler-cli): change how partial-linkers are matched to declaration versions (#41578) 2021-04-14 11:00:40 -07:00
needs_linking.ts feat(compiler-cli): expose function to allow short-circuiting of linking (#40137) 2020-12-22 14:53:02 -08:00
translator.ts refactor: delete the View Engine runtime (#43884) 2021-11-23 21:10:06 +00:00