2329 Commits

Author SHA1 Message Date
Pawel Kozlowski
6a64ac4151 fix(ivy): Renderer2 should not use a special injection fn (#26369)
PR Close #26369
2018-10-11 14:12:03 -07:00
Pawel Kozlowski
4b494f23f5 fix(ivy): fix generated code for style bindings with units (#26397)
PR Close #26397
2018-10-11 14:11:15 -07:00
Pete Bacon Darwin
1e69d601fb fix(ivy): ensure that ɵNgModuleDefWithMeta is exported (#26082)
This is needed to build an app with `ngtsc` once `ngcc` has compiled
`@angular/core`.

PR Close #26082
2018-10-11 14:08:39 -07:00
Pete Bacon Darwin
34b6d5fff9 refactor(ivy): ngcc - Transformer delegates to Analyzers and Renderer (#26082)
PR Close #26082
2018-10-11 14:08:39 -07:00
Pete Bacon Darwin
632f66a461 refactor(ivy): ngcc - Renderer now manages d.ts transformation (#26082)
PR Close #26082
2018-10-11 14:08:39 -07:00
Pete Bacon Darwin
f7b17a4784 refactor(ivy): ngcc - DecorationAnalyzer acts on whole program (#26082)
PR Close #26082
2018-10-11 14:08:39 -07:00
Pete Bacon Darwin
9562324ea4 refactor(ivy): implement ngcc SwitchMarkerAnalyzer (#26082)
PR Close #26082
2018-10-11 14:08:39 -07:00
Pete Bacon Darwin
880c0add56 refactor(ivy): move and rename Analyzer to DecorationAnalyzer (#26082)
This is in preparation for adding in other kinds of Analyzer.

PR Close #26082
2018-10-11 14:08:39 -07:00
Pete Bacon Darwin
64c96186da refactor(ivy): move ngcc rootDirs computation into a function (#26082)
PR Close #26082
2018-10-11 14:08:39 -07:00
Pete Bacon Darwin
26209fca49 refactor(ivy): remove ngcc Parser and use NgccReflectionHost instead (#26082)
PR Close #26082
2018-10-11 14:08:39 -07:00
Pete Bacon Darwin
7f03528dbc refactor(ivy): implement NgccReflectionHost.findDecoratedFiles (#26082)
PR Close #26082
2018-10-11 14:08:39 -07:00
Pete Bacon Darwin
d17602f31d refactor(ivy): rename and move ngcc Parsed... to Decorated... (#26082)
PR Close #26082
2018-10-11 14:08:39 -07:00
Pawel Kozlowski
053bf27fb3 refactor(ivy): use context discovery in TestBed implementation (#26211)
PR Close #26211
2018-10-11 13:01:28 -07:00
Andrew Kushnir
39f42bad1c feat(ivy): i18n compiler support for element attributes (#26280)
PR Close #26280
2018-10-11 13:00:19 -07:00
Pawel Kozlowski
3f8ac238f1 refactor(ivy): remove unused directives field from TView (#26364)
It was removed in #26316

PR Close #26364
2018-10-11 12:59:02 -07:00
Jason Aden
7466a99dda Revert "fix(upgrade): properly destroy upgraded component elements and descendants (#26209)"
This reverts commit 912f3d186f4ce5c4a97268775509cfb6285916c2. Revert is needed due to compilation failures due to this PR inside Google.
2018-10-10 14:44:52 -07:00
Jason Bedard
912f3d186f fix(upgrade): properly destroy upgraded component elements and descendants (#26209)
Fixes #26208

PR Close #26209
2018-10-10 14:19:00 -07:00
Andrew Kushnir
be4edf15ee fix(core): resolving merge conflicts in query.ts (#26324)
PR Close #26324
2018-10-09 17:34:08 -07:00
Andrew Kushnir
d5e9405d4f fix(ivy): local refs in View and Content Queries should be pulled out into consts in generated code (#26240)
PR Close #26240
2018-10-09 17:20:36 -07:00
Andrew Kushnir
e5644204dc fix(ivy): removing unnecessary assert in getOrCreateNodeInjector function (#26305)
PR Close #26305
2018-10-09 16:52:00 -07:00
Andrew Kushnir
69b9758ab8 fix(ivy): removing no longer needed QueryReadType (#26314) (#26314)
PR Close #26314

PR Close #26314
2018-10-09 16:50:34 -07:00
Kara Erickson
7ea5161d4d refactor(ivy): merge directives into LViewData (#26316)
PR Close #26316
2018-10-09 16:46:00 -07:00
Kara Erickson
b0879046b7 test(ivy): add testing utility to replace loadDirective (#26316)
PR Close #26316
2018-10-09 16:46:00 -07:00
Alex Rickabaugh
456f23f76a fix(ivy): reflect animations field directly into the output definition (#26322)
The 'animations' field of @Component metadata should be copied directly
into the ngComponentDef for that component and should not pass through
static resolution.

Previously the animations array was statically resolved and then the
values were translated back when generating ngComponentDef.

PR Close #26322
2018-10-09 16:45:31 -07:00
Jason Aden
9623e7c639 Revert "fix(upgrade): properly destroy upgraded component elements and descendants (#26209)"
This reverts commit 5a31bde6496c63d82d86227d7772c2127c28b08c.
2018-10-08 14:34:47 -07:00
Pete Bacon Darwin
83302d193e fix(ivy): ensure ngcc compiles @angular/core with correct internal imports (#26236)
PR Close #26236
2018-10-08 13:45:46 -07:00
Pete Bacon Darwin
807070fe83 refactor(ivy): ngcc - expose the package name from EntryPoint (#26236)
PR Close #26236
2018-10-08 13:45:46 -07:00
Pete Bacon Darwin
6a24db2bc6 fix(ivy): ngcc: only consider decorators from @angular/core (#26236)
PR Close #26236
2018-10-08 13:45:46 -07:00
Pete Bacon Darwin
50d1cba174 fix(ivy): ngcc: remove redundant __decorate() calls (#26236)
Previously we only removed assignments to `Class.decorators = [];`
if the array was not empty.

Now we also remove calls to `__decorate([])`, similarly.

PR Close #26236
2018-10-08 13:45:46 -07:00
Pete Bacon Darwin
44c05c05af fix(ivy): include "variable-declared" decorated classes in ngcc compilation (#26236)
Previously, classes that were declared via variable declarations,
rather than class declarations, were being excluded from the
parsed classes.

PR Close #26236
2018-10-08 13:45:46 -07:00
Pete Bacon Darwin
7d08722e80 fix(ivy): support tsutils.__decorate decorator declarations in ngcc (#26236)
The most recent Angular distributions have begun to use __decorate instead of Class.decorators.
This prevents `ngcc` from recognizing the classes and then fails to perform the transform to
ivy format.

Example:

```
var ApplicationModule = /** @class */ (function () {
    // Inject ApplicationRef to make it eager...
    function ApplicationModule(appRef) {
    }
    ApplicationModule = __decorate([
        NgModule({ providers: APPLICATION_MODULE_PROVIDERS }),
        __metadata("design:paramtypes", [ApplicationRef])
    ], ApplicationModule);
    return ApplicationModule;
}());
```

Now `ngcc` recognizes `__decorate([...])` declarations and performs its transform.

See FW-379

PR Close #26236
2018-10-08 13:45:46 -07:00
Pete Bacon Darwin
13cdd13511 fix(ivy): support late-initialized variables in ngcc/ngtsc (#26236)
In some formats variables are declared as `var` or `let` and only
assigned a value later in the code.

The ngtsc resolver still needs to be able to resolve this value,
so the host now provides a `host.getVariableValue(declaration)`
method that can do this resolution based on the format.

The hosts make some assumptions about the layout of the
code, so they may only work in the constrained scenarios that
ngcc expects.

PR Close #26236
2018-10-08 13:45:46 -07:00
Jason Bedard
5a31bde649 fix(upgrade): properly destroy upgraded component elements and descendants (#26209)
Fixes #26208

PR Close #26209
2018-10-08 12:06:13 -07:00
JiaLi.Passion
55d54c7e97 fix(platform-browser): fix #22155, destroy hammer manager when off (#22156)
PR Close #22156
2018-10-05 15:44:05 -07:00
Ash Kyd
c9cfcfa728 docs: clarify CurrencyPipe display property (#25852)
Clarify how to suppress the currency/code in the CurrencyPipe by passing an empty string.

PR Close #25852
2018-10-05 15:42:57 -07:00
Judy Bogart
f543d71cc3 docs: add package doc files (#26047)
PR Close #26047
2018-10-05 15:42:14 -07:00
George Kalpakas
bfeed842ee docs(service-worker): improve API docs for SwPush/SwUpdate (#23138)
PR Close #23138
2018-10-05 13:48:14 -07:00
George Kalpakas
77942cc690 refactor(service-worker): simplify/improve NgswCommChannel typings (#23138)
PR Close #23138
2018-10-05 13:48:14 -07:00
George Kalpakas
7aed64d3a1 docs(service-worker): add UpdateActivated/AvailableEvent to the public API (#23138)
PR Close #23138
2018-10-05 13:48:14 -07:00
JoostK
9953fe7c00 fix(ivy): reexport compileNgModuleFactory__POST_NGCC__ to prevent DCE in FESM (#26071)
While creating FESM files, rollup usually drops all unused symbols.
All *__POST_NGCC__ are unused unless ngcc rewires stuff. To prevent this DCE
we reexport them as private symbols. If ngcc is not used, these symbols will
be dropped when we optimize an application bundle.

PR Close #26071
2018-10-05 13:45:55 -07:00
Kara Erickson
8f25321787 refactor(ivy): update context discovery to prep for dir merge (#26262)
PR Close #26262
2018-10-05 13:39:30 -07:00
Kara Erickson
51dfdd5dd1 fix(ivy): sync view with blueprint when necessary (#26263)
PR Close #26263
2018-10-05 13:39:03 -07:00
Pawel Kozlowski
fdaf573073 feat(ivy): expose node injector as part of debug context (#26210)
PR Close #26210
2018-10-04 10:12:02 -07:00
Alex Rickabaugh
35bf95281f test(ivy): implement tests for template type-checking (#26203)
This commit builds on the NgtscTestEnvironment helper work before and
introduces template_typecheck_spec.ts, which contains compiler tests
for template type-checking.

PR Close #26203
2018-10-04 10:11:17 -07:00
Alex Rickabaugh
7a78889994 test(ivy): refactor ngtsc tests to use an NgtscTestEnvironment helper (#26203)
This commit gets ready for the introduction of ngtsc template
type-checking tests by refactoring test environment setup into a
custom helper. This helper will simplify the authoring of future
ngtsc tests.

Ngtsc tests previously returned a numeric error code (a la ngtsc's CLI
interface) if any TypeScript errors occurred. The helper has the
ability to run ngtsc and return the actual array of ts.Diagnostics, which
greatly increases the ability to write clean tests.

PR Close #26203
2018-10-04 10:11:17 -07:00
Alex Rickabaugh
19c4e705ff feat(ivy): turn on template type-checking via fullTemplateTypeCheck (#26203)
This commit enables generation and checking of a type checking ts.Program
whenever the fullTemplateTypeCheck flag is enabled in tsconfig.json. It
puts together all the pieces built previously and causes diagnostics to be
emitted whenever type errors are discovered in a template.

Todos:

* map errors back to template HTML
* expand set of type errors covered in generated type-check blocks

PR Close #26203
2018-10-04 10:11:17 -07:00
Alex Rickabaugh
36d6e6076e feat(ivy): support template type check narrowing for *ngFor and *ngIf (#26203)
This commit adds an ngTemplateGuard_ngIf static method to the NgIf
directive and an ngTemplateContextGuard static method to NgFor. The
function of these two static methods is to enable type narrowing
within generated type checking code for consumers of the directives.

PR Close #26203
2018-10-04 10:11:17 -07:00
Alex Rickabaugh
868047e87f feat(ivy): augment selector scopes to extract additional metadata (#26203)
Before type checking can be turned on in ngtsc, appropriate metadata for
each component and directive must be determined. This commit adds tracking
of the extra metadata in *DefWithMeta types to the selector scope handling,
allowing for later extraction for type-checking purposes.

PR Close #26203
2018-10-04 10:11:17 -07:00
Alex Rickabaugh
5f1273ba2e feat(ivy): introduce type-checking context API (#26203)
This commit introduces the template type-checking context API, which manages
inlining of type constructors and type-check blocks into ts.SourceFiles.
This API will be used by ngtsc to generate a type-checking ts.Program.

An TypeCheckProgramHost is provided which can wrap a normal ts.CompilerHost
and intercept getSourceFile() calls. This can be used to provide source
files with type check blocks to a ts.Program for type-checking.

PR Close #26203
2018-10-04 10:11:17 -07:00
Alex Rickabaugh
355a7cae3c feat(ivy): introduce the type check block compiler (#26203)
This commit introduces the main functionality of the type-check compiler:
generation of type check blocks. Type check blocks are blocks of TypeScript
code which can be inlined into source files, and when processed by the
TypeChecker will give information about any typing errors in template
expressions.

PR Close #26203
2018-10-04 10:11:17 -07:00