build: create JS bundles for each component (#6998)

Before this change, all of `@angular/material` was bundled into a
single, flat JS file.

After this change, each top-level component (i.e., each directory under
`src/lib`) will be have its own JS file (and d.ts and metadata.json).

The benefit of this change is that current versions of webpack will be
able to do a much better job of only including the code an app is using.

It also allows (but does not require) people to explicitly import from specific components,
e.g.
```
import {MdButtonModule} from '@angular/material/button';
``

For development _within Angular Material itself_ we have to use these
deeper imports because the root `@angular/material` doesn't exist until
we build the relase package.

Additionally, this PR adds a `tsconfig.json` for each dir under `src/`
with the correct path mappings for that directory, so that IDEs will
correctly generate imports.

Closure Compiler CI check is also disabled by this PR; it cannot work
with the new package structure until a release with
https://github.com/google/closure-compiler/pull/2600 is made available.
This commit is contained in:
Jeremy Elbourn
2017-09-14 15:15:17 -07:00
committed by mmalerba
parent 2f1f0fd0b6
commit 1cb8907a66
213 changed files with 2786 additions and 1861 deletions
@@ -58,9 +58,9 @@ OPTS=(
"--debug"
# Include the Material and CDK FESM bundles
dist/releases/material/@angular/material.js
dist/releases/cdk/@angular/cdk.js
dist/releases/material-moment-adapter/@angular/material-moment-adapter.js
dist/releases/material/esm2015/material.js
dist/releases/cdk/esm2015/cdk.js
dist/releases/material-moment-adapter/esm2015/material-moment-adapter.js
# Include all Angular FESM bundles.
node_modules/@angular/core/@angular/core.js
@@ -90,7 +90,7 @@ OPTS=(
# Walk through every entry-point of the CDK and add it to closure options.
for i in "${cdkEntryPoints[@]}"; do
OPTS+=("--js_module_root=dist/releases/cdk/${i}")
OPTS+=("dist/releases/cdk/@angular/cdk/${i}.js")
OPTS+=("dist/releases/cdk/esm2015/${i}.js")
done
# Write closure flags to a closure flagfile.