Commit Graph

1357 Commits

Author SHA1 Message Date
Pawel Kozlowski 913563a41d test(ivy): finish root cause analysis for @angular/core TestBed failing tests (#27510)
PR Close #27510
2018-12-06 13:41:02 -08:00
Andrew Kushnir cad67148b1 fix(ivy): "select" attribute on <ng-content> should not be case-sensitive (FW-789) (#27500)
While generating attributes for `projection` instruction, we checked whether attribute name is equal to 'select' in lower case. However in other cases we treat 'select' attribute name as case-insensitive. This PR makes 'select' attribute consistently case-insensitive.

PR Close #27500
2018-12-06 13:40:15 -08:00
Andrew Kushnir c71d7b5633 fix(ivy): setting up animation properties correctly (FW-643) (#27496)
Prior to this change, animation properties were defined as element attributes, which caused errors at runtime. Now all animation-related attributes are defined as element properties.

Also as a part of this update, we start to account for bindings used in animations, which was previously missing.

PR Close #27496
2018-12-06 13:38:40 -08:00
Sander Elias 21d13dd15a fix(ivy): Added missing getHostElement to export (#27488)
PR Close #27488
2018-12-06 13:35:41 -08:00
Marc Laval 8e9858fadb fix(ivy): align NgModuleRef implementation between Ivy and ViewEngine (#27482)
Solves FW-765 and FW-767

PR Close #27482
2018-12-06 13:35:08 -08:00
JoostK 159ab1c257 fix(ivy): ngtsc should include generic types on injectable definitions (#27037)
Analogously to directives, the `ngInjectableDef` field in .d.ts files is
annotated with the type of service that it represents. If the service
contains required generic type arguments, these must be included in
the .d.ts file.

PR Close #27037
2018-12-06 13:33:13 -08:00
Pawel Kozlowski 821fecb413 test(ivy): update root causes for @angular/core TestBed failures (#27479)
PR Close #27479
2018-12-05 11:24:06 -08:00
Ben Lesh cd858323f2 feat(ivy): Forward refs now supported (#27439)
Adds deferred execution of scope setting for modules such that forward refs can be supported in ivy. Design docs can be found at https://docs.google.com/document/d/11KTbybis9rt0cZgMKd1wo_IKb6y1PMU-RoTDVLTXK4Y/edit#

PR Close #27439
2018-12-05 10:41:24 -08:00
Olivier Combe 2bc39860bb feat(ivy): support inputs & outputs with aliases in component decorators (#27350)
PR Close #27350
2018-12-05 10:40:08 -08:00
Olivier Combe 1279a503a1 feat(ivy): add ng-reflect debug text for containers (#27350)
PR Close #27350
2018-12-05 10:40:08 -08:00
Misko Hevery f52600e261 test(ivy): add ability to find already passing tests (#27449)
PR Close #27449
2018-12-05 09:34:52 -08:00
Miško Hevery 4b9948c1be fix(core): More precise return type for `InjectableDecorator` (#27360)
closes #26942

PR Close #27360
2018-12-04 23:18:19 -08:00
Misko Hevery faca8b1382 test(ivy): remove symbol tests which are too big and not useful (#27446)
PR Close #27446
2018-12-04 23:17:52 -08:00
Kristiyan Kostadinov b6dbcf93a0 test(ivy): add root cause on tree shakable providers test (#27465)
Adds the root cause on one of the failing NgModule tests.

PR Close #27465
2018-12-04 21:01:58 -08:00
Pawel Kozlowski b25f06ee7c test(ivy): update root causes for @angular/core TestBed failures (#27459)
PR Close #27459
2018-12-04 20:02:21 -08:00
Marc Laval 8973f12ee4 fix(ivy): provided Injector should be instantiated by its factory (#27456)
(FW-777)

When an Injector is provided, R3Injector instantiates it by calling its
constructor instead of its factory, not resolving dependencies.
With this fix, the ngInjectorDef is checked and the factory is correctly
used if it is found.

PR Close #27456
2018-12-04 20:01:49 -08:00
Andrew Kushnir 130ae158c4 test(ivy): more precise TestBed failure causes for View/Content Queries (FW-670) (#27447)
PR Close #27447
2018-12-04 20:01:03 -08:00
Misko Hevery 295e0f65a1 refactor(ivy): remove old unused test case (#27442)
PR Close #27442
2018-12-04 20:00:17 -08:00
Kristiyan Kostadinov 862697d4bd fix(ivy): return new ViewRef when detaching view (#27437)
When detaching a view by its index via `ViewContainerRef.detach(index)`, in `ViewEngine` we used to return a new `ViewRef` ([for reference](https://github.com/angular/angular/blob/master/packages/core/src/view/refs.ts#L227)), however in Ivy we return the same `ViewRef` which means that its internal `_viewContainerRef` is never reset and we'll throw an error if the consumer tried to attach it to the `ApplicationRef`. These changes return a new `ViewRef` in order to match the original behavior.

These changes also add the same errors as `ViewEngine` when attempting to attach a view that is attached already. This was the original goal of this PR, however it ended up uncovering the issues with the `ViewRef`.

PR Close #27437
2018-12-04 19:59:37 -08:00
Olivier Combe 7f17c70fd0 test(ivy): add bundling test `todo_i18n` (#27420)
PR Close #27420
2018-12-04 19:59:12 -08:00
Marc Laval bd864fb274 feat(ivy): support WrappedValue in pipes (FW-726) (#27409)
PR Close #27409
2018-12-04 19:59:01 -08:00
Miško Hevery b2d6f43b49 fix(ivy): Implement remaining methods for DebugNode (#27387)
PR Close #27387
2018-12-04 19:58:25 -08:00
Andrew Kushnir 8e644d99fc fix(ivy): taking "interpolation" config option into account (FW-723) (#27363)
PR Close #27363
2018-12-04 14:04:14 -08:00
George Kalpakas 56f8c23adf test(ivy): add tests for `ComponentFactory#create()` fix in #27341 (#27300)
PR Close #27300
2018-12-04 14:03:44 -08:00
George Kalpakas 6cf3c2b682 docs(ivy): fix component definition description of `inputs` (#27300)
PR Close #27300
2018-12-04 14:03:44 -08:00
JoostK 6552471c49 fix(ivy): account for `useValue: undefined` providers in module injector (#27035)
PR Close #27035
2018-12-03 14:39:25 -08:00
Kristiyan Kostadinov 7ec05b4d8c fix(ivy): run initialializers in TestBed on init (#27355)
Fixes the initializers not being run by `TestBed` when creating a fixture.

PR Close #27355
2018-12-03 14:37:49 -08:00
Andrew Kushnir 8eb102ab10 fix(ivy): avoid counting style/class bindings in component/directive `hostBindings` (#27388)
PR Close #27388
2018-12-03 14:37:30 -08:00
Kara Erickson 2a39425e48 fix(ivy): temporary hack to set host styles and static classes (#27385)
PR Close #27385
2018-12-03 11:05:36 -08:00
Misko Hevery 7d89cff545 fix(ivy): Ensure ComponentFactory uses both injectors to retrieve rendererFactory (#27341)
PR Close #27341
2018-12-03 10:02:05 -08:00
Andrew Kushnir 6f5c124fe9 fix(ivy): proper accounting of host vars in case of inherited Directives (#27392)
Prior to this change, the number of host vars stored for directives with `hostBindings` in expando block was incorrect for inherited directives (in case both parent and child directive have `hostBindings` defined). Now if we identify that we already added a `hostBinding` into expando block, we just increase the corresponding number of host binding vars

PR Close #27392
2018-12-03 09:18:07 -08:00
Matias Niemelä a082f6484a fix(ivy): fix style prop instructions to account for zero-based values (#27270)
PR Close #27270
2018-12-03 08:23:23 -08:00
Pawel Kozlowski a1470c94a6 test(ivy): update root causes for @angular/core TestBed failures (#27419)
PR Close #27419
2018-12-03 08:19:56 -08:00
Andrew Kushnir a088b8c203 feat(ivy): introduce "allocHostVars" instruction as a replacement for "hostVars" field (FW-692) (#27299)
PR Close #27299
2018-11-30 14:03:12 -08:00
Alex Rickabaugh 64a34616d8 fix(ivy): support string tokens in dependency injection (#27383)
In Angular, it used to be an accepted practice to use strings as dependency
injection tokens. E.g. {provide: 'test', useValue: 'provided'}. However,
the Ivy node injection system did not support this. The Ivy DI system
attempts to patch a Bloom bit index onto each type registered with it, and
this patch operation does not work for a string token.

This commit adds string token support to the bloom filter system by
reserving bit 0 for string tokens. This eliminates the need for each string
token to store its own Bloom bit, at the expense of slightly more expensive
lookups of string tokens.

PR Close #27383
2018-11-30 14:00:23 -08:00
Pawel Kozlowski 1fa5478fef test(ivy): update root causes for @angular/core TestBed failures (#27370)
PR Close #27370
2018-11-30 13:41:21 -08:00
Alex Rickabaugh 412e47d311 fix(ivy): support multiple directives with the same selector (#27298)
Previously the concept of multiple directives with the same selector was
not supported by ngtsc. This is due to the treatment of directives for a
component as a Map from selector to the directive, which is an erroneous
representation.

Now the directives for a component are stored as an array which supports
multiple directives with the same selector.

Testing strategy: a new ngtsc_spec test asserts that multiple directives
with the same selector are matched on an element.

PR Close #27298
2018-11-29 21:35:28 -08:00
Kristiyan Kostadinov 23bc8edf24 test: move remaining fixmeIvy to test level (#27354)
Moves all of the remaning `describe`-level fixme instances to the `it` level.

PR Close #27354
2018-11-29 21:28:01 -08:00
Misko Hevery 816ec0b1c3 refactor(ivy): treate LView as the primary global state (#27282)
- rename `LViewData` to `LView` (to be consistent with `TView`)
- Remove `getRenderer`, `getRendererFactory`, `getTview`, `getCurrentQueries`,

PR Close #27282
2018-11-29 21:26:15 -08:00
Pawel Kozlowski 8ceea0f238 test(ivy): update root causes for @angular/core TestBed failures (#27351)
PR Close #27351
2018-11-29 21:21:13 -08:00
Andrew Kushnir 7773d7f552 fix(ivy): add polyfill for goog.getMsg to unblock tests (FW-663) (#27218)
PR Close #27218
2018-11-28 11:40:56 -08:00
Pawel Kozlowski 7076773360 test(ivy): update root causes for @angular/core TestBed failures (#27321)
PR Close #27321
2018-11-28 11:38:51 -08:00
Misko Hevery 39e426cde3 fix(ivy): TestBed.get(Compiler) throws "Error: Runtime compiler is not loaded" (#27223)
BREAKING CHANGE:

The public API for `DebugNode` was accidentally too broad. This change removes
1. Public constructor. Since `DebugNode` is a way for Angular to communicate information
   on to the developer there is no reason why the developer should ever need to
   Instantiate the `DebugNode`
2. We are also removing `removeChild`, `addChild`, `insertBefore`, and `insertChildAfter`.
   All of these methods are used by Angular to constructor the correct `DebugNode` tree.
   There is no reason why the developer should ever be constructing a `DebugNode` tree
   And these methods should have never been made public.
3. All properties have been change to `readonly` since `DebugNode` is used by Angular
   to communicate to developer and there is no reason why these APIs should be writable.

While technically breaking change we don’t expect anyone to be effected by this change.

PR Close #27223
2018-11-27 13:42:23 -08:00
Miško Hevery 60e403bf6d build: ts-api-guardian should support interface with value types (#27223)
This fixes an issue where a value would hide the type.

```
export interface Foo {
  someMethod(): void;
}

export const Foo: Function = ...;
```

In the above example the `Foo` constant will hide the `interface Foo` symbol.
This change properly saves the interface in addition to the type.

PR Close #27223
2018-11-27 13:42:23 -08:00
Alex Rickabaugh 23b06af940 fix(core): export a value for InjectFlags (#27279)
A recent commit (probably 2c7386c) has changed the import graph of the
DI types in core, and somehow results in the ngc compiler deciding to
re-export core DI types from application factories which tangentially
use inject(). This is not really surprising; ngc's import graph can be
very unstable.

However, this results in a re-export of InjectFlags surviving JS
compilation. InjectFlags was a const enum, akin to an interface in TS,
with no runtime repesentation. This causes a warning to be emitted by
Webpack when it sees the re-export of InjectFlags.

This commit avoids the issue by removing 'const' from the declaration
of InjectFlags, causing it to have a runtime value. This is a temporary
fix. The real fix will be for ngc to no longer write exports of const
enums.

Testing strategy: manually verified. Due to the problem only manifesting
when recompiling after a change and then running Webpack, there is no
existing framework via which this could be easily tested with an
integration test. Additionally, the potential for this issue is gone in
Ivy, so this solution is only temporarily needed.

Fixes #27251.

PR Close #27279
2018-11-27 13:40:39 -08:00
Igor Minar 5d82c73da6 fix(ivy): @NgModule() should not require an metadata object (#27278)
There is no test in this diff because I'm making an already failing test pass.

PR Close #27278
2018-11-27 10:30:58 -08:00
Igor Minar 1cca27d823 fix(ivy): @Inject should not overwrite an existing ngInjectableDef (#27278)
There is no test in this diff because I've made a failing test pass.

PR Close #27278
2018-11-27 10:30:58 -08:00
Igor Minar f7ba4b2ff9 fix(ivy): remove obsolete ng_module code for global and jit mode (#27278)
These paths are no longer needed / used.

I had to disable one jit mode spec because it fails now that we actually run it.
I root caused the jit test failure as missing forwardRef support. See FW-645.

PR Close #27278
2018-11-27 10:30:58 -08:00
Igor Minar d1227ec800 ci(ivy): packages/core/test/render3 now passes with ivy aot (#27278)
PR Close #27278
2018-11-27 10:30:58 -08:00
Kristiyan Kostadinov 4622d0b23a fix(ivy): detach ViewRef from ApplicationRef on destroy (#27276)
Currently we store the `_appRef` when a `ViewRef` is attached, however we don't use it for anything. These changes use it to detach the view from the `ApplicationRef` when it is destroyed. These changes also fix that the `ComponentRef` doesn't remove its `ViewRef` on destroy.

PR Close #27276
2018-11-27 10:24:53 -08:00
Pawel Kozlowski 0487fbe236 fix(ivy): throw a descriptive error when trying to insert / move destroyed view (#27289)
PR Close #27289
2018-11-27 10:23:14 -08:00
Kara Erickson d0e8020506 fix(ivy): blueprints should be synced whenever they are off (#27281)
PR Close #27281
2018-11-27 10:22:03 -08:00
Kara Erickson a7ba05ad82 fix(ivy): fix directive instantiation at slots above 2^12 (#27280)
PR Close #27280
2018-11-27 10:20:02 -08:00
Olivier Combe 2fce701ced feat(ivy): enable ng-reflect debug attributes (#27268)
PR Close #27268
2018-11-27 10:18:51 -08:00
Olivier Combe 32157115da fix(ivy): register `ModuleWithProviders` when deduplicating imported modules (#27268)
PR Close #27268
2018-11-27 10:18:51 -08:00
Marc Laval c2f30542e7 fix(ivy): should support components without selector (#27169)
PR Close #27169
2018-11-27 10:17:35 -08:00
JoostK d767e0b2c0 fix(ivy): consider providers for view/content queries (#27156)
In ViewEngine it is possible to query for a token that is provided by
a directive that is in scope. See StackBlitz for example:
https://stackblitz.com/edit/ng-viewengine-viewchild-providers

Material uses this pattern with its `MatFormFieldControl` setup, see
https://bit.ly/2zgCUxD for documentation.

PR Close #27156
2018-11-27 10:16:57 -08:00
Pawel Kozlowski 9e5223eaba test(core): add more root causes for TestBed tests failures (#27236)
PR Close #27236
2018-11-26 09:24:32 -08:00
Pawel Kozlowski 3c9ad1d231 fix(ivy): inject null for missing attributes (#27237)
PR Close #27237
2018-11-26 09:23:56 -08:00
Andrew Kushnir dc300c5c41 feat(ivy): render flags support in host bindings function (FW-649) (#27204)
PR Close #27204
2018-11-21 15:33:47 -08:00
JoostK c8c8648abf fix(ivy): prevent ngcc from referencing missing ɵsetClassMetadata (#27055)
When ngtsc compiles @angular/core, it rewrites core imports to the
r3_symbols.ts file that exposes all internal symbols under their
external name. When creating the FESM bundle, the r3_symbols.ts file
causes the external symbol names to be rewritten to their internal name.

Under ngcc compilations of FESM bundles, the indirection of
r3_symbols.ts is no longer in place such that the external names are
retained in the bundle. Previously, the external name `ɵdefineNgModule`
was explicitly declared internally to resolve this issue, but the
recently added `setClassMetadata` was not declared as such, causing
runtime errors.

Instead of relying on the r3_symbols.ts file to perform the rewrite of
the external modules to their internal variants, the translation is
moved into the `ImportManager` during the compilation itself. This
avoids the need for providing the external name manually.

PR Close #27055
2018-11-21 09:20:11 -08:00
Pawel Kozlowski d666370e16 test(core): add JIRA references for root-casuse ivy TestBed failures (#27196)
PR Close #27196
2018-11-21 09:18:54 -08:00
Misko Hevery e56c8bf8d1 fix(ivy): align discovery methods for consistency (#27117)
PR Close #27117
2018-11-20 11:44:14 -08:00
Miško Hevery ca40565f9a fix(ivy): hack implementation of host styles (#27180)
PR Close #27180
2018-11-20 11:43:29 -08:00
Olivier Combe bf3beb5959 fix(ivy): set `ng-version` attribute on root component (#27175)
PR Close #27175
2018-11-20 10:43:51 -08:00
Olivier Combe 20729b3378 fix(ivy): deduplicate imported modules in r3_injector (#27102)
PR Close #27102
2018-11-19 09:20:39 -08:00
Matias Niemelä 20ea5b5634 refactor(ivy): ensure directive host bindings use the styling algorithm (#27145)
PR Close #27145
2018-11-17 10:12:47 -08:00
Misko Hevery 4222b63639 Revert "refactor(ivy): ensure directive host bindings use the styling algorithm (#27134)"
This reverts commit b5dbf5154e.
2018-11-16 17:55:41 -08:00
Matias Niemelä b5dbf5154e refactor(ivy): ensure directive host bindings use the styling algorithm (#27134)
PR Close #27134
2018-11-16 16:10:45 -08:00
Andrew Kushnir 92e80af875 feat(ivy): ICU support for Ivy (#26794)
PR Close #26794
2018-11-16 16:09:30 -08:00
JoostK 60800da6c1 fix(ivy): export elementContainerStart/End instructions (#27053)
PR Close #27053
2018-11-16 12:19:18 -08:00
Marc Laval 848f4148c0 fix(ivy): DI should work when no element injector on starting node (#27133)
PR Close #27133
2018-11-16 09:26:29 -08:00
crisbeto 6574e61062 test(ivy): skip useJit tests with Ivy (#27067)
Currently the `useJit` option from `TestBed.configureCompiler` isn't supported. These changes rework the existing test suites not to pass in `useJit` when running with Ivy.

PR Close #27067
2018-11-15 21:19:21 -08:00
Kara Erickson ee12e725c0 fix(ivy): component ref injector should support change detector ref (#27107)
PR Close #27107
2018-11-15 21:18:24 -08:00
Olivier Combe e22a302cad feat(ivy): support for i18n & ICU expressions (#27101)
PR Close #27101
2018-11-14 16:22:01 -08:00
Pawel Kozlowski ce5242462b fix(ivy): implement rootNodes getter on ViewRef (#27095)
PR Close #27095
2018-11-14 12:28:03 -08:00
Marc Laval 1c9e526a83 fix(ivy): use the root view injector when resolving dependencies (#27090)
PR Close #27090
2018-11-14 12:26:36 -08:00
Miško Hevery f8f1168fa6 Revert "feat(ivy): support for i18n & ICU expressions (#26275)"
This reverts commit a63fd2d0f5.
2018-11-14 10:23:21 -08:00
Kara Erickson f0c4f31771 fix(ivy): should export lifecycle hooks feature (#27082)
PR Close #27082
2018-11-13 16:17:30 -08:00
Olivier Combe a63fd2d0f5 feat(ivy): support for i18n & ICU expressions (#26275)
PR Close #26275
2018-11-13 14:50:30 -08:00
Kara Erickson bc652a2943 fix(ivy): jit compilation should support content queries with type predicates (#27068)
PR Close #27068
2018-11-13 12:18:13 -08:00
Kara Erickson e6e590479e fix(ivy): support forward refs in @Inject annotations (#27069)
PR Close #27069
2018-11-13 12:17:18 -08:00
Kara Erickson 123da1a8c2 test(ivy): split out provider tests (#27069)
PR Close #27069
2018-11-13 12:17:18 -08:00
Judy Bogart 9741f5b8cf docs: new doc for core directives (#26923)
PR Close #26923
2018-11-13 10:57:56 -08:00
Kristiyan Kostadinov 5247594e86 fix(ivy): add support for providers in TestBed.configureCompiler (#27066)
Adds support for the `providers` that are passed in through `TestBed.configureCompiler` and scopes the error only if the consumer has passed in `useJit`.

PR Close #27066
2018-11-12 15:33:56 -08:00
Kara Erickson 8b9249a670 fix(ivy): host bindings should support content children and content hooks (#27065)
PR Close #27065
2018-11-12 14:26:06 -08:00
Kara Erickson 1810cdf2c3 fix(ivy): compiler should generate restoreView() for local refs in listeners (#27034)
PR Close #27034
2018-11-12 12:50:58 -08:00
Kristiyan Kostadinov e5c9f7a507 fix(ivy): provide NgZone to ComponentRef (#26898)
Fixes the r3 `TestBed` not providing an `NgZone` to the `ComponentFixture`.

PR Close #26898
2018-11-12 12:47:07 -08:00
Kara Erickson 78b6f88cb3 fix(ivy): TestBed should use an NgZone (#27015)
PR Close #27015
2018-11-09 09:56:36 -08:00
Kara Erickson 552836ebf0 fix(ivy): merged host bindings functions should take superclass hostVars into account (#27013)
PR Close #27013
2018-11-09 09:55:47 -08:00
Kara Erickson 2f36a9591d fix(ivy): providers should not be inherited (#27013)
PR Close #27013
2018-11-09 09:55:47 -08:00
Igor Minar 499e303ea3 test(ivy): add global utils to the public_api_guard test (#27008)
This API is part of our public api surface and needs to be monitored by the public_api_guard.

I also had to go back and mark all of the exported functions with @publicApi jsdoc tag.

PR Close #27008
2018-11-08 15:37:11 -08:00
Matias Niemelä e618032d53 feat(ivy): introduce `getPlayers()` to global utils (#27008)
PR Close #27008
2018-11-08 15:37:11 -08:00
Andrew Kushnir 3567e81175 fix(ivy): restore missing match operation in View and Content Queries (#26847)
PR Close #26847
2018-11-07 16:29:19 -08:00
Kara Erickson 9e26216c40 fix(ivy): compiler should generate bindings to host attrs properly (#26973)
PR Close #26973
2018-11-07 11:09:31 -08:00
Miško Hevery 53e4e0c1a3 fix(ivy): Enable AoT tests to run on CI; disable failing tests (#26975)
PR Close #26975
2018-11-07 10:35:20 -08:00
Miško Hevery 5e769d9a25 fix(ivy): add `nocollapse` to ngInjectableDef for closure compatibility (#26975)
PR Close #26975
2018-11-07 10:35:20 -08:00
Matias Niemelä 931a363612 fix(ivy): use `window.ng` instead of `window.ngDev` for debug tooling (#26951)
PR Close #26951
2018-11-06 17:08:37 -08:00
Marc Laval 297c54ebb3 fix(ivy): support env where requestAnimationFrame is not available (#26779)
PR Close #26779
2018-11-06 11:49:32 -08:00
Kara Erickson dc2464eaaa fix(ivy): jit should handle undefined type in constructor deps (#26956)
PR Close #26956
2018-11-06 11:22:14 -08:00
Misko Hevery 7d2a746090 build: remove ivy JIT mode (#26863)
PR Close #26863
2018-11-02 15:44:05 -07:00
Miško Hevery c13f46c7c5 fix(ivy): enable packages/core/test/render3 test for AoT (#26863)
PR Close #26863
2018-11-02 15:44:05 -07:00
Kara Erickson ea0a99610d fix(ivy): init hooks should be called before host bindings (#26802)
PR Close #26802
2018-11-01 14:49:01 -07:00
Kara Erickson 3b9bc73db4 fix(ivy): host bindings after dirs without host bindings should work (#26801)
PR Close #26801
2018-11-01 14:18:57 -07:00
Pete Bacon Darwin a64859b4bc fix(core): ensure that `ɵdefineNgModule` is available in flat-file formats (#26403)
When compiling the flat-file version of the `@angular/core` we need to be aware
that we cannot rely upon imported names to access the ivy definition functions.
The compiler is already clever enough to use local function calls rather than
trying to add a namespaced import, but there is a problem if the local name of the
function is different to the exported name. This is the case for functions that
are not part of the public API, and so are exported under a barred-O private alias.

In `@angular/core` the only decorations in use are `@NgModule` and `@Injectable`.
There are no directives, components, pipes, etc.

Since `defineInjectable` is part of the public API of `@angular/core`, the compiler
is able to generate code that references the original non-barred-O version of the
function.

But the `defineNgModule` is not part of the public API and so the compiler must
generate code that refers to it by the private barred-O version of the function.

This commit imports and then re-exports this barred-O version of `defineModule` to
ensure that the symbol is available in the local scope of the flat-file versions of
the `@angular/core` library.

PR Close #26403
2018-11-01 14:13:26 -07:00
Miško Hevery 683d53db4b docs: add `Function Inlining` rules to `PERF_NOTES.md` (#26876)
PR Close #26876
2018-11-01 13:47:34 -07:00
Kara Erickson a2929dfd57 fix(ivy): dynamically created components should run init hooks (#26864)
PR Close #26864
2018-11-01 13:44:10 -07:00
Kara Erickson 911bfef04c fix(ivy): bindings should be checked in components created dynamically by root component' (#26864)
PR Close #26864
2018-11-01 13:44:10 -07:00
Kara Erickson aadbc8a9d3 fix(ivy): sync exported r3 symbol with compiler generated symbol (#26877)
PR Close #26877
2018-11-01 13:32:35 -07:00
Igor Minar 2e7b5c5d64 test: fix broken golden file for packages/core/test/bundling/hello_world_r2 (#26893)
PR Close #26893
2018-11-01 06:03:12 -07:00
Alex Rickabaugh 8634d0bcd8 feat(ivy): emit metadata along with all Angular types (#26860)
This commit causes a call to setClassMetadata() to be emitted for every
type being compiled by ngtsc (every Angular type). With this metadata,
the TestBed should be able to recompile these classes when overriding
decorator information.

Testing strategy: Tests in the previous commit for
generateSetClassMetadataCall() verify that the metadata as generated is
correct. This commit enables the generation for each DecoratorHandler,
and a test is added to ngtsc_spec to verify all decorated types have
metadata generated for them.

PR Close #26860
2018-10-31 19:52:36 -04:00
Alex Rickabaugh ca1e538752 feat(ivy): setClassMetadata() for assigning decorator metadata (#26860)
This commit introduces the setClassMetadata() private function, which
adds metadata to a type in a way that can be accessed via Angular's
ReflectionCapabilities. Currently, it writes to static fields as if
the metadata being added was downleveled from decorators by tsickle.

The plan is for ngtsc to emit code which calls this function, passing
metadata on to the runtime for testing purposes. Calls to this function
would then be tree-shaken away for production bundles.

Testing strategy: proper operation of this function will be an integral
part of TestBed metadata overriding. Angular core tests will fail if this
is broken.

PR Close #26860
2018-10-31 19:52:36 -04:00
Misko Hevery d042c4afe0 fix(core): Remove static dependency from @angular/core to @angular/compiler (#26734)
PR Close #26734
2018-10-31 14:15:06 -04:00
Matias Niemelä 5d740785a9 docs: fix aot typo 2018-10-30 17:37:20 -07:00
Matias Niemelä 68b2211e64 fix(ivy): ensure falsy styling is not applied during creation mode (#26793)
PR Close #26793
2018-10-30 19:41:56 -04:00
Trotyl 95743e3a64 fix(core): support computed base class in metadata inheritance (#24014)
PR Close #24014
2018-10-30 13:48:22 -04:00
Pawel Kozlowski ede65dbede fix(ivy): allow root components to inject ViewContainerRef (#26682)
PR Close #26682
2018-10-29 18:47:14 -04:00
Pawel Kozlowski 578e4c7642 fix(ivy): compile queries in JIT mode (#26816)
PR Close #26816
2018-10-29 18:46:44 -04:00
Kara Erickson 96770e5c6b fix(ivy): optional dependencies should not throw with module injector (#26763)
PR Close #26763
2018-10-29 14:12:36 -04:00
Kara Erickson 1130e48541 fix(ivy): host injection flag should not throw for embedded views (#26795)
PR Close #26795
2018-10-29 14:12:11 -04:00
Andrew Kushnir 2a869271f6 fix(ivy): move HostListeners generation to factory function (#26480)
PR Close #26480
2018-10-29 14:02:22 -04:00
Kara Erickson d52d82d744 fix(ivy): injecting optional TemplateRef on element should not throw (#26664)
PR Close #26664
2018-10-26 18:11:27 -04:00
Matias Niemelä d50d400231 build: fix formatting issue in host_binding_spec file 2018-10-26 14:33:04 -07:00
Kara Erickson 19fcfc3d00 fix(compiler): generate inputs with aliases properly (#26774)
PR Close #26774
2018-10-26 17:23:45 -04:00
Matias Niemelä c048358cf9 build: fix the golden files for hello_world_r2 2018-10-26 14:20:40 -07:00
Matias Niemelä 8171a2ab94 fix(ivy): ensure pipe declarations are populated lazily when a forward ref is detected (#26765)
PR Close #26765
2018-10-26 15:57:10 -04:00
Kara Erickson 2fd4c372d5 fix(ivy): resolve forward refs in providers (#26766)
PR Close #26766
2018-10-26 15:50:11 -04:00
Kara Erickson f76ce84ae1 fix(ivy): host bindings should work on nodes with providers (#26771)
PR Close #26771
2018-10-26 15:49:30 -04:00
Igor Minar 40bbfbf961 test(ivy): fix or disable failing ivy tests (#26735)
These tests were previously not running on CI so they have always been broken,
or got broken just recently :-(.

test(ivy): mark failing test targets with fixme-ivy-jit and fixme-ivy-local tags

PR Close #26735
2018-10-26 14:48:05 -04:00
Miško Hevery 95f852e856 build: fix comment formatting to make closure happy (#26769)
PR Close #26769
2018-10-25 19:40:36 -04:00
Kara Erickson 2c7386c961 feat(ivy): support injecting the injector (#26699)
PR Close #26699
2018-10-25 18:47:56 -04:00
Shino Kurian d5cbcef0ea fix(core): ignore comment nodes under unsafe elements (#25879)
Comment nodes that are child nodes of unsafe elements are identified as text nodes. This results in the comment node being returned as an encoded string.
Add a check to ignore such comment nodes.

PR Close #25879
2018-10-25 11:20:19 -07:00
Marc Laval b0476f308b feat(ivy): support providers and viewProviders (#25803)
PR Close #25803
2018-10-25 12:58:40 -04:00
Matias Niemelä 9dc52d9d04 feat(ivy): expose a series of debug console tools (#26705)
PR Close #26705
2018-10-24 20:30:51 -04:00
Matias Niemelä 297dc2bc02 fix(ivy): ensure `ngClass` works with [class] bindings (#26559)
PR Close #26559
2018-10-24 20:27:12 -04:00
Alex Rickabaugh bf9ab53f12 build(ivy): fix typo in build file 2018-10-24 10:07:49 -07:00
Alex Rickabaugh d99f661af7 build(ivy): properly tag the js_expected_symbol_test rules
Previously the rules were tagged ivy-only, but missing the ivy-aot tag
which would cause them to run under CI.
2018-10-24 10:04:06 -07:00
Alex Rickabaugh 5d58a31d86 fix(ivy): rename broken reflect_metadata switch file
This file was missed during the rename of the --define=compile
flag value from 'local' to 'aot. It's referenced as
reflect_metadata_${compile}.
2018-10-24 09:53:10 -07:00
Igor Minar ee0b857172 build: rename the ivy compile mode 'local' to 'aot' (#26686)
PR Close #26686
2018-10-23 14:14:49 -07:00
Igor Minar 4237c34c78 test(ivy): mark failing test targets with fixme-ivy-jit and fixme-ivy-local tags (#26471)
We are close enough to blacklist a few test targets, rather than whitelist targets to run...

Because bazel rules can be composed of other rules that don't inherit tags automatically,
I had to explicitly mark all of our ts_library and ng_module targes with "ivy-local" and
"ivy-jit" tags so that we can create a query that excludes all fixme- tagged targets even
if those targets are composed of other targets that don't inherit this tag.

This is the updated overview of ivy related bazel tags:

- ivy-only: target that builds or runs only under ivy
- fixme-ivy-jit: target that doesn't yet build or run under ivy with --compile=jit
- fixme-ivy-local: target that doesn't yet build or run under ivy with --compile=local
- no-ivy-jit: target that is not intended to build or run under ivy with --compile=jit
- no-ivy-local: target that is not intended to build or run under ivy with --compile=local

PR Close #26471
2018-10-23 08:57:42 -07:00
Pawel Kozlowski ff767dd153 fix(ivy): support ViewContainerRef ng-container children (#26646)
Issue found while running NgPlural tests with ivy

PR Close #26646
2018-10-23 08:52:30 -07:00
Anthony Ciccarello 6737e91974 docs(core): fix spelling in ComponentFactory (#26603)
PR Close #26603
2018-10-22 10:38:56 -07:00
Greg Magolan 15c2467dbd build: review comments addressed (#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
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 24521f549c docs: convert all `@experimental` tags to `@publicApi` tags (#26595)
PR Close #26595
2018-10-19 14:35:52 -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
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
Matias Niemelä 9e5d440a0b refactor(ivy): handle animation metadata normalization in the compiler (#26481)
PR Close #26481
2018-10-16 20:31:04 -07:00
Miško Hevery 7d82053117 docs(ivy): i18n design (#26091)
PR Close #26091
2018-10-16 14:08:01 -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
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
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
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
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
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 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
Judy Bogart f543d71cc3 docs: add package doc files (#26047)
PR Close #26047
2018-10-05 15:42: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 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 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
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ä 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 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
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 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
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 d5f47d6b71 refactor(ivy): special injection tokens should not be cached (#26048)
PR Close #26048
2018-09-20 18:02:08 -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
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
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
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
cexbrayat 21009b06a1 fix(ivy): use proper sanitizer names (#25817)
Fixes #25816

PR Close #25817
2018-09-11 16:22:38 -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 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
Ben Lesh 7ba0cb7c93 refactor(ivy): remove superfluous Array check (#25894)
related #25755

PR Close #25894
2018-09-10 14:00:58 -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
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
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
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
Marc Laval 00f13110be feat(ivy): support injecting Renderer2 (#25523)
PR Close #25523
2018-08-31 09:42:36 -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 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
Kara Erickson b06f1c0087 refactor(ivy): remove duplicate global (#25756)
PR Close #25756
2018-08-30 21:20:15 -07: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
Alan Agius 5653fada32 feat: add TypeScript 3 support (#25275)
PR Close #25275
2018-08-27 21:07:53 -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 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
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
Kara Erickson 27e2039630 fix(compiler): update compiler to generate new slot allocations (#25607)
PR Close #25607
2018-08-22 21:08:39 -04:00
Kara Erickson d5b70e0c66 fix(ivy): create LViewData from blueprint (#25587)
PR Close #25587
2018-08-22 15:58:42 -04: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
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
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
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
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
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
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 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
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
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 97d8b5ed88 fix(ivy): reordering how root is acquired (#25470)
PR Close #25470
2018-08-13 17:25:47 -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 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
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
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
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
Pawel Kozlowski dbdbbdbe86 fix(ivy): support ng-container inside another ng-container (#25346)
PR Close #25346
2018-08-07 11:48:42 -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
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
JoostK 4e264781ee refactor(ivy): do not mention LViewData in public documentation (#25292)
PR Close #25292
2018-08-03 14:48:11 -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
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
Victor Berchet d46a961509 docs(ivy): API doc tweaks (#25258)
PR Close #25258
2018-08-01 16:19:54 -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
Kara Erickson c8a4fb1faf fix(ivy): walk declaration views in listener (#25228)
PR Close #25228
2018-07-31 16:35:20 -07:00
Ben Lesh 64516da6b0 feat(ivy): support inheriting input/output from bare base class (#25094)
PR Close #25094
2018-07-31 16:25:11 -07:00
Miško Hevery 6e2a1877ab refactor(core): remove withBody from public testing API (#25171)
PR Close #25171
2018-07-31 15:09:32 -07:00
Misko Hevery aafd502bcb fix(ivy): default to `ngDevMode = true` (#25208)
Before the `ngDevMode` had to be set explicitly or it would throw
an exception at runtime. This changes it so that if `ngDevModu` is
`undefined` than we default to `ngDevMode = true`. In other words
unless the developer has explicitly asked to make a prodution build
by setting `ngDevMode = false` as compilation constant, the default
is `ngDevMode = true`.

This also fixes a minor bug where the setup code would read
`global['ngDevMode']` but all other code would read `global.ngDevMode`.
This would cause issues with closure compiler since the
reading of the `ngDevMode` must be consistent.

PR Close #25208
2018-07-31 14:19:19 -07:00
Marc Laval e3834b7001 feat(ivy): support change detection on the root view (#25085)
PR Close #25085
2018-07-30 21:50:54 -07:00
Victor Berchet 36648293a8 refactor(ivy): misc (#25174)
PR Close #25174
2018-07-30 16:59:48 -07:00
Marc Laval cd89eb8404 feat(ivy): implement the getters of ViewContainerRef (#25174)
BREAKING CHANGE: ViewContainerRef.parentInjector is deprecated without replacement

PR Close #25174
2018-07-30 16:59:48 -07:00
Carlos Ortiz Garcia e99d860393 feat(compiler): add "original" placeholder value on extracted XMB (#25079)
Update XMB placeholders(<ph>) to include the original value on top of an
example. Placeholders can by definition have one example(<ex>) tag and a
text node. The text node is used by TC as the "original" value from the
placeholder, while the example should represent a dummy value.
For example: <ph name="PET"><ex>Gopher</ex>{{ petName }}</ph>.
This change makes sure that we have the original text, but it *DOES NOT*
make sure that the example is correct. The example has the same wrong
behavior of showing the interpolation text rather than a useful
example.

No breaking changes, but tools that depend on the previous behavior and
don't consider the full XMB definition may fail to parse the XMB.
Fixes b/72565847

PR Close #25079
2018-07-30 16:49:00 -07:00
Kara Erickson 2ef777b0b2 fix(ivy): convert context code into a tree-shakable instruction (#24943)
PR Close #24943
2018-07-30 15:54:11 -07:00
Kara Erickson fe14f180a6 fix(compiler): update compiler to flatten nested template fns (#24943)
PR Close #24943
2018-07-30 15:54:11 -07:00
Kara Erickson 87419097da fix(ivy): flatten template fns for nested views (#24943)
PR Close #24943
2018-07-30 15:54:11 -07:00
Victor Berchet 6a797d5401 refactor(ivy): `element` and `ElementStart` retuns `void` (#25173)
use `loadElement` to load an element when needed in specs

PR Close #25173
2018-07-27 17:22:18 -07:00
Victor Berchet 89e8b6fc0e refactor(ivy): update specs to make use of the `element()` instruction (#25173)
PR Close #25173
2018-07-27 17:22:18 -07:00
Victor Berchet 8e65891985 build(ivy): fix ci failures (#25166)
PR Close #25166
2018-07-27 18:47:13 -04:00
Victor Berchet 7f59170f77 refactor(ivy): use `element()` where applicable in di_spec (#25166)
For future ref
Search `elementStart\(([^)]+)\);\s*\n\s*elementEnd\(\);`
Replace `element($1)`

PR Close #25166
2018-07-27 18:47:13 -04:00
Victor Berchet 9ea112473b refactor(ivy): use bit operations in node injector (#25166)
PR Close #25166
2018-07-27 18:47:13 -04:00
Victor Berchet 16f0ac38b8 refactor(ivy): simplify node injector imports (#25166)
PR Close #25166
2018-07-27 18:47:13 -04:00
Victor Berchet 15df853622 fix(ivy): walk the node injector tree and then the module injector tree (#25166)
- `directiveInjector()` is used to inject anything in the directive / component
/ pipe factories so adding `InjectionToken<T>` as a supported token type.
- `getOrCreateInjectable()` should search first in the node injector tree and
then in the module injector tree (was either or before the PR).

PR Close #25166
2018-07-27 18:47:13 -04:00
Victor Berchet d3c0915598 docs(ivy): clarify injector API docs (#25166)
PR Close #25166
2018-07-27 18:47:13 -04:00
George Kalpakas 342678486d test: fix typings for `DoneFn` (#25163)
This also fixes CI tests, which were accidentally broken in #24663.

PR Close #25163
2018-07-27 11:13:32 -07:00
Greg Magolan 1d051c5841 build(bazel): use bazel managed node_modules for downstream angular from source build support (#24663)
PR Close #24663
2018-07-26 17:02:21 -07:00
Alex Rickabaugh ed7aa1c3e5 fix(ivy): force new imports for .d.ts files (#25080)
When ngtsc encounters a reference to a type (for example, a Component
type listed in an NgModule declarations array), it traces the import
of that type and attempts to determine the best way to refer to it.

In the event the type is defined in the same file where a reference
is being generated, the identifier of the type is used. If the type
was imported, ngtsc has a choice. It can use the identifier from the
original import, or it can write a new import to the module where the
type came from.

ngtsc has a bug currently when it elects to rely on the user's import.
When writing a .d.ts file, the user's import may have been elided as
the type was not referred to from the type side of the program. Thus,
in .d.ts files ngtsc must always assume the import may not exist, and
generate a new one.

In .js output the import is guaranteed to still exist, so it's
preferable for ngtsc to continue using the existing import if one is
available.

This commit changes how @angular/compiler writes type definitions, and
allows it to use a different expression to write a type definition than
is used to write the value. This allows ngtsc to specify that types in
type definitions should always be imported. A corresponding change to
the staticallyResolve() Reference system allows the choice of which
type of import to use when generating an Expression from a Reference.

PR Close #25080
2018-07-26 16:38:09 -07:00
Miško Hevery e1c6fd5453 Revert "feat(core): add support for using async/await with Jasmine" (#25096)
This reverts commit f6829aba55e07609e312b4f67dbc9dbbf36e4e46.

PR Close #25096
2018-07-25 11:44:56 -07:00
Olivier Combe 1ceddb6290 fix(ivy): support re-order embedded templates (#24805)
PR Close #24805
2018-07-24 16:41:05 -07:00
Olivier Combe 22731a7588 refactor(ivy): split i18nInterpolation into 8 functions (#24805)
PR Close #24805
2018-07-24 16:41:05 -07:00
Olivier Combe 72dd10f78f refactor(ivy): cleanup runtime i18n code (#24805)
Fixes #24785

PR Close #24805
2018-07-24 16:41:05 -07:00
Marc Laval 445b9a5627 feat(ivy): support ViewContainerRef.createComponent() (#24997)
PR Close #24997
2018-07-24 08:23:23 -07:00
Matias Niemelä 169e9dd2c8 feat(ivy): bridge compile instructions to include sanitization helpers (#24938)
PR Close #24938
2018-07-23 08:49:52 -07:00
Pawel Kozlowski 13f3157823 fix(ivy): update content query compilation to latest runtime (#24957)
PR Close #24957
2018-07-23 08:45:50 -07:00
Vikram Subramanian 6b859daea4 fix(core): stop reusing provider definitions across NgModuleRef instances (#25022)
Fixes #25018.

Instantiating a NgModuleRef from NgModuleFactory reuses the NgModuleDefinition if it is already present. However the NgModuleDefinition has a providers array which modified when tree shakable providers are instantiated. This corrupts the provider definitions the next time the same factory is used to create a new NgModuleRef - Two provider definitions can end up with the same index anf the injector could potentially return a completely wrong object for a provider token.

This scenario is more likely on the server where the same NgModuleFactory is reused across requests.

The fix clones the cached NgModuleDefinition so that any tree shakable providers added later do not affect the cached copy.

PR Close #25022
2018-07-23 08:13:29 -07:00
Judy Bogart 7960d1879d
docs: technical review incorporated (#24744)
closes #24744
2018-07-20 12:40:00 -07:00
Judy Bogart f1ab394218
docs: add api doc to commonly queried elements 2018-07-20 12:39:10 -07:00
Alex Rickabaugh 41ef75869c fix(ivy): types in .d.ts files should account for generics (#24862)
Ivy definition types have a generic type which specifies the return
type of the factory function. For example:

static ngDirectiveDef<NgForOf, '[ngFor][ngForOf]'>

However, in this case NgForOf itself has a type parameter <T>. Thus,
writing the above is incorrect.

This commit modifies ngtsc to understand the genericness of NgForOf and
to write the following:

static ngDirectiveDef<NgForOf<any>, '[ngFor][ngForOf]'>

PR Close #24862
2018-07-20 11:48:36 -07:00
Alex Rickabaugh 2b8b647006 fix(ivy): export injectElementRef (#24862)
PR Close #24862
2018-07-20 11:48:36 -07:00
Alex Rickabaugh ed1db40322 fix(ivy): use 'typeof' and 'never' for type metadata (#24862)
Previously ngtsc would use a tuple of class types for listing metadata
in .d.ts files. For example, an @NgModule's declarations might be
represented with the type:

[NgIf, NgForOf, NgClass]

If the module had no declarations, an empty tuple [] would be produced.

This has two problems.

1. If the class type has generic type parameters, TypeScript will
complain that they're not provided.

2. The empty tuple type is not actually legal.

This commit addresses both problems.

1. Class types are now represented using the `typeof` operator, so the
above declarations would be represented as:

[typeof NgIf, typeof NgForOf, typeof NgClass].

Since typeof operates on a value, it doesn't require generic type
arguments.

2. Instead of an empty tuple, `never` is used to indicate no metadata.

PR Close #24862
2018-07-20 11:48:36 -07:00
Alex Rickabaugh d3594fc1c5 fix(ivy): correctly export all *Def symbols as private (#24862)
Previously, some of the *Def symbols were not exported or were exported
as public API. This commit ensures every definition type is in the
private export namespace.

PR Close #24862
2018-07-20 11:48:36 -07:00
Alex Rickabaugh 9644873023 fix(ivy): ignore imports without ngInjectorDef in r3_injector (#24862)
ngInjectorDef.imports is generated from @NgModule.imports plus
@NgModule.exports. A problem arises as a result, because @NgModule
exports contain not only other modules (which will have ngInjectorDef
fields), but components, directives, and pipes as well. Because of
locality, it's difficult for the compiler to filter these out at
build time.

It's not impossible, but for now filtering them out at runtime will
allow testing of the compiler against complex applications.

PR Close #24862
2018-07-20 11:48:36 -07:00
Alex Rickabaugh ae4563202c fix(ivy): export NgModuleFactory adapter (#24862)
PR Close #24862
2018-07-20 11:48:36 -07:00