Commit Graph

2799 Commits

Author SHA1 Message Date
Alan 35ec2dc9bc fix(ivy): normalize summary and factory shim files paths (#28173)
At the moment, paths stored in `maps` are not normalized and in Windows is causing files not to be found when enabling factory shimming.

For example, the map contents will be
```
Map {
  'C:\\git\\cli-repos\\ng-factory-shims\\index.ngfactory.ts' => 'C:\\git\\cli-repos\\ng-factory-shims\\index.ts' }
```

However, ts compiler normalized the paths and is causing;
```
error TS6053: File 'C:/git/cli-repos/ng-factory-shims/index.ngfactory.ts' not found.
error TS6053: File 'C:/git/cli-repos/ng-factory-shims/index.ngsummary.ts' not found.
```

The changes normalized the paths that are stored within the factory and summary maps.

PR Close #28173
2019-01-16 09:47:27 -08:00
George Kalpakas 332dcb2d47 test(upgrade): clean up global state after test (#28181)
In ngUpgradeLite, when a downgraded component
[requests its downgraded module][1], the AngularJS injector is
[temporarily stored][2] with the intention of grabbing it
[once the module has been bootstrapped][3] (which also cleans up the
[temporary injector reference][4]).

In [some tests][5], bootstrapping a component might throw an error,
which causes the test to fail immediatelly and move on to the next
test. In slow browsers (e.g. on CI/Saucelabs), the (successful)
bootstrapping of another downgraded module might not have been
completed in time and thus the temporary injector reference not cleaned
up.

In such a case, if the following test (in our randomized test suite)
happens to rely on the temporary injector reference's being initially
unset (such as [this test][6]), it will fail. This might appear as a
flake on CI, because it depends on a race condition and specific order
of tests, so it usually goes away after a rerun.

This commit fixes it by ensuring the temporary injector reference is
manually cleaned up, when necessary.

Jira issue: FW-939

[1]: https://github.com/angular/angular/blob/f983e99fb245532b41125672447a7d6756e9da06/packages/upgrade/src/common/downgrade_component.ts#L120
[2]: https://github.com/angular/angular/blob/f983e99fb245532b41125672447a7d6756e9da06/packages/upgrade/src/static/downgrade_module.ts#L165
[3]: https://github.com/angular/angular/blob/f983e99fb245532b41125672447a7d6756e9da06/packages/upgrade/src/static/downgrade_module.ts#L169
[4]: https://github.com/angular/angular/blob/f983e99fb245532b41125672447a7d6756e9da06/packages/upgrade/src/static/angular1_providers.ts#L25
[5]: https://github.com/angular/angular/blob/f983e99fb245532b41125672447a7d6756e9da06/packages/upgrade/test/static/integration/downgrade_module_spec.ts#L1331-L1381
[6]: https://github.com/angular/angular/blob/f983e99fb245532b41125672447a7d6756e9da06/packages/upgrade/test/static/angular1_providers_spec.ts#L31-L45

PR Close #28181
2019-01-16 09:45:01 -08:00
Benedikt Meurer 2c3b084817 perf(platform-server): use shared DomElementSchemaRegistry instance (#28150) (#28151)
Right now the `ServerRendererFactory2` creates a new instance of the
`DomElementSchemaRegistry` for each and every request, which is quite
costly (for the Tour of Heroes SSR this takes around **30%** of the
overall execution time). Since the schema is never modified, but only
used in a read-only fashion, it should be possible to re-use a single
instance instead.

Naive performance testing with 100 concurrent connections and 1000
requests in total shows an approximate **33%** improvement in Req/Sec
on the Tour of Heroes SSR example.

PR Close #28150

PR Close #28151
2019-01-15 11:27:55 -08:00
Jason Aden 918d906a1e docs(router): add clarification for Router config (#28159)
PR Close #28159
2019-01-15 10:54:50 -08:00
Judy Bogart 12e3b71740 docs: add api doc for switch directives (#27378)
PR Close #27378
2019-01-15 10:53:03 -08:00
Ernest Galbrun 9faad4b2b0 docs(core): fix typo (#28042)
PR Close #28042
2019-01-15 09:52:49 -08:00
Serginho 42ccea547e fix(service-worker): navigation urls backwards compatibility (#27244)
PR Close #27244
2019-01-15 09:50:32 -08:00
Jason Aden 67e6b63165 fix(router): ensure URL is updated after second redirect with UrlUpdateStrategy="eager" (#27680)
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 #27680
2019-01-14 17:19:37 -08:00
Keen Yee Liau 3bc02a3652 fix(bazel): Bazel schematics should add router package (#28141)
This commit fixes a bug whereby a Bazel project created by the
schematics would not compiled if project contains routing module.

It is missing a dependency on the router package.

PR Close #28141
2019-01-14 17:12:01 -08:00
赵正阳 a3f72d92f2 docs(ivy): remove duplicated words in architecture doc (#27471)
PR Close #27471
2019-01-14 17:06:43 -08:00
Paul Gschwendtner ac3c9c1e6e fix(bazel): incorrectly always uses ngc-wrapped from "npm" workspace (#28137)
* This is a follow-up to https://github.com/angular/angular/commit/cd0451305a819548e2816e84c9271c61001897e7 which fixes that "ngc-wrapped" from the "npm" workspace is always used if "angular" is fetched as an external dependency.

PR Close #28137
2019-01-14 14:12:19 -08:00
Paul Gschwendtner 17403a2b1d fix(bazel): replay compilation uses wrong compiler for building esm5 (#28053)
With the update to TypeScript 3.2.x, a big issue seems to have appeared for downstream Bazel users. If the downstream user still uses a lower TypeScript version, normal Bazel targets using the `ng_module` rule are still compiled with the correct/old TypeScript version (assuming they set the `node_modules` attribute properly).

But, if they build the previous Bazel targets by specifying them within a `ng_package` rule, the TypeScript version from the Angular `workspace` is being used for the replayed ESM5 compilation. This is because we resolve the replay compiler to `ngc_wrapped` or `tsc_wrapped` Bazel executables which are defined as part of the `angular` workspace. This means that the compilers are different if the downstream user uses `ngc-wrapped` from the `@npm` repository because the replayed compilation would use the compiler with `@ngdeps//typescript`.

In order to fix this, we should just use the compiler that is defined in the `@angular//BUILD.bazel` file. This target by defaults to the "@npm" workspace which is working for downstream users. This is similar to how it is handled for `tsc-wrapped`. `tsc-wrapped` works as expected for downstream users.

**Note**: This is not the ideal solution because ideally we would
completely respect the `compiler` option from the base `ng_module`, but
this is not possible in a hermetic way, unless we somehow accept the
`compiler` as an attribute that builds all transitive deps. This is
something we should explore in the future. For now, we just fix this in
a reasonable way that is also used for `tsc_wrapped` from the TypeScript
rules.

PR Close #28053
2019-01-14 10:44:25 -08:00
Keen Yee Liau 325bf558ba refactor(bazel): use web_package rule for index.html (#27995)
index.html needs to have the zone.js and the project bundle injected
using script tags. This used to be done explicitly by specifying a
new index.html but with `web_package` rule introduced in rules_nodejs,
it is now possible to perform the injection dynamically.

PR Close #27995
2019-01-14 10:42:14 -08:00
kwiateusz 0316fda529 docs: ngComponentOutlet doc updated with new Injector creation (#27291)
PR Close #27291
2019-01-14 10:36:03 -08:00
Keen Yee Liau 01d475d6f3 fix(bazel): Add ibazel to deps of Bazel project (#28090)
Incremental rebuilds is a fundamental part of the development
workflow. `@bazel/ibazel` should be added to the dev dependencies
of a Bazel project.

PR Close #28090
2019-01-11 15:58:38 -08:00
Pete Bacon Darwin 3c08b86e27 docs(forms): fix up @see tags for AbstractContol (#28069)
PR Close #28069
2019-01-11 14:35:24 -08:00
Karanveer Plaha 7bafe180fb docs(router): fixed a typo in CanLoad title text (#27894)
* Interface that a class can implement to be a guard deciding if a children can be loaded.
'...if a children...' changed to '...if children...'
 * Interface that a class can implement to be a guard deciding if children can be loaded.

PR Close #27894
2019-01-10 17:06:55 -08:00
Teamop 9447b852a4 refactor(core): improve type for EventEmitter (#27228)
PR Close #27228
2019-01-10 17:02:53 -08:00
Keen Yee Liau 11d184aaae build(bazel): Bump @bazel/typescript & @bazel/karma to 0.22.1 (#28031)
PR Close #28031
2019-01-10 16:49:56 -08:00
Suguru Inatomi d4b476fb45 fix(bazel): Add /bazel-out to .gitignore (#27874)
PR Close #27874
2019-01-10 13:40:29 -08:00
George Kalpakas a64a7a4041 test(upgrade): log more info to help debug CI flakes (#28045)
Related Jira issue: FW-939

PR Close #28045
2019-01-10 11:03:26 -08:00
Paul Gschwendtner 9bda4460fa fix(bazel): protractor rule does not run spec files with underscore (#28022)
There are various e2e tests with the `_spec.ts` suffix in the Angular project. Currently the protractor Bazel rule does not pick up these files and just ignores them. Since underscore is commonly used, we should support this.

Needed for the conversion fo the `examples` to Bazel.

PR Close #28022
2019-01-10 10:53:26 -08:00
Keen Yee Liau 69ca7cd381 fix(bazel): Add @bazel/bazel to dev deps (#28032)
Project created by @angular/cli depends on Bazel at build time and
we should not assume that Bazel is available globally.
Instead, the project should specify an explicit dev dependency on
`@bazel/bazel`.

PR Close #28032
2019-01-09 17:45:17 -08:00
Meknassih 51f8892d9b docs(core): add missing closing backtick (`) (#27908)
PR Close #27908
2019-01-09 12:44:13 -08:00
Ivan Tham a06469c2f5 docs(forms): remove duplicated link (#27884)
PR Close #27884
2019-01-09 12:43:29 -08:00
Keen Yee Liau 49138bd114 build(bazel): List explicit dependencies in WORKSPACE (#28000)
Instead of relying on implicit dependencies through Angular, the WORKSPACE
of the project should explicitly add rules_nodejs and rules_typescript so
it can better control the versions.

PR Close #28000
2019-01-09 11:49:09 -08:00
Paul Gschwendtner aa7f2c8dc7 fix(bazel): flat module misses AMD module name on windows (#27839)
* Fixes that the flat module out files do not have a proper AMD module name on Windows. This is currently blocking serving a `ng_module` using the Bazel TypeScript `devserver` on Windows.

PR Close #27839
2019-01-09 10:42:38 -08:00
Dario Braun cdfca90053 docs(core): fix characters that corrupt link (#27982)
PR Close #27982
2019-01-09 10:38:23 -08:00
George Kalpakas 2ce90323b8 test(upgrade): properly clean up after tests to avoid errors in unrelated tests (#28013)
Many `ngUpgrade` tests need to manually [bootstrap modules][1] (instead
of using `TestBed` which automatically cleans up) and thus need to also
manually clean up afterwards (e.g. by calling [destroyPlatform()][2]
after each test).

Failing to destroy the platform is usually not a problem, unless the
next test tries to manually destroy it (as a precaution), as happens
[here][3] (among other places).

More specifically, the problem happens, because (as part of the clean-up
happening on platform destruction) upgraded components will try to
[call a method][4] on `angular.element` after `angular` has been
[set to `undefined`][5] (assuming the last test was using the
[withEachNg1Version()][6] helper).

Because the test order is pseudo-random and thus different on each run,
these errors did not always come up and - when they did- they would go
away after a couple of reruns, making them appear as flakes on CI.

(For reference, the issue was introduced in 43c33d566.)

This commit eliminates the issue by always destroying the platform after
each `ngUpgrade` test.

Jira issue: FW-924

[1]: https://github.com/angular/angular/blob/c3aa24c3f9699242331ca014b1616e968c1a7f8c/packages/upgrade/test/static/test_helpers.ts#L21
[2]: https://github.com/angular/angular/blob/c3aa24c3f9699242331ca014b1616e968c1a7f8c/packages/upgrade/test/static/integration/upgrade_component_spec.ts#L24
[3]: https://github.com/angular/angular/blob/c3aa24c3f9699242331ca014b1616e968c1a7f8c/packages/elements/test/create-custom-element_spec.ts#L31
[4]: https://github.com/angular/angular/blob/c3aa24c3f9699242331ca014b1616e968c1a7f8c/packages/upgrade/src/common/upgrade_helper.ts#L134-L135
[5]: https://github.com/angular/angular/blob/c3aa24c3f9699242331ca014b1616e968c1a7f8c/packages/upgrade/test/common/test_helpers.ts#L115
[6]: https://github.com/angular/angular/blob/c3aa24c3f9699242331ca014b1616e968c1a7f8c/packages/upgrade/test/common/test_helpers.ts#L31

PR Close #28013
2019-01-09 10:27:47 -08:00
Kara Erickson 5a7dd73b2c Revert "test(ivy): re-enable passing animation tests (#27997)"
This reverts commit 097af5ae2b.
It was accidentally merged on both master and patch branches when
it should have only been merged on master.
2019-01-08 16:19:44 -08:00
Kara Erickson 097af5ae2b test(ivy): re-enable passing animation tests (#27997)
PR Close #27997
2019-01-08 14:07:32 -08:00
Paul Gschwendtner 204b675ea4 build: remove "build.sh" script (#27937)
this script is now obsolete and not needed any more. yay!!!

PR Close #27937
2019-01-07 15:35:11 -08:00
Paul Gschwendtner 23c666bdf5 build: remove "test.sh" script (#27937)
test.sh is no longer needed... all the tests should now be executed via bazel.

if for whatever reason we need to run the legacy unit test setup, we should should follow the commands that we use to execute those tests in .circle/config.yaml

PR Close #27937
2019-01-07 15:35:11 -08:00
Paul Gschwendtner cbc45fd59b ci: move e2e tests from travis to circleci (#27937)
PR Close #27937
2019-01-07 15:35:11 -08:00
Igor Minar 50fadfaca3 ci: move local and saucelabs unit tests to circle (#27937)
Moving the tests over to CircleCI in pretty much "as-is" state just so that we can drop the dependency on Travis.

In the followup changes we plan to migrate these tests to run on sauce under bazel. @gregmagolan is working on that.

I've previously verified that all the tests executed in legacy-unit-tests-local already under bazel.
Therefore the legacy-unit-tests-local job is strictly not necessary any more, but given how flaky legacy-unit-tests-saucelabs is,
it is good to have the -local job just so that we can quickly determine if any failure is a flake or legit issue
(the bazel version of these tests could theoretically run in a slightly different way and fail or not fail in a different way, so having -lcoal job is just an extra safety check).

This change was coauthored with @devversion

PR Close #27937
2019-01-07 15:35:10 -08:00
Paul Gschwendtner 9e04284bb3 fix(bazel): protractor utils cannot start server on windows (#27915)
* Currently the protractor utils assume that the specified Bazel server runfile can be resolved by just using the real file system. This is not the case on Windows because the runfiles are not symlinked into the working directory and need to be resolved through the runfile manifest.

PR Close #27915
2019-01-07 14:49:44 -08:00
Paul Gschwendtner 216bbd09ef 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:48 -08:00
Paul Gschwendtner 0c683a73e2 test(bazel): fix all ng_package tests not working on windows (#27829)
PR Close #27829
2019-01-07 14:46:48 -08:00
Paul Gschwendtner 998bb8382e fix(bazel): packager not properly removing amd directives on windows (#27829)
PR Close #27829
2019-01-07 14:46:47 -08:00
Paul Gschwendtner f893e2e502 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:47 -08:00
Greg Magolan 3fc02ce60b build: update to Bazel 0.21.0 (#27935)
PR Close #27935
2019-01-04 18:38:44 -08:00
Paul Gschwendtner 7e98eedf5e 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
Judy Bogart 213e01bd38 docs: add api doc for viewport scroller (#27381)
PR Close #27381
2018-12-26 11:47:16 -08:00
Alex Eagle 92d3942691 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
Michael De Wree 4b78c23c65 docs: fix typo explictly (#27798)
Closes #27796

PR Close #27798
2018-12-26 06:57:55 -05:00
jnizet 98a617e415 docs(forms): clarify the pattern validator behavior (#27560)
PR Close #27560
2018-12-21 15:12:31 -05:00
George Kalpakas dd59e9a343 docs(upgrade): add gotchas/tips/example for multiple downgraded modules (#27217)
PR Close #27217
2018-12-20 16:20:42 -05:00
George Kalpakas 89fd1822d4 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:42 -05:00
George Kalpakas 4ae1880642 fix(upgrade): allow nesting components from different downgraded modules (#27217)
PR Close #27217
2018-12-20 16:20:42 -05:00
George Kalpakas c51b0b9564 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:42 -05:00