Commit Graph

19882 Commits

Author SHA1 Message Date
Kristiyan Kostadinov 744f46c37d refactor(compiler-cli): migrate view compiler directive tests (#39929)
Migrates the compliance tests under `r3_view_compiler_directives` to the new format.

PR Close #39929
2020-12-02 14:55:58 -08:00
Jeremy Elbourn 790ca09e04 docs: remove superfluous "NOTE:" (#39933)
PR Close #39933
2020-12-02 14:55:27 -08:00
Andrew Kushnir a55e01b89c test(core): verify `onDestroy` callbacks are invoked when ComponentRef is destroyed (#39876)
This commit adds a few tests to verify that the `onDestroy` callbacks are invoked when `ComponentRef` instance
is destroyed and the logic is consistent between ViewEngine and Ivy.

PR Close #39876
2020-12-02 12:56:05 -08:00
arturovt df27027ecb fix(core): remove application from the testability registry when the root view is removed (#39876)
In the new behavior Angular removes applications from the testability registry when the
root view gets destroyed. This eliminates a memory leak, because before that the
TestabilityRegistry holds references to HTML elements, thus they cannot be GCed.

PR Close #22106

PR Close #39876
2020-12-02 12:56:04 -08:00
Andrew Scott 75fc89384d refactor(compiler-cli): expose TTC method to determine if file is tracked shim (#39768)
The Language Service "find references" currently uses the
`ngtypecheck.ts` suffix to determine if a file is a shim file. Instead,
a better API would be to expose a method in the template type checker
that does this verification so that the LS does not have to "know" about
the typecheck suffix. This also fixes an issue (albeit unlikely) whereby a file
in the user's program that _actually_ is named with the `ngtypecheck.ts`
suffix would have been interpreted as a shim file.

PR Close #39768
2020-12-02 12:54:22 -08:00
Andrew Scott 06a782a2e3 feat(language-service): Add "find references" capability to Ivy integrated LS (#39768)
This commit adds "find references" functionality to the Ivy integrated
language service. The basic approach is as follows:

1. Generate shims for all files to ensure we find references in shims
throughout the entire program
2. Determine if the position for the reference request is within a
template.
  * Yes, it is in a template: Find which node in the template AST the
  position refers to. Then find the position in the shim file for that
  template node. Pass the shim file and position in the shim file along
  to step 3.
  * No, the request for references was made outside a template: Forward
  the file and position to step 3.
3. (`getReferencesAtTypescriptPosition`): Call the native TypeScript LS
`getReferencesAtPosition`. For each reference that is in a shim file, map those
back to a template location, otherwise return it as-is.

PR Close #39768
2020-12-02 12:54:21 -08:00
Andrew Scott c69e67c9cb refactor(compiler-cli): Always wrap RHS of TCB writes in parens (#39768)
There were two issues with the current TCB:

1. The logic for only wrapping the right hand side of the property write
if it was not already a parenthesized expression was incorrect. A
parenthesized expression could still have a trailing comment, and if
that were the case, that span comment would still be ambiguous, as explained
by the comment in the code before `wrapForTypeChecker`.
2. The right hand side of keyed writes was not wrapped in parens at all

PR Close #39768
2020-12-02 12:54:20 -08:00
Andrew Scott 786295dfbd refactor(compiler-cli): Add nameSpan to SafePropertyRead TCB (#39768)
In order to map the a safe property read's method access in the type check block
directly back to the property in the template source, we need to
include the `SafePropertyRead`'s `nameSpan` with the `ts.propertyAccess` for
the pipe's transform method.

Note that this is specifically relevant to the Language Service's "find
references" feature. As an example, with something like `{{a?.value}}`,
when calling "find references" on the 'value' we want the text
span of the reference to just be `value` rather than the entire source
`a?.value`.

PR Close #39768
2020-12-02 12:54:19 -08:00
Andrew Scott 1a5e5f86a3 refactor(compiler-cli): Include pipe `nameSpan` in TCB (#39768)
In order to map the pipe's `transform` method in the type check block
directly back to the pipe name in the template source, we need to
include the `BindingPipe`'s `nameSpan` with the `ts.methodAccess` for
the pipe's transform method.

Note that this is specifically relevant to the Language Service's "find
references" feature. As an example, with something like `-2.5 | number:'1.0-0'`,,
when calling "find references" on the 'number' pipe we want the text
span of the reference to just be `number` rather than the entire binding
pipe's source `-2.5 | number:'1.0-0'`.

PR Close #39768
2020-12-02 12:54:18 -08:00
Eduardo Speroni 82e3f546db fix(zone.js): patch child method that overrides an already patched method (#39850)
Fix a case where, if the parent class had already been patched, it would
not patch the child class. In addition to checking if the method is
defined in the prototype, and not inherited, it also does the same for
the unpatched method.

PR Close #39850
2020-12-02 12:52:27 -08:00
George Kalpakas eba185edc8 test(docs-infra): reduce ambiguity in `deploy-to-firebase.js` test descriptions (#39853)
Previously, test descriptions used `latest` to refer to the most
recent/highest version. This was ambiguous, because `latest` can also
refer to the stable version of a package (e.g. see `@latest` npm tag).

This commit replaces `latest` with `highest` (or `highest for major`) to
reduce ambiguity.

Discussed in:
https://github.com/angular/angular/pull/39853#discussion_r531730317

PR Close #39853
2020-12-02 12:51:39 -08:00
George Kalpakas cf1f5a1e37 fix(docs-infra): fix redirecting `rc.angular.io` to `angular.io` when no active RC (#39853)
Currently there is an issue with redirecting `rc.angular.io` to
`angular.io` when there is no active RC. If a user has visited
`rc.angular.io` before and has a ServiceWorker registered for that
subdomain, they will never "see" the redirect to `angular.io`.

This commit fixes the problem by doing an additional deployment from the
stable branch to the `rc-angular-io-site` Firebase site when there is no
active RC. This additional deployment will ensure that:
1. Users will be temporarily redirected from `rc.angular.io` to
   `angular.io`.
2. Users with a registered ServiceWorker (who don't see the redirect)
   will have their ServiceWorker unregistered on the next visit.
3. The content on both sites is identical.

See #39760 for more details on the problem and the solution.

NOTE:
As mentioned in #39760, for this fix to take affect, we need to remove
the redirect from `rc.angular.io` to `angular.io` in the Firebase
console for site `rc-angular-io-site`.

Fixes #39760

PR Close #39853
2020-12-02 12:51:38 -08:00
George Kalpakas 1e39e493fb fix(docs-infra): do not deploy as `archive` when major is not lower than stable (#39853)
Previously, a branch would be deployed as `archive` even if it had a
major version that was equal/higher than that of the stable branch (as
long as it was not the RC branch - i.e. not the most recent minor
branch). For example, with `11.0.x` as the stable branch  and `12.0.x`
as the RC branch, `11.1.x` would be deployed as archive.

Theoretically, we should never find ourselves in such a situation.
Typically, there will only be at most one minor branch most recent than
the stable one (and that branch will be the RC branch). However, it
is possible under unusual circumstances.

This commit adds additional checks to guard against this problem. It
also refactors the code in preparation of fixing an issue with
`rc.angular.io` redirects in the presence of a ServiceWorker, which will
require identifying whether there is an active RC version or not.
See #39760 for more details.

PR Close #39853
2020-12-02 12:51:37 -08:00
George Kalpakas ab4e9e1d52 test(docs-infra): avoid unnecessary re-computations in `deploy-to-firebase.spec.js` (#39853)
Previously, the latest commit for branch may be computed multiple times
in the `deploy-to-firebase.js` tests.

This commit avoids the unnecessary re-computations by computing the
latest commits for the necessary branches at the beginning and using the
computed values throughout the tests.

PR Close #39853
2020-12-02 12:51:36 -08:00
George Kalpakas 53bd832c77 refactor(docs-infra): support multiple deployments per run (#39853)
Previously, the `deploy-to-firebase.js` script would only perform one
deployment operation on each run.

This commit adds support for performing multiple deployment operations.

NOTE:
In a subsequent commit, this will be leveraged fix an issue with
`rc.angular.io` redirects in the presence of a ServiceWorker by
deploying the same artifacts to multiple Firebase projects/sites.
See #39760 for more details.

PR Close #39853
2020-12-02 12:51:35 -08:00
George Kalpakas 6e6eee6d5b refactor(docs-infra): decouple deploying from other operations in `deploy-to-firebase.js` (#39853)
Previously, the `deploy()` function in `deploy-to-firebase.js` would
also perform other operations (beyond deploying), such as building the
app, checking the generated payload size, testing the PWA score of the
deployed app.

This commit decouples these operations, so that deploying can be
performed independently.

NOTE:
In a subsequent commit, this will be leveraged fix an issue with
`rc.angular.io` redirects in the presence of a ServiceWorker by
deploying the same artifacts to multiple Firebase projects/sites.
See #39760 for more details.

PR Close #39853
2020-12-02 12:51:34 -08:00
Wes Grimes c923aaf64b docs: add wes grimes to GDE resources (#34741)
PR Close #34741
2020-12-02 12:40:21 -08:00
George Kalpakas b596366c67 feat(docs-infra): add maskable PWA icon (#39928)
This commit adds a [maskable PWA icon][1] to ensure it looks good on
different devices/platforms. It also improves the PWA Lighthouse score
(from 96 to 100) by passing the [maskable icon audit][2].

For reference, the maskable icon can be previewed [here][3].

[1]: https://web.dev/maskable-icon/
[2]: https://web.dev/maskable-icon-audit
[3]:
https://maskable.app/?demo=https://user-images.githubusercontent.com/8604205/100861028-f16c9d80-3499-11eb-9341-beba69988cfa.png

PR Close #39928
2020-12-02 11:17:53 -08:00
George Kalpakas d5fc51cc22 build(docs-infra): update `lighthouse` to 6.5.0 (#39928)
This commit updates the `lighthouse` package to version 6.5.0 to take
advantage of the latest fixes and audits.

PR Close #39928
2020-12-02 11:17:52 -08:00
Nicholas Papadopoulos 7851a254d8 docs(common): fix typo in HttpClient docs (#39904)
PR Close #39904
2020-12-02 11:16:43 -08:00
Kapunahele Wong 943ae37f99 docs: archive svg-in-templates.md (#39896)
PR Close #39896
2020-12-02 11:15:32 -08:00
Иванов Дмитрий 215e9069e3 docs(forms): fix example 'Reset the form group values and disabled status' (#33137)
PR Close #33137
2020-12-02 11:14:25 -08:00
Jessica Janiuk 784667ca12 release: cut the v11.1.0-next.1 release (#39932)
PR Close #39932
2020-12-02 10:40:10 -08:00
Kristiyan Kostadinov eac85b4e23 test(compiler-cli): migrate view compliance tests (#39914)
Migrates the `r3_view_compiler` tests to the new format.

PR Close #39914
2020-12-01 15:12:40 -08:00
George Kalpakas 7695671cd6 build(docs-infra): upgrade cli command docs sources to 548c6ed3e (#39906)
Updating [angular#master](https://github.com/angular/angular/tree/master) from
[cli-builds#master](https://github.com/angular/cli-builds/tree/master).

##
Relevant changes in
[commit range](70150e3f0...548c6ed3e):

**Modified**
- help/build.json

PR Close #39906
2020-12-01 14:59:04 -08:00
Kristiyan Kostadinov 50962c1b0b test(compiler-cli): migrate template compliance tests (#39871)
Migrates the `r3_view_compiler_template` tests to the new format.
Also introduces a new matcher for unique function names.

PR Close #39871
2020-12-01 14:58:11 -08:00
Kristiyan Kostadinov 40b127c7a3 test(compiler-cli): migrate listener compliance tests (#39867)
Migrates the `r3_view_compiler_listener` compliance tests to the new format.

PR Close #39867
2020-12-01 14:56:59 -08:00
Kristiyan Kostadinov 97ea2c7bfd test(compiler-cli): migrate input/output compliance tests (#39867)
Migrates the `r3_view_compiler_input_outputs` compliance tests to the new format.

PR Close #39867
2020-12-01 14:56:59 -08:00
Fabian Wiles 7a5bc95614 refactor(http): inline HttpObserve (#18417)
Inline `HttpObserve` for better type safety.

Fix #18146

PR Close #18417
2020-12-01 12:13:04 -08:00
Kapunahele Wong b40aa0a5d3 docs: edit binding-syntax doc (#38773)
PR Close #38773
2020-12-01 12:05:53 -08:00
George Kalpakas 00d56e4ead ci: enable the Selenium Promise Manager in AIO e2e tests to avoid flakiness on CI (#39905)
Since we turned off the Selenium Promise Manager in #39600, the AIO e2e
tests have started flaking on CI. After trying out several things, the
only change that seems to eliminate the flakiness is turning the
Selenium Promise Manager back on (see #39873 for more details).

This commit turns the Selenium Project Manager on to get rid of the
flakiness.

Fixes #39872

PR Close #39905
2020-12-01 11:39:49 -08:00
George Kalpakas 07fa97c831 ci: remove unnecessary retry for docs examples tests (#39905)
In #32497, an option was introduced to retry failed docs examples tests
a second time. This was done to work around some then recently
introduced flakiness. After inspecting ~50 recent CI docs examples jobs,
all tests passed on the first try.

This commit gets rid of the retry attempt. This will avoid covering up
any new flakiness introduces in the future.

PR Close #39905
2020-12-01 11:39:49 -08:00
Kapunahele Wong 0b5b24abd7 docs: edit interpolation doc (#38687)
This commit edits the copy on the interpolation page.
Tightens language, clarifies headers, and streamlines text.
There are no content or code changes.

PR Close #38687
2020-12-01 10:15:00 -08:00
Kristiyan Kostadinov 11cd37fae3 fix(core): not invoking object's toString when rendering to the DOM (#39843)
Currently we convert objects to strings using `'' + value` which is quickest,
but it stringifies the value using its `valueOf`, rather than `toString`. These
changes switch to using `String(value)` which has identical performance
and calls the `toString` method as expected. Note that another option
was calling `toString` directly, but benchmarking showed it to be slower.

I've included the benchmark I used to verify the performance so we have it
for future reference and we can reuse it when making changes to `renderStringify`
in the future.

Also for reference, here are the results of the benchmark:

```
Benchmark: renderStringify
 concat: 2.006 ns(0%)
 concat with toString: 2.201 ns(-10%)
 toString: 237.494 ns(-11741%)
 toString with toString: 121.072 ns(-5937%)
 constructor: 2.201 ns(-10%)
 constructor with toString: 2.201 ns(-10%)
 toString mono: 14.536 ns(-625%)
 toString with toString mono: 9.757 ns(-386%)
```

Fixes #38839.

PR Close #39843
2020-11-30 15:49:57 -08:00
Kapunahele Wong 1de59d2818 docs: edit step 2 of getting started start-routing.md (#39593)
PR Close #39593
2020-11-30 15:00:38 -08:00
Jaime Oliveira dd3ed3cb2b docs: fix builder section of generated angular.json file for libs (#39888)
Closes #39887

PR Close #39888
2020-11-30 12:10:12 -08:00
Kristiyan Kostadinov 71a5314335 test(compiler-cli): migrate providers compliance tests (#39878)
Migrates the `r3_view_compiler_providers` compliance tests to the new format.

PR Close #39878
2020-11-30 12:07:02 -08:00
Tzimpoulas Nikos 1539c64fb0 docs(common): change HTTPResponse to HttpResponse (#39860)
PR Close #39860
2020-11-30 12:04:34 -08:00
JoostK c5619ca56e test(compiler-cli): convert styling compliance tests (#39881)
This commit converts the DI compliance tests taken from
`r3_view_compiler_styling_spec.ts` to the new test runner.

PR Close #39881
2020-11-30 11:23:30 -08:00
JoostK c622b17b0d test(compiler-cli): convert di compliance tests (#39863)
This commit converts the DI compliance tests taken from
`r3_view_compiler_di_spec.ts` to the new test runner.

PR Close #39863
2020-11-30 11:21:23 -08:00
JoostK 157d690704 test(compiler-cli): expand logging when extra compliance check fails (#39863)
Previously this would have just printed that `false` was not equal to
`true`, which, although true, is not very helpful. This commit adds
details about which special check failed together with the generated
code, for easier debugging.

PR Close #39863
2020-11-30 11:21:23 -08:00
bluemyria e2040af412 docs: fix typo in two-way-binding guide (#39859)
PR Close #39859
2020-11-30 11:15:02 -08:00
christos-P df97fbc077 docs: added a missing ` in inputs-outputs.md (#39856)
PR Close #39856
2020-11-30 11:14:01 -08:00
Kapunahele Wong 9a2f83b826 docs: edit Getting Started start/index.md copy and headers (#39583)
PR Close #39583
2020-11-30 11:06:11 -08:00
Kapunahele Wong 93d689ffa8 docs: edit dependency-injection.md (#39255)
PR Close #39255
2020-11-30 11:03:59 -08:00
Andrew Scott 68d4a74411 fix(core): Ensure OnPush ancestors are marked dirty when events occur (#39833)
We currently only wrap the event listener in the function which ensures
ancestors are marked for check when the listener is placed on an element
that has a native method for listening to an event. We actually need to do
this wrapping in all cases so that events that are attached to non-rendered
template items (`ng-template` and `ng-container`) also mark ancestors for check
when they receive the event.

fixes #39832

PR Close #39833
2020-11-25 14:39:19 -08:00
Ryan Russell e148382bd0 docs(forms): Deprecate legacy options for FormBuilder.group (#39769)
DEPRECATION:

Mark the {[key: string]: any} type for the options property of the FormBuilder.group method as deprecated.
Using AbstractControlOptions gives the same functionality and is type-safe.

PR Close #39769
2020-11-25 14:28:11 -08:00
JiaLiPassion c43267b912 build: update peerDependencies of zone.js to 0.10~0.11 (#39809)
`@angular/core` support zone.js `^0.10.2 and ^0.11.3`, so this PR updates the
peerDependencies to `^0.10.2 || ^ 0.11.3`, so the app will not show warning about
peer denepdency not consistent when using zone.js 0.10.x version.

PR Close #39809
2020-11-25 14:25:48 -08:00
Manfred Steyer ba6945bfa9 docs(docs-infra): display angulararchitects.io in trainings (#37139)
This adds angulararchitects.io to the tranings section in the
resources.json file for angular.io. It also adds a description
for angulararchitects.io.

PR Close #37139
2020-11-25 12:33:08 -08:00
Adrien Crivelli 07f2e0c34e docs: integrate webserver configuration (#36553)
The article previously referred was out of date. Most of the article content
was already duplicated here, or described how to generate multiple bundles. But
creating multiple bundles manually is now obsolete and the parameter `--localize`
should be preferred instead, because it is much faster.

This commit integrate the only interesting part left, relating to webserver configuration.

Co-authored-by: David Shevitz <dshevitz@google.com>

PR Close #36553
2020-11-25 12:30:08 -08:00