angular/packages/compiler/src
Alex Rickabaugh 235a235fab feat: change @Injectable() to support tree-shakeable tokens (#22005)
This commit bundles 3 important changes, with the goal of enabling tree-shaking
of services which are never injected. Ordinarily, this tree-shaking is prevented
by the existence of a hard dependency on the service by the module in which it
is declared.

Firstly, @Injectable() is modified to accept a 'scope' parameter, which points
to an @NgModule(). This reverses the dependency edge, permitting the module to
not depend on the service which it "provides".

Secondly, the runtime is modified to understand the new relationship created
above. When a module receives a request to inject a token, and cannot find that
token in its list of providers, it will then look at the token for a special
ngInjectableDef field which indicates which module the token is scoped to. If
that module happens to be in the injector, it will behave as if the token
itself was in the injector to begin with.

Thirdly, the compiler is modified to read the @Injectable() metadata and to
generate the special ngInjectableDef field as part of TS compilation, using the
PartialModules system.

Additionally, this commit adds several unit and integration tests of various
flavors to test this change.

PR Close #22005
2018-02-12 14:34:59 -08:00
..
aot feat: change @Injectable() to support tree-shakeable tokens (#22005) 2018-02-12 14:34:59 -08:00
compiler_util feat(compiler): implement "enableIvy" compiler option (#21427) 2018-01-18 18:22:44 -06:00
css_parser fix(compiler): Update types for TypeScript nullability support 2017-04-10 15:26:33 -06:00
expression_parser refactor(compiler): split compiler and core (#18683) 2017-08-16 17:58:53 -05:00
i18n fix(compiler): add support for marker tags in xliff serializers (#21250) 2018-01-17 17:02:09 -08:00
jit feat(compiler): implement "enableIvy" compiler option (#21427) 2018-01-18 18:22:44 -06:00
ml_parser fix(compiler): skip   when trimming / removing whitespaces (#19310) 2017-09-25 13:33:31 -07:00
output fix(ivy): add names to function expressions (#21714) 2018-01-23 13:33:48 -08:00
render3 fix(ivy): generate lifecycle pattern (#21865) 2018-02-02 07:50:31 -08:00
schema refactor(compiler): split compiler and core (#18683) 2017-08-16 17:58:53 -05:00
template_parser feat(compiler): mark @NgModules in provider lists for identification at runtime (#22005) 2018-02-12 14:34:59 -08:00
view_compiler feat: change @Injectable() to support tree-shakeable tokens (#22005) 2018-02-12 14:34:59 -08:00
assertions.ts refactor(compiler): split compiler and core (#18683) 2017-08-16 17:58:53 -05:00
ast_path.ts refactor(compiler-cli): move the expression expression type checker (#16562) 2017-05-09 16:16:50 -07:00
chars.ts refactor: move angular source to /packages rather than modules/@angular 2017-03-08 16:29:27 -08:00
compile_metadata.ts feat: change @Injectable() to support tree-shakeable tokens (#22005) 2018-02-12 14:34:59 -08:00
compile_reflector.ts feat: change @Injectable() to support tree-shakeable tokens (#22005) 2018-02-12 14:34:59 -08:00
compiler.ts feat(compiler-cli): reflect static methods added to classes in metadata (#21926) 2018-02-01 08:30:58 -08:00
config.ts fix(compiler): don't overwrite missingTranslation's value in JIT (#19952) 2017-11-03 11:08:39 -07:00
constant_pool.ts fix(ivy): fix issues found producing "Hello, World" example (#21790) 2018-01-27 10:50:13 -08:00
core.ts feat: change @Injectable() to support tree-shakeable tokens (#22005) 2018-02-12 14:34:59 -08:00
directive_normalizer.ts refactor(compiler): remove stale metadata classes for animations 2017-10-04 16:20:55 -07:00
directive_resolver.ts feat(compiler): narrow types of expressions used in *ngIf (#20702) 2017-12-08 10:24:26 -08:00
identifiers.ts feat: change @Injectable() to support tree-shakeable tokens (#22005) 2018-02-12 14:34:59 -08:00
injectable_compiler.ts feat: change @Injectable() to support tree-shakeable tokens (#22005) 2018-02-12 14:34:59 -08:00
lifecycle_reflector.ts refactor(compiler): don’t rely on global reflector (#16832) 2017-05-23 10:41:23 -06:00
metadata_resolver.ts feat: change @Injectable() to support tree-shakeable tokens (#22005) 2018-02-12 14:34:59 -08:00
ng_module_compiler.ts refactor(compiler): split compiler and core (#18683) 2017-08-16 17:58:53 -05:00
ng_module_resolver.ts refactor(compiler): split compiler and core (#18683) 2017-08-16 17:58:53 -05:00
parse_util.ts feat(compiler): implement "enableIvy" compiler option (#21427) 2018-01-18 18:22:44 -06: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 feat(compiler): implement "enableIvy" compiler option (#21427) 2018-01-18 18:22:44 -06:00
shadow_css.ts fix(compiler): Don't strip /*# sourceURL ... */ (#16088) 2018-01-24 12:35:30 -08:00
style_compiler.ts fix(compiler): various squashed fixes for the new ngc 2017-09-25 13:36:00 -07: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(compiler): implement "enableIvy" compiler option (#21427) 2018-01-18 18:22:44 -06:00
version.ts refactor(compiler): split compiler and core (#18683) 2017-08-16 17:58:53 -05:00