Commit Graph

2676 Commits

Author SHA1 Message Date
Greg Magolan 8d5e3e6981 build: update to rules_typescript 0.20.3 and rules_nodejs 0.15.1 (#26488)
PR Close #26488
2018-10-19 20:59:29 -07:00
Greg Magolan 30f1dc002a build: add npm deps after rebase (#26488)
PR Close #26488
2018-10-19 20:59:29 -07:00
Greg Magolan 631998b2df build: idiomatic install of @angular/bazel npm package (#26258) (#26488)
PR Close #26488
2018-10-19 20:59:29 -07:00
Alex Eagle 30d6233e83 build: update ngcontainer to bazel 0.18.0 (#26465) (#26488)
* build: update ngcontainer to bazel 0.18.0

* build: update skylint to bazel 0.18

use .bazelignore file to ignore node_modules directory

PR Close #26488
2018-10-19 20:59:29 -07:00
Greg Magolan 6468711e16 build(bazel): update to rules_typescript 0.20.2 (#26279) (#26488)
PR Close #26488
2018-10-19 20:59:29 -07:00
Greg Magolan d698b0eadf build: update to rules_typescript 0.20.1 and rules_nodejs 0.15.0 (#26260) (#26488)
PR Close #26488
2018-10-19 20:59:29 -07:00
Greg Magolan 1f3331f5e6 build(bazel): use fine-grained npm deps (#26111) (#26488)
PR Close #26488
2018-10-19 20:59:29 -07:00
Alex Eagle b6c9678f21 build: introduce a package.bzl (#26488)
This lets Angular Bazel users install our transitive deps, rather than have to list them in their WORKSPACE file.
If they want a different version of one of these deps, they just need to install it before calling rules_angular_dependencies.

PR Close #26488
2018-10-19 20:59:29 -07:00
Pete Bacon Darwin 853faf4c71 docs: update upgrade to use `@publicApi` tags (#26595)
PR Close #26595
2018-10-19 14:35:53 -07:00
Pete Bacon Darwin 13143b850e docs: update router to use `@publicApi` tags (#26595)
PR Close #26595
2018-10-19 14:35:53 -07:00
Pete Bacon Darwin 7570f7222f docs: update platform-server to use `@publicApi` tags (#26595)
PR Close #26595
2018-10-19 14:35:53 -07:00
Pete Bacon Darwin f1e3d5125d docs: update platform-browser-dynamic to use `@publicApi` tags (#26595)
PR Close #26595
2018-10-19 14:35:53 -07:00
Pete Bacon Darwin 3511f08a81 docs: update http with `@publicApi` tags (#26595)
PR Close #26595
2018-10-19 14:35:53 -07:00
Pete Bacon Darwin 982bc7f2aa docs: update forms with `@publicApi` tags (#26595)
PR Close #26595
2018-10-19 14:35:53 -07:00
Pete Bacon Darwin 3903e5ebe7 docs: update core to use `@publicApi` tags (#26595)
PR Close #26595
2018-10-19 14:35:53 -07:00
Pete Bacon Darwin 0918adf39d docs: common with `@publicApi` tags (#26595)
PR Close #26595
2018-10-19 14:35:53 -07:00
Pete Bacon Darwin 42c331bbf2 docs: update animations with `@publicApi` tags (#26595)
PR Close #26595
2018-10-19 14:35:53 -07:00
Pete Bacon Darwin 0bae97a726 docs: update platform-browser with `@publicApi` tags (#26595)
PR Close #26595
2018-10-19 14:35:52 -07:00
Pete Bacon Darwin 24521f549c docs: convert all `@experimental` tags to `@publicApi` tags (#26595)
PR Close #26595
2018-10-19 14:35:52 -07:00
Alex Rickabaugh 31022cbecf feat(ivy): generate .ngsummary.js shims (#26495)
This commit adds generation of .ngsummary.js shims alongside .ngfactory.js
shims when generated files are enabled.

Generated .ngsummary shims contain a single, null export for every exported
class with decorators that exists in the original source files. Ivy code
does not depend on summaries, so these exist only as a placeholder to allow
them to be imported and their values passed to old APIs. This preserves
backwards compatibility.

Testing strategy: this commit adds a compiler test to verify the correct
shape and contents of the generated .ngsummary.js files.

PR Close #26495
2018-10-19 13:30:02 -07:00
Alex Rickabaugh ce8053103e refactor(ivy): make shim generation generic in ngtsc (#26495)
This commit refactors the shim host to be agnostic to the shims being
generated, and provides an API for generating additional shims besides
the .ngfactory.js. This will be used in a following commit to generate
.ngsummary.js shims.

Testing strategy: this refactor introduces no new behavior, so it's
sufficient that the existing tests for factory shim generation continue
to pass.

PR Close #26495
2018-10-19 13:30:01 -07:00
Alex Rickabaugh 0b885ecaf7 refactor(ivy): rename ngtsc/factories to ngtsc/shims (#26495)
This simple refactor of the build rules renames the .ngfactory.js shim
generator to 'shims' instead of 'factories', in preparation for adding
.ngsummary.js shim generation.

Testing strategy: this commit does not introduce any new behavior and
merely moves files and symbols around. It's sufficient that the existing
ngtsc tests pass.

PR Close #26495
2018-10-19 13:30:01 -07:00
Alex Eagle 5b4cf38166 refactor(bazel): remove workaround for TS bug (#26516)
PR Close #26516
2018-10-19 11:14:24 -07:00
Olivier Combe 03bf0d6b41 docs(ivy): update status for i18n (#26502)
PR Close #26502
2018-10-19 11:06:25 -07:00
Alex Rickabaugh d4cee514f6 refactor(ivy): obviate the Bazel component of the ivy_switch (#26550)
Originally, the ivy_switch mechanism used Bazel genrules to conditionally
compile one TS file or another depending on whether ngc or ngtsc was the
selected compiler. This was done because we wanted to avoid importing
certain modules (and thus pulling them into the build) if Ivy was on or
off. This mechanism had a major drawback: ivy_switch became a bottleneck
in the import graph, as it both imports from many places in the codebase
and is imported by many modules in the codebase. This frequently resulted
in cyclic imports which caused issues both with TS and Closure compilation.

It turns out ngcc needs both code paths in the bundle to perform the switch
during its operation anyway, so import switching was later abandoned. This
means that there's no real reason why the ivy_switch mechanism needed to
operate at the Bazel level, and for the ivy_switch file to be a bottleneck.

This commit removes the Bazel-level ivy_switch mechanism, and introduces
an additional TypeScript transform in ngtsc (and the pass-through tsc
compiler used for testing JIT) to perform the same operation that ngcc
does, and flip the switch during ngtsc compilation. This allows the
ivy_switch file to be removed, and the individual switches to be located
directly next to their consumers in the codebase, greatly mitigating the
circular import issues and making the mechanism much easier to use.

As part of this commit, the tag for marking switched variables was changed
from __PRE_NGCC__ to __PRE_R3__, since it's no longer just ngcc which
flips these tags. Most variables were renamed from R3_* to SWITCH_* as well,
since they're referenced mostly in render2 code.

Test strategy: existing test coverage is more than sufficient - if this
didn't work correctly it would break the hello world and todo apps.

PR Close #26550
2018-10-19 09:23:05 -07:00
Pawel Kozlowski f8195e5e3d fix(ivy): stub TestBed.compileComponents implementation (#26506)
PR Close #26506
2018-10-17 13:08:14 -07:00
Andrew Kushnir 8a3fd58cad feat(ivy): i18n compiler support for i18nStart and i18nEnd instructions (#26442)
PR Close #26442
2018-10-17 11:03:52 -07:00
Andrew Kushnir 8024857d4c feat(ivy): i18n compiler support for element attributes (#26442)
PR Close #26442
2018-10-17 11:03:52 -07:00
Matias Niemelä fa8e633be5 feat(ivy): enhance [style] and [class] bindings to be animation aware (#26096)
PR Close #26096
2018-10-16 20:39:19 -07:00
Matias Niemelä be337a2e52 refactor(ivy): move styling files around (#26096)
PR Close #26096
2018-10-16 20:39:18 -07:00
Miško Hevery 4d164b6ca4 fix(ivy): make defineComponent tree shakable by Closure Compiler (#26425)
PR Close #26425
2018-10-16 20:37:35 -07:00
Igor Minar 371ffef4ce test(ivy): enable unit tests for @angular/animations (#26470)
PR Close #26470
2018-10-16 20:31:56 -07:00
Jason Aden fdfedceeec feat(router): add prioritizedGuardValue operator optimization and allowing UrlTree return from guard (#26478)
* If all guards return `true`, operator returns `true`
* `false` and `UrlTree` are now both valid returns from a guard
* Both these values wait for higher priority guards to resolve
* Highest priority `false` or `UrlTree` value will be returned

PR Close #26478
2018-10-16 20:31:32 -07:00
Matias Niemelä 9e5d440a0b refactor(ivy): handle animation metadata normalization in the compiler (#26481)
PR Close #26481
2018-10-16 20:31:04 -07:00
George Kalpakas 2326b9c294 fix(service-worker): clean up caches from old SW versions (#26319)
Since the SW immediately takes over all clients, it is safe to delete
caches used by older (e.g. beta) `@angular/service-worker` versions to
avoid running into browser storage quota limitations.

PR Close #26319
2018-10-16 14:12:07 -07:00
Miško Hevery 7d82053117 docs(ivy): i18n design (#26091)
PR Close #26091
2018-10-16 14:08:01 -07:00
Jason Aden 1c9b06504b fix(router): fix regression where navigateByUrl promise didn't resolve on CanLoad failure (#26455)
Fixes #26284

PR Close #26455
2018-10-15 16:53:25 -07:00
Kara Erickson e76a570908 refactor(ivy): remove LNode (#26426)
PR Close #26426
2018-10-15 11:20:32 -07:00
Kara Erickson 931e603f80 refactor(ivy): revert LNode.data into LViewData[HOST] (#26424)
PR Close #26424
2018-10-15 10:17:12 -07:00
Pawel Kozlowski 45732e5b91 fix(ivy): fix reference to pipeBind instruction with 2 args (#26451)
PR Close #26451
2018-10-15 10:14:25 -07:00
George Kalpakas 9e32dc7c95 build: upgrade `@types/jasminewd2` to 2.0.4 (#26139)
This commit also removes the extra jasminewd2 typings, since the changes
have been merged in the official typings with
DefinitelyTyped/DefinitelyTyped#28957.

PR Close #26139
2018-10-12 14:11:11 -07:00
Manduro ff15043e48 fix(core): allow null value for renderer setElement(…) (#17065)
Using Renderer’s setElementAttribute or setElementStyle with a null or undefined value removes the
corresponding attribute or style. The argument type should allow this when using strictNullChecks.

Closes #13686

PR Close #17065
2018-10-12 09:17:59 -07:00
Miško Hevery 9ebb4c02a2 docs(ivy): update status.md (#26382)
PR Close #26382
2018-10-12 09:01:41 -07:00
Jason Bedard 071934e92a fix(upgrade): properly destroy upgraded component elements and descendants (#26209)
Fixes #26208

PR Close #26209
2018-10-11 21:07:48 -07:00
Kara Erickson 735dfd3b1a refactor(ivy): replace LNode.dynamicLContainerNode with flat LContainers (#26407)
PR Close #26407
2018-10-11 21:07:21 -07:00
Kara Erickson 70cd112872 refactor(ivy): remove TNode.dynamicContainerNode (#26407)
PR Close #26407
2018-10-11 21:07:21 -07:00
krzysztof-grzybek 0a3f8173f0 refactor(platform-browser): remove type assertion on console.profileEnd (#26303)
Since typescript v3.1 type definition for console.profileEnd is fixed and type assertion 'any' is
not needed any more

PR Close #26303
2018-10-11 14:12:23 -07:00
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 `Analyzer`s 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 912f3d186f. 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 5a31bde649.
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
Alex Rickabaugh 4c615f7de7 refactor(ivy): move the expr/stmt translator to a separate target (#26203)
Template type-checking will make use of expression and statement
translation as well as the ImportManager, so this code needs to
live in a separate build target which can be depended on by both
the main ngtsc transform as well as the template type-checking
mechanism. This refactor introduces a separate build target
for that code.

PR Close #26203
2018-10-04 10:11:17 -07:00
Alex Rickabaugh 79466baef8 fix(ivy): remove metadata from *Def and introduce *DefWithMeta types (#26203)
Previously in Ivy, metadata for directives/components/modules/etc was
carried in .d.ts files inside type information encoded on the
DirectiveDef, ComponentDef, NgModuleDef, etc types of Ivy definition
fields. This works well, but has the side effect of complicating Ivy's
runtime code as these extra generic type parameters had to be specified
as <any> throughout the codebase. *DefInternal types were introduced
previously to mitigate this issue, but that's the wrong way to solve
the problem.

This commit returns *Def types to their original form, with no metadata
attached. Instead, new *DefWithMeta types are introduced that alias the
plain definition types and add extra generic parameters. This way the
only code that needs to deal with the extra metadata parameters is the
compiler code that reads and writes them - the existence of this metadata
is transparent to the runtime, as it should be.

PR Close #26203
2018-10-04 10:11:17 -07:00
Alex Rickabaugh b0070dfb9a feat(ivy): introduce typecheck package and a type constructor generator (#26203)
This commit introduces //packages/compiler-cli/src/ngtsc/typecheck as a
container for template type-checking code, and implements an initial API:
type constructor generation.

Type constructors are static methods on component/directive types with
no runtime implementation. The methods are used during compilation to
enable inference of a component or directive's generic type parameters
from the types of expressions bound to any of their @Inputs. A type
constructor looks like:

class Directive<T> {
  someInput: T;
  static ngTypeCtor<T>(init: Partial<Pick<Directive<T>, 'someInput'>>): Directive<T>;
}

It can be used to infer a type for T based on the input:

const _dir = Directive.ngTypeCtor({someInput: 'string'}); // Directive<T>

PR Close #26203
2018-10-04 10:11:17 -07:00
Alex Rickabaugh 9ed4e3df60 feat(ivy): introduce a new compiler API for operating on templates (#26203)
This commit introduces the "t2" API, which processes parsed template ASTs
and performs a number of functions such as binding (the process of
semantically interpreting cross-references within the template) and
directive matching. The API is modeled on TypeScript's TypeChecker API,
with oracle methods that give access to collected metadata.

This work is a prerequisite for the upcoming template type-checking
functionality, and will also become the basis for a refactored
TemplateDefinitionBuilder.

PR Close #26203
2018-10-04 10:11:17 -07:00
Alex Rickabaugh a2da485d90 feat(ivy): add generics to the SelectorMatcher API (#26203)
This commit adds a generic type parameter to the SelectorMatcher
class and its associated response types. This makes the API for
matching selectors and obtaining information about the matched
directives significantly more ergonomic and type-safe.

PR Close #26203
2018-10-04 10:11:17 -07:00
Alex Rickabaugh 9cb17ecc39 refactor(ivy): extract directive matching code into a utility function (#26203)
Upcoming implementation work for template type-checking will need to reuse the
code which matches directives inside a template, so this refactor commit moves
the code to a shared location in preparation.

This commit pulls the code needed to match directives against a template node
out of the TemplateDefinitionBuilder into a utility function, in preparation
for template type-checking and other TemplateDefinitionBuilder refactoring.

PR Close #26203
2018-10-04 10:11:16 -07:00
Jason Aden 532e53678d refactor(router): get guards only one time and simplify guard operator signature (#26239)
PR Close #26239
2018-10-04 10:10:28 -07:00
Jason Aden f859d83298 refactor(router): move pre activation helpers into utils (#26239)
PR Close #26239
2018-10-04 10:10:28 -07:00
Jason Aden ac68c75e26 refactor(router): convert PreActivation's resolve data to pure functions & remove PreActivation class (#26239)
PR Close #26239
2018-10-04 10:10:28 -07:00
Jason Aden fe45b9cebd refactor(router): convert PreActivation's check guards to pure functions (#26239)
PR Close #26239
2018-10-04 10:10:28 -07:00
Andrew Kushnir aaaa34021c fix(ivy): sanitize tag name while generating listener function name (#26237)
PR Close #26237
2018-10-03 15:29:49 -07:00
Kara Erickson 730679964f refactor(ivy): flatten LInjector into LViewData (#26220)
PR Close #26220
2018-10-03 15:27:57 -07:00
Andrew Kushnir cb59d87489 feat(ivy): compiler support to generate QUERY_READ_FROM_NODE calls (#26171)
PR Close #26171
2018-10-03 12:28:23 -07:00
Matias Niemelä ab379ab72a refactor(ivy): always use styling helper methods when comparing values (#26149)
PR Close #26149
2018-10-01 09:35:22 -07:00
Matias Niemelä 32e479ffec refactor(ivy): reorganize styling and player files (#26149)
PR Close #26149
2018-10-01 09:35:22 -07:00
Matias Niemelä 391c708d7e fix(ivy): ensure [style]/[class] bindings identity check the previous value (#26149)
PR Close #26149
2018-10-01 09:35:22 -07:00
Matias Niemelä c51331689f refactor(ivy): rename stylingProp => styleProp (#26149)
PR Close #26149
2018-10-01 09:35:22 -07:00
Kara Erickson 68fadd9b97 refactor(ivy): replace LNode.nodeInjector with TNode.injectorIndex (#26177)
PR Close #26177
2018-10-01 09:34:52 -07:00
Igor Minar 9993c72335 feat: add support for TypeScript 3.1 (#26151)
PR Close #26151
2018-09-28 09:34:51 -07:00
Matias Niemelä 7cf5807100 fix(ivy): ensure [style] and [class] bindings are placed in the same instruction (#26126)
PR Close #26126
2018-09-27 15:32:40 -07:00
Jason Aden 9523991a9b refactor(router): cleanup to navigation stream for readability and documentation (#25740)
* Pull out `activateRoutes` into new operator
* Add `asyncTap` operator
* Use `asyncTap` operator for router hooks and remove corresponding abstracted operators
* Clean up formatting
* Minor performance improvements

PR Close #25740
2018-09-27 14:02:58 -07:00
Jason Aden 9acd04c192 refactor(router): update test based on router quick-cancelling ongoing navigations (#25740)
PR Close #25740
2018-09-27 14:02:58 -07:00
Jason Aden c091d40fb0 refactor(router): make sure redirect within NavigationStart event works (#25740)
PR Close #25740
2018-09-27 14:02:58 -07:00
Jason Aden b7baf632c0 refactor(router): move routing into a single Observable stream (#25740)
This is a major refactor of how the router previously worked. There are a couple major advantages of this refactor, and future work will be built on top of it.

First, we will no longer have multiple navigations running at the same time. Previously, a new navigation wouldn't cause the old navigation to be cancelled and cleaned up. Instead, multiple navigations could be going at once, and we imperatively checked that we were operating on the most current `router.navigationId` as we progressed through the Observable streams. This had some major faults, the biggest of which was async races where an ongoing async action could result in a redirect once the async action completed, but there was no way to guarantee there weren't also other redirects that would be queued up by other async actions. After this refactor, there's a single Observable stream that will get cleaned up each time a new navigation is requested.

Additionally, the individual pieces of routing have been pulled out into their own operators. While this was needed in order to create one continuous stream, it also will allow future improvements to the testing APIs as things such as Guards or Resolvers should now be able to be tested in much more isolation.

* Add the new `router.transitions` observable of the new `NavigationTransition` type to contain the transition information
* Update `router.navigations` to pipe off of `router.transitions`
* Re-write navigation Observable flow to a single configured stream
* Refactor `switchMap` instead of the previous `mergeMap` to ensure new navigations cause a cancellation and cleanup of already running navigations
* Wire in existing error and cancellation logic so cancellation matches previous behavior

PR Close #25740
2018-09-27 14:02:57 -07:00
Jason Aden 4c0d4fc649 refactor(router): create pipeable afterPreactivation function (#25740)
PR Close #25740
2018-09-27 14:02:57 -07:00
Jason Aden 5b3c08b237 refactor(router): create pipeable resolveData function (#25740)
PR Close #25740
2018-09-27 14:02:57 -07:00
Jason Aden 68f2e0c391 refactor(router): create pipeable checkGuards function (#25740)
PR Close #25740
2018-09-27 14:02:57 -07:00
Jason Aden 9c1c945489 refactor(router): create pipeable setupPreactivation function (#25740)
PR Close #25740
2018-09-27 14:02:57 -07:00
Jason Aden ef5338663d refactor(router): create pipeable beforePreactivation function (#25740)
PR Close #25740
2018-09-27 14:02:57 -07:00
Jason Aden 380b3d7653 refactor(router): create pipeable applyRedirects function (#25740)
PR Close #25740
2018-09-27 14:02:57 -07:00
Jason Aden 4decc8521d refactor(router): create pipeable recognize function (#25740)
PR Close #25740
2018-09-27 14:02:57 -07:00
Alan Agius a08af77b70 refactor: fix return type of `tryCall` (#25481)
PR Close #25481
2018-09-27 12:07:38 -07:00
Matias Niemelä 63b795ae4a refactor(ivy): make sure that test bed symbols are imported from ivy_switch (#26121)
PR Close #26121
2018-09-27 12:06:34 -07:00
Pawel Kozlowski 5f6900ecc0 feat(ivy): add ability to inspect local refs through context discovery (#26117)
PR Close #26117
2018-09-27 12:00:53 -07:00
Misko Hevery 325e8010e9 fixup! feat(ivy): adding support for ngNonBindable attribute 2018-09-27 11:52:07 -07:00
Misko Hevery 632b19d5c2 fixup! feat(ivy): adding support for ngNonBindable attribute 2018-09-27 11:52:07 -07:00
Andrew Kushnir add1198b88 fixup! feat(ivy): adding support for ngNonBindable attribute 2018-09-27 11:52:07 -07:00
Andrew Kushnir 0ed2df2a36 fixup! feat(ivy): adding support for ngNonBindable attribute 2018-09-27 11:52:07 -07:00
Andrew Kushnir bc1f2d6411 fixup! feat(ivy): adding support for ngNonBindable attribute 2018-09-27 11:52:07 -07:00
Andrew Kushnir d7326d81ba fixup! feat(ivy): adding support for ngNonBindable attribute 2018-09-27 11:52:07 -07:00
Andrew Kushnir c683f74225 feat(ivy): fixed typo in test case description 2018-09-27 11:52:07 -07:00
Andrew Kushnir b286abeabe feat(ivy): adding support for ngNonBindable attribute 2018-09-27 11:52:07 -07:00
Ben Lesh ffc6e199bf build: RxJS updated to 6.3 (#26087)
PR Close #26087
2018-09-26 17:01:15 -07:00
Kara Erickson 15a2b8f622 fix(ivy): wrapper fns arent necessary anymore (#26108)
PR Close #26108
2018-09-26 00:03:16 -07:00
Brandon Roberts ebd01e8e79 docs: more form overview edits (#25663)
PR Close #25663
2018-09-25 18:48:15 -07:00
Brandon Roberts 04dfca41f4 docs(forms): add package overview for forms (#25663)
PR Close #25663
2018-09-25 18:48:15 -07:00
Kara Erickson 6a62ed2245 fix(ivy): objects like ElementRef should not use a special injection fn (#26064)
PR Close #26064
2018-09-25 12:51:29 -07:00
Matias Niemelä 0c344715e5 feat(ivy): expose a series of helpful application inspection tools (#25919)
PR Close #25919
2018-09-25 09:46:12 -07:00
Pete Bacon Darwin 23ec88ef23 refactor(ivy): remove unreferenced utils file (#26076)
PR Close #26076
2018-09-24 11:39:52 -07:00
George Kalpakas 2bd767c4a6 fix(service-worker): do not blow up when caches are unwritable (#26042)
In some cases, example when the user clears the caches in DevTools but
the SW remains active on another tab and keeps references to the deleted
caches, trying to write to the cache throws errors (e.g.
`Entry was not found`).

When this happens, the SW can no longer work correctly and should enter
a degraded mode allowing requests to be served from the network.

Possibly related:
- https://github.com/GoogleChrome/workbox/issues/792
- https://bugs.chromium.org/p/chromium/issues/detail?id=639034

This commits remedies this situation, by ensuring the SW can enter the
degraded `EXISTING_CLIENTS_ONLY` mode and forward requests to the
network.

PR Close #26042
2018-09-24 09:53:39 -07:00
Frederik Schlemmer 1e02cd9961 docs: Fixes typo in FormArray (#26031)
PR Close #26031
2018-09-24 09:14:07 -07:00
Pete Bacon Darwin 206ae7a233 docs(core): remove usage notes from ReflexiveInjector.parent property (#26039)
Properties are not allowed usage notes, and in this case the example
is so simple it didn't warrant moving it to the overall class documentation.

PR Close #26039
2018-09-24 09:11:02 -07:00
Pete Bacon Darwin 79b6256789 docs(core): move headings to `@usageNotes` (#26039)
PR Close #26039
2018-09-24 09:11:02 -07:00
Pete Bacon Darwin 72dce34f42 docs(common): move `KeyValuePipe` example to `@usageNotes` (#26039)
PR Close #26039
2018-09-24 09:11:02 -07:00
Pete Bacon Darwin 7d39bc68fb docs(forms): move extended text to @usageNotes (#26039)
Headings are not allowed in the basic description block.

PR Close #26039
2018-09-24 09:11:02 -07:00
Pete Bacon Darwin 32ad2438ca docs(http): move examples to `@usageNotes` (#26039)
PR Close #26039
2018-09-24 09:11:02 -07:00
Pete Bacon Darwin fc4b993d98 docs(platform-browser): move examples to `@usageNotes` (#26039)
PR Close #26039
2018-09-24 09:11:02 -07:00
Pete Bacon Darwin ff028f0b39 docs(router): move examples to `@usageNotes` (#26039)
PR Close #26039
2018-09-24 09:11:02 -07:00
Pete Bacon Darwin fef9cebed0 docs(upgrade): move examples etc into `@usageNotes` (#26039)
PR Close #26039
2018-09-24 09:11:02 -07:00
Pete Bacon Darwin c08549ae38 docs(common): move `KeyValuePipe` example to `@usageNotes` (#26039)
PR Close #26039
2018-09-24 09:11:02 -07:00
Pete Bacon Darwin cf8ad24dcf docs(common): remove legacy `@whatItDoes` tag (#26039)
PR Close #26039
2018-09-24 09:11:02 -07:00
Matias Niemelä 82a14dc107 feat(ivy): provide groundwork for animations in core (#25234)
PR Close #25234
2018-09-21 14:51:24 -07:00
Kara Erickson e7ade38731 Revert "refactor(router): cleanup to navigation stream for readability" and associated changes (#26060)
PR Close #26060
2018-09-21 10:15:43 -07:00
Kara Erickson d5f47d6b71 refactor(ivy): special injection tokens should not be cached (#26048)
PR Close #26048
2018-09-20 18:02:08 -07:00
Jason Aden 64aa6701f6 refactor(router): cleanup to navigation stream for readability and documentation (#25740)
* Pull out `activateRoutes` into new operator
* Add `asyncTap` operator
* Use `asyncTap` operator for router hooks and remove corresponding abstracted operators
* Clean up formatting
* Minor performance improvements

PR Close #25740
2018-09-20 17:42:58 -07:00
Jason Aden 12ccf57340 refactor(router): update test based on router quick-cancelling ongoing navigations (#25740)
PR Close #25740
2018-09-20 17:42:58 -07:00
Jason Aden c634176035 refactor(router): make sure redirect within NavigationStart event works (#25740)
PR Close #25740
2018-09-20 17:42:58 -07:00
Jason Aden 4bb10d224c refactor(router): move routing into a single Observable stream (#25740)
This is a major refactor of how the router previously worked. There are a couple major advantages of this refactor, and future work will be built on top of it.

First, we will no longer have multiple navigations running at the same time. Previously, a new navigation wouldn't cause the old navigation to be cancelled and cleaned up. Instead, multiple navigations could be going at once, and we imperatively checked that we were operating on the most current `router.navigationId` as we progressed through the Observable streams. This had some major faults, the biggest of which was async races where an ongoing async action could result in a redirect once the async action completed, but there was no way to guarantee there weren't also other redirects that would be queued up by other async actions. After this refactor, there's a single Observable stream that will get cleaned up each time a new navigation is requested.

Additionally, the individual pieces of routing have been pulled out into their own operators. While this was needed in order to create one continuous stream, it also will allow future improvements to the testing APIs as things such as Guards or Resolvers should now be able to be tested in much more isolation.

* Add the new `router.transitions` observable of the new `NavigationTransition` type to contain the transition information
* Update `router.navigations` to pipe off of `router.transitions`
* Re-write navigation Observable flow to a single configured stream
* Refactor `switchMap` instead of the previous `mergeMap` to ensure new navigations cause a cancellation and cleanup of already running navigations
* Wire in existing error and cancellation logic so cancellation matches previous behavior

PR Close #25740
2018-09-20 17:42:58 -07:00
Jason Aden 5d689469f6 refactor(router): create pipeable afterPreactivation function (#25740)
PR Close #25740
2018-09-20 17:42:58 -07:00
Jason Aden 855ad8804e refactor(router): create pipeable resolveData function (#25740)
PR Close #25740
2018-09-20 17:42:58 -07:00
Jason Aden 29d3f3f6dd refactor(router): create pipeable checkGuards function (#25740)
PR Close #25740
2018-09-20 17:42:58 -07:00
Jason Aden 33101359c6 refactor(router): create pipeable setupPreactivation function (#25740)
PR Close #25740
2018-09-20 17:42:58 -07:00
Jason Aden 44eef5c343 refactor(router): create pipeable beforePreactivation function (#25740)
PR Close #25740
2018-09-20 17:42:58 -07:00
Jason Aden 68b7847b4c refactor(router): create pipeable applyRedirects function (#25740)
PR Close #25740
2018-09-20 17:42:58 -07:00
Jason Aden 2b2e841e5b refactor(router): create pipeable recognize function (#25740)
PR Close #25740
2018-09-20 17:42:58 -07:00
Alan Agius 549de1e21a fix(core): add missing `peerDependency ` to `@angular/compiler` (#26033)
In 919f42fea1 (diff-58563046c4439699f2e6a89187099a54) a dependency to the compiler was added. However the peerDependency was not added.
PR Close #26033
2018-09-20 10:53:25 -07:00
Pete Bacon Darwin 927323f24e docs: add missing `@ngModule` tags (#25734)
PR Close #25734
2018-09-19 16:18:24 -07:00
Alan Agius d7e5bbf2d0 feat(compiler-cli): add support to extend `angularCompilerOptions` (#22717)
`TypeScript` only supports merging and extending of `compilerOptions`. This is an implementation to support extending and inheriting of `angularCompilerOptions` from multiple files.

Closes: #22684

PR Close #22717
2018-09-19 16:17:28 -07:00
Brandon Roberts a9a81f91cf docs(forms): update form apis based on review feedback (#25724)
PR Close #25724
2018-09-19 16:09:00 -07:00
Brandon Roberts 07c10e2844 docs(forms): update API reference for forms interfaces and abstract classes (#25724)
PR Close #25724
2018-09-19 16:09:00 -07:00
Adam Plumer 3fb0da2de5 feat(platform-server): update domino to v2.1.0 (#25564)
PR Close #25564
2018-09-19 16:07:36 -07:00
Judy Bogart d0e710d472 docs: copy edit (#25582)
PR Close #25582
2018-09-19 10:43:06 -07:00
Judy Bogart bc7f962039 docs: clean up formats, add detail (#25582)
PR Close #25582
2018-09-19 10:43:06 -07:00
Judy Bogart 78d42a9503 docs: update view-related api doc (#25582)
PR Close #25582
2018-09-19 10:43:06 -07:00
Judy Bogart dd5e35ee67 docs: add ngmodule api doc (#25618)
PR Close #25618
2018-09-19 10:40:58 -07:00
Alex Eagle cbbad1b791 refactor(ivy): pre-factor: set explicit type parameters for ModuleWithProviders (#25970)
Ivy depends on having the generic type token later when reading the ModuleWithProviders from a .d.ts file.

PR Close #25970
2018-09-18 13:28:44 -07:00
George Wilde ddd3bf83c7 docs(forms): change documentation of the FormGroup patchValue method (#25901)
Improve the grammar of the description to make it more readable.
PR Close #25901
2018-09-18 13:08:05 -07:00
Pete Bacon Darwin 9b1bb370a3 fix(ivy): ngcc should compile entry-points in the correct order (#25862)
The compiler should process all an entry-points dependencies
before processing that entry-point.

PR Close #25862
2018-09-18 13:06:28 -07:00
Pete Bacon Darwin 976389836e build: update node type version (#25862)
PR Close #25862
2018-09-18 13:06:28 -07:00
Pete Bacon Darwin f76a9ad156 style(ivy): remove unused import (#25862)
PR Close #25862
2018-09-18 13:06:28 -07:00
Pete Bacon Darwin 6f1100a7e9 refactor(ivy): use `canonical-path` in ngcc (#25862)
It turns out that `path.posix` does not always reliably
return forward slash paths on Windows.

PR Close #25862
2018-09-18 13:06:28 -07:00
Greg Magolan b99d7ed5bf build(bazel): update to rules_typescript 0.17.0 & rules_nodejs 0.13.4 (#25920)
PR Close #25920
2018-09-18 13:05:38 -07:00
Kara Erickson f47f2628e1 refactor(ivy): remove LNode.view (#25988)
PR Close #25988
2018-09-18 13:04:23 -07:00
Kara Erickson 5653874683 fix(ivy): events should not mark views dirty by default (#25969)
PR Close #25969
2018-09-17 13:02:39 -07:00
Alex Eagle bdbb2f9bfa ci: update to bazel 0.17 (#25967)
this includes support for @ character in labels, which we need for fine-grained deps

PR Close #25967
2018-09-17 12:51:52 -07:00
Kara Erickson aedebaf025 refactor(ivy): remove LNode.tNode (#25958)
PR Close #25958
2018-09-14 16:16:28 -07:00
Kara Erickson 47f4412650 refactor(ivy): LContainers should store views not nodes (#25933)
PR Close #25933
2018-09-13 15:56:04 -07:00
Matias Niemelä 10a656fc38 refactor(ivy): ensure hello world doesn't pull in context discovery creation code (#25895)
PR Close #25895
2018-09-12 13:25:12 -04:00
Daniel Wiehl 8dc2b119fb fix(router): mount correct component if router outlet was not instantiated and if using a route reuse strategy (#25313) (#25314)
This unsets 'attachRef' on outlet context if no route is to be reused in route activation.

Closes #25313

PR Close #25314
2018-09-11 16:26:42 -07:00
vincecampanale f2ba55f2fb docs(router): change description of parameter usage for navigation functions (#21840)
PR Close #21840
2018-09-11 16:24:23 -07:00
Matt Keller 00d3666d95 fix(compiler): Fix look up of entryComponents in AOT Summaries (#24892)
Previously, when you attempted to bootstrap a component that had a
router-outlet using ngsummaries, it would complain that the component
was not provided by any module even if it was. This commit fixes a
mistake (AFAICT) which caused the lookup of the component in the AOT
summaries to fail.

I believe this change is safe. I've run the affected tests within Google
and there were no breakages caused by this change.

PR Close #24892
2018-09-11 16:23:17 -07:00
cexbrayat 21009b06a1 fix(ivy): use proper sanitizer names (#25817)
Fixes #25816

PR Close #25817
2018-09-11 16:22:38 -07:00
Greg Estren f3b552f51f build(bazel): remove outdated "cfg = "data"" references (#25434)
PR Close #25434

PR Close #25434
2018-09-11 08:27:39 -07:00
Misko Hevery 86a3be8610 docs(ivy): add explanation of LViewData (#25779)
PR Close #25779
2018-09-11 07:10:15 -07:00
Miško Hevery d5bd86ae5d fix(ivy): don't accidently read the inherited definition (#25736)
Create getter methods `getXXXDef` for each definition which
uses `hasOwnProperty` to verify that we don't accidently read form the
parent class.

Fixes: #24011
Fixes: #25026

PR Close #25736
2018-09-11 07:09:38 -07:00
Alex Rickabaugh a9099e8f70 fix(ivy): ensure Ivy *Ref classes derive from view engine equivalents (#25775)
Various user code uses 'instanceof' to check whether a particular instance
is a TemplateRef, ElementRef, etc. Ivy needs to work with these checks.

PR Close #25775
2018-09-11 06:53:22 -07:00
Alex Rickabaugh 96d6b79ada feat(ivy): resolve references to vars in .d.ts files (#25775)
Previously, if ngtsc encountered a VariableDeclaration without an
initializer, it would assume that the variable was undefined, and
return that result.

However, for symbols exported from external modules that resolve to
.d.ts files, variable declarations are of the form:

export declare let varName: Type;

This form also lacks an initializer, but indicates the presence of an
importable symbol which can be referenced. This commit changes the
static resolver to understand variable declarations with the 'declare'
keyword and to generate references when it encounters them.

PR Close #25775
2018-09-11 06:53:21 -07:00
Alex Rickabaugh 13ccdfd89d feat(ivy): support bootstrap in ngModuleDef (#25775)
The bootstrap property of @NgModule was not previously compiled by
the compiler in AOT or JIT modes (in Ivy). This commit adds support
for bootstrap.

PR Close #25775
2018-09-11 06:53:21 -07:00
Alex Rickabaugh a0c4b2d8f0 fix(ivy): add @nocollapse when writing closure-annotated code (#25775)
Closure requires @nocollapse on Ivy definition static fields in order
to not convert them to standalone constants. However tsickle, the tool
which would ordinarily be responsible for adding @nocollapse, doesn't
properly annotate fields which are added synthetically via transforms.
So this commit adds @nocollapse by applying regular expressions against
code during the final write to disk.

PR Close #25775
2018-09-11 06:53:21 -07:00
Ben Lesh 7ba0cb7c93 refactor(ivy): remove superfluous Array check (#25894)
related #25755

PR Close #25894
2018-09-10 14:00:58 -07:00
Vikram Subramanian d83f9d432a fix(common): register locale data for all equivalent closure locales (#25867)
This fix is for the issue below when compiling I18N Angular apps using closure.

For certain locales closure converts the input locale id to a different equivalent locale string. For example if the input locale is 'id'(for Indonesia) goog.LOCALE is set to 'in' and the closure locale data is registered only for 'in'. The Angular compiler uses the original input locale string, 'id' to set the LOCALE_ID token and there is a mismatch of locale used to register and locale used when requesting the locale data.

The fix is for the closure-locale.ts code to register the locale data for all equivalent locales names so that it doesn't matter what goog.LOCALE is actually set to.

PR Close #25867
2018-09-10 13:59:56 -07:00
Matias Niemelä e3633888ed feat(ivy): support animation @triggers in templates (#25849)
PR Close #25849
2018-09-10 13:59:27 -07:00
Kara Erickson 91d79939be refactor(ivy): traverse tNode tree directly (#25872)
PR Close #25872
2018-09-10 09:59:17 -07:00
Miško Hevery 96eb79b1c7 build: add support for running builds outside of sandbox on Mac. (#25870)
Add following to your `~/.bazelrc`. This will run the build faster locally
(outside of sandbox), but continue running the builds with sandboxing
on CI.

```
build --spawn_strategy=standalone --strategy=ESM5=sandboxed
```
PR Close #25870
2018-09-07 16:06:55 -07:00
Kara Erickson 83a1334876 refactor(ivy): migrate previousOrParentNode to use TNodes (#25829)
PR Close #25829
2018-09-07 16:06:17 -07:00
Matias Niemelä 62be8c2e2f feat(ivy): allow combined context discovery for components, directives and elements (#25754)
PR Close #25754
2018-09-07 14:14:56 -07:00
Matias Niemelä d2dfd48be0 feat(ivy): patch animations into metadata (#25828)
PR Close #25828
2018-09-07 13:46:06 -07:00
Alex Eagle 34ec9244a6 build: update to Node 10 (#25822)
PR Close #25822
2018-09-06 14:58:30 -07:00
Pete Bacon Darwin d96e962da3 test(ivy): mock the filesystem in ngcc main() integration tests (#25557)
Bazel does not like the filesystem being modified.
This commit a temporary mock filesystem that can be modified as needed.

PR Close #25557
2018-09-05 11:35:47 -07:00
Pete Bacon Darwin b0cb134815 feat(ivy): implement ngcc build marker (#25557)
`ngcc` adds marker files to each folder that has been
compiled, containing the version of the ngcc used.

When compiling, it will ignore folders that contain these
marker files, as long as the version matches.

PR Close #25557
2018-09-05 11:35:47 -07:00
George Kalpakas 2a672a97ab fix(upgrade): trigger `$destroy` event on upgraded component element (#25357)
Fixes #25334

PR Close #25357
2018-09-05 11:35:14 -07:00
George Kalpakas 71007ef9b2 refactor(upgrade): share code for destroying upgraded components between `dynamic` and `static` (#25357)
PR Close #25357
2018-09-05 11:35:14 -07:00
Trotyl 010e35d995 feat(router): warn if navigation triggered outside Angular zone (#24959)
closes #15770, closes #15946, closes #24728

PR Close #24959
2018-09-05 09:35:14 -07:00
Alex Rickabaugh a417b2b419 fix(ivy): detect frozen flyweight objects in definitions and unfreeze (#25755)
defineComponent() and friends can return a flyweight EMPTY object for
specific fields when they contain no data. InheritDefinitionFeature
was attempting to write into these flyweight objects, which have been
protected with Object.freeze().

This commit adds detection to InheritDefinitionFeature to identify the
frozen objects.

PR Close #25755
2018-09-05 09:27:41 -07:00
Igor Minar 51c0d9cae9 style(ivy): remove unused ivy code (#25780)
PR Close #25780
2018-09-04 12:12:04 -07:00
Igor Minar 08dfbc5475 fix(ivy): reexport __POST_NGCC__ symbols as private to prevent DCE in FESM (#25780)
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.

We don't have an infrastructure to test this fix, so I just manually inspected
the bundles before and after to verify that the fix works.

PR Close #25780
2018-09-04 12:12:04 -07:00
Alex Rickabaugh cc29b9cf93 fix(ivy): use globally unique names for i18n constants (#25689)
Closure compiler requires that the i18n message constants of the form

const MSG_XYZ = goog.getMessage('...');

have names that are unique across an entire compilation, even if the
variables themselves are local to a given module. This means that in
practice these names must be unique in a codebase.

The best way to guarantee this requirement is met is to encode the
relative file name of the file into which the constant is being written
into the constant name itself. This commit implements that solution.

PR Close #25689
2018-09-04 12:09:29 -07:00
Brandon Roberts abd29f5049 docs(forms): update API reference for reactive and template-driven forms modules (#25687)
PR Close #25687
2018-08-31 13:37:40 -07:00
Pawel Kozlowski 6def18a95e fix(ivy): support directive outputs on ng-template (#25717)
Compiler part of #25698
Fixes #25697

PR Close #25717
2018-08-31 13:37:16 -07:00
Pawel Kozlowski 34be51898d fix(ivy): support host bindings on dynamically created components (#25765)
PR Close #25765
2018-08-31 13:36:53 -07:00
Pawel Kozlowski 1e3460be0b refactor(ivy): remove obsolete types (#25767)
In the past factories could return an array with content queries
but we no longer manage queries in factory functions.

PR Close #25767
2018-08-31 13:36:22 -07:00
Greg Magolan 31349fde90 build(bazel): make resolveTypeReferenceDirectives override work with both ts 2.9 & ts 3.0 (#25581)
PR Close #25581
2018-08-31 11:12:03 -07:00
Greg Magolan 910381ddbd build(bazel): fix bazel types reference directive resolves (#25581)
PR Close #25581
2018-08-31 11:12:03 -07:00
Pete Bacon Darwin 20b9c61d4c perf(ivy): speed up ngcc ivy switch processing (#25534)
Only parse the AST for ngcc ivy switch constants
if the marker is not found in the module text.

PR Close #25534
2018-08-31 09:47:50 -07:00
Pete Bacon Darwin e964319fe9 test(ivy): test `Esm5Renderer.getSwitchableDeclarations` (#25534)
Also incorporates a refactoring of the tests to make them less fragile.

PR Close #25534
2018-08-31 09:47:50 -07:00
Pete Bacon Darwin 26cd9f5433 feat(ivy): implement `Renderer.getSwitchableDeclarations` (#25534)
This supports the "ngcc ivy switch" specified in #25238.

PR Close #25534
2018-08-31 09:47:50 -07:00
Pete Bacon Darwin e73e864f87 test(ivy): refactor Esm5Renderer tests to make them less fragile (#25534)
PR Close #25534
2018-08-31 09:47:50 -07:00
Pete Bacon Darwin 73047483a1 test(ivy): refactor Esm2015Renderer tests to make them less fragile (#25534)
PR Close #25534
2018-08-31 09:47:50 -07:00
Pete Bacon Darwin 6f168b7a0f feat(ivy): implement `NgccReflectionHost.getSwitchableDeclarations()` (#25534)
This method will be used to find all the places where the "ivy switch"
will occur. See #25238

PR Close #25534
2018-08-31 09:47:49 -07:00
Alex Rickabaugh a469c2c412 feat(ivy): produce contextual diagnostics in ngtsc mode (#25647)
TypeScript has a more modern diagnostic emit function which produces
contextually annotated error information, using colors in the console
to indicate where in the code the error occurs.

This commit swiches ngtsc to use this format for diagnostics when
emitting them after a failed compilation.

PR Close #25647
2018-08-31 09:43:31 -07:00
Alex Rickabaugh 38f624d7e3 feat(ivy): output diagnostics for many errors in ngtsc (#25647)
This commit takes the first steps towards ngtsc producing real
TypeScript diagnostics instead of simply throwing errors when
encountering incorrect code.

A new class is introduced, FatalDiagnosticError, which can be thrown by
handlers whenever a condition in the code is encountered which by
necessity prevents the class from being compiled. This error type is
convertable to a ts.Diagnostic which represents the type and source of
the error.

Error codes are introduced for Angular errors, and are prefixed with -99
(so error code 1001 becomes -991001) to distinguish them from other TS
errors.

A function is provided which will read TS diagnostic output and convert
the TS errors to NG errors if they match this negative error code
format.

PR Close #25647
2018-08-31 09:43:30 -07:00
Kara Erickson b424b3187e fix(compiler): add hostVars and support pure functions in host bindings (#25626)
PR Close #25626
2018-08-31 09:42:58 -07:00
Marc Laval 00f13110be feat(ivy): support injecting Renderer2 (#25523)
PR Close #25523
2018-08-31 09:42:36 -07:00
Mike Giambalvo 06d04002fd fix(benchpress): Use performance.mark() instead of console.time() (#24114)
Previously, benchpress would use `console.time()` and
`console.timeEnd()` to measure the start and end of a test in the
performance log. This used to work over navigations - if you called
`console.time(id)` then navigated to a different page, calling
`console.timeEnd(id)` would still insert an event in the performance
log.

As of Chrome 65, this is no longer the case. `console.timeEnd(id)` will
simply not insert an event in the performance log unless
`console.time(id)` was called on the same page. Likewise, using
`performance.measure()` does not work if the starting mark was on a
different page.

This simple workaround uses `performance.mark()` to insert events in the
performance log at the start and end of the test. Benchpress looks for
'-bpstart' and '-bpend' in the name of the performance mark, and
normalizes that to the start and end events expected by PerflogMetric

PR Close #24114
2018-08-30 21:33:40 -07:00
Rob Wormald c9844a2f01 feat(elements): enable Shadow DOM v1 and slots (#24861)
When using ViewEncapsulation.ShadowDom, Angular will not remove the child nodes of the DOM node a root Component is bootstrapped into. This enables developers building Angular Elements to use the `<slot>` element to do native content projection.

PR Close #24861
2018-08-30 21:33:14 -07:00
Rob Wormald 4815b92495 test(elements): add basic integration test for angular elements (#24861)
PR Close #24861
2018-08-30 21:33:14 -07:00
Rob Wormald d76a7d6f7c test(core): update Web Platform feature detection (#24861)
PR Close #24861
2018-08-30 21:33:14 -07:00
Rob Wormald 6e828bba88 fix(core): do not clear element content when using shadow dom (#24861)
PR Close #24861
2018-08-30 21:33:13 -07:00
Miško Hevery 1f59f2f04d fix(core): size regression with closure compiler (#25531)
By pulling in `compiler` into `core` the `compiler` was not
100% tree-shakable and about  8KB of code was retained
when tree-shaken with closure.

PR Close #25531
2018-08-30 21:22:40 -07:00
Pawel Kozlowski 371df35624 fix(ivy): register to directive outputs on ng-template / ng-container (#25698)
Runtime part of #25697

PR Close #25698
2018-08-30 21:22:01 -07:00
Alex Eagle 3809e0fcae fix(bazel): protractor rule should include *.e2e-spec.js (#25701)
PR Close #25701
2018-08-30 21:21:27 -07:00
Kara Erickson b06f1c0087 refactor(ivy): remove duplicate global (#25756)
PR Close #25756
2018-08-30 21:20:15 -07:00
Alex Eagle f394ba0e27 fix(bazel): Cache fileNameToModuleName lookups (#25731)
This saves expensive re-parsing of the file when not run as a Bazel worker

PR Close #25731
2018-08-29 17:39:22 -04:00
Alex Eagle 42072c4d0d fix(bazel): only lookup amd module-name tags in .d.ts files (#25710)
PR Close #25710
2018-08-28 21:07:15 -04:00
Alex Eagle 29761ea5f8 refactor(compiler-cli): remove tsickle from dependencies (#25649)
Users can still install tsickle if they want closure-compatible output.

PR Close #25649
2018-08-28 16:44:43 -04:00
Alex Eagle a22fb91e1a refactor(compiler-cli): remove a test that we no longer care about (#25649)
Alex R. says that we no longer care about the behavior this is testing.

PR Close #25649
2018-08-28 16:44:43 -04:00
Pawel Kozlowski 0386c44acc fix(ivy): inject attributes for directives on ng-template / ng-container (#25697)
PR Close #25697
2018-08-28 14:34:59 -04:00
Matias Niemelä 0024d68add feat(ivy): add support for resolving view data from a DOM node (#25627)
PR Close #25627
2018-08-27 21:15:29 -04:00
Igor Minar 317d40d879 test(compiler-cli): improve testing harness for incremental compilation (#25275)
In tsc 3.0 the check that enables program structure reuse in tryReuseStructureFromOldProgram has changed
and now uses identity comparison on arrays within CompilerOptions. Since we recreate the options
on each incremental compilation, we now fail this check.

After this change the default set of options is reused in between incremental compilations, but we still
allow options to be overriden if needed.

PR Close #25275
2018-08-27 21:07:53 -04:00
Alex Rickabaugh ab32ac6bb7 test(compiler-cli): fix the incremental ngc tests so that they run under bazel (#25275)
PR Close #25275
2018-08-27 21:07:53 -04:00
Alan Agius 5653fada32 feat: add TypeScript 3 support (#25275)
PR Close #25275
2018-08-27 21:07:53 -04:00
Greg Magolan 366195e182 build(bazel): esm5_outputs_aspect to work with targets such as ts_proto_library with no replay_params attribute (#25605)
PR Close #25605
2018-08-27 18:19:44 -04:00
Pawel Kozlowski 6a0f78fabf fix(ivy): match directives on bindings and element outputs (#25614)
Closes #23560

PR Close #25614
2018-08-27 18:17:25 -04:00
Pawel Kozlowski 3634575d89 test(common): fix double instantiation in NgSwitch test (#25632)
One of the tests was creating TestComponent instance _and_ using
global state making this test not predictable. Fixing the test
by making sure that TestComponent is instantiated only once.

PR Close #25632
2018-08-27 16:40:56 -04:00
Greg Magolan 9bcd8c2425 build(bazel): use value of /// <amd-module name=“”> directive to convert fileNameToModuleName in ngc-wrapped (#25650)
PR Close #25650
2018-08-27 12:21:18 -04:00
Pawel Kozlowski 8fa099158e fix(ivy): allow queries for ng-container without read option (#25617)
PR Close #25617
2018-08-24 11:52:50 -04:00
Pawel Kozlowski b00038c847 fix(ivy): inject ViewContainerRef for directives on ng-container (#25617)
PR Close #25617
2018-08-24 11:52:50 -04:00
George Kalpakas 18f129f536 build: upgrade Chromium and ChromeDriver to latest versions (#25602)
PR Close #25602
2018-08-24 11:48:40 -04:00
George Kalpakas 658f49f650 docs(elements): fix typo (tranformation --> transformation) (#25600)
PR Close #25600
2018-08-23 16:54:49 -04:00
Matias Niemelä a37bcc3bfe feat(ivy): bridge component styles into the component renderer (#25255)
PR Close #25255
2018-08-23 16:51:15 -04:00
Alex Eagle 22e7f7e99f build(bazel): update to rules_typescript 0.16.1 (#25490)
PR Close #25490
2018-08-23 15:26:21 -04:00
Matias Niemelä 668bfcec9d fix(docs-infra): fix closure warning issue for improper internal flag (#25628)
PR Close #25628
2018-08-22 21:59:22 -04:00
Alex Rickabaugh eb1fe19088 fix(ivy): ngtsc directive compilation should use shared ConstantPool (#25620)
This fixes a bug in ngtsc where each @Directive was compiled using a
separate ConstantPool. This resulted in two issues:

* Directive constants were not shared across the file
* Extra statements from directive compilation were dropped instead of
added to the file

This commit fixes both issues and adds a test to verify @Directive is
working properly.

PR Close #25620
2018-08-22 21:14:54 -04:00
Greg Magolan 22d58fc89b build(bazel): remove workaround no longer needed for module names for ngfactory & ngsummary files (#25604)
Workaround was added in https://github.com/angular/angular/pull/25335. It was necessary for .ngfactory & .ngsummary files to have proper AMD module names starting with @angular when building angular downstream from source using Bazel. The underlying issue has been resolved in the compiler and these files now get proper AMD module names without the need for this workaround. The workaround had an unexpected consequence https://github.com/angular/angular-cli/issues/11835 which is fixed by its removal.

PR Close #25604
2018-08-22 21:11:18 -04:00
Kara Erickson 27e2039630 fix(compiler): update compiler to generate new slot allocations (#25607)
PR Close #25607
2018-08-22 21:08:39 -04:00
Alex Rickabaugh 5c95b4b3a3 feat(ivy): support enum values in static resolution (#25619)
This commit adds support for enumeration values. An enumeration value
is now a first-class return value of the resolver, which provides both
a Reference to the enum type itself and the name of the value from that
enum. Resolving an enum itself returns a Map<string, EnumValue>.

PR Close #25619
2018-08-22 19:30:23 -04:00
Alex Rickabaugh 61218f5f0b fix(ivy): ensure factory statements are emitted correctly (#25406)
PR Close #25406
2018-08-22 19:28:56 -04:00
Pete Bacon Darwin 7500f0eafb feat(ivy): find all packages to be compiled by ngcc (#25406)
PR Close #25406
2018-08-22 19:28:56 -04:00
Pete Bacon Darwin 68acc5b355 feat(ivy): compile all package formats in ngcc (#25406)
PR Close #25406
2018-08-22 19:28:56 -04:00
Pete Bacon Darwin 7d3b70c2af fix(ivy): ngcc is resilient to bad source-map comments (#25406)
PR Close #25406
2018-08-22 19:28:56 -04:00
Pete Bacon Darwin 7ce291c72a feat(ivy): implement `Esm5ReflectionHost.getGenericArityOfClass()` (#25406)
PR Close #25406
2018-08-22 19:28:56 -04:00
Pete Bacon Darwin 6ae1e63c89 refactor(ivy): rename `Esm2015ReflectionHost` to `Fesm2015ReflectionHost` (#25406)
PR Close #25406
2018-08-22 19:28:56 -04:00
Alex Rickabaugh d33e0091df fix(ivy): emit generic types when needed in defs in .d.ts file (#25406)
Ivy definitions in .d.ts files often reference the type of a class.
Sometimes, those classes have generic type parameters. When this is
the case, ngtsc needs to emit generic type parameters in the .d.ts
files (usually by passing 'any').

PR Close #25406
2018-08-22 19:28:56 -04:00
George Kalpakas b97d770e60 feat(ivy): add support for typings in ngcc (#25406)
PR Close #25406
2018-08-22 19:28:56 -04:00
George Kalpakas a3158bff27 refactor(ivy): minor re-organization of ngcc `PackageTransformer#transform` (#25406)
In preparation of adding support for transforming `.d.ts` files.

PR Close #25406
2018-08-22 19:28:56 -04:00
George Kalpakas d6e91ba545 feat(ivy): support getting the corresponding `.d.ts` file in ngcc (#25406)
PR Close #25406
2018-08-22 19:28:56 -04:00
George Kalpakas cdb0215d0b test(ivy): clean up ngcc spec (#25406)
PR Close #25406
2018-08-22 19:28:56 -04:00
George Kalpakas 396766104b refactor(ivy): rename spec files to match corresponding source files (#25406)
PR Close #25406
2018-08-22 19:28:56 -04:00
George Kalpakas e77f0fd6e6 refactor(ivy): export ngcc import prefix into constant (#25406)
PR Close #25406
2018-08-22 19:28:56 -04:00
George Kalpakas cdd4c9be63 feat(ivy): support custom prefix for imports in `DtsFileTransformer` (#25406)
PR Close #25406
2018-08-22 19:28:56 -04:00
George Kalpakas 29705dd8f2 refactor(ivy): make `ReflectionHost` a parameter of `Renderer` (#25406)
PR Close #25406
2018-08-22 19:28:56 -04:00
George Kalpakas ea68ba048a refactor(ivy): minor refactorings (#25406)
PR Close #25406
2018-08-22 19:28:55 -04:00
George Kalpakas 9081efa961 feat(ivy): enable processing of esm5 format in ngcc (#25406)
PR Close #25406
2018-08-22 19:28:55 -04:00
George Kalpakas 9e179cb311 fix(ivy): correctly detect classes in ngcc `Esm5ReflectionHost` (#25406)
PR Close #25406
2018-08-22 19:28:55 -04:00
George Kalpakas 3211432d2a feat(ivy): add support for esm2015 and esm5 in ngcc `PackageParser` (#25406)
Since non-flat module formats (esm2015, esm5) have different structure
than their flat counterparts (and since we are operating on JS files
inside `node_modules/`, we need to configure TS to include deeply nested
JS files (by specifying a sufficiently high `maxNodeModuleJsDepth`).

Remains to be determined if this has any (noticeable) performance
implications.

PR Close #25406
2018-08-22 19:28:55 -04:00
George Kalpakas a7134dbc37 refactor(ivy): remove unused arg from ngcc `Analyzer` (#25406)
PR Close #25406
2018-08-22 19:28:55 -04:00
Pete Bacon Darwin a528636f56 fix(ivy): allow `FunctionExpression` to indicate a method declaration (#25406)
In some code formats (e.g. ES5) methods can actually be function
expressions. For example:

```js
function MyClass() {}
// this static method is declared as a function expression
MyClass.staticMethod = function() { ... };
```

PR Close #25406
2018-08-22 19:28:55 -04:00
Pete Bacon Darwin f87b499dde feat(ivy): implement `getDefinitionOfFunction` on ES2015 and ES5 reflection hosts (#25406)
PR Close #25406
2018-08-22 19:28:55 -04:00
Alex Rickabaugh a45f2bfb8f feat(ivy): use the ReflectionHost to resolve parameters and initializers (#25406)
ngtsc's static resolver can evaluate function calls where parameters
have default values. In TypeScript code these default values live on the
function definition, but in ES5 code the default values are represented
by statements in the function body.

A new ReflectionHost method getDefinitionOfFunction() abstracts over
this difference, and allows the static reflector to more accurately
evaluate ES5 code.

PR Close #25406
2018-08-22 19:28:55 -04:00
Kara Erickson d5b70e0c66 fix(ivy): create LViewData from blueprint (#25587)
PR Close #25587
2018-08-22 15:58:42 -04:00
Marc Laval 6176974832 test(compiler-cli): fix failing test after bad merge (#25599)
PR Close #25599
2018-08-21 11:30:42 -07:00
Kara Erickson 831e71ea3c fix(ivy): host bindings should support array/object literals (#25583)
PR Close #25583
2018-08-21 10:48:42 -07:00
Jason Aden fc89479044 fix(router): default scroll position restoration to disabled (#25586)
Fixes #25145
FW-305 #resolve

PR Close #25586
2018-08-21 10:48:14 -07:00
Ben Lesh f54f3856cb feat(ivy): add query inheritance (#25556)
Adds inheritance handling for the following:

- viewQuery
- contentQueries
- contentQueriesRefresh

PR Close #25556
2018-08-20 16:36:22 -07:00
Vikram Subramanian 9ed3bd6b4f refactor(bazel): allow and ignore extra args for _ts_expected_outs (#25558)
This is needed to let ts_compile_actions take explicit list of srcs and deps to generate tsc actions from another rule. This is no-op for ngc for now.

PR Close #25558
2018-08-20 16:25:19 -07:00
Pawel Kozlowski 11e2d9da1a feat(ivy): add support to template local refs in the compiler (#25576)
Fixes #23316

PR Close #25576
2018-08-20 16:24:56 -07:00
Kara Erickson 21a14407f6 refactor(ivy): generate vars in component defs (#25562)
PR Close #25562
2018-08-20 11:08:10 -07:00
Kara Erickson f2aa9c6a7f refactor(ivy): use generated consts value to set binding index (#25533)
PR Close #25533
2018-08-17 14:32:55 -07:00
Kara Erickson 4708cb91ef refactor(ivy): remove reserveSlots instruction (#25533)
PR Close #25533
2018-08-17 14:32:55 -07:00
Wei Huang f053a3f274 test(bazel): Remove --no-sandbox for protractor tests (#25362)
Since we no longer need this flag to run web tests inside a docker
container, this reverts https://github.com/angular/angular/pull/24906

PR Close #25362
2018-08-17 09:58:30 -07:00
Pawel Kozlowski 31f0f5b3c3 feat(ivy): add support for local refs on ng-template (#25482)
PR Close #25482
2018-08-17 09:58:07 -07:00
Marcus Krahl 07d8d3994c feat(router): add UrlSegment[] to CanLoad interface (#13127)
CanLoad now defines UrlSegment[] as a second parameter of the function.
Users can store the initial url segments and refer to them later, e.g. to go
back to the original url after authentication via router.navigate(urlSegments).
Existing code still works as before because the second function parameter
does not have to be defined.

Closes #12411

PR Close #13127
2018-08-16 16:32:18 -07:00
Miško Hevery 116946fb11 style: tslint enforces no debugger statements left behind (#25532)
PR Close #25532
2018-08-16 16:00:22 -07:00
Misko Hevery 503905c807 feat(ivy): add `ngcc` ivy switch (#25238)
Provides a runtime and compile time switch for ivy including
`ApplicationRef.bootstrapModule`.

This is done by naming the symbols such that `ngcc` (angular
Compatibility compiler) can rename symbols in such a way that running
`ngcc` command will switch the `@angular/core` module from `legacy` to
`ivy` mode.

This is done as follows:

```
const someToken__PRE_NGCC__ = ‘legacy mode’;
const someToken__POST_NGCC__ = ‘ivy mode’;

export someSymbol = someToken__PRE_NGCC__;
```

The `ngcc` will search for any token which ends with `__PRE_NGCC__`
and replace it with `__POST_NGCC__`. This allows the `@angular/core`
package to be rewritten to ivy mode post `ngcc` execution.

PR Close #25238
2018-08-16 13:51:42 -07:00
Kara Erickson 6482f6f0fe refactor(ivy): separate container into 2 instructions (#25509)
PR Close #25509
2018-08-16 13:47:14 -07:00
Greg Magolan 9605456b66 build: refactor ambient node & jasmine types so they are only included where needed (#25491)
PR Close #25491
2018-08-16 13:46:43 -07:00
Miško Hevery 9ee6702fa9 refactor(ivy): remove short instruction names as they provide no value (#25493)
PR Close #25493
2018-08-16 11:04:34 -07:00
Victor Berchet 1f1103913a refactor(ivy): cleanup the public API for core/testing (#25492)
PR Close #25492
2018-08-15 09:53:17 -07:00
Alan Agius 01ec5fd6b0 fix(service-worker): `Cache-Control: no-cache` on assets breaks service worker (#25408)
At the moment `cacheAge` can we undefined when having `Cache-Control` set to `no-cache` due the mapping method in `needToRevalidate`

Closes #25442

PR Close #25408
2018-08-14 16:40:15 -07:00
Kieran Whiteman be2cf4dfd6 docs(core): Correct spelling error in directives docs (#25377)
Link to life-cycle hooks was spelt as "life-cycle hoooks".
PR Close #25377
2018-08-14 16:39:33 -07:00
Greg Magolan b5f354f2fb build(bazel): update to rules_typescript 0.16.0 & update to tagged rules_webtesting 0.2.1 (#25433)
PR Close #25433
2018-08-14 16:37:15 -07:00
Ben Lesh a0a29fdd27 feat(ivy): Add AOT handling for bare classes with Input and Output decorators (#25367)
PR Close #25367
2018-08-14 16:36:18 -07:00
Alex Rickabaugh 26066f282e fix(ivy): consider exported modules from other compilation scopes (#25425)
PR Close #25425
2018-08-14 14:23:24 -07:00
Alex Rickabaugh b40c437379 fix(ivy): ensure factory statements are emitted correctly (#25425)
A small bug caused base factory variable statements for @Component to
not be emitted properly. At the same time as this is fixed, those
statements are now emitted as const.

PR Close #25425
2018-08-14 14:23:24 -07:00
Alex Rickabaugh 82e2725154 fix(ivy): handle the case where no base factory is found (#25425)
When an Angular decorated class is inherited, it might be the case that
the entire inheritance chain actually has no constructor defined. In
that event, a factory which simply instantiates the type without any
arguments should be used.

PR Close #25425
2018-08-14 14:23:24 -07:00
Judy Bogart 98f336c0fb docs: add api doc for programmatic animation classes (#24668)
PR Close #24668
2018-08-14 13:15:27 -07:00
Pawel Kozlowski 9117fa199c test(ivy): activate local references canonical spec (#25462)
PR Close #25462
2018-08-14 12:01:55 -07:00
Pawel Kozlowski 0c4209f4b9 refactor(ivy): harmonize container and element / elementContainer signatures (#25458)
PR Close #25458
2018-08-14 12:01:23 -07:00
Victor Berchet 14ac7ad6b4 feat(ivy): implement TestBed (#25369)
PR Close #25369
2018-08-14 11:58:47 -07:00
Victor Berchet 85106375ac refactor(ivy): misc cleanup (#25369)
PR Close #25369
2018-08-14 11:58:47 -07:00
Ben Lesh bbb3f8fa60 docs(ivy): add better documentation around debugging ivy tests (#25432)
PR Close #25432
2018-08-13 21:44:55 -07:00
Martin Probst c869b143c6 build: drop unused re-export of json_marshal. (#25449)
This appears to be unused, and will be removed from rules_typescript now
that `struct.to_json` can take `dicts`.

PR Close #25449
2018-08-13 21:37:41 -07:00
Ben Lesh 1bb30147d3 fix(ivy): add typeof guard around ngDevMode for instances where we cannot set it in Node (#25475)
PR Close #25475
2018-08-13 20:50:53 -07:00
Ben Lesh fb2c5241fc fix(bazel): correct type concatenated to devmode_js (#25467)
PR Close #25467
2018-08-13 17:27:45 -07:00
Ben Lesh 97d8b5ed88 fix(ivy): reordering how root is acquired (#25470)
PR Close #25470
2018-08-13 17:25:47 -07:00
Kara Erickson 4a4d6fb0e6 test(ivy): compiler compliance tests should support ? (#25435)
PR Close #25435
2018-08-10 17:12:18 -07:00
Miško Hevery 2016afdbff fix(ivy): remove ivy dependency on ViewEngine's resolveRendererType2 (#25396)
PR Close #25396
2018-08-10 13:32:04 -07:00
Kara Erickson 409860a4da fix(ivy): queries should be restored when view changes (#25415)
PR Close #25415
2018-08-10 09:13:16 -07:00
Kara Erickson 2b128a47b9 refactor(ivy): queries should not rely on LNode (#25415)
PR Close #25415
2018-08-10 09:13:16 -07:00
Pawel Kozlowski 2d759927d4 feat(ivy): add support for ng-container in the compiler (#25383)
PR Close #25383
2018-08-09 13:13:04 -07:00
Alex Rickabaugh 7058072ff6 feat(ivy): enable .ngfactory.js generation in g3 only (#25392)
This turns on generation of ngfactory.js files when compiling in Ivy
mode in g3. They're not turned on for Bazel users as there appears to
be a strange interaction with the way our tests run in Bazel mode.

PR Close #25392
2018-08-09 09:58:13 -07:00
Alex Rickabaugh 33fd7e0784 fix(ivy): export NgModuleFactory via r3_symbols for core factories (#25392)
When @angular/core is compiled by ngtsc, a factory file is generated
for ApplicationModule, that is currently invalid because r3_symbols
does not export NgModuleFactory. This change fixes that issue and
ensures the generated ngfactory file for @angular/core is valid.

PR Close #25392
2018-08-09 09:58:13 -07:00
Alex Rickabaugh 2befc65777 fix(ivy): ngtsc should pay attention to declaration order (#25392)
When generating the 'directives:' property of ngComponentDef, ngtsc
needs to be conscious of declaration order. If a directive being
written into the array is declarated after the component currently
being compiled, then the entire directives array needs to be wrapped
in a closure.

This commit fixes ngtsc to pay attention to such ordering issues
within directives arrays.

PR Close #25392
2018-08-09 09:58:13 -07:00
Alex Rickabaugh 6f085f8610 fix(ivy): add missing exportAs field to ngDirectiveDef (#25392)
This commit includes the missing exportAs field from @Directive and
propagates it into the ngDirectiveDef.

PR Close #25392
2018-08-09 09:58:13 -07:00
Alex Rickabaugh 5be186035f feat(ivy): enable inheritance of factory functions in definitions (#25392)
This commit creates an API for factory functions which allows them
to be inherited from one another. To do so, it differentiates between
the factory function as a wrapper for a constructor and the factory
function in ngInjectableDefs which is determined by a default
provider.

The new form is:

factory: (t?) => new (t || SomeType)(inject(Dep1), inject(Dep2))

The 't' parameter allows for constructor inheritance. A subclass with
no declared constructor inherits its constructor from the superclass.
With the 't' parameter, a subclass can call the superclass' factory
function and use it to create an instance of the subclass.

For @Injectables with configured providers, the factory function is
of the form:

factory: (t?) => t ? constructorInject(t) : provider();

where constructorInject(t) creates an instance of 't' using the
naturally declared constructor of the type, and where provider()
creates an instance of the base type using the special declared
provider on @Injectable.

PR Close #25392
2018-08-09 09:58:13 -07:00
Alex Rickabaugh fba276d3d1 fix(ivy): use a single constant pool per source file (#25392)
Previously, ngtsc used a new ConstantPool for each decorator
compilation. This could result in collisions between constants in the
top-level scope.

Now, ngtsc uses a single ConstantPool for each source file being
compiled, and merges the constant statements into the file after the
import section.

PR Close #25392
2018-08-09 09:58:13 -07:00
Pawel Kozlowski 9c92a6fc7a test(ivy): add test for <ng-container> and shallow queries (#25379)
PR Close #25379
2018-08-09 07:35:01 -07:00
Alex Eagle 6c4da9dcd3 build: stop printing source-map-support warning (#25339)
PR Close #25339
2018-08-08 19:02:57 -07:00
Miško Hevery b64fed1ba3 fix(ivy): prevent ngDevMode from getting removed too early (#25371)
PR Close #25371
2018-08-08 13:13:16 -07:00
Alex Eagle a3f1e2cb42 style: format .bzl files with buildifier (#23544)
PR Close #23544
2018-08-08 13:12:07 -07:00
Alex Eagle bfdbdc2ee6 docs(bazel): add skydoc generation (#23544)
PR Close #23544
2018-08-08 13:12:07 -07:00
Igor Minar 74518c4b2e style: fix whitespace and indentation in the testing guide (#21669)
PR Close #21669
2018-08-08 13:11:15 -07:00
JiaLi.Passion ebf508fcd0 docs: add docs for fakeAsync test with custom macroTask in aio (#21669)
PR Close #21669
2018-08-08 13:11:15 -07:00
Roope Hakulinen 732026c3f5 feat(core): add DoBootstrap interface. (#24558)
Closes #24557.

PR Close #24558
2018-08-07 13:17:06 -07:00
Pawel Kozlowski af9ced9026 fix(ivy): project ng-container nodes (#25354)
PR Close #25354
2018-08-07 12:02:48 -07:00
Ádám Lippai c6e5b971d6 fix(compiler-cli): use the oldProgram option in watch mode (#21364)
The performCompilation() is always called with an undefined oldProgram option (even in watch mode).
This was regression introduced in: 957be960d2

Partial fix, discovered in: #21361

PR Close #21364
2018-08-07 11:58:38 -07:00
Pawel Kozlowski dbdbbdbe86 fix(ivy): support ng-container inside another ng-container (#25346)
PR Close #25346
2018-08-07 11:48:42 -07:00
Alex Rickabaugh fefc860f35 fix(ivy): fix bug with banana-in-a-box expressions in nested templates (#25321)
Inside of a nested template, an attempt to generate code for a banana-
in-a-box expression would cause a crash in the _AstToIrVisitor, as it
was not handling the case where a write would be generated to a local
variable.

This change supports such a mode of operation.

PR Close #25321
2018-08-07 11:45:32 -07:00
Greg Magolan 02e201ab1a fix: add mappings for ngfactory & ngsummary files to their module names in aot summary resolver (#25335)
PR Close #25335
2018-08-07 11:13:28 -07:00
George Kalpakas 2505c077d7 test(upgrade): reduce flaky-ness by increasing timeout (#24937)
PR Close #24937
2018-08-06 14:52:50 -07:00
George Kalpakas 066fc6a0ca refactor(upgrade): improve internal AngularJS typings (#24937)
PR Close #24937
2018-08-06 14:52:50 -07:00
George Kalpakas 07ab98bbb0 build(upgrade): use correct sources in `BUILD.bazel` (#24937)
PR Close #24937
2018-08-06 14:52:50 -07:00
Michael Giambalvo 16c03c0f38 fix(core): In Testability.whenStable update callback, pass more complete (#25010)
data about tasks.

When building a list of pending tasks for callers of whenStable(),
Testability will copy data about the task into a new object, in order to
avoid leaking references to tasks.

This change copies more properties from Tasks into the list of pending
tasks, as well as a reference to Task.data to give callers more
information about the tasks that are pending.

Specifically, this also copies runCount and task ID, which are needed in
order for callers to know when a given task is repeating.

PR Close #25010
2018-08-06 13:49:19 -07:00
Pawel Kozlowski 3355502f2f fix(ivy): support ng-container at the root of a view with delayed insertion (#25329)
PR Close #25329
2018-08-06 13:47:44 -07:00
vincecampanale 4933e103d3 docs(core): clarify supported ViewChild selectors (#22784)
PR Close #22784
2018-08-06 13:40:47 -07:00
Vani 7d006c5005 docs(core): fix tree-shakable spelling (#24057)
PR Close #24057
2018-08-06 13:40:15 -07:00
Vani 67ad59c245 docs: standardize spelling of tree-shakable (#24057)
PR Close #24057
2018-08-06 13:40:15 -07:00
Jessy Cormier c1587029db docs: add missing word in outputs description. (#25330)
PR Close #25330
2018-08-06 13:36:49 -07:00
Bartosz Wyporkiewicz 637ae135c5 docs(http): fixed example unit test for error catching (#25306)
The example unit test should test the service when the backend
application is not available, by providing a mock error response.
Although, the test will
fail as the mock response from the server is valid (it does not simulate
a
error response, but valid response with an error status 404).
This merge request fix this issue by replacing MockResponse with
MockError

This PR resolves 19499 issue

PR Close #25306
2018-08-06 11:31:57 -07:00
Anthony Humes ba1e25f53f fix(router): take base uri into account in `setUpLocationSync()` (#20244)
Normalize the full URL (including the base uri) before passing it to
`router.navigateByUrl()`.

Fixes #20061

PR Close #20244
2018-08-06 11:11:07 -07:00
Victor Berchet 795e1e8a38 test(ivy): improve error message for the compiler compliance test (#25291)
before:

```
Expected to find features 'import * as i0 from "@angular/core";
import { Directive, Input } from '@angular/core';

```

after:

```
Failed to find "template" after "...Component_Factory() { return new
MyComponent(); }," in:
'import * as i0 from "@angular/core";
import { Directive, Input } from '@angular/core';```

```

PR Close #25291
2018-08-05 15:31:19 -07:00
Victor Berchet aea8832243 refactor(ivy): misc cleanup (#25291)
PR Close #25291
2018-08-05 15:31:19 -07:00
Victor Berchet 1e7ca22078 refactor(ivy): make all directives public by default (#25291)
To match the View Engine behavior.

We should make this configurable so that the node injector is tree shaken when
directives do not need to be published.

PR Close #25291
2018-08-05 15:31:19 -07:00
Fabian Wiles b0d86c1c2f refactor(bazel): dont rely on language target to downlevel for loop (#24534)
PR Close #24534
2018-08-03 15:55:18 -07:00
JoostK 4e264781ee refactor(ivy): do not mention LViewData in public documentation (#25292)
PR Close #25292
2018-08-03 14:48:11 -07:00
Kara Erickson 79a9c71422 test(ivy): remove unnecessary common import (#25297)
PR Close #25297
2018-08-03 14:34:02 -07:00
Pete Bacon Darwin 15cc85c54a style(common): fix short param names (#23667)
PR Close #23667
2018-08-03 14:09:27 -07:00
Pete Bacon Darwin 725bae1921 docs(common): fix content errors (#23667)
PR Close #23667
2018-08-03 14:09:27 -07:00
Alex Rickabaugh eb999300d9 test(ivy): run compiler compliance tests without rebuilding core,common (#25248)
Previously the compiler compliance tests ran and built test code with
real dependencies on @angular/core and @angular/common. This meant that
any changes to the compiler would result in long rebuild processes
for tests to rerun.

This change removes those dependencies and causes test code to be built
against the fake_core stub of @angular/core that the ngtsc tests use.
This change also removes the dependency on @angular/common entirely, as
locality means it's possible to reference *ngIf without needing to link
to an implementation.

PR Close #25248
2018-08-03 13:08:51 -07:00
Victor Berchet afa6b9e794 fix(ivy): execute the optional begin and end methods of the rendererFactory (#25273)
This is required to i.e. flush animations when using a Renderer2.
`rf.begin()` and `rf.end()` around the change detection.

PR Close #25273
2018-08-03 10:17:13 -07:00
Alex Rickabaugh 0822dc70f2 feat(ivy): generate .ngfactory stubs if requested (#25176)
Existing bootstrap code in the wild depends on the existence of
.ngfactory files, which Ivy does not need. This commit adds the
capability in ngtsc to generate .ngfactory files which bridge
existing bootstrap code with Ivy.

This is an initial step. Remaining work includes complying with
the compiler option to specify a generated file directory, as well
as presumably testing in g3.

PR Close #25176
2018-08-03 09:42:06 -07:00
Victor Berchet 728d98d3a9 fix(ivy): add bound proerties name to template (#25272)
Before this change bound properties would not be used when matching directives
at runtime.

That is `<ng-template [ngIf]=cond>...</ng-template>` would not trigger the
`ngIf` directive.

PR Close #25272
2018-08-02 22:59:04 -07:00
Victor Berchet 2f4abbf5a1 fix(ivy): fix inline template bindings parsing (#25272)
PR Close #25272
2018-08-02 22:59:04 -07:00
Victor Berchet 1000fb8406 test(ivy): add tests for attributes and bound attributes to the tpl transform (#25272)
PR Close #25272
2018-08-02 22:59:04 -07:00
Victor Berchet b38931b484 fix(ivy): use devModeEqual in no change mode (#25252)
To avoid the unfamous error `Expression has changed after it was checked.`

PR Close #25252
2018-08-02 22:57:28 -07:00
Kara Erickson 1fb7111da1 fix(ivy): content query results should be available in content hooks (#25271)
PR Close #25271
2018-08-02 19:32:09 -07:00
Pawel Kozlowski c2c12e52fe feat(ivy): support ng-container as a child of an already inserted view (#25227)
PR Close #25227
2018-08-02 18:50:03 -07:00
Pawel Kozlowski 28c7a4efbc feat(ivy): add basic support for ng-container (#25227)
This commit adds basic support for <ng-container> - most of the
functionality should work as long as <ng-container> is a child of
a regular element.

PR Close #25227
2018-08-02 18:50:03 -07:00
Aldo Roman Nureña 183757daa2 fix(core): fix tests for uninitialized @Output error (#19116)
PR Close #19116
2018-08-02 09:37:21 -07:00
Aldo Roman adf510f986 fix(core): throw error message when @Output not initialized (#19116)
Closes #3664

PR Close #19116
2018-08-02 09:37:21 -07:00
Alan 3ba5220839 refactor(forms): `ngForm` element selector has been deprecated in favor of `ng-form` (#23721)
This has been deprecated to keep selector consistent with other core Angular selectors.  As element selectors are in kebab-case.

 Now deprecated:
 ```
 <ngForm #myForm="ngForm">
 ```

 After:
 ```
 <ng-form #myForm="ngForm">
 ```

You can also choose to supress this warnings by providing a config for `FormsModule` during import:

```ts
imports: [
 FormsModule.withConfig({warnOnDeprecatedNgFormSelector: 'never'});
]

Closes: #23678

PR Close #23721
2018-08-02 08:34:43 -07:00
Drummond Dawson 5982425436 test(common): TokenExtractor should extend HttpXsrfTokenExtractor in xsrf spec (#24649)
PR Close #24649
2018-08-02 08:34:15 -07:00
Drummond Dawson 140248ade0 test(common): remove unused import in xsrf spec (#24649)
PR Close #24649
2018-08-02 08:34:14 -07:00
Victor Berchet d46a961509 docs(ivy): API doc tweaks (#25258)
PR Close #25258
2018-08-01 16:19:54 -07:00
George Kalpakas 06af7943a4 test(upgrade): run tests against AngularJS v1.7.x as well (#25231)
PR Close #25231
2018-08-01 14:10:21 -07:00
Greg Magolan 7d6b258778 build: revert yarn.lock rxjs version to 6.0.0 (#25236)
PR Close #25236
2018-08-01 13:23:35 -07:00
mhartington 2b6e1f0f4b docs(core): remove experimental tag (#24032)
Remove experimental note on APP_INITIALIZER.

PR Close #24032
2018-08-01 10:56:06 -07:00
Martin Probst 01e6dab544 fix(compiler-cli): correct realPath to realpath. (#25023)
The optional property on `ts.CompilerHost` is called `realpath` (lower
case), not `realPath` (lower camel case).

It is not clear to me what the impact of this is, but the author's
intent was clearly to override `realpath`.

PR Close #25023
2018-08-01 10:54:51 -07:00
Stephen Fluin 166ddaadca docs(router): clarify scroll position wording (#25077)
PR Close #25077
2018-08-01 10:53:35 -07:00
Brandon Roberts 1e5327872d docs(core): replace ReflectiveInjector example with Static Injector example (#25162)
PR Close #25162
2018-08-01 10:52:32 -07:00
Pete Bacon Darwin d5b73832bf refactor(animations): do not use short parameter names (#25198)
PR Close #25198
2018-08-01 10:51:58 -07:00
Greg Magolan bafe1a0d2a build(bazel): fix typo in protractor test target definition (#25235)
PR Close #25235
2018-08-01 10:50:43 -07:00
Kara Erickson c8a4fb1faf fix(ivy): walk declaration views in listener (#25228)
PR Close #25228
2018-07-31 16:35:20 -07:00