Commit Graph

19794 Commits

Author SHA1 Message Date
Andrew Kushnir 1e46b73463 ci: add new group to approve contributor list changes (#40368)
This commit adds a new `docs-contributors` group (with Emma and Minko as members) which will be used as reviewers
for PRs that update the list of contributors.

PR Close #40368
2021-01-11 09:48:48 -08:00
George Kalpakas 94ec027865 build(docs-infra): upgrade cli command docs sources to e1bcfba66 (#40373)
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](4cefc7dc1...e1bcfba66):

**Modified**
- help/extract-i18n.json
- help/test.json

##
Relevant changes in
[commit range](e41d0dd01...e1bcfba66) since PR #40355:

**Modified**
- help/extract-i18n.json

##
Closes #40355

PR Close #40373
2021-01-11 09:46:19 -08:00
Anuj Bhatnagar 9a024d82ec docs: fix incorrect link "Debugging tests" (#40379)
update the "Debugging tests" link from "guide/testing-attribute-directives" to "guide/test-debugging"
PR Close #40379
2021-01-11 09:44:59 -08:00
Andrew Scott 74175f84ea fix(router): Remove usage of `Object.values` to avoid the need for a polyfill (#40370)
`Object.values` is not supported in IE11 without a polyfill. The quickest,
most straightfoward fix for this is to simply use `Object.keys` instead.
We may want to consider including the polyfill in the CLI in the future
or just wait until IE11 support is dropped before using
`Object.values`.

PR Close #40370
2021-01-09 16:36:21 -08:00
Keen Yee Liau 6a9e328432 feat(language-service): log Angular compiler options (#40364)
This commit records the Angular compiler options in the log file to help
debugging.

PR Close #40364
2021-01-08 13:45:47 -08:00
Keen Yee Liau 811cacc80c fix(language-service): reinstate overridden compiler option after change (#40364)
Currently the language service has to force `compileNonExportedClasses` to
`true` to handle inline NgModules in tests, regardless of the value in user's
tsconfig.json.

However, the override is not reinstated after the compiler option changes
(triggered by a change in tsconfig.json).
This commit fixes the bug.

PR Close #40364
2021-01-08 13:45:47 -08:00
Andrew Scott b36bece17c docs(router): Clearly document how to retrieve all params in the router tree (#40306)
This commit documents how to add a helper function which combines all the params
in the router state tree into a single object. It provides a starting point for
developers to reference if they require a more fine-tuned approach.

Fixes #11023

PR Close #40306
2021-01-08 11:47:47 -08:00
Christian Liebel e05ac395fc docs: add @christianliebel to list of GDEs (#39788)
PR Close #39788
2021-01-08 09:50:52 -08:00
Che Liu 8116edb17f fix(zone.js): fix typo in zone_externs (#40348)
This change fixes a typo in zone.js externs definition and avoids Closure
compiler renaming Task.cancelScheduleRequest() unexpectedly.

PR Close #40348
2021-01-08 09:47:46 -08:00
sijmenhuizenga 14389755e6 docs: import in-memory-web-api readme (#40203)
In #37182 the in-memory-web-api module was moved into this repo.
Copy the reamde into this repo with the following changes:
 * Removed Travis badges
 * Updated github links to point to Angular repo
 * Removed 'running tests' as it is no longer relevant

Fixes #40190

PR Close #40203
2021-01-08 09:45:41 -08:00
sijmenhuizenga acb1162d91 docs: change links to in-memory-web-api in github/angular repo (#40203)
In #37182 the in-memory-web-api module was moved into this repo.
Make links in the docs point to the new location of the in-memory-web-api.

Fixes #40190

PR Close #40203
2021-01-08 09:45:41 -08:00
Kristiyan Kostadinov 4f73820ad6 fix(core): memory leak if view container host view is destroyed while view ref is not (#40219)
When we attach a `ViewRef` to a `ViewContainerRef`, we save a reference to the container
onto the `ViewRef` so that we can remove it when the ref is destroyed. The problem is
that if the container's `hostView` is destroyed first, the `ViewRef` has no way of knowing
that it should stop referencing the container.

These changes remove the leak by not saving a reference at all. Instead, when a `ViewRef`
is destroyed, we clean it up through the `LContainer` directly. We don't need to worry
about the case where the container is destroyed before the view, because containers
automatically clean up all of their views upon destruction.

Fixes #38648.

PR Close #40219
2021-01-08 09:45:12 -08:00
Andrew Kushnir fdbd3cae8a fix(forms): handle standalone `<form>` tag correctly in `NgControlStatusGroup` directive (#40344)
The `NgControlStatusGroup` directive is shared between template-driven and reactive form modules. In cases when
only reactive forms module is present, the `NgControlStatusGroup` directive is still activated on all `<form>`
elements, but if there is no other reactive directive applied (such as `formGroup`), corresponding `ControlContainer`
token is missing, thus causing exceptions (since `NgControlStatusGroup` directive relies on it to determine the
status). This commit updates the logic to handle the case when no `ControlContainer` is present (effectively making
directive logic a noop in this case).

Alternative approach (more risky) worth considering in the future is to split the `NgControlStatusGroup` into
2 directives with different set of selectors and include them into template-driven and reactive modules separately.
The downside is that these directives might be activated simultaneously on the same element (e.g. `<form>`),
effectively doing the work twice.

Resolves #38391.

PR Close #40344
2021-01-08 09:44:42 -08:00
Joey Perrott 7a819caef6 fix(dev-infra): delay checking if a closed pr has been merged by 30 seconds (#40181)
Delaying the check if a closed PR was closed by a merge or just closed by 30 seconds
allows for Github to have time to update the PR to be associated to the commit which
closed the PR.  Without this delay, a race condition can exist in which we check for
how a PR was closed before this association is made.

PR Close #40181
2021-01-08 09:38:19 -08:00
George Kalpakas 0153cd0d28 build: remove redundant `node_repositories` dictionary from `node_repositories` rules (#40151)
According to a [discussion with Alex Eagle][1], the `node_repositories`
dictionary is no longer necessary, since the `node_repositories` rule
will ensure all Node.js versions are available.

From the [`node_repositories` docs][2]:

> By default, if this attribute has no items, we’ll use a list of all
> public NodeJS releases.

[1]: https://angular-team.slack.com/archives/C042EU9T5/p1606841390116500?thread_ts=1606838958
[2]: https://bazelbuild.github.io/rules_nodejs/Built-ins.html#node_repositories-node_repositories

PR Close #40151
2021-01-08 09:37:51 -08:00
Pete Bacon Darwin e27b920ac3 refactor(compiler-cli): split up `NodeJSFileSystem` class (#40281)
This class is refactored to extend the new `NodeJSReadonlyFileSystem`
which itself extends `NodeJSPathManipulation`. These new classes allow
consumers to create file-systems that provide a subset of the full file-system.

PR Close #40281
2021-01-08 09:34:44 -08:00
Pete Bacon Darwin bb6d791dab refactor(localize): update to use new file-system interfaces (#40281)
Now that `ReadonlyFileSystem` and `PathManipulation` interfaces are
available, this commit updates the localize package to use these more
focussed interfaces.

PR Close #40281
2021-01-08 09:34:44 -08:00
Pete Bacon Darwin d100a15998 refactor(compiler-cli): update to use new file-system interfaces (#40281)
Now that `ReadonlyFileSystem` and `PathManipulation` interfaces are
available, this commit updates the compiler-cli to use these more
focussed interfaces.

PR Close #40281
2021-01-08 09:34:44 -08:00
Pete Bacon Darwin 80b1ba9f95 refactor(compiler-cli): split the `FileSystem` interface up (#40281)
This interface now extends `ReadonlyFileSystem` which in turn
extends `PathManipulation`. This means consumers of these
interfaces can be more specific about what is needed, and so
providers do not need to implement unnecessary methods.

PR Close #40281
2021-01-08 09:34:44 -08:00
JoostK da6c739bb6 test(core): update test expectation to account for IE11 anonymous function name (#40342)
The "monitoring" workflow has been failing since #40127 was merged,
due to a Saucelabs test failure in Internet Explorer 11. The issue is
with the test's expectation which does not account for Ivy instruction
invocations to use "anonymous" instead of the instruction's function
name. This commit changes the test expectation to also accept
"anonymous", which was already the case for similar expectations.

PR Close #40342
2021-01-07 13:29:49 -08:00
ivanwonder 15b15be259 fix(compiler): recover event parse when animation event name is empty (#39925)
Now when the animation trigger output event is missing its phase value name, the `BoundEvent` will be ignored,
but it's useful for completion in language service.

PR Close #39925
2021-01-07 13:21:06 -08:00
Andrew Scott 57043721db docs(language-service): Add comment about approach to quick info for two-way bindings (#40185)
This commit simply adds a comment about why quick info only gets data
for the `BoundAttribute` of a two-way binding.

PR Close #40185
2021-01-07 13:18:38 -08:00
Andrew Scott 7d74853a1d fix(language-service): Support completions of two-way bindings (#40185)
This commit adds special handling to the completion builder by detecting
a two way binding context and ensuring that we filter out any `Input`s
that do not support two way binding.

PR Close #40185
2021-01-07 13:18:38 -08:00
Andrew Scott ebb7ac5979 fix(language-service): Support 'find references' for two-way bindings (#40185)
Rather than expecting that a position in a template only targets a
single node, this commit simply adjusts the approach to account for two way
bindings. Specifically, we attempt to get references for each targeted
node and then return the combination of all results, or `undefined` if
none of the target nodes had references.

PR Close #40185
2021-01-07 13:18:38 -08:00
Andrew Scott a9d8c228d9 fix(language-service): Support 'go to definition' for two-way bindings (#40185)
Rather than expecting that a position in a template only targets a
single node, this commit adjusts the approach to account for two way
bindings. In particular, we attempt to get definitions for each targeted
node and then return the combination of all results, or `undefined` if
none of the target nodes had definitions.

PR Close #40185
2021-01-07 13:18:38 -08:00
Andrew Scott d70c26cc06 refactor(language-service): Have TemplateTarget recognize two way bindings (#40185)
Adjust the visitor logic of the template target as well as the
consumption of the visitor result to account for two-way bindings.

This sets up downstream consumers for being able to handle the
possibility of a template position that targets both an input and an
output.

PR Close #40185
2021-01-07 13:18:38 -08:00
Andrew Scott a893187d51 refactor(language-service): Add type to `TemplateTarget` that can indicate multi-node targets (#40185)
The current template target implementation only allows a way to
represent the template position as targeting a single node in the
template AST. However, there is at least one case (banana-in-a-box)
where a given template position refers to two template targets.

This commit expands the contexts that the `TemplateTarget` can return to
include support for the banana-in-a-box syntax, which has two logically
targetted AST nodes given a position within the `keySpan` of the
binding.

PR Close #40185
2021-01-07 13:18:38 -08:00
Andrew Scott 46ea684351 refactor(compiler-cli): find symbol for output when there is a two way binding (#40185)
This commit fixes the Template Type Checker's `getSymbolOfNode` so that
it is able to retrieve a symbol for the `BoundEvent` of a two-way
binding. Previously, the implementation would locate the node in the TCB
for the input because it appeared first and shares the same `keySpan` as
the event binding. To fix this, the TCB node search now verifies that
the located node matches the expected name for the output subscription:
either `addEventListener` for a native listener  or the class member of the Angular `@Output`
in the case of an Angular output, as would be the case for two-way
bindings.

PR Close #40185
2021-01-07 13:18:38 -08:00
Kristiyan Kostadinov 104546569e fix(compiler): incorrectly interpreting some HostBinding names (#40233)
Currently when analyzing the metadata of a directive, we bundle together the bindings from `host`
and the `HostBinding` and `HostListener` together. This can become a problem later on in the
compilation pipeline, because we try to evaluate the value of the binding, causing something like
`@HostBinding('class.foo') public true = 1;` to be treated the same as
`host: {'[class.foo]': 'true'}`.

While looking into the issue, I noticed another one that is closely related: we weren't treating
quoted property names correctly. E.g. `@HostBinding('class.foo') public "foo-bar" = 1;` was being
interpreted as `classProp('foo', ctx.foo - ctx.bar)` due to the same issue where property names
were being evaluated.

These changes resolve both of the issues by treating all `HostBinding` instance as if they're
reading the property from `this`. E.g. the `@HostBinding('class.foo') public true = 1;` from above
is now being treated as `host: {'[class.foo]': 'this.true'}` which further down the pipeline becomes
`classProp('foo', ctx.true)`. This doesn't have any payload size implications for existing code,
because we've always been prefixing implicit property reads with `ctx.`. If the property doesn't
have an identifier that can be read using dotted access, we convert it to a quoted one (e.g.
`classProp('foo', ctx['is-foo']))`.

Fixes #40220.
Fixes #40230.
Fixes #18698.

PR Close #40233
2021-01-07 13:15:46 -08:00
Pete Bacon Darwin 266cc9b162 refactor(compiler-cli): support external template source-mapping when linking (#40237)
This commit changes the `PartialComponentLinker` to use the original source
of an external template when compiling, if available, to ensure that the
source-mapping of the final linked code is accurate.

If the linker is given a file-system and logger, then it will attempt
to compute the original source of external templates so that the final
linked code references the correct template source.

PR Close #40237
2021-01-07 13:12:53 -08:00
Pete Bacon Darwin 0fd06e5ab8 test(compiler-cli): add external template source-map tests (#40237)
This commit migrates, and supplements, compliance tests that
check the source-mapping of external templates.

PR Close #40237
2021-01-07 13:12:53 -08:00
Pete Bacon Darwin dfe64a0060 test(compiler-cli): improve source mapping compliance test failure messages (#40237)
Now, if a source-mapping compliance test fails, the message displays both
the path to the generated file, and more helpfully the path to the expected
file.

PR Close #40237
2021-01-07 13:12:53 -08:00
Pete Bacon Darwin 9f662e1313 test(compiler-cli): tidy up the line-ending compliance test TEST_CASES (#40237)
Previously the names of the source and expectation files were often reused,
which caused potential confusion.

There is now a single source file for
each test-case, which is important when they are being compiled with different
compiler options, since the GOLDEN_PARTIAL file will only contain one copy
per file name.

The names of the expectation files have now been changed so that is clearer
which test-case they are related to.

PR Close #40237
2021-01-07 13:12:53 -08:00
Pete Bacon Darwin 2224ab712d test(compiler-cli): fix up import paths in test code (#40237)
These imports were unnecessrily deep, since the files are actually in the
same directory.

PR Close #40237
2021-01-07 13:12:53 -08:00
Pete Bacon Darwin 8ebf538c04 refactor(compiler-cli): add file to Babel locations (#40237)
The filename of the source-span is now added to the Babel location
when setting the source-map range in the `BabelAstHost`.

Note that the filename is only added if it is different to the main file
being processed. Otherwise Babel will generate two entries in its
generated source-map.

PR Close #40237
2021-01-07 13:12:53 -08:00
Pete Bacon Darwin 3158858059 fix(compiler-cli): do not duplicate repeated source-files in rendered source-maps (#40237)
When a source-map/source-file tree has nodes that refer to the same file, the
flattened source-map rendering was those files multiple times, rather than
consolidating them into a single source-map source.

PR Close #40237
2021-01-07 13:12:53 -08:00
Pete Bacon Darwin e7c3687936 refactor(compiler): synthesize external template node for partial compilation (#40237)
When partially compiling a component with an external template, we must
synthesize a new AST node for the string literal that holds the contents of
the external template, since we want to source-map this expression directly
back to the original external template file.

PR Close #40237
2021-01-07 13:12:53 -08:00
Alexey Elin aea265bfc5 docs: lifecycle-hooks example - extract things (components, directives) into their own files (#40212)
This change is in line with Angular Style Guide rule 01-01
https://angular.io/guide/styleguide#style-01-01.

PR Close #40212
2021-01-07 13:10:41 -08:00
Alexey Elin 9be9e466b1 docs: remove duplicated 'the' (#40333)
PR Close #40333
2021-01-07 13:09:34 -08:00
Craig Spence 335c1ab37f docs: add Craig Spence to contributor list (#40335)
PR Close #40335
2021-01-07 13:09:04 -08:00
Joey Perrott 1437f4cf3c build: use reviewed_for: ignored for required-minimum-review group (#40338)
Since all PRs will need to have this review, all reviews should apply
to this group even if someone is reviewing for another group.

PR Close #40338
2021-01-07 13:07:16 -08:00
Andrew Scott 482a4c6c12
docs: release notes for the v11.0.7 release (#40345) 2021-01-07 12:35:27 -08:00
Andrew Scott 2028a43580 fix(router): Remove usage of `Object.entries` to avoid the need for a polyfill (#40340)
`Object.entries` is not supported in IE11 without a polyfill. The quickest,
most straightfoward fix for this is to simply use `Object.keys` instead.
We may want to consider including the polyfill in the CLI in the future
or just wait until IE11 support is dropped before using
`Object.entries`.

PR Close #40340
2021-01-07 11:45:58 -08:00
George Kalpakas 1e151f9fe4 docs: fix instructions for setting up `ProductDetailsComponent` in `start-routing.md` (#40197)
PR #34934 switched the `getting-started` docs example from using the
index of a product in the `products` array to using the product's ID
property for indentifiying each product in the `ProductDetailsComponent`
component. However, some necessary changes in the example code and the
`start-routing.md` guide were missed in #34934, resulting in broken
instructions for the readers (see #40189).

This commit is essentially a follow-up to #34934, making the remaining
changes in the example code and the guide instructions.

Fixes #40189

PR Close #40197
2021-01-06 13:54:54 -08:00
George Kalpakas d08828339b docs: refactor code in `get-product` docregion of `getting-started` docs example (#40197)
This commit slightly refactors the code in the `get-product` docregion
of the `getting-started` docs example to make it easier to follow.

PR Close #40197
2021-01-06 13:54:54 -08:00
George Kalpakas 1d78d4d774 docs: clean up docregions in the `getting-started` docs example (#40197)
This commit does some minor clean-up in docregions of the
`getting-started` docs example. More specifically, it:
- Removes redundant docregion markers.
- Fixes whitespace inconsistencies.
- Adds `/* ... */` to indicate that there is more code before the end of
  a docregion (in order to avoid confusion).

PR Close #40197
2021-01-06 13:54:54 -08:00
George Kalpakas 1fae285e04 docs: more closely align the `getting-started-v0` and `getting-started` docs examples (#40197)
This commit aligns the code and style in the `getting-started-v0` docs
example with that of the `getting-started` example more closely (except
for the the parts that are intentionally different between the two).

PR Close #40197
2021-01-06 13:54:54 -08:00
Andrew Scott 989b4a94d4 refactor(compiler-cli): Return symbols for all matching outputs (#40144)
This commit ensures that the template type checker returns symbols for
all outputs if a template output listener binds to more than one.

PR Close #40144
2021-01-06 13:53:46 -08:00
Andrew Scott da2be4b710 refactor(compiler-cli): Return symbols for all matching inputs (#40144)
This commit ensures that the template type checker returns symbols for
all inputs if an attribute binds to more than one.

PR Close #40144
2021-01-06 13:53:46 -08:00
Andrew Scott 13020f904f fix(router): correctly deactivate children with componentless parent (#40196)
During route activation, a componentless route will not have a context created
for it, but the logic continues to recurse so that children are still
activated. This can be seen here:
362f45c4bf/packages/router/src/operators/activate_routes.ts (L151-L158)

The current deactivation logic does not currently account for componentless routes.

This commit adjusts the deactivation logic so that if a context cannot
be retrieved for a given route (because it is componentless), we
continue to recurse and deactivate the children using the same
`parentContexts` in the same way that activation does.

Fixes #20694

PR Close #40196
2021-01-06 13:49:30 -08:00