angular-docs-cn/packages/compiler-cli/ngcc/test/rendering
JoostK 32ce8b1326 feat(compiler): add dependency info and ng-content selectors to metadata (#35695)
This commit augments the `FactoryDef` declaration of Angular decorated
classes to contain information about the parameter decorators used in
the constructor. If no constructor is present, or none of the parameters
have any Angular decorators, then this will be represented using the
`null` type. Otherwise, a tuple type is used where the entry at index `i`
corresponds with parameter `i`. Each tuple entry can be one of two types:

1. If the associated parameter does not have any Angular decorators,
   the tuple entry will be the `null` type.
2. Otherwise, a type literal is used that may declare at least one of
   the following properties:
   - "attribute": if `@Attribute` is present. The injected attribute's
   name is used as string literal type, or the `unknown` type if the
   attribute name is not a string literal.
   - "self": if `@Self` is present, always of type `true`.
   - "skipSelf": if `@SkipSelf` is present, always of type `true`.
   - "host": if `@Host` is present, always of type `true`.
   - "optional": if `@Optional` is present, always of type `true`.

   A property is only present if the corresponding decorator is used.

   Note that the `@Inject` decorator is currently not included, as it's
   non-trivial to properly convert the token's value expression to a
   type that is valid in a declaration file.

Additionally, the `ComponentDefWithMeta` declaration that is created for
Angular components has been extended to include all selectors on
`ng-content` elements within the component's template.

This additional metadata is useful for tooling such as the Angular
Language Service, as it provides the ability to offer suggestions for
directives/components defined in libraries. At the moment, such
tooling extracts the necessary information from the _metadata.json_
manifest file as generated by ngc, however this metadata representation
is being replaced by the information emitted into the declaration files.

Resolves FW-1870

PR Close #35695
2020-03-24 14:21:42 -07:00
..
commonjs_rendering_formatter_spec.ts test(ngcc): remove usage of ES2015 syntax in ES5/UMD/CommonJS tests (#34889) 2020-01-23 14:47:03 -08:00
dts_renderer_spec.ts feat(compiler): add dependency info and ng-content selectors to metadata (#35695) 2020-03-24 14:21:42 -07:00
esm5_rendering_formatter_spec.ts test(ngcc): remove usage of ES2015 syntax in ES5/UMD/CommonJS tests (#34889) 2020-01-23 14:47:03 -08:00
esm_rendering_formatter_spec.ts fix(ngcc): insert definitions after statement (#34677) 2020-01-08 15:09:24 -08:00
renderer_spec.ts fix(ngcc): handle mappings outside the content when flattening source-maps (#35718) 2020-02-27 16:09:36 -05:00
umd_rendering_formatter_spec.ts test(ngcc): remove usage of ES2015 syntax in ES5/UMD/CommonJS tests (#34889) 2020-01-23 14:47:03 -08:00