angular-cn/packages/compiler-cli/integrationtest
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
..
bazel/injectable_def feat: change @Injectable() to support tree-shakeable tokens (#22005) 2018-02-12 14:34:59 -08:00
benchmarks refactor: move angular source to /packages rather than modules/@angular 2017-03-08 16:29:27 -08:00
flat_module fix(compiler): look for flat module resources using declaration module path (#15367) 2017-03-21 19:05:03 -05:00
ngtools_src fix(compiler-cli): find lazy routes in nested module import arrays 2017-06-20 14:21:14 -07:00
src fix(compiler): work well with `forwardRef` with `useValue` / `useFactory` 2017-09-25 13:36:00 -07:00
test refactor(compiler): remove old ngtools api and add listLazyRoutes to new api (#19836) 2017-10-23 18:46:04 -04:00
third_party_src feat(compiler-cli): new compiler api and command-line using TypeScript transformers 2017-06-23 16:18:44 -07:00
tsconfig-build.json refactor(compiler): remove old ngtools api and add listLazyRoutes to new api (#19836) 2017-10-23 18:46:04 -04:00
tsconfig-ngc-build.json feat(compiler-cli): new compiler api and command-line using TypeScript transformers 2017-06-23 16:18:44 -07:00
tsconfig-xi18n.json refactor(compiler): remove old ngtools api and add listLazyRoutes to new api (#19836) 2017-10-23 18:46:04 -04:00
webpack.config.js fix(compiler): make sourcemaps work in AOT mode 2017-03-16 12:56:56 -07:00