angular-cn/packages/compiler/src
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
..
aot fix(compiler): do not recurse to find static symbols of same module (#35262) 2020-03-16 10:52:23 -07:00
compiler_util perf(ivy): remove unused event argument in listener instructions (#35097) 2020-02-20 15:22:13 -08:00
css_parser build(bazel): Turning on strictPropertyInitialization for Angular. (#24572) 2018-06-25 07:57:13 -07:00
expression_parser fix(compiler): record correct end of expression (#34690) 2020-03-20 10:19:02 -07:00
i18n perf(compiler): speed up i18n digest computations (#34332) 2019-12-12 14:06:37 -08:00
jit refactor(compiler): wrap the jit evaluation in an injectable class (#28055) 2019-02-12 20:58:27 -08:00
ml_parser fix(localize): allow ICU expansion case to start with any character except `}` (#36123) 2020-03-23 11:37:12 -07:00
output fix: work around 'noImplicityAny' incompatibility due to ts3.7 update (#34798) 2020-01-16 12:06:57 -05:00
render3 feat(compiler): add dependency info and ng-content selectors to metadata (#35695) 2020-03-24 14:21:42 -07:00
schema refactor(compiler): update docs (#29599) 2019-04-02 10:28:52 -07:00
template_parser feat(compiler): Propagate value span of ExpressionBinding to ParsedProperty (#36133) 2020-03-20 10:21:11 -07:00
view_compiler feat(compiler): type TemplateAst values as ASTWithSource (#35892) 2020-03-09 12:14:09 -04:00
assertions.ts refactor(compiler): rename INTERPOLATION_BLACKLIST_REGEXPS (#29593) 2019-04-02 10:36:26 -07:00
ast_path.ts style: typos fixed - https://github.com/vlajos/misspell-fixer (#22975) 2018-03-27 14:51:53 -04:00
chars.ts feat(compiler): support tokenizing escaped strings (#28055) 2019-02-12 20:58:27 -08:00
compile_metadata.ts feat(core): allow users to define timing of ViewChild/ContentChild queries (#28810) 2019-02-19 12:56:25 -08:00
compile_reflector.ts feat(ivy): @NgModule -> ngInjectorDef compilation (#22458) 2018-03-16 12:57:11 -07:00
compiler.ts fix(ivy): move setClassMetadata calls into a pure iife (#33337) 2019-11-20 12:55:58 -08:00
compiler_facade_interface.ts fix(ivy): throw a better error when DI can't inject a ctor param (#33739) 2019-12-09 11:37:10 -08:00
config.ts feat: add TypeScript 3 support (#25275) 2018-08-27 21:07:53 -04:00
constant_pool.ts fix(ivy): incorrectly generating shared pure function between null and object literal (#35481) 2020-02-20 15:23:58 -08:00
core.ts refactor(core): rename ngInjectableDef to ɵprov (#33151) 2019-10-16 16:36:19 -04:00
directive_normalizer.ts refactor(compiler): use `options` argument for parsers (#28055) 2019-02-12 20:58:27 -08:00
directive_resolver.ts feat(compiler): narrow types of expressions used in *ngIf (#20702) 2017-12-08 10:24:26 -08:00
identifiers.ts refactor(ivy): generate ngFactoryDef for injectables (#32433) 2019-10-02 13:04:26 -07:00
injectable_compiler.ts refactor(core): rename ngInjectableDef to ɵprov (#33151) 2019-10-16 16:36:19 -04:00
injectable_compiler_2.ts fix(ngcc): use the correct identifiers when updating typings files (#34254) 2019-12-18 11:25:01 -08:00
jit_compiler_facade.ts feat(compiler): add dependency info and ng-content selectors to metadata (#35695) 2020-03-24 14:21:42 -07:00
lifecycle_reflector.ts feat(ivy): implement TestBed (#25369) 2018-08-14 11:58:47 -07:00
metadata_resolver.ts refactor: utilize type narrowing (#33075) 2019-10-10 15:18:44 -07:00
ng_module_compiler.ts feat(compiler): lower @NgModule ids if needed (#23031) 2018-03-28 09:15:16 -07:00
ng_module_resolver.ts refactor(compiler): split compiler and core (#18683) 2017-08-16 17:58:53 -05:00
parse_util.ts feat(ivy): record absolute position of template expressions (#31391) 2019-07-22 09:48:35 -07:00
pipe_resolver.ts refactor(compiler): split compiler and core (#18683) 2017-08-16 17:58:53 -05:00
provider_analyzer.ts feat: change @Injectable() to support tree-shakeable tokens (#22005) 2018-02-12 14:34:59 -08:00
resource_loader.ts refactor(compiler): allow sync AOT compilation (#16832). 2017-05-23 10:41:23 -06:00
selector.ts fix(ivy): support for #id bootstrap selectors (#33784) 2019-11-15 10:42:52 -08:00
shadow_css.ts fix(compiler): Don't strip `/*# sourceURL ... */` (#16088) 2018-01-24 12:35:30 -08:00
style_compiler.ts feat(ivy): bridge component styles into the component renderer (#25255) 2018-08-23 16:51:15 -04:00
style_url_resolver.ts fix(compiler): Don't strip CSS source maps 2017-08-15 16:30:09 -07:00
summary_resolver.ts fix(compiler): allow to use flat modules and summaries 2017-09-28 14:20:20 -07:00
url_resolver.ts refactor(compiler): split compiler and core (#18683) 2017-08-16 17:58:53 -05:00
util.ts feat(core): add `isPromise` generic (#34168) 2020-03-20 10:15:01 -07:00
version.ts style: remove empty comments (#23404) 2018-05-10 15:48:13 -07:00