Commit Graph

3209 Commits

Author SHA1 Message Date
Paul Gschwendtner ac5f5ed0a6 test(bazel): re-enable ng_package golden testing on ci (#27829)
* Enables the ng_package golden testing on the CI
* Fixes the ng_package golden testing for Windows

PR Close #27829
2019-01-07 14:46:47 -08:00
Paul Gschwendtner 8122970f63 test(bazel): fix all ng_package tests not working on windows (#27829)
PR Close #27829
2019-01-07 14:46:47 -08:00
Paul Gschwendtner 8473d68ea8 fix(bazel): packager not properly removing amd directives on windows (#27829)
PR Close #27829
2019-01-07 14:46:46 -08:00
Paul Gschwendtner 4caf6540d1 fix(bazel): ng_package creates invalid typings reexport on windows (#27829)
Currently when building a package on Windows, the typings re-export for secondary entry-points is not valid TypeScript. Similarly the metadata and the "package.json" files use non-posix paths and cause inconsistency within the NPM package.

For example:

_package.json_
```
  "esm5": "./esm5\\core.js",
  "esm2015": "./esm2015\\core.js",
```

_testing.d.t.s_ (of the `core` package)
```
export * from './testing\testing';
```

PR Close #27829
2019-01-07 14:46:46 -08:00
Andrew Kushnir a75c734471 fix(ivy): restore NG defs after running tests in TestBed (#27786)
`R3TestBed` allows consumers to configure a "testing module", declare components, override various metadata, etc. To do this, it implements its own JIT compilation, where components/directives/modules have Ivy definition fields generated based on testing metadata. It results in tests interfering with each other. One test might override something in a component that another test tries to use normally, causing failures.

In order to resolve this problem, we store current components/directives/modules defs before applying overrides and re-compiling. Once the test is complete, we restore initial defs, so the next tests interact with "clean" components.

PR Close #27786
2019-01-07 14:44:14 -08:00
Marc Laval e775313188 fix(ivy): ngOnDestroy hooks should be called on providers (#27955)
PR Close #27955
2019-01-07 14:43:33 -08:00
Marc Laval 996435b79a refactor(ivy): remove TView.pipeDestroyHooks (#27955)
PR Close #27955
2019-01-07 14:43:33 -08:00
Pawel Kozlowski 45880532bf test(ivy): update root causes for @angular/core tests (#27961)
PR Close #27961
2019-01-07 08:44:57 -08:00
Pawel Kozlowski e08feb7e54 refactor(ivy): unify native node handling around render parent and element / ICU containers (#27925)
PR Close #27925
2019-01-07 08:36:51 -08:00
Pawel Kozlowski 8a3cebde8b fix(ivy): support ICU messages inside <ng-container> (#27925)
PR Close #27925
2019-01-07 08:36:51 -08:00
Pawel Kozlowski d80c32310a refactor(ivy): remove code duplication in native nodes manipulation (#27925)
PR Close #27925
2019-01-07 08:36:51 -08:00
Pawel Kozlowski 3ac249b2ab refactor(ivy): renames and documentation updates (#27925)
PR Close #27925
2019-01-07 08:36:50 -08:00
Kara Erickson 6b0c1a71fa test(ivy): turn on platform-browser-dynamic tests on CI (#27940)
We missed removing the `fixme-ivy-aot` bazel tag from the BUILD file
of platform-browser-dynamic, so we weren't running the
`//packages/platform-browser-dynamic/test:test_web_chromium-local`
test target on CI. This commit turns on the tests and adds root causes
where they are known.

PR Close #27940
2019-01-05 17:48:11 -08:00
Greg Magolan e7f43386a6 build: update to Bazel 0.21.0 (#27935)
PR Close #27935
2019-01-04 18:38:44 -08:00
Miško Hevery 411de252d7 fix(ivy): disable test which rely on DebugElement in WebWorker (#27895)
PR Close #27895
2019-01-04 18:37:31 -08:00
Alan Agius b61dafaeac refactor: remove redundant error in catch (#25478)
PR Close #25478
2019-01-04 15:42:19 -08:00
Marc Laval 929334b0bf fix(ivy): should not throw when getting VCRef.parentInjector on the root view (#27909)
PR Close #27909
2019-01-04 14:57:39 -08:00
Marc Laval fb7816fed4 fix(ivy): element injector on the host of a component should see viewProviders of that component (#27928)
PR Close #27928
2019-01-04 14:46:15 -08:00
Matias Niemelä 5d3dcfc6ad fix(ivy): ensure @animation host bindings/listeners work properly (#27896)
PR Close #27896
2019-01-04 14:12:29 -08:00
Marc Laval 0bd9deb9f5 fix(ivy): pipes should overwrite pipes with later entry in the pipes array (#27910)
PR Close #27910
2019-01-04 13:21:46 -08:00
Kristiyan Kostadinov 13d23f315b fix(ivy): ngtsc program emit ignoring custom transformers (#27837)
Fixes the `customTransformers` that are passed to the `NgtscProgram.emit` not being passed along.

PR Close #27837
2019-01-04 12:29:15 -08:00
George Kalpakas 48555f95c6 fix(ivy): ensure unique template and listener function identifiers (#27766)
Previously, there could be identical template/listener function names
for a component's template, if it had multiple similarly structured
nested sub-templates or listeners.
This resulted in build errors:
`Identifier '<SOME_IDENTIFIER>' has already been declared`

This commit fixes this by ensuring that the template index is included
in the `contextName` passed to the `TemplateDefinitionBuilder`
responsible for processing nested sub-templates.
Similarly, the template or element index is included in the listener
names.

PR Close #27766
2019-01-04 12:28:11 -08:00
George Kalpakas d026b675be refactor(ivy): minor refactoring / code clean-up (#27766)
PR Close #27766
2019-01-04 12:28:11 -08:00
Kara Erickson 7eb2c41fb2 fix(ivy): ng-content tags in re-inserted templates should walk declaration tree (#27783)
This PR assures that content projection works if an <ng-content> tag is
placed inside an <ng-template> in one component and that <ng-template>
is inserted into a different component. It fixes a bug where the
projection instruction code would walk up the insertion tree to find
selector data instead of the declaration tree.

PR Close #27783
2019-01-04 12:20:18 -08:00
Andrew Kushnir 3f2ebbd7ab fix(ivy): support bindings in ICUs in nested contexts (#27914)
Prior to this change, ICU extraction logic was not taking into account nested bindings (that look like this: �0:1�) and only accounted for top level bindings (like this �0�). As a result, ICUs were not parsed and remained as text in the output. Now the extraction logic (regular expressions) take into account the nested bindings format as well.

PR Close #27914
2019-01-04 12:19:46 -08:00
Andrew Kushnir 38b4d15227 fix(ivy): implement 'TestBed.overrideTemplateUsingTestingModule' function (#27717)
Adding 'TestBed.overrideTemplateUsingTestingModule' function that overrides Component template and uses TestingModule as a scope.

PR Close #27717
2019-01-04 12:19:20 -08:00
Ben Lesh 51a0bd2e75 test(ivy): correct attribute marker in broken test (#27919)
Test incorrectly marks the attribute as a 'Class', when it should be 'SelectOnly'

PR Close #27919
2019-01-03 16:10:00 -08:00
Fabian Wiles 1b0b36d143 fix(forms): match getError and hasError to get method signature (#20211)
Internally getError and hasError call the AbstractControl#get method which takes  `path: Array<string | number> | string` as input, since there are different ways to traverse the AbstractControl tree.
This change matches the method signitures of all methods that use this.

PR Close #20211
2019-01-03 10:16:06 -08:00
Kara Erickson e268a0579a docs(forms): update desc for hasError and getError (#27861)
This commit adds docs for the changes made in #20211.

Closes #19734.

PR Close #27861
2019-01-03 10:15:23 -08:00
Misko Hevery 1f1e77b641 fix(ivy): don’t publish animation bindings as attributes (#27805)
Some of the animation tests have been failing because animation gets
triggered multiple times. The reason for this is that the compiler was
generating static attribute bindings in addition to dynamic bindings.
This created multiple writes to the animation render which failed the
tests.

PR Close #27805
2019-01-03 09:39:25 -08:00
crisbeto 5fee444fea test(ivy): update test failure root cause (#27855)
Updates the root cause for a couple of the test failures.

PR Close #27855
2019-01-03 09:37:26 -08:00
Paul Gschwendtner 1e6c9be86c fix(bazel): unable to launch protractor test on windows (#27850)
Due to an incorrect environment variable name, it's currently not possible to launch Protractor on Windows using the Bazel protractor rule.

PR Close #27850
2019-01-03 09:36:37 -08:00
Andrew Kushnir a9790018df fix(ivy): resolve `forwardRefs` correctly in TestBed (JIT) (#27737)
Forward refs in some places (like imports/export/providers/viewProviders/queries) were not resolved before passing to compilation phase. Now we resolve missing refs before invoking compile function.

PR Close #27737
2019-01-03 09:34:15 -08:00
Marc Laval b7d0ab7de3 test(ivy): enable more @angular/core tests (#27912)
PR Close #27912
2019-01-03 09:22:22 -08:00
Marc Laval 460be795cf test(ivy): add root cause analysis for failing core tests (view injector integration) (#27912)
PR Close #27912
2019-01-03 09:22:22 -08:00
Judy Bogart c4f7727408 docs: add api doc for viewport scroller (#27381)
PR Close #27381
2018-12-26 11:47:16 -08:00
Alex Eagle d1de9ff313 build: update to latest rules_nodejs (#27764)
This includes a performance fix for module resolution in the common case under Ivy

PR Close #27764
2018-12-26 11:31:37 -08:00
Olivier Combe c34eee4e8e test(ivy): root cause analysis for `@angular/platform-server` (#27800)
PR Close #27800
2018-12-26 11:17:45 -08:00
Michael De Wree 9b91beed69 docs: fix typo explictly (#27798)
Closes #27796

PR Close #27798
2018-12-26 06:57:55 -05:00
Matias Niemelä eea2b0f288 revert: fix(router): ensure URL is updated after second redirect with UrlUpdateStrategy="eager" (#27523) 2018-12-25 22:14:07 -08:00
Matias Niemelä 13eb57a59f fix(ivy): merge static style rendering across elements, directives and components (#27661)
PR Close #27661
2018-12-21 18:14:44 -05:00
Andrew Kushnir 4b67b0af3e fix(ivy): adding TestBed.overrideProvider support (#27693)
Prior to this change, provider overrides defined via TestBed.overrideProvider were not applied to Components/Directives. Now providers are taken into account while compiling Components/Directives (metadata is updated accordingly before being passed to compilation).

PR Close #27693
2018-12-21 16:39:34 -05:00
jnizet bba5e2632e docs(forms): clarify the pattern validator behavior (#27560)
PR Close #27560
2018-12-21 15:12:31 -05:00
Andrew Kushnir 509aa61619 fix(ivy): apply all overrides from TestBed, not the last one only (#27734)
In some cases in our tests we can define multiple overrides for a given class. As a result, only the last override is actually applied due to the fact that we store overrides in a Type<->Override map. This update changes the logic to keep all overrides defined in a given test for a Type (i.e. Type<->Override[] map) and applies them one by one at resolution phase. This behavior is more inline with the previous TestBed.

PR Close #27734
2018-12-21 15:09:00 -05:00
Pawel Kozlowski cdd737e28b test(ivy): mark tests using getDebugContext as obsolete in ivy (#27790)
PR Close #27790
2018-12-21 15:07:31 -05:00
Marc Laval 5da55d6246 test(ivy): add root cause analysis for failing router tests (#27792)
PR Close #27792
2018-12-21 15:06:56 -05:00
George Kalpakas 50a91ba28c docs(upgrade): add gotchas/tips/example for multiple downgraded modules (#27217)
PR Close #27217
2018-12-20 16:20:41 -05:00
George Kalpakas 077a5fb04b test(upgrade): test injector tree traversal for downgraded components (#27217)
This commit adds tests that verify the current behavior wrt injector
tree traversal for downgraded components, so that it is easier to
contrast with changed behavior is future commits (should we decide
to actually change it).

PR Close #27217
2018-12-20 16:20:41 -05:00
George Kalpakas bc0ee01d09 fix(upgrade): allow nesting components from different downgraded modules (#27217)
PR Close #27217
2018-12-20 16:20:41 -05:00
George Kalpakas 326b464d20 fix(upgrade): correctly handle nested downgraded components with `downgradeModule()` (#27217)
Previously, nested downgraded components would not be created/destroyed
inside the Angular zone (as they should) and they would not be wired up
correctly for change detection.

This commit ensures that ngUpgrade correctly detects whether this is an
ngUpgradeLite app (i.e. one using `downgradeModule()` instead of
`UpgradeModule`) and appropriately handles components, even if they are
nested inside other downgraded components.

Fixes #22581
Closes #22869
Closes #27083

PR Close #27217
2018-12-20 16:20:41 -05:00
George Kalpakas 8a7498e0ef refactor(upgrade): simplify special handling of ngUpgradeLite in `downgradeComponent()` (#27217)
PR Close #27217
2018-12-20 16:20:41 -05:00
Jason Aden 07ada7f3d9 fix(router): ensure URL is updated after second redirect with UrlUpdateStrategy="eager" (#27523)
Navigating to a route such as `/users`, you may get redirected to `/login`. Previously, if you go then route to `/users` again the URL will end up showing `/users` after the second redirect. This only happened in `UrlUpdateStrategy="eager"`. This is now fixed so after the second redirect, the URL shows the correct page.

Fixes #27116

PR Close #27523
2018-12-20 16:18:52 -05:00
Matias Niemelä 880e8a5cfc refactor: fix broken formatting 2018-12-20 09:16:09 -08:00
Pawel Kozlowski a0585c9a9a fix(ivy): correct content projection with nested templates (#27755)
Previously ivy code generation was emmiting the projectionDef instruction in
a template where the <ng-content> tag was found. This code generation logic was
incorrect since the ivy runtime expects the projectionDef instruction to be present
in the main template only.

This PR ammends the code generation logic so that the projectionDef instruction is
emmitedin the main template only.

PR Close #27755
2018-12-20 12:01:20 -05:00
Kristiyan Kostadinov a833b98fd0 fix(ivy): change detection strategy not being passed to compiler (#27753)
Fixes the defined change detection strategy not being passed to the compiler when a component is being compiled.

PR Close #27753
2018-12-20 12:00:58 -05:00
Pete Bacon Darwin 4b70a4e905 feat(ivy): support NgModule metadata from calls that do not return ModuleWithProviders types (#27326)
Normally functions that return `ModuleWithProvider` objects should parameterize
the return type to include the type of `NgModule` that is being returned. For
example `forRoot(): ModuleWithProviders<RouterModule>`.

But in some cases, especially those generated by nccc, these functions to not
explicitly declare `ModuleWithProviders` as their return type. Instead they
return a "intersection" type, one of whose members is a type literal that
declares the `NgModule` type returned. For example:
`forRoot(): CustomType&{ngModule:RouterModule}`.

This commit changes the `NgModuleDecoratorHandler` so that it can extract
the `NgModule` type from either kind of declaration.

PR Close #27326
2018-12-20 11:58:50 -05:00
Pete Bacon Darwin f2a1c66031 feat(ivy): ngcc - add typings to `ModuleWithProviders` functions (#27326)
Exported functions or static method that return a `ModuleWithProviders`
compatible structure need to provide information about the referenced
`NgModule` type in their return type.

This allows ngtsc to be able to understand the type of `NgModule` that is
being returned from calls to the function, without having to dig into the
internals of the compiled library.

There are two ways to provide this information:

* Add a type parameter to the `ModuleWithProviders` return type. E.g.

```
static forRoot(): ModuleWithProviders<SomeNgModule>;
```

* Convert the return type to a union that includes a literal type. E.g.

```
static forRoot(): (SomeOtherType)&{ngModule:SomeNgModule};
```

This commit updates the rendering of typings files to include this type
information on all matching functions/methods.

PR Close #27326
2018-12-20 11:58:49 -05:00
Pete Bacon Darwin cfb8c17511 feat(ivy): ngcc - map functions as well as classes from source to typings (#27326)
To support updating `ModuleWithProviders` calls,
we need to be able to map exported functions between
source and typings files, as well as classes.

PR Close #27326
2018-12-20 11:58:49 -05:00
Kara Erickson 99d0e27587 test(ivy): update root cause for core test (#27768)
PR Close #27768
2018-12-20 11:58:14 -05:00
Matias Niemelä 3ab25ab078 refactor: fix broken linting rules due to revert 2018-12-19 13:06:43 -08:00
Marc Laval 8f8572fd3e fix(ivy): @Host should behave as in View Engine (#27646)
PR Close #27646
2018-12-19 15:12:35 -05:00
Alex Eagle e8f7241366 build: fix our copy of Array#find typing (#27742)
It should be nullable, matching the lib.es2015.d.ts from TypeScript

PR Close #27742
2018-12-19 15:11:52 -05:00
Kara Erickson a20b2f72f2 fix(ivy): process creation mode deeply before running update mode (#27744)
Prior to this commit, we had two different modes for change detection
execution for Ivy, depending on whether you called `bootstrap()` or
`renderComponent()`. In the former case, we would complete creation
mode for all components in the tree before beginning update mode for
any component. In the latter case, we would run creation mode and
update mode together for each component individually.

Maintaining code to support these two different execution orders was
unnecessarily complex, so this commit aligns the two bootstrapping
mechanisms to execute in the same order. Now creation mode always
runs for all components before update mode begins.

This change also simplifies our rendering logic so that we use
`LView` flags as the source of truth for rendering mode instead of
`rf` function arguments. This fixed some related bugs (e.g. calling
`ViewRef.detectChanges` synchronously after the view's creation
would create view nodes twice, view queries would execute twice, etc).

PR Close #27744
2018-12-19 15:10:16 -05:00
Jason Aden 12c317603a feat(router): add predicate function mode for runGuardsAndResolvers (#27682)
This option means guards and resolvers will ignore changes when a provided predicate function returns `false`. This supports use cases where an application needs to ignore some param updates but not others. For example, changing a sort param in the URL might need to be ignored, whereas changing the a `project` param might require re-run of guards and resolvers.

Related to #26861 #18253 #27464

PR Close #27682
2018-12-18 13:55:06 -08:00
Miško Hevery 7901cd8cfb fix(ivy): add missing AttributeMarker export (#27485)
PR Close #27485
2018-12-18 13:23:20 -08:00
Keen Yee Liau 2c9b6c0c1f fix(compiler-cli): create LiteralLikeNode for String and Number literal (#27536)
Typescript 3.2 introduced BigInt type, and consequently the
implementation for checkExpressionWorker() in checkers.ts is refactored.

For NumberLiteral and StringLiteral types, 'text' filed must be present
in the Node type, therefore they must be LiteralLikeNode instead of
Node.

PR Close #27536
2018-12-18 13:20:01 -08:00
Igor Minar 17e702bf8b feat: add support for typescript 3.2 (#27536)
https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-2.html
https://blogs.msdn.microsoft.com/typescript/2018/11/29/announcing-typescript-3-2/

Any application using tsickle for closure compatibility will need to update it's tsickle
dependency to 0.34

PR Close #27536
2018-12-18 13:20:01 -08:00
Kara Erickson b04bc5d06c test(ivy): re-enable passing upgrade tests (#27736)
PR Close #27736
2018-12-18 13:19:28 -08:00
Misko Hevery 1c93afe956 fix(ivy): fix property names of ngOnChanges (#27714)
- #reslove FW-812
- #reslove FW-844

PR Close #27714
2018-12-18 10:42:42 -08:00
Paul Gschwendtner 1b6c4e7ae0 build: load angular.js minified output in upgrade tests (#27711)
* We should try loading Angular.JS for the upgrade tests in their minfied output. There seems to be a lot flakiness in regards to loading `AngularJS` within Travis, and the `onerror` messages aren't really too helpful. In order to reduce the payload that will be passed through the Saucelabs tunnel, we should try to load the minfied output files.

PR Close #27711
2018-12-18 09:29:27 -08:00
Keen Yee Liau f57916c0d9 fix(bazel): devserver entry_module should have underscore name (#27719)
This commit fixes a bug whereby the path of the entry_module is not
consistent with the workspace name, which does not permit dashes
in the name.

PR Close #27719
2018-12-18 09:12:55 -08:00
Miško Hevery e98c57a404 refactor(core): rename spec file to match case of src file 2018-12-17 20:51:00 -08:00
Andrew Kushnir 4bf8d64c56 fix(ivy): restore `fixmeIvy` imports for Router-related tests (#27720)
It looks like `fixmeIvy` imports were accidentally removed from Router integration tests, thus causing build errors. The necessary imports are now restored and the project should build normally.

PR Close #27720
2018-12-17 20:12:15 -08:00
Andrew Kushnir 9bfe42840b fix(ivy): call `hostBindings` function with proper element index (#27694)
We invoked `hostBindings` function in Create and Update modes with different element index due to the fact that we did not subtract HEADER_OFFSET from the index before passing it to `hostBindings` function in Create mode. Now we subtract HEADER_OFFSET value before invoking `hostBindings`, which makes Ceate and Update calls consistent.

PR Close #27694
2018-12-17 16:48:04 -08:00
Olivier Combe 4c1cd1bb78 feat(ivy): support context discovery for containers & ICU expressions (#27644)
Context discovery was only available on elements. This PR adds support for containers and ICU expressions.
FW-378 #resolve
FW-665 #comment linker integration tests

PR Close #27644
2018-12-17 16:47:29 -08:00
Kara Erickson 062c7af4f3 test(ivy): replace resolved issue in compiler-cli test with new root cause (#27709)
PR Close #27709
2018-12-17 16:46:42 -08:00
Marc Laval 8042140742 test(ivy): enable more @angular/core tests (#27654)
PR Close #27654
2018-12-17 16:45:53 -08:00
Brandon Roberts a433baf99a docs(forms): update API reference for validator directives (#26926)
PR Close #26926
2018-12-17 16:45:35 -08:00
Paul Gschwendtner 87d7b747d2 build: improve error message for upgrade test helper (#27706)
Currently whenever the upgrade test helper fails to load a given AngularJS version, the error that will be rejected is technically not an error because the `onerror` callback is not returning an error, but an "ErrorEvent".

Since that `ErrorEvent` is basically just rejected, browsers will print
the error as followed:

```
Failed: [object Event]
```

This is not helpful at all and also implies that there _might_ be more
information hidden within the `Event` instance. Unfortunately that's not
the case (at least on browsers we test against) and the logic to extract
the data from the event would be not worth the effort, we just return a
simple custom `Error` that won't imply that there is more information
hidden.

PR Close #27706
2018-12-17 16:45:18 -08:00
Keen Yee Liau 85866defa4 fix(bazel): Set module_name and enable ng test (#27715)
Relative imports in Typescript files only work when module_name is
defined in ts_library (when run in Node.js).
See issue https://github.com/bazelbuild/rules_typescript/issues/360

With that fixed, `ng test` now works.

`ng build` requires `node_modules` to be available in the project
directory, so it's not usable yet. Running `yarn` in project directory
does not work because of postinstall version check.

PR Close #27715
2018-12-17 16:43:09 -08:00
Pete Bacon Darwin c986d3dcf4 fix(upgrade): upgrade Directive facade should not return different instance from constructor (#27660)
In ngUpgrade (dynamic) we create a dynamic Angular `Directive` that wraps AngularJS components
that are being upgraded. The constructor of this `Directive` class returns a different instance
than `this`. It is this instance that actually contains the life-cycle hook handlers.

This would break in ivy, since the methods on the prototype of the original class are wired up,
rather than the instance methods. This results in hooks like `ngOnInit` not being called.

This commit refactors the code to extend the inner class that was being returned so that the
prototype chain is correct for both ViewEngine and ivy.

This change resolves a number of failing ivy tests, but also exposes other failures that were
masked by this issue. The tests have been updated accordingly.

(FW-812)

PR Close #27660
2018-12-17 14:51:34 -08:00
Pete Bacon Darwin 3444aee5da test(upgrade): update test failure cause descriptions (#27660)
The changes here clarify that we now have a better description
of the root cause of the failure.

PR Close #27660
2018-12-17 14:51:34 -08:00
Miško Hevery e94975d109 fix(ivy): check semantics of NgModule for consistency (#27604)
`NgModule` requires that `Component`s/`Directive`s/`Pipe`s are listed in
declarations, and that each `Component`s/`Directive`s/`Pipe` is declared
in exactly one `NgModule`. This change adds runtime checks to ensure
that these sementics are true at runtime.

There will need to be seperate set of checks for the AoT path of the
codebase to verify that same set of semantics hold. Due to current
design there does not seem to be an easy way to share the two checks
because JIT deal with references where as AoT deals with AST nodes.

PR Close #27604
2018-12-17 14:49:51 -08:00
Pawel Kozlowski d132baede3 test(ivy): add more test for content projection with ngIf / ngFor (#27705)
PR Close #27705
2018-12-17 10:26:30 -08:00
JoostK 4376ec207c perf(ivy): let ngcc first check marker file before assembling bundle (#27438)
With the bundle info being assembled into a single object before the
transform is started, we now greedily create a TypeScript program up-front.
If a marker file exists that indicates that the bundle could be skipped
the program creation has already taken place which takes a significant
amount of time. This commit moves the marker check to occur before the
bundle is assembled.

PR Close #27438
2018-12-17 09:35:16 -08:00
JoostK 52544ffaa3 fix(ivy): ngcc generates setClassMetadata calls for ES5 bundles (#27438)
ngcc would feed ngtsc with the function declaration inside of an IIFE as
that is considered the class symbol's declaration node, according to
TypeScript's `ts.Symbol.valueDeclaration`. ngtsc however only considered
variable decls and actual class decls as potential class declarations,
so given the function declaration node it would fail to generate the
`setClassMetadata` call.

ngtsc no longer makes its own assumptions about what classes look like,
but always asks the reflection host to yield this kind of information.

PR Close #27438
2018-12-17 09:35:16 -08:00
JoostK 84084b1bdb fix(ivy): make exported pipes available in module scope (#27438)
This is tested in the Ivy CLI integration test.

PR Close #27438
2018-12-17 09:35:16 -08:00
JoostK 11600255fb fix(ivy): prevent DCE of __POST_R3__ symbols (#27438)
While creating FESM files, rollup usually drops all unused symbols.
All *__POST_R3__ 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 #27438
2018-12-17 09:35:15 -08:00
Andrew Kushnir dfbf6d72b0 fix(ivy): provide an ability to match <ng-template> tags (#27636)
Prior to this change, we were unable to match directives using `ng-template` tags (for example the following selector would not work even though there might be some <ng-template>s in a template: `ng-template[directiveA]`. As a result, that broke some components that relies on such selectors to work. In order to resolve the problem, we now pass tag name to the `template` instruction (where we passed `null` before) and this tag name is used for matching at runtime. This update should also help support projecting containers, because the tag name is required to properly match such elements.

PR Close #27636
2018-12-17 09:33:37 -08:00
Pawel Kozlowski ea10a3abe5 test(ivy): enable all test for @angular/common (#27700)
PR Close #27700
2018-12-17 09:32:09 -08:00
cyraid f8096d4993 docs(animations): rename animateChild() to animate() (#26184)
Renamed "animateChild()" to "animate()" in the comments/usage.
  The docs state to use animateChild() but uses animate() in the examples.
PR Close #26184
2018-12-14 15:27:37 -08:00
Ruslan Dzhabbarov 7dab458884 docs(common): fix documentation for getLocaleCurrencyName (#27087)
PR Close #27087
2018-12-14 15:27:03 -08:00
JoostK f4a797db24 fix(ivy): prevent ngcc from inadvertently dropping Ivy definitions (#27159)
A surprising interaction with the MagicString library caused inserted
Ivy definitions to be dropped during the removal of decorators, iff all
decorators on the class could be removed. In that case, the removal
location corresponds with the exact location where Ivy definitions were
inserted into.

This commit moves the removal of decorators to occur before Ivy
definitions are inserted. This effectively avoids the problem, as later
inserted text fragments will be retained by MagicString.

PR Close #27159
2018-12-14 15:26:15 -08:00
Olivier Combe 4df82bdbc1 test(ivy): don't run`ViewEngine` tests for ivy (#27645)
All the tests in `packages/core/test/view/` are specific to the `ViewEngine` and shouldn't run for ivy. This PR introduces a new BUILD.bazel file to run those tests separately.

PR Close #27645
2018-12-14 15:23:15 -08:00
Pawel Kozlowski b00aeeff37 fix(ivy): properly destroy views created by ComponentFactory (#27676)
PR Close #27676
2018-12-14 15:22:11 -08:00
levgaas f1c9d6a81f fix(animations): do not truncate decimals for delay (#24455)
Do not truncate decimals for animation delay if specified in seconds

PR Close #24455
2018-12-14 15:20:23 -08:00
JoostK df123e0410 fix(animations): mark actual descendant node as disabled (#26180)
PR Close #26180
2018-12-14 15:19:56 -08:00
JoostK 023bd31965 fix(ivy): ngcc should not emit TypeScript syntax (#27051)
If a template contains specific TypeScript syntax, such as a non-null
assertion, the code that is emitted from ngcc into a JavaScript bundle
should not retain such syntax as it is invalid in JS.

A full-blown TypeScript emit of a complete ts.SourceFile would be
required to be able to emit JS and possibly downlevel into a lower
language target, which is not an option for ngcc as it currently
operates on partial ASTs, not full source files.

Instead, ngtsc no longer produces TypeScript specific syntax in the first
place, such that TypeScript print logic will only generate JS code.

PR Close #27051
2018-12-14 15:19:31 -08:00
Ingo Bürk b39efdd9d6 fix(common): KeyValuePipe should return empty array for empty objects (#27258)
This lets KeyValuePipe return an empty array (rather than undefined)
when the input is empty.

PR Close #27258
2018-12-14 15:19:13 -08:00
cexbrayat 0b78f54d4f docs(router): typo in state documentation (#27671)
PR Close #27671
2018-12-14 15:13:45 -08:00
Igor Minar 522919a537 fix(bazel): emit full node stack traces when Angular compilation crashes (#27678)
The default 10 items are often not enough to debug deeply nested compilation operations.

This PR is based on @martinprobst's http://cl/225528216.

PR Close #27678
2018-12-14 14:58:21 -08:00
Miško Hevery 650c5a02ac Revert "fix(router): ensure URL is updated after second redirect with UrlUpdateStrategy="eager" (#27523)"
This reverts commit ad26cd6d0c.
2018-12-14 13:18:16 -08:00
Christopher Dahm d0d351cccb docs(common): update currencyPipe default digitsInfo values (#27417)
Change the docs to reflect the actual default values

Fixes #27414
PR Close #27417
2018-12-14 10:26:56 -08:00
JoostK a9543457ef fix(ivy): prevent invalid forward references in setClassMetadata call (#27561)
In Ivy, a pure call to `setClassMetadata` is inserted to retain the
information that would otherwise be lost while eliding the Angular
decorators. In the past, the Angular constructor decorators were
wrapped inside of an anonymous function which was only evaluated once
`ReflectionCapabilities` was requested for such metadata. This approach
prevents forward references from inside the constructor parameter
decorators from being evaluated before they are available.

In the `setClassMetadata` call, the constructor parameters were not wrapped
within an anonymous function, such that forward references were evaluated
too early, causing runtime errors.

This commit changes the `setClassMetadata` call to pass the constructor
parameter decorators inside of an anonymous function again, such that
forward references are not resolved until requested by
`ReflectionCapabilities`, therefore avoiding the early reads of forward refs.

PR Close #27561
2018-12-14 10:24:16 -08:00
JoostK a8ebc837ea fix(ivy): support complex type nodes in ModuleWithProviders (#27562)
With ngcc's ability to fixup pre-Ivy ModuleWithProviders such that they
include a reference to the NgModule type, the type may become a qualified
name:

```
import {ModuleWithProviders} from '@angular/core';
import * as ngcc0 from './module';

export declare provide(): ModuleWithProviders<ngcc0.Module>;
```

ngtsc now takes this situation into account when reflecting a
ModuleWithProvider's type argument.

PR Close #27562
2018-12-14 10:23:43 -08:00
cooljeffro 7fae9114c8 docs(common): Fix typo in KeyValuePipe docs (#27580)
PR Close #27580
2018-12-14 10:21:47 -08:00
Kristiyan Kostadinov 5d34657198 fix(ivy): attempting to remove detached view on destroy (#27585)
Currently the `ViewRef.destroy` method assumes that its index inside the view container will always be valid, however if it has been removed already, it'll be -1 which will throw an error.

The error manifested itself in one of the unit tests where a view had been detached during the test and then `TestBed` attempted to destroy its `ComponentRef` which ended threw an `Error during cleanup of component`.

PR Close #27585
2018-12-14 10:21:23 -08:00
Alex Eagle d32939d51a build: restrict visibility of npm_package targets (#27611)
dependencies on these cause very long rebuilds which have to re-package angular.
Such tests belong in the integration/ folder

PR Close #27611
2018-12-14 10:20:40 -08:00
Igor Minar d528e30cef test(ivy): update fixmes in packages/core/test/linker/jit_summaries_integration_spec.ts (#27639)
the issues referenced were stale and unrelated.

PR Close #27639
2018-12-14 10:20:18 -08:00
Igor Minar 8f8c5ba12e test(ivy): improve fixme message in //packages/platform-webworker/test (#27639)
the old one was not detailed enough

PR Close #27639
2018-12-14 10:20:18 -08:00
Igor Minar cba92db6bf test(ivy): remove stale fixmes from //packages/platform-server/test (#27639)
these issues have already been resolved but we forgot to reenable the tests.

PR Close #27639
2018-12-14 10:20:18 -08:00
Keen Yee Liau 3680aef801 test(bazel): integration test for ng new with Bazel (#27659)
integration test for bazel build and bazel test

PR Close #27659
2018-12-14 10:19:22 -08:00
Jason Aden ad26cd6d0c fix(router): ensure URL is updated after second redirect with UrlUpdateStrategy="eager" (#27523)
Navigating to a route such as `/users`, you may get redirected to `/login`. Previously, if you go then route to `/users` again the URL will end up showing `/users` after the second redirect. This only happened in `UrlUpdateStrategy="eager"`. This is now fixed so after the second redirect, the URL shows the correct page.

Fixes #27116

PR Close #27523
2018-12-13 14:59:41 -08:00
Andrew Kushnir fdf39985f0 fix(ivy): do not use MSG_ prefix for i18nPostprocess invocation (FW-779) (#27468)
Closure Compiler doesn't allow non-goo.getMsg const names to start with `MSG_`, so we should use different prefix for const that references a result of the `i18nPostprocess` fn invocation. With this update we also append file-based prefix to i18n constants (via $$ postfix) to ensure the names are unique across codebase of a project (otherwise it might lead to errors while compiling a project with Closure Compiler).

PR Close #27468
2018-12-13 14:58:56 -08:00
Paul Gschwendtner 44dfa606ed fix(bazel): ng_package writes unrelevant definitions to bazel out (#27519)
In order to keep the bazel bin directory as clean as possible, we should not write definition files that are not relevant to a `ng_package` to an undesired location in the bazel bin directory. This currently just happens because we only filter out external definition files while we also should filter out definitions that aren't just in the current package.

The `packager.ts` file currently tries to write these files to the package, but fails because those are not inside of the current package. So the logic to create a relative path for the file fails, and the definition will be copied to a location like:

```js
// Notice the double "bazel-out" here.
C:\Users\Paul\_bazel_Paul\kn4tsvyh\execroot\angular_material\bazel-out\x64_windows-fastbuild\bin\src\bazel-out\x64_windows-fastbuild\bin\src\cdk
```

[See logic that causes this](4f9374951d/packages/bazel/src/ng_package/packager.ts (L105-L124)) (nothing wrong with that logic because it assumes that only paths from within the package are passed to it)

PR Close #27519
2018-12-13 14:58:38 -08:00
Igor Minar 3970d00edd test(ivy): remove state fixme from packages/compiler-cli/test:ngtools_api (#27638)
it seems that we forgot to remove it in the recent refactoring.

PR Close #27638
2018-12-13 14:57:38 -08:00
Pawel Kozlowski 10c7b89f14 test(ivy): update root causes for @angular/core TestBed failures (#27650)
PR Close #27650
2018-12-13 14:56:00 -08:00
Pawel Kozlowski 0397e08153 test(ivy): update test status for cases modified in ivy (#27652)
PR Close #27652
2018-12-13 14:55:38 -08:00
Alex Rickabaugh 6b96931576 fix(ivy): enable flat module index production in Bazel (#27655)
ngtsc now produces flat module index files when that option is enabled
in tsconfig, but Bazel still needs the output declared in order for them to
be passed through.

This fixes some tests which verify this behavior on Bazel.

FW-738 #resolve

PR Close #27655
2018-12-13 14:55:15 -08:00
Keen Yee Liau 8313ffc38d fix(bazel): Load http_archive and rules_nodejs dependencies (#27609)
Bazel 0.20 requires loading http_archive explicitly.
rules_nodejs dependencies must now be installed explicity as well.

PR Close #27609
2018-12-13 11:01:31 -08:00
Greg Magolan 1cc08b4a4a fix(bazel): fix major/minor semver check between @angular/bazel npm packager version and angular bazel repo version (#27635)
PR Close #27635
2018-12-13 10:59:14 -08:00
Igor Minar 7fabe4429d fix(ivy): add support for optional nullable injection tokens (#27552)
FW-778 #resolve

PR Close #27552
2018-12-12 13:04:29 -08:00
Andrew Kushnir 37c05bd575 fix(ivy): avoid destroy renderer method invocation for child views (#27592)
Since Renderer is shared across root and child views, we need to avoid `destroy` method invocation for child views and only invoke is for root view when needed. Prior to this change, the `destroy` function was called whenever child view was destroyed, thus causing errors at runtime.

PR Close #27592
2018-12-12 13:04:09 -08:00
Pawel Kozlowski 28ceca0163 test(ivy): update root causes for @angular/core TestBed failures (#27627)
PR Close #27627
2018-12-12 11:02:03 -08:00
Kara Erickson 053b43d308 fix(ivy): update new host binding test with instruction change (#27605)
The pure functions in host bindings change was merged after the change in
host binding instructions, so it had a new test that wasn't yet updated
with the new generated code. This commit updates the new test.

PR Close #27605
2018-12-11 12:09:40 -08:00
Pawel Kozlowski 6980631631 test(ivy): update root causes for @angular/core TestBed failures (#27602)
PR Close #27602
2018-12-11 11:28:43 -08:00
Kara Erickson 452668b581 fix(ivy): host bindings should work if input has same name (#27589)
Previously in Ivy, host bindings did not work if they shared a public name
with an Input because they used the `elementProperty` instruction as is.
This instruction was originally built for inside component templates, so it
would either set a directive input OR a native property. This is the
correct behavior for inside a template, but for host bindings, we always
want the native properties to be set regardless of the presence of an Input.

This change adds an extra argument to `elementProperty` so we can tell it to
ignore directive inputs and only set native properties (if it is in the
context of a host binding).

PR Close #27589
2018-12-11 11:27:08 -08:00
Andrew Kushnir ceb14deb60 fix(ivy): proper slot allocation for pure functions in `hostBindings` function (#27587)
Prior to this update, we always returned the number of host vars defined in @Component definition as a value for `allocatePureFunctionsSlot` callback in ValueConverter. As a result, pure function arguments were not accounted for, thus leasing to incorrect slot offsets in `pureFunction` calls. Now we update and return total # of host vars, so the offsets are defined correctly.

PR Close #27587
2018-12-11 11:26:04 -08:00
Pete Bacon Darwin 3290fc3365 fix(bazel): fix TS errors in the `schematics/bazel-workspace` files (#27600)
Upgrading to the new `ts_library` rule uncovered TS errors in these
files. This commit fixes the code to pass TS checking.

PR Close #27600
2018-12-11 09:24:08 -08:00
Keen Yee Liau 30a3b49830 fix(bazel): Read latest versions from latest-versions.ts & use semver check (#27526)
When @angular/bazel is installed, a postinstall script is run to make sure that
the npm version is *exactly* the same as the Angular repository install by
Bazel. This check is overly stringent. Instead, it should enforce that the
version satisfies the range check instead. This is consistent with the range
defined in angular-cli/packages/schematics/angular/utility/latest-versions.ts.

This commit also fixes the Bazel workspace to use the same Rxjs version if it's
already installed.

PR Close #27526
2018-12-10 16:35:42 -08:00
Alex Eagle 50687e11cf build: fix type-check errors introduced during rules_ts 0.21 (#27586)
PR Close #27586
2018-12-10 16:33:41 -08:00
Alex Eagle bf57e9d781 build: update rules_typescript (#27586)
This release of rules_typescript fixes a critical bug: typescript code
was not checked at all, including type-checking, tsetse, and strict deps

fixes #27569

PR Close #27586
2018-12-10 16:33:41 -08:00
Andrew Kushnir 05cdfb90e9 fix(ivy): make ViewRef.detectChanges work with embedded views (FW-749) (#27521)
In `ViewRef.detectChanges`, we are passing `ViewRef.context` into `detectChanges` to trigger change detection. This only makes sense for component `ViewRefs` (i.e. injected `ChangeDetectorRefs`) because with embedded views, `context` is not a component instance where the view has been monkey-patched. It's a just a normal object, so the view will be undefined.

In order to resolve this problem, we now invoke `detectChangesInternal` and also pass `LView` (to make sure we always have a view available).

PR Close #27521
2018-12-10 14:20:22 -08:00
Igor Minar f5c0b30256 test: remove extranious fixme from packages/bazel/test/ngc-wrapped (#27578)
we forgot to remove this when the last fixme was removed.

PR Close #27578
2018-12-10 10:31:06 -08:00
Pawel Kozlowski 2182be48c4 test(ivy): enable more of @angular/core tests on node and in a browser (#27572)
PR Close #27572
2018-12-10 10:30:03 -08:00
Olivier Combe 9e7a8f6e89 refactor(ivy): dedup render3 NodeInjector (#27541)
We had two `NodeInjector` classes: one in `view_compatibility` and one in `di`. We replaced the one in `di` with the one from `view_compatibility` and reconciled their differences.
PR Close #27541
2018-12-10 10:29:13 -08:00
Alex Eagle 44dd764d6d build: update to Bazel 0.20 (#27394)
refactor Bazel RBE configs

PR Close #27394
2018-12-07 14:29:03 -08:00
Andrew Kushnir 255e672295 fix(ivy): define correct SVG namespace (FW-757) (#27529)
The trailing slash in SVG namespace prevented its correct resolution, thus triggering issues at runtime.

PR Close #27529
2018-12-07 11:53:52 -08:00
Paul Gschwendtner f0341142b8 fix(bazel): tsickle dependency not working with typescript 3.1.x (#27402)
`@angular/bazel` currently requires TypeScript 3.1.x as a peer dependency, but comes with `tsickle` as dependency. The current version of `tsickle` that is specified by `@angular/bazel` does not support TypeScript 3.1.x (which is a peer dependency) and therefore we need to make sure that `tsickle` works with the required TypeScript versions.

This change updates `tsickle` to the latest version that comes with b10fb6de0a in order to work with TypeScript 3.1.x.

PR Close #27402
2018-12-07 10:51:36 -08:00
cexbrayat b0c75611d6 fix(forms): typed argument for FormBuilder group (#26985)
PR Close #26985
2018-12-07 09:30:07 -08:00
Pete Bacon Darwin 2a35471abe test(upgrade): add diagnosis to failing ivy tests (#27542)
PR Close #27542
2018-12-07 09:29:12 -08:00
Alex Eagle cab5927bd5 ci: use buildifier binary release (#27489)
Switch from Skylint to buildifier --lint - this is required for the Bazel 0.20 upgrade since Bazel no longer lets us use the embedded JDK to build and run Java programs, and Skylint is a Java program

PR Close #27489
2018-12-07 09:27:32 -08:00
Andrew Kushnir dcb44e6dea fix(ivy): generate proper event listener names for animation events (FW-800) (#27525)
Prior to this change, animation event names were treated as a regular event names, stripping `@` symbol and event phase. As a result, event listeners were not invoked during animations. Now animation event name is formatted as needed and the necessary callbacks are invoked.

PR Close #27525
2018-12-07 09:25:18 -08:00
Pawel Kozlowski 5657126d86 test(ivy): run browser-specific @angular/core tests on CI (#27545)
PR Close #27545
2018-12-07 09:24:15 -08:00
Alex Rickabaugh aa48810d80 feat(ivy): generate flat module index files (#27497)
Previously, ngtsc did not respect the angularCompilerOptions settings
for generating flat module indices. This commit adds a
FlatIndexGenerator which is used to implement those options.

FW-738 #resolve

PR Close #27497
2018-12-07 09:22:29 -08:00
Alex Rickabaugh 352c582f98 refactor(ivy): allow for shim generators not based on existing files (#27497)
Previously the ngtsc ShimGenerator interface expected that all shims would
be generated using the contents of existing ts.SourceFiles. This assumption
was true for ngfactory and ngsummary files, but breaks down for flat module
index files, which are standalone.

This commit prepares for flat module index generation by enabling shim
generators which don't require an existing file.

PR Close #27497
2018-12-07 09:22:29 -08:00
Marc Laval f013c57186 test(router): correct a wrong test (FW-766) (#27511)
PR Close #27511
2018-12-06 13:41:20 -08:00
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
Marc Laval 8fa7e93c30 test(ivy): enable router tests with pending timers (FW-768) (#27509)
PR Close #27509
2018-12-06 13:40:42 -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
Keen Yee Liau 4da739a970 fix(bazel): Respect existing angular installation (#27495)
If user has already installed Angular, Bazel should fetch the same
version. Otherwise, user will see an error in the post-install step
that performs version check.

PR Close #27495
2018-12-06 13:36:19 -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
Kara Erickson 160cace336 test(ivy): fix query compliance spec (#27501)
PR Close #27501
2018-12-06 09:26:57 -08:00
Paul Gschwendtner ca1c430f30 fix(compiler-cli): ngtsc shim files not being generated on case-insensitive platforms (#27466)
Common insensitive platforms are `win32/win64` (see:
[here](3e4c5c95ab/src/compiler/sys.ts (L681-L682)))

Currently when running `bazel build packages/core --define=compile=aot`, the `compiler-cli` will throw because it cannot find the `index.ngfactory.ts` file in the compiler host. This is because the shim host wrapper is not properly generating the requested `ngfactory` file.

This happens because we call `getCanonicalFileName` that returns a path that is different to the actual program filenames that are used to construct a map of generated files. Since the generators always use the paths which are not "canonical" and pases them internally like that, we can just stop manually calling `getCanonicalFileName`.

PR Close #27466
2018-12-06 09:24:52 -08:00
Igor Minar 091a504377 Revert "fix(router): change processing url tree children condition (#26243)" (#27516)
This reverts commit ccc77ca441.

Breaks Pantheon see cl/224256517.

PR Close #27516
2018-12-06 09:17:20 -08:00
Igor Minar 4f61832d1c Revert "fix(router): process empty path segment when preceding a named outlet (#26243)" (#27516)
This reverts commit 20cef5078d.

Breaks Pantheon see cl/224256517.

PR Close #27516
2018-12-06 09:17:20 -08:00
Igor Minar 917a7884be test(benchpress): make most of the tests run under bazel (#27386)
PR Close #27386
2018-12-05 20:55:32 -08:00
Igor Minar dacf58eb99 docs: remove obsolete packages/examples/web_workers/ts/.gitkeep (#27386)
PR Close #27386
2018-12-05 20:55:32 -08:00
Igor Minar 21f6daf0bb test: correct bazel visibility for @angular/private/testing (#27386)
we don't want anyone else to depened on this stuff.

PR Close #27386
2018-12-05 20:55:32 -08:00
Igor Minar 95f8b63265 test(service-worker): run the remaining service-worker tests under bazel (#27386)
PR Close #27386
2018-12-05 20:55:31 -08:00
Igor Minar 4f81a7c590 test(common): run @angular/common/http/testing tests under bazel (#27386)
PR Close #27386
2018-12-05 20:55:31 -08:00
Andrew Kushnir a315dedb85 fix(ivy): fix fixmeIvy invocations in "platform-browser" tests (#27498)
Some "platform-browser" tests were updated before `fixmeIvy` function contract was changed to `fixmeIvy(...).it(...)`, thus triggering failed tests to run on CI. This commit updates these cases to invoke `fixmeIvy` correctly.

PR Close #27498
2018-12-05 16:33:27 -08:00
Alex Rickabaugh f514ac3da2 test(ivy): enable //packages/router/test/aot_ngsummary_test in Ivy mode (#27483)
This commit enables the above test to run under --define=compile=aot.
To accomplish this, one import is rewritten from a strange form to the
correct absolute form.

FW-658 #resolve

PR Close #27483
2018-12-05 16:26:39 -08:00
Alex Rickabaugh 0ae8c08b3c build(ivy): expect factories and summaries in Ivy mode (#27483)
Previously, Bazel/Blaze were only expecting .ngfactory.js and .ngsummary.js
files to be generated in legacy mode. ngtsc was attempting to write those
files, but they ended up being ignored at the Bazel level.

This commit causes Bazel to expect these files, and rearranges the logic
a little bit as the name 'include_ng_files' is now incorrect.

FW-514 FW-737 #resolve

PR Close #27483
2018-12-05 16:26:39 -08:00
Alex Rickabaugh 276bdd1f3e fix(ivy): move the generation of ɵNonEmptyModule to shim construction (#27483)
ngfactory files have a ɵNonEmptyModule constant included if there are no
other exported factory symbols. Previously this extra export was added
dynamically in a TS transformer.

However, synthetically constructed exports don't get properly downleveled
during JS emit, and this generated constant caused issues with downstream
tests.

Instead, this commit configures the shim to always have this export to
begin with, and to filter it out if it's not required.

Testing strategy: covered by existing ngtsc_spec tests which verify the
presence of the ɵNonEmptyModule symbol.

PR Close #27483
2018-12-05 16:26:39 -08:00
Alex Rickabaugh d553ec2f36 fix(ivy): generate correct moduleNames for factories and summaries (#27483)
In ngtsc, files loaded into the ts.Program have a "module name", set via
ts.SourceFile.moduleName, which ends up being written into an AMD module
name triple-slash directive in the generated .js file.

For generated shim files (ngfactories, ngsummaries) that are constructed
synthetically, there was previously no moduleName set, which caused some
issues with downstream tests.

This commit adds logic to compute and set moduleNames for both generated
ngfactory and ngsummary shims.

PR Close #27483
2018-12-05 16:26:39 -08:00
Alex Rickabaugh dfdaaf6a0d fix(ivy): deduplicate directives in component scopes (#27462)
A previous fix to ngtsc opened the door for duplicate directives in
the 'directives' array of a component. This would happen if the directive
was declared in a module which was imported more than once within the
component's module.

This commit adds deduplication when the component's scope is materialized,
so declarations which arrive via more than one module import are coalesced.

PR Close #27462
2018-12-05 14:36:24 -08:00
Olivier Combe b82f62a11d test(ivy): enable ivy tests for platform-browser/animations (#27478)
PR Close #27478
2018-12-05 14:35:23 -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
Alex Rickabaugh 8f425701e4 test(ivy): enable //packages/bazel/test/ngc-wrapped/... tests for Ivy (#27470)
This commit allows //packages/bazel/test/ngc-wrapped/... tests to run
under Ivy mode. To get them to pass, it addresses a problem with the
way the tests are configured: both test targets have sloppy .d.ts
dependencies configured, leading to many type errors being generated
in TypeScript for the .d.ts files.

Due to the way ngc directs TypeScript emit, it avoids type-checking
.d.ts files and thus this issue does not surface. ngtsc does a whole-
program emit which results in full .d.ts type-checking by default,
catching this configuration issue.

To fix this, skipLibCheck is added to the tsconfig.jsons for these
tests, which tells TypeScript to skip type-checking of the .d.ts files,
avoiding this problem in a similar way to ngc.

PR Close #27470
2018-12-05 10:46:51 -08:00
Alex Rickabaugh 0d8ab323a7 fix(ivy): add missing directoryExists() method to shim CompilerHost (#27470)
The method `ts.CompilerHost.directoryExists` is optional, and was not
previously handled by our ts.CompilerHost wrapper for factory and
summary shims (GeneratedShimsHostWrapper).

TypeScript checks for the existence of this method and silently ignores
things like typeRoots if it's not found. This commit adds proper handling
of directoryExists() to the shim.

A test is also added which verifies typeRoots behavior works when shims
are enabled.

PR Close #27470
2018-12-05 10:46:51 -08:00
Alex Rickabaugh 345bdd3db0 fix(ivy): generate empty ngfactory files if needed (#27470)
Previously the ngfactory shim generator in ngtsc would always write two
imports in the factory file shims:

1) an import to @angular/core
2) an import to the base file

If the base file has no exports, import #2 would be empty. This turns out
to cause issues downstream.

This commit changes the generated shim so if there are no exports in the
base file, the generated shim is empty too.

PR Close #27470
2018-12-05 10:46:51 -08:00
Jason Aden d70a7f3ac9 feat(router): add pathParamsOrQueryParamsChange mode for runGuardsAndResolvers (#27464)
This option means guards and resolvers will ignore changes to matrix parameters. Guards and resolvers will be rerun when the path changes, when path parameters change, or when query parameters change.

The primary use case for such a mode is when updating the UI and getting the URL to be in sync with local changes. For example, if displaying a sortable table, changing the sort direction is often handled by the table itself. But you would want to update the URL to be in sync with what's being displayed to the user. As long as the table sort direction is stored as a matrix parameter, you can use this option to update the URL without causing the overhead of re-running guards and resolvers.

Related to #26861 #18253

PR Close #27464
2018-12-05 10:43:29 -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
miginmrs 20cef5078d fix(router): process empty path segment when preceding a named outlet (#26243)
PR Close #10726

PR Close #26243
2018-12-05 10:39:30 -08:00
miginmrs ccc77ca441 fix(router): change processing url tree children condition (#26243)
stop adding next path of pathless activated route to the url

PR Close #26224

PR Close #26243
2018-12-05 10:39:30 -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
Andrew Kushnir a3ee08968e fix(ivy): compiler compliance tests actualized (#27473)
PR #27404 introduced additional test case to make sure we generate `elementStyling` instructions with proper set of arguments (first argument was missing in some cases). It looks like that PR was created before we updated host vars count calculation and the `allocHostVars` becomes unnecessary in the test cases introduced in PR #27404. This commit actualizes this test to get rid of unnecessary `allocHostVars` instruction.

PR Close #27473
2018-12-04 21:07:59 -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
Olivier Combe 9062b391a2 test(ivy): root cause analysis for platform-browser (#27460)
PR Close #27460
2018-12-04 20:02:33 -08:00
Olivier Combe c07afd9db1 test(ivy): enable ivy tests for platform-browser (#27460)
PR Close #27460
2018-12-04 20:02:33 -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
Pete Bacon Darwin 486f69fcac test(upgrade): do not lock up browser when unit test fails (#27454)
Previously, if the two injectors are not the same, jasmine tried to
display an error message, but it got stuck in an infinite loop trying
to render the injectors that were different.

PR Close #27454
2018-12-04 20:01:37 -08:00
Pete Bacon Darwin 145121a75d test(upgrade): re-enable tests fixed in ivy (#27454)
PR Close #27454
2018-12-04 20:01:37 -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
Jason Aden 0d4149c736 test(router): add test verifying guards re-run when parent path segments change (#27440)
Related to #26861

PR Close #27440
2018-12-04 19:59:53 -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
Andrew Kushnir e31992c112 fix(ivy): missing first argument in `elementStyling` instruction inside `hostBindings` section (#27404)
The logic that generates first argument for the `elementStyling` instruction was missing the check that directive expression is specified. As a result, in some cases first argument was not added, thus making function invocation incorrect. Now the presence of directive expression is taken into account and the `null` expression is generated as needed.

PR Close #27404
2018-12-04 19:58:46 -08:00
Paul Gschwendtner c61a8b7b14 fix(bazel): do not throw if ts compile action does not create esm5 outputs (#27401)
In some applications, developers define a `ts_library` that just consists of `d.ts` files (e.g. to type `module.id`; see: https://github.com/angular/material2/blob/master/src/module-typings.d.ts), and expect the `esm5.bzl` file to not throw an error like:

```
  target.typescript.replay_params.outputs
struct' object has no attribute 'outputs'
```

The "replay_parameters" property will exist in that case, but is set to "None" because there is no action that should be replayed in favor of producing ES5 outputs. See: https://github.com/bazelbuild/rules_typescript/pull/326. Notice that this right now breaks similarly because an empty `struct()` is returned that does not have a property called `outputs`. [#326](https://github.com/bazelbuild/rules_typescript/pull/326) fixes that by being explicit that there is no _action_ at all.

PR Close #27401
2018-12-04 19:58:36 -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 f0b0d64453 fix(ivy): adding `projectDef` instructions to all templates where <ng-content> is present (FW-745) (#27384)
Prior to this change `projectDef` instructions were placed to root templates only, thus the necessary information (selectors) in nested templates was missing. This update adds the logic to insert `projectDef` instructions to all templates where <ng-content> is present.

PR Close #27384
2018-12-04 19:58:13 -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
Alex Rickabaugh 159788685a fix(ivy): resolve resources using TS module resolution semantics (#27357)
Previously ngtsc assumed resource files (templateUrl, styleUrls) would be
physically present in the file system relative to the .ts file which
referenced them. However, ngc previously resolved such references in the
context of ts.CompilerOptions.rootDirs. Material depends on this
functionality in its build.

This commit introduces resolution of resources by leveraging the TypeScript
module resolver, ts.resolveModuleName(). This resolver is used in a way
which will never succeed, but on failure will return a list of locations
checked. This list is then filtered to obtain the correct potential
locations of the resource.

PR Close #27357
2018-12-04 14:03:55 -08:00
Alex Rickabaugh cfb67edd85 feat(ivy): support styleUrls in ngtsc (#27357)
This commit adds support for resolution of styleUrls to ngtsc. Previously
this field was never read, and so components with styleUrls would appear
unstyled after compilation.

PR Close #27357
2018-12-04 14:03:54 -08:00
JoostK b5ed403bc4 fix(ivy): prevent ngtsc from synchronous compilation for in-flight resouces (#27357)
When a single resource is preloaded twice in ngtsc, the second request
would be recognized as in-flight in which case `undefined` would
be returned, which signals to the compilation that is can resume
synchronously. The compilation would then proceed immediately and call
`load`, only to find out that the request is still in-flight which is
not allowed.

This commit caches the Promise of the in-flight fetch requests, such
that subsequent preload requests can return the corresponding Promise
instance.

PR Close #27357
2018-12-04 14:03:54 -08:00
George Kalpakas 46bc910ecb test(elements): run tests with Ivy (#27300)
PR Close #27300
2018-12-04 14:03:44 -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
Paul Gschwendtner d3c08e74f6 fix(compiler-cli): flatModuleIndex files not generated on windows with multiple input files (#27200)
* Currently when building a `ng_module` with Bazel and having the flat module id option set, the flat module files are not being generated because `@angular/compiler-cli` does not properly determine the entry-point file.

Note that this logic is not necessarily specific to Bazel and the same problem can happen without Bazel if multiple TypeScript input files are specified while the `flatModuleIndex` option has been enabled.

PR Close #27200
2018-12-04 14:01:25 -08:00
Paul Gschwendtner 4f9374951d fix(bazel): ng_package cannot be run multiple times without clean (#27200)
Currently when building the `ng_package` multiple times, the old `ng_package` output will be copied over to the new `ng_package` content. Resulting in packages like `src/cdk/npm_package/npm_package/npm_package/AND_MORE`.

This happens because currently all TypeScript definition files are resolved from within the `binDir`. This is just wrong because it could then take up the `d.ts` files from the previous `ng_package` output. All typescript definitions that belong to the target package, should be resolved through Bazel and copied based on that computation.

Also fixes that `esm` files aren't written to the `ng_package` on Windows. This is because we try to flatten paths using the `path.delimiter` while the path is always using Posix delimiters (causing the paths to be incorrect)

PR Close #27200
2018-12-04 14:01:25 -08:00
Paul Gschwendtner 20a2bae1d3 fix(bazel): do not throw error when writing tsickle externs (#27200)
* Currently when building the ES5 and ES2015 output, `ngc_wrapped` will fail because it tries to write the `fs.openSync` the tsickle output file at the same time. This causes a runtime exception in Windows and can be fixed by just writing the externs for ES5 mode to the proper ES5 "output root".

PR Close #27200
2018-12-04 14:01:24 -08:00
Paul Gschwendtner 7d598801f0 fix(bazel): ng_package not generating UMD bundles on windows (#27200)
* Fixes that `ng_package` does not work generate UMD bundles on Windows because the `esm5/` files are not written to the output directory. This is because `rootDirs` and `rootDir` are posix paths and cause invalid relative paths when mixed with Windows backslash paths.

PR Close #27200
2018-12-04 14:01:24 -08:00
Marc Laval 0cf49c8de3 test(ivy): run router/upgrade tests with ivy on CI (#27410)
PR Close #27410
2018-12-03 14:54:20 -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
JoostK 75723d5c89 feat(ivy): ngtsc support for static resolution of array.slice() (#27158)
For ngcc's processing of ES5 bundles, the spread syntax has been
downleveled from `[...ARRAY]` to become `ARRAY.slice()`. This commit
adds basic support for static resolution of such call.

PR Close #27158
2018-12-03 14:38:41 -08:00
Keen Yee Liau 06d4a0c46e feat(bazel): ng-new schematics with Bazel (#27277)
This commit creates a schematics for ng new command that builds
the project with Bazel.

PR Close #27277
2018-12-03 14:38:23 -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
Christopher Dahm d84705121a test(common): add PercentPipe round and trim tests (#27365)
Add tests to cover the percent's decimal to be rounded and trimmed.
PR Close #27365
2018-12-03 08:22:25 -08:00
Christopher Dahm f3f2ef4a2a docs(common): update PercentPipe default maxFractionDigits value (#27365)
Change the docs to reflect the actual default value

Fixes #27079
PR Close #27365
2018-12-03 08:22:25 -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
Alex Eagle f5f323dae0 build: only stamp version info when releasing (#27362)
Also build releases into a dedicated output_base so you can't
accidentally publish with outdated version stamp.

Bump the version of rules_nodejs so we don't need to create the
symlink_prefixes for the .publish command to work.

PR Close #27362
2018-11-30 16:08:23 -08:00
Marc Laval 35e02ad5e0 test(ivy): add root causes for router TestBed failures (#27325)
PR Close #27325
2018-11-30 14:58:22 -08:00
Marc Laval a566e52ca4 test(ivy): run more router tests in CI (#27325)
PR Close #27325
2018-11-30 14:58:22 -08:00
Andrew Kushnir 01fd0cd878 fix(ivy): proper accounting of bound vars in i18nExp fns (FW-747) (#27338)
The problem was caused by missing `allocateBindingSlots` that led to incorrect # of vars defined for components and as a result, causing errors at runtime. Now all `bind` operation are accounted for and the number of `vars` is correct.

PR Close #27338
2018-11-30 14:04:55 -08:00
Andrew Kushnir 973ebdc0ea fix(ivy): avoid creating self-closing i18n instructions in case we have styling instructions (#27330)
The problem was caused by the self-closing i18n instruction that was generated in case we have styling instructions defined for a component. As a result, that caused problems at runtime. This update adds extra check to avoid creating self-closing i18n instructions (create i18nStart and i18nEnd instructions instead) when styling instructions are present.

PR Close #27330
2018-11-30 14:04:00 -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
Pete Bacon Darwin 912b0529c1 feat(ivy): ngcc - render private declaration exports (#26906)
Ngcc will now render additional exports for classes that are referenced in
`NgModule` decorated classes, but which were not publicly exported
from an entry-point of the package.

This is important because when ngtsc compiles libraries processed by ngcc
it needs to be able to publcly access decorated classes that are referenced
by `NgModule` decorated classes in order to build templates that use these
classes.

Doing this re-exporting is not without its risks. There are chances that
the class is not exported correctly: there may already be similarly named
exports from the entry-point or the class may be being aliased. But there
is not much more we can do from the point of view of ngcc to workaround
such scenarios. Generally, packages should have been built so that this
approach works.

PR Close #26906
2018-11-30 14:02:03 -08:00
Pete Bacon Darwin bf3ac41e36 feat(ivy): ngcc - add `PrivateDeclarationsAnalyzer` (#26906)
This analyzer searches the source for declared classes that are not
exported publicly from the entry-point.

PR Close #26906
2018-11-30 14:02:03 -08:00
Pete Bacon Darwin b55e1c2ba9 refactor(ivy): ngcc - encapsulate variables into "bundles" (#26906)
There are a number of variables that need to be passed around
the program, in particular to the renderers, which benefit from being
stored in well defined objects.

The new `EntryPointBundle` structure is a specific format of an entry-point
and contains the compiled `BundleProgram` objects for the source and typings,
if appropriate.

This change helps with future refactoring, where we may need to add new
properties to this object. It allows us to maintain more stable APIs between
the constituent parts of ngcc, rather than passing lots of primitive values
around throughout the program.

PR Close #26906
2018-11-30 14:02:03 -08:00
Pete Bacon Darwin 64f6820660 refactor(ivy): ngcc - subclasses do not need to declare `protected` variables (#26906)
These variables are already declared as protected in the super class, and
so it is redundant to do it again in the subclasses.

PR Close #26906
2018-11-30 14:02:03 -08:00
Pete Bacon Darwin 4526b3ef50 refactor(ivy): ngcc - remove unused code (#26906)
PR Close #26906
2018-11-30 14:02:03 -08:00
Pete Bacon Darwin 49c73bc170 style(ivy): ngcc - fix typos (#26906)
PR Close #26906
2018-11-30 14:02:03 -08:00
Pete Bacon Darwin 4a70b669be feat(ivy): register references from NgModule annotations (#26906)
The `NgModuleDecoratorHandler` can now register all the references that
it finds in the `NgModule` metadata, such as `declarations`, `imports`,
`exports` etc.

This information can then be used by ngcc to work out if any of these
references are internal only and need to be manually exported from a
library's entry-point.

PR Close #26906
2018-11-30 14:02:03 -08:00
Pete Bacon Darwin b93c1dffa1 style(ivy): ngcc - fix misspelled method (#26906)
PR Close #26906
2018-11-30 14:02:03 -08:00
Pete Bacon Darwin 84ce45ca16 refactor(ivy): ngcc - make `EntryPoint` an interface rather than a type (#26906)
By inverting the relationship between `EntryPointPaths` and
`EntryPointFormat` we can have interfaces rather than types.

Thanks to @gkalpak for this idea.

PR Close #26906
2018-11-30 14:02:03 -08:00
Pete Bacon Darwin 0c6e1f4a1b fix(ivy): ngcc - support typings (d.ts) classes that are not publicly exported (#26906)
If a decorated class is not publicly exported via an entry-point then the
previous approach to finding the associated typings file failed.

Now we ensure that we extract all the class declarations from the
dtsTypings program, even if they are not exported from the entry-point.
This is achieved by also parsing statements of each source file, rather
than just parsing classes that are exported from the entry-point.

Because we now look at all the files, it is possible for there to be multiple
class declarations with the same local name. In this case, only the first
declaration with a given name is added to the map; subsequent classes are
ignored.

We are most interested in classes that are publicly exported from the
entry-point, so these are added to the map first, to ensure that they are
not ignored.

PR Close #26906
2018-11-30 14:02:03 -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 c96dea27ce test(ivy): turn ivy test selectors into real functions (#27372)
Having real functions allows me to bypass individual checks, ex.:

```
export function fixmeIvy(reason: string): boolean {
  return true;
}
```

This is useful for situation where I want to see if previously disabled tests
were fixed (ex. some PRs merged). In this case I don't want to run tests that
I know are not passing (obsolete / modified).

PR Close #27372
2018-11-30 13:59:47 -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
Igor Minar eb17502a7c fix(bazel): ng_package should correctly map to source maps in secondary entry-points (#27313)
This fixes the issue with broken source maps for @angular/common/http/testing.

Fixes #25510

PR Close #27313
2018-11-30 13:40:00 -08:00
Greg Magolan c8a8dcfc6e build(bazel): update handling of rules_nodejs transitive deps (#27264)
BREAKING CHANGES:

Bazel users: rules_angular_dependencies() will no longer install transitive dependencies of build_bazel_rules_nodejs and build_bazel_rules_typescript. User WORKSPACE files will now need to install rules_nodejs and rules_typescript transitive deps directly:

```
load("@build_bazel_rules_typescript//:package.bzl", "rules_typescript_dependencies")
rules_typescript_dependencies()

load("@build_bazel_rules_nodejs//:package.bzl", "rules_nodejs_dependencies")
rules_nodejs_dependencies()
```

PR Close #27264
2018-11-30 13:35:51 -08:00
Jason Aden d40af0c137 feat(router): add a Navigation type available during navigation (#27198)
Provides target URLs, Navigation, and `NavigationExtras` data.

FW-613

PR Close #27198
2018-11-30 13:34:55 -08:00
Jason Aden 73f6ed9be1 feat(router): allow passing `state` to routerLink directives (#27198)
This value will get written to the `history.state` entry.

FW-613 (related)
Related to #24617

PR Close #27198
2018-11-30 13:34:55 -08:00
Jason Aden 67f4a5d4bd feat(router): allow passing state to `NavigationExtras` (#27198)
This value will get written to the `history.state` entry.

FW-613 (related)

PR Close #27198
2018-11-30 13:34:55 -08:00
Jason Aden 26842491c6 feat(router): restore whole object when navigating back to a page managed by Angular router (#27198)
PR Close #27198
2018-11-30 13:34:55 -08:00
Igor Minar 1b84b11cf5 Revert "fix(forms): apply unicode flag to pattern attribute when supported (#20819)" (#27375)
This reverts commit 3c34b8b4f1.

breaks google3 see http://cl/223526995

PR Close #27375
2018-11-30 10:49:27 -08:00
Igor Minar 63e125986c Revert "test(forms): add test on applying unicode flag (#20819)" (#27375)
This reverts commit 619b8ab822.

breaks google3 see http://cl/223526995

PR Close #27375
2018-11-30 10:49:27 -08:00
Igor Minar 1439071b7e Revert "docs(forms): take words suggestion (#20819)" (#27375)
This reverts commit e024f2f8b7.

breaks google3 see http://cl/223526995

PR Close #27375
2018-11-30 10:49:27 -08:00
Igor Minar 32c5be97b0 fix(platform-server): add @angular/http to the list of peerDependencies (#27307)
Fixes #26154

PR Close #27307
2018-11-30 10:02:44 -08:00
Andrew Kushnir aedc343003 feat(ivy): updated translation const names (that include message ids) (#27185)
PR Close #27185
2018-11-30 10:00:54 -08:00
ryo.s 9129f9ac9b docs: fix typo (#27294)
PR Close #27294
2018-11-29 22:15:27 -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
Brandon Roberts c331fc6f0c docs(forms): update API reference for common APIs and template-driven directives (#27033)
PR Close #27033
2018-11-29 21:33:07 -08:00
Igor Minar 2389a68ea3 test(platform-server): import ivyEnabled from @angular/private/testing (#27302)
PR Close #27302
2018-11-29 21:32:49 -08:00
Igor Minar 81a5ceb6d4 test(ivy): add/remove fixmes with root causes for packages/bazel/test/ng_package:core_package (#27302)
PR Close #27302
2018-11-29 21:32:49 -08:00
Igor Minar ed36c68cdb test(ivy): add `obsoleteInIvy`, `modifiedInIvy`, and `ivyEnabled` test selectors (#27302)
See inline docs for description of these functions.

PR Close #27302
2018-11-29 21:32:49 -08:00
Igor Minar 88c30e231a test(ivy): add/remove fixmes in packages/bazel/test/ngc-wrapped (#27302)
PR Close #27302
2018-11-29 21:32:49 -08:00
Andrew Kushnir eb99753e4a test(ivy): enable @angular/service-worker targets to run on CI (#27310)
PR Close #27310
2018-11-29 21:32:19 -08:00
Alex Rickabaugh 4effb89ae8 test(ivy): update //packages/compiler tests for Ivy (#27301)
Most of the specs in these tests are not relevant to Ivy:

//packages/compiler/test:test
//packages/compiler/test:test_web_chromium-local

However, a few test pieces of the compiler infrastructure that are used in
Ivy, and new BUILD.bazel files are created to separate them from the above
disabled targets:

//packages/compiler/test/css_parser:css_parser
//packages/compiler/test/css_parser:css_parser_web
//packages/compiler/test/expression_parser:expression_parser
//packages/compiler/test/expression_parser:expression_parser_web
//packages/compiler/test/ml_parser:ml_parser
//packages/compiler/test/ml_parser:ml_parser_web
//packages/compiler/test/selector:selector
//packages/compiler/test/selector:selector_web

PR Close #27301
2018-11-29 21:31:35 -08:00
Alex Rickabaugh 49537458ea test(ivy): update //packages/compiler-cli tests for Ivy (#27301)
These tests are not relevant to Ivy:

//packages/compiler-cli/test/diagnostics:check_types
//packages/compiler-cli/test/diagnostics:expression_diagnostics
//packages/compiler-cli/test/transformers:test
//packages/compiler-cli/test:extract_i18n

The //packages/compiler-cli/test:ngtools_api test has 2 specs, one of
which passes and the other of which depends on ngtsc supporting lazy
routes. It's now disabled with fixmeIvy().

PR Close #27301
2018-11-29 21:31:35 -08:00
Pete Bacon Darwin 140217546d test(upgrade): re-enable tests that have been fixed (#27305)
The fix in #27223 unblocks these tests

PR Close #27305
2018-11-29 21:29:27 -08:00
Ben Lesh 65775a36d7 refactor(ivy): add fixmeIvy blocks to ivy failing tests (#27311)
PR Close #27311
2018-11-29 21:29:07 -08:00
Ben Lesh 6e89b1c1cd refactor(ivy): updates imports so tests will run in Bazel with ivy AOT (#27311)
PR Close #27311
2018-11-29 21:29:07 -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
Miško Hevery 4354fce2bb build: Replace iteration over depsets with an explicit .to_list() call. (#27336)
PR Close #27336
2018-11-29 21:22:39 -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
Igor Minar e024f2f8b7 docs(forms): take words suggestion (#20819)
Co-Authored-By: JLHwung <JLHwung@users.noreply.github.com>

PR Close #20819
2018-11-29 21:19:37 -08:00
Huáng Jùnliàng 619b8ab822 test(forms): add test on applying unicode flag (#20819)
PR Close #20819
2018-11-29 21:19:37 -08:00
Huáng Jùnliàng dde1d67232 test(platform-browser): add supportsRegExUnicodeFlag method (#20819)
PR Close #20819
2018-11-29 21:19:37 -08:00
Huáng Jùnliàng 3c34b8b4f1 fix(forms): apply unicode flag to pattern attribute when supported (#20819)
Both Firefox and Chrome have applied unicode flag to the `pattern` content attribute of INPUT element.
See https://www.chromestatus.com/feature/4753420745441280

PR Close #20819
2018-11-29 21:19:37 -08:00
Jason Aden 11a8bd8aca fix(router): update URL after redirects when urlHandlingStrategy='eager' (#27356)
fixes #27076

PR Close #27356
2018-11-29 14:46:32 -08:00
Andrew Kushnir d819c00fee fix(ivy): take preserveWhitespaces config option into account (FW-650) (#27197)
PR Close #27197
2018-11-28 11:41:49 -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 3074f0e436 test(ivy): update root causes for @angular/common TestBed failures (#27322)
PR Close #27322
2018-11-28 11:39:14 -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 78e3a4c97c test(ivy): root-case //packages/compiler-cli/integrationtest/bazel/injector_def/ivy_build/app/test:test (#27278)
PR Close #27278
2018-11-27 10:30:58 -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 d35d164ece test(ivy): add fixme to a failing testbed test (#27278)
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 572fd7a79a build(ivy): remove the remains of ivy-jit mode (#27278)
This stuff is obsolete and shouldn't be here because we removed the JIT mode on CI.

PR Close #27278
2018-11-27 10:30:58 -08:00
Igor Minar 04f902fca5 ci(ivy): //packages/platform-browser-dynamic/test:test now works in jit (#27278)
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 d62da4da12 test(platform-server): add root causes for TestBed tests failures (#27268)
PR Close #27268
2018-11-27 10:18:51 -08:00
Olivier Combe b09e03b28d test(platform-server): don't set `document` to undefined for ivy tests (#27268)
PR Close #27268
2018-11-27 10:18:51 -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
Trotyl Yu 1db53da0d3 fix(common): expose request url in network error (#27143)
closes #27029

PR Close #27143
2018-11-27 10:16:22 -08:00
Pete Bacon Darwin 330ecfbed0 ci(upgrade): remove `fixme-ivy-aot` tag (#27132)
PR Close #27132
2018-11-26 09:25:08 -08:00
Pete Bacon Darwin bc0fbfc93e test(upgrade): disable failing ngUpgrade tests when in ivy mode (#27132)
PR Close #27132
2018-11-26 09:25:08 -08:00
Pete Bacon Darwin a4462c24fa fix(upgrade): don't rely upon the runtime to resolve forward refs (#27132)
The way that `UpgradeAdapter` needs to be setup, you often find that
you must pass a `forwardRef` for an `NgModule.import`. Pre-ivy, this
gets resolved at runtime, but until this is implemented in ivy, we can
workaround it by resolving it in the `UpgradeAdapter` upfront.

This should be backward-compatible since by the time we actually
create the dynamic `NgModule` that has the import, the imported
class should be defined.

PR Close #27132
2018-11-26 09:25:08 -08:00
Pete Bacon Darwin 69c7488927 test(upgrade): add dependency on `fixmeIvy()` method (#27132)
PR Close #27132
2018-11-26 09:25:07 -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 0d9b27ff26 fix(ivy): let ngcc transform @angular/core typings with relative imports (#27055)
PR Close #27055
2018-11-21 09:20:11 -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
Marc Laval 8ce59a583b test(ivy): run router tests with ivy on CI (#27195)
PR Close #27195
2018-11-21 09:19:40 -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
Keen Yee Liau a72250bace build(bazel): Add Bazel builders (#27141)
PR Close #27141
2018-11-21 07:46:42 -08:00
Alex Eagle 026b7e34b3 build: update yarn version (#27193)
Some engineers were already on Yarn 0.10.x which was permitted by the range in our package.json#engines
However this introduced 'integrity sha512' lines into the yarn.lock files.
Then when engineers use yarn 0.9 (in particular, Bazel did this) then the lock files get tons of meaningless edits.
We could force everyone back to yarn 0.9 but this commit chooses to instead advance everyone past 0.10

PR Close #27193
2018-11-21 07:46:22 -08:00
Alex Rickabaugh 4390e10dfd fix(ivy): don't update parent pointers in the ivy switch transform (#27170)
Now that the Ivy switch transform uses ts.getMutableClone() to copy
statements, there's no need to set .parent pointers on the resulting
updated nodes. Doing this was causing assertion failures deep in
TypeScript in some cases.

PR Close #27170
2018-11-20 12:03:39 -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
Nick Tobolski 975c269752 docs(forms): language correction (#27177)
Word missing from docs
PR Close #27177
2018-11-20 10:46:34 -08:00
Huáng Jùnliàng 34306c356e docs(forms): close markdown backticks (#27189)
PR Close #27189
2018-11-20 10:45:16 -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 01917733a1 fix(ivy): set encapsulation to `None` when there is no style (#27175)
PR Close #27175
2018-11-20 10:43:51 -08:00
Pawel Kozlowski a43998c089 test(ivy): add JIRA references for root-casuse TestBed failrues (#27188)
PR Close #27188
2018-11-20 10:43:11 -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
Olivier Combe cf1ebdc079 test(ivy): enable platform-server tests for ivy (#27102)
PR Close #27102
2018-11-19 09:20:39 -08:00
Alex Eagle 81e975ad93 build: update to latest Bazel rules_typescript (#27138)
PR Close #27138
2018-11-17 12:19:32 -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
Olivier Combe 91bffa9c53 fix(ivy): set encapsulation metadata (#27115)
PR Close #27115
2018-11-16 12:22:11 -08:00
JoostK 60800da6c1 fix(ivy): export elementContainerStart/End instructions (#27053)
PR Close #27053
2018-11-16 12:19:18 -08:00
mrmeku b07bd30b70 feat(bazel): Bazel workspace schematics (#26971)
This commit creates a schematics for Bazel workspace.

PR Close #26971
2018-11-16 12:18:06 -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
Kara Erickson 3ec7c5081d test(ivy): fix paths for http tests to work with ivy (#27121)
PR Close #27121
2018-11-15 21:18:00 -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
Pawel Kozlowski 8a626288a6 test(ivy): run more common tests with ivy on ci (#27089)
With https://github.com/angular/angular/pull/27068 merged we can activate
more ivy tests on CI.

PR Close #27089
2018-11-14 12:25:35 -08:00
Jason Aden bf6ac6cef8 feat(router): add pathParamsChange mode for runGuardsAndResolvers (#26861)
This option means guards and resolvers will ignore changes to optional
parameters such as query and matrix params. When the path or any path
params change, guards and resolvers will be run

Related to discussion in #18253
FW-560 #resolve

PR Close #26861
2018-11-14 12:24:43 -08:00
Greg Magolan 3da82338d1 build(bazel): turn on --nolegacy-external-runfiles (#26770)
PR Close #26770
2018-11-14 12:23:38 -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
Sarun Intaralawan a752971bca fix(router): add `relativeLinkResolution` to `recognize` operator (#26990)
Close #26983

PR Close #26990
2018-11-13 16:18:08 -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
Alex Rickabaugh d97994b27f fix(ivy): clone ts.SourceFile in ivy_switch when triggered (#27032)
Make a copy of the ts.SourceFile before modifying it in the ivy_switch
transform. It's suspected that the Bazel tsc_wrapped host's SourceFile
cache has issues when the ts.SourceFiles are mutated.

PR Close #27032
2018-11-13 14:00:20 -08:00
Charles Lyding c31e78f670 fix(compiler-cli): add missing tslib dependency (#27063)
PR Close #27063
2018-11-13 13:59:41 -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
Pawel Kozlowski 7695dbd0bd test(ivy): run common tests with ivy on ci (#27071)
PR Close #27071
2018-11-13 10:59:55 -08:00
Judy Bogart 9741f5b8cf docs: new doc for core directives (#26923)
PR Close #26923
2018-11-13 10:57:56 -08:00
Paul Gschwendtner 0ada23a5fb fix(compiler-cli): only pass canonical genfile paths to compiler host (#27062)
In a more specific scenario: Considering people use a custom TypeScript compiler host with `NGC`, they _could_ expect only posix paths in methods like `writeFile`. This at first glance sounds like a trivial issue that should be just fixed by the actual compiler host, but usually TypeScript internal API's just pass around posix normalized paths, and therefore it would be good to follow the same standards when passing JSON genfiles to the `CompilerHost`.

For normal TypeScript files (and TS genfiles), this is already consistent because those will be handled by the actual TypeScript `Program` (see `emitCallback`).

PR Close #27062
2018-11-13 10:51:19 -08:00
cexbrayat f5a0ec0d7c fix(ivy): ngcc should not fail on invalid package.json (#26539)
Some package.json files may have invalid JSON, for example package.json blueprints from `@schematics/angular` (see https://github.com/angular/angular-cli/blob/master/packages/schematics/angular/workspace/files/package.json).

This makes ngcc more resilient, by simpling logging a warning if an error is encountered, instead of failing as it does right now.

PR Close #26539
2018-11-13 10:48:31 -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
Matias Niemelä 095b6e8113 refactor(ivy): abstract all styling-related compiler logic into a shared class (#27043)
PR Close #27043
2018-11-12 15:32:48 -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
JoostK 97ef8ae9e7 fix(ivy): let ngcc not consider deep imports as missing dependencies (#27031)
This fixes an issue where packages would be skipped if they contained
e.g. RxJS 5 style imports such as
```
import { observeOn } from 'rxjs/operators/observeOn';
```

Given that no package.json file can be found at the imported path, the
dependency would be reported missing, causing the package to be skipped.

PR Close #27031
2018-11-12 12:50:06 -08:00
Brandon Roberts 99c5db1fb1 docs(forms): update API reference for value accessors (#26946)
PR Close #26946
2018-11-12 12:48:33 -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
Deltatiger 83c9bff242 docs(core): cleanup todo notes in ContentChild documentation examples (#26543)
PR Close #26543
2018-11-09 09:47:26 -08:00
Andrew Lobban 4efb460127 docs(router): add RxJS filter pipe operator to example (#25686)
This example for Angular 6 requires piping the RxJS filter operator in order to traverse the multitude of Router Events.

PR Close #25686
2018-11-09 09:46:11 -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
Greg Magolan 15e671ec5a build(bazel): upgrade benchmarks to protractor_web_test_suite for CI without local chrome (#26908)
PR Close #26908
2018-11-07 16:47:39 -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
Kara Erickson a4398aa17f docs(forms): update description for FormBuilder.group (#26970)
PR Close #26970
2018-11-07 10:39:12 -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
Kara Erickson 3ca1a57f81 test(ivy): run forms tests with ivy on ci (#26968)
PR Close #26968
2018-11-06 15:09:35 -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
George Kalpakas 7dbc103cbe fix(upgrade): improve downgrading-related error messages (#26217)
Make the error messages thrown when instantiating downgraded components,
injectables and modules more descriptive and actionable, also taking
into account incorrect use of the `downgradedModule` field.

PR Close #26217
2018-11-05 16:33:55 -08:00
George Kalpakas 93837e9545 feat(upgrade): support downgrading multiple modules (#26217)
Currently, calling `downgradeModule()` more than once is not supported.
If one wants to downgrade multiple Angular modules, they can create a
"super-module" that imports all the rest and downgrade that.

This commit adds support for downgrading multiple Angular modules. If
multiple modules are downgraded, then one must explicitly specify the
downgraded module that each downgraded component or injectable belongs
to, when calling `downgradeComponent()` and `downgradeInjectable()`
respectively.

No modification is needed (i.e. there is no need to specify a module for
downgraded components and injectables), if an app is not using
`downgradeModule()` or if there is only one downgraded Angular module.

Fixes #26062

PR Close #26217
2018-11-05 16:33:55 -08:00
George Kalpakas 6c5c97b2f9 refactor(upgrade): use a constant for `$exceptionHandler` (#26217)
PR Close #26217
2018-11-05 16:33:54 -08:00
Brandon Roberts 099d1a67a0 docs(forms): update reactive form directives API reference (#26823)
PR Close #26823
2018-11-05 15:11:42 -08:00
Huáng Jùnliàng 6744b19297 refactor(compiler): typo (#25496)
PR Close #25496
2018-11-05 12:53:04 -08:00
Kara Erickson 4e4bca6bbc Revert "fix(ivy): correct ngtsc path handling in Windows (#26703)"
This reverts commit d0037b22ef. The commit must be temporarily reverted because
there were unforeseen breakages in g3.
2018-11-05 11:18:52 -08:00
JoostK d0037b22ef fix(ivy): correct ngtsc path handling in Windows (#26703)
As it turns out, the usage of path.posix does not unify path handling
across operating systems. Instead, canonical-path is used to ensure
path handling is consistent, avoiding incorrect paths in Windows.

See https://github.com/angular/angular/pull/25862#discussion_r216157914

PR Close #26703
2018-11-05 09:56:20 -08:00
Andrew Grekov e6a0c45674 style(compiler): typo fix (#26934)
PR Close #26934
2018-11-05 09:49:22 -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
Andy Blatecky 64647af1a6 fix(upgrade): make typings compatible with older AngularJS typings (#26880)
Make `angular1` typings compatible with older versions of AngularJS
typings from `@types/angular`.

Closes #26420

PR Close #26880
2018-11-02 11:24:05 -07:00
Pete Bacon Darwin c016066d9b fix(ivy): ngcc should not break lifecycle hooks (#26856)
Previously the ivy definition calls we going directly after the
class constructor function But this meant that the lifecycle
hooks attached to the prototype were ignored by the ngtsc
compiler.

Now the definitions are written to the end of the IIFE block,
just before the return statement.

Closes #26849

PR Close #26856
2018-11-02 10:38:08 -07:00
Jason Aden 496372dd30 fix(router): remove type bludgeoning of context and outlet when running CanDeactivate (#26496)
Fixes #18253

PR Close #26496
2018-11-01 16:04:01 -07:00
Lars Gyrup Brink Nielsen e9e804fb02 feat(forms): add updateOn option to FormBuilder (#24599)
PR Close #24599
2018-11-01 15:31:11 -07:00
Alan Agius aed95fd8c7 fix(bazel): unknown replay compiler error in windows (#26711)
In Windows the compiler path ends with `.exe` thus it will never match and throw  `Unknown replay compiler`

PR Close #26711
2018-11-01 15:16:06 -07:00
joostme aca8ea9c0b refactor(service-worker): Format comments and add additional test (#25860)
- Format JSDoc for notificationClicks
- Add comment on why handleClick does not use hasOwnProperty
- Add additional test that uses handleClick without action

PR Close #25860
2018-11-01 15:13:33 -07:00
Joost Zöllner 4a01ada291 fix(service-worker): Fix public api guard typing (#25860)
PR Close #25860
2018-11-01 15:13:33 -07:00
Joost Zöllner 10618752e6 fix(service-worker): Add typing to public api guard and fix lint errors (#25860)
PR Close #25860
2018-11-01 15:13:33 -07:00
Joost Zöllner c60418b1f4 refactor(service-worker): Rework notification click handler (#25860)
- Add missing image and timestamp properties
- Remove focus from click handler

PR Close #25860
2018-11-01 15:13:33 -07:00
Joost Zöllner c78c221028 feat(service-worker): Add typing for messagesClicked in SwPush service (#25860)
- Properly type messagesClicked Observable stream
- Add new NotificationObject interface

PR Close #25860
2018-11-01 15:13:32 -07:00
Joost Zöllner 1aca54da06 refactor(service-worker): Code optimizations (#25860)
- Add missing new line in tests
- Add proper noop method in MockNotificationEvent

PR Close #25860
2018-11-01 15:13:32 -07:00
Joost Zöllner f5d5a3df59 feat(service-worker): close notifications and focus window on click (#25860)
- Serialize notification object before using postMessage
- Close notification on click
- Focus browser if it is not already focused on click

PR Close #25860
2018-11-01 15:13:32 -07:00
Joost Zöllner f017b26e5d refactor(service-worker): update tests based of review feedback (#25860)
- Rename invalid click event name
- Make test expects more explicit
- Remove NotificationClickEvent in favor of NotificationEvent

PR Close #25860
2018-11-01 15:13:32 -07:00
Joost Zoellner cf6ea283bb feat(service-worker): handle 'notificationclick' events (#25860)
The previous version did not support the 'notificationclick' event.
Add event handler for the event and provide an observable of
clicked notifications in the SwPush service.

Closes #20956, #22311

PR Close #25860
2018-11-01 15:13:32 -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
Pete Bacon Darwin 2f30bbb495 perf(ivy): ngcc - only render .d.ts analysis when necessary (#26403)
For each package entry-point there is only one format that
is used to compile the typings files (.d.ts). This will be
either esm2015 or fesm2015 (preferred). So we would not run
any dts processing in the renderer if we are not compiling
the appropriate format.

PR Close #26403
2018-11-01 14:13:26 -07:00
Pete Bacon Darwin 030d43b9f3 fix(ivy): ngcc - fixes to support compiling Material library (#26403)
1) The `DecorationAnalyzer now analyzes all source files, rather than just
the entry-point files, which fixes #26183.
2) The `DecoratorAnalyzer` now runs all the `handler.analyze()`  calls
across the whole entry-point *before* running `handler.compile()`. This
ensures that dependencies between the decorated classes *within* an
entry-point are known to the handlers when running the compile process.
3) The `Renderer` now does the transformation of the typings (.d.ts) files
which allows us to support packages that only have flat format
entry-points better, and is faster, since we won't parse `.d.ts` files twice.

PR Close #26403
2018-11-01 14:13:26 -07:00
Pete Bacon Darwin dff10085e8 refactor(ivy): ngcc - move typings rendering to `Renderer` (#26403)
The rendering of typings is not specific to the package
format, so it doesn't make sense to put it in a specific
renderer.

As a result there is no real difference between esm5 and esm2015
renderers, so there is no point in having separate classes.

PR Close #26403
2018-11-01 14:13:26 -07:00
Pete Bacon Darwin e804143183 perf(ivy): ngcc - use flat file for dependency sorting if available (#26403)
Previously we always used the non-flat format because we thought
that this was the one that would always be available.

It turns out that this is not the case and that only one of the flat and
non-flat formats may be available.

Therefore we should use whichever is available, defaulting to the flat
format if that exists, since that will be faster to parse.

PR Close #26403
2018-11-01 14:13:26 -07:00
Pete Bacon Darwin bec4ca0c73 refactor(ivy): ngcc - recombine flat and non-flat `Esm2015ReflectionHost` (#26403)
Going forward we need to be able to do the same work on both
flat and non-flat module formats (such as computing arity and
transforming .d.ts files)

PR Close #26403
2018-11-01 14:13:26 -07:00
Pete Bacon Darwin 81acbad058 fix(ivy): ngcc - skip missing formats rather than erroring (#26403)
It is perfectly normal for some of the formats to be missing from
a package. We should not fail compilation for this.

PR Close #26403
2018-11-01 14:13:26 -07:00
Pete Bacon Darwin 360be02c0e fix(ivy): ngcc - support Angular Material package.json format (#26403)
The Material project uses slightly different properties to the
core Angular project for specifying the different format entry-point.

This commit ensures that we map these properties correctly for both
types of project.

PR Close #26403
2018-11-01 14:13:26 -07:00
Pete Bacon Darwin adce5064b0 fix(ivy): fix 'Module not found` error message (#26403)
The message was dumping a serialized object instead of a
human readable name into the exception being thrown.

PR Close #26403
2018-11-01 14:13:25 -07:00
Pete Bacon Darwin 1918f8d5b5 feat(ivy): support separate .js and .d.ts trees when generating imports (#26403)
The `NgModule` handler generates `R3References` for its declarations, imports,
exports, and bootstrap components, based on the relative import path
between the module and the classes it's referring to. This works fine for
compilation of a .ts Program inside ngtsc, but in ngcc the import needed
in the .d.ts file may be very different to the import needed between .js
files (for example, if the .js files are flattened and the .d.ts is not).

This commit introduces a new API in the `ReflectionHost` for extracting the
.d.ts version of a declaration, and makes use of it in the
`NgModuleDecorationHandler` to write a correct expression for the `NgModule`
definition type.

PR Close #26403
2018-11-01 14:13:25 -07:00
Pete Bacon Darwin eb5d3088a4 build: update `canonical-path` dependency (#26719)
This new version (1.0.0) provides a typings file!

PR Close #26719
2018-11-01 13:49:10 -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
Pete Bacon Darwin 86580a8460 style(router): remove trailing whitespace (#26891)
PR Close #26891
2018-11-01 05:28:17 -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 492576114d feat(ivy): generator of setClassMetadata statements for Angular types (#26860)
This commit introduces generateSetClassMetadataCall(), an API in ngtsc
for generating calls to setClassMetadata() for a given declaration. The
reflection API is used to enumerate Angular decorators on the declaration,
which are converted to a format that ReflectionCapabilities can understand.
The reflection metadata is then patched onto the declared type via a call
to setClassMetadata().

This is simply a utility, a future commit invokes this utility for
each DecoratorHandler.

Testing strategy: tests are included which exercise generateSetClassMetadata
in isolation.

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
Alex Rickabaugh afbee736ea refactor(ivy): use wrapped metadata in all DecoratorHandlers (#26860)
Previously, the Directive, Injectable, and Pipe DecoratorHandlers were
directly returning @angular/compiler metadata from their analyze() steps.
This precludes returning any additional information along with that
metadata. This commit introduces a wrapper interface for these handlers,
opening the door for additional information to be returned from analyze().

Testing strategy: this is a refactor commit, existing test coverage is
sufficient.

PR Close #26860
2018-10-31 19:52:36 -04:00
Alex Rickabaugh 84e311038d feat(ivy): capture the identifier of a decorator during reflection (#26860)
Previously the ReflectionHost API only returned the names of decorators
and not a reference to their TypeScript Identifier. This commit adds
the identifier itself, so that a consumer can write references to the
decorator.

Testing strategy: this commit is trivial, and the functionality will be
exercised by downstream tests.

PR Close #26860
2018-10-31 19:52:36 -04:00
Alex Rickabaugh 4dfa71f018 feat(compiler): ability to mark an InvokeFunctionExpr as pure (#26860)
Uglify and other tree-shakers attempt to determine if the invocation
of a function is side-effectful, and remove it if so (and the result
is unused). A /*@__PURE__*/ annotation on the call site can be used
to hint to the optimizer that the invocation has no side effects and
is safe to tree-shake away.

This commit adds a 'pure' flag to the output AST function call node,
which can be used to signal to downstream emitters that a pure
annotation should be added. It also modifies ngtsc's emitter to
emit an Uglify pure annotation when this flag is set.

Testing strategy: this will be tested via its consumers, by asserting
that pure functions are translated with the correct comment.

PR Close #26860
2018-10-31 19:52:36 -04:00
Jason Aden 4e9f2e5895 feat(router): guard returning UrlTree cancels current navigation and redirects (#26521)
Fixes #24618
FW-153 #resolve

PR Close #26521
2018-10-31 19:51:50 -04:00
Jason Aden 081f95c812 feat(router): allow guards to return UrlTree as well as boolean (#26521)
* Removed `andObservable` helper function in favor of inline implementation
* Flow `boolean | UrlTree` through guards check
* Add tests to verify behavior of `checkGuards` function flowing `UrlTree` properly

PR Close #26521
2018-10-31 19:51:50 -04:00
Jason Aden 152ca66eba feat(router): allow redirect from guards by returning UrlTree (#26521)
* Improve type checking within the CheckGuards function
* Change public API to allow returning of UrlTree instead of boolean

PR Close #26521
2018-10-31 19:51:50 -04:00
Jason Aden 17586f1e94 refactor(router): remove type casting from wrapIntoObservable private function (#26521)
PR Close #26521
2018-10-31 19:51:50 -04:00
Jason Aden 6712492dc2 refactor(router): add type definitions for guard functions (#26521)
PR Close #26521
2018-10-31 19:51:50 -04:00
Jason Aden 9f4299d47b refactor(router): add type guards for router guards (#26521)
PR Close #26521
2018-10-31 19:51:49 -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
Greg Magolan 332394d87c build(bazel): generalize fix for AMD name for flat module out file (#26837)
PR Close #26837
2018-10-30 18:37:12 -04:00
Paul Gschwendtner 8fc4ae51fb build: use bazel version from node modules (#26691)
* No longer depends on a custom CircleCI docker image that comes with Bazel pre-installed. Since Bazel is now available through NPM, we should be able to use the version from `@bazel/bazel` in order to enforce a consistent environment on CI and locally.
* This also reduces the amount of packages that need to be published (ngcontainer is removed)

PR Close #26691
2018-10-30 16:19:13 -04:00
Alex Eagle 66be3c9f51 build: Move non-bazel deps to devDependencies (#26691)
This makes yarn_install of ngdeps under Bazel faster, since we don't need many of the large dependencies.
It's important because downstream angular/bazel users will observe the same install time.

PR Close #26691
2018-10-30 16:19:13 -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
Matias Niemelä 95993e1dd5 fix(ivy): ensure pipes indices are referenced in styling bindings (#26755)
PR Close #26755
2018-10-26 18:40:23 -04:00