Commit Graph

20851 Commits

Author SHA1 Message Date
Alan Agius d8282957b6 build: update angular cli packages to version 12.0.0-next.9 (#41636)
This enables us to remove the workaround that we needed to consume `@angular-devkit/build-angular` from the snapshot builds.

PR Close #41636
2021-04-15 14:37:26 -07:00
Alan Agius 8d0511d009 ci: disable dependency updates of Angular JS packages (#41642)
With this change we configure Renote Bot to ignore Angular JS packages.

Example of unwanted PR: https://github.com/angular/angular/pull/41639/files

PR Close #41642
2021-04-15 12:48:18 -07:00
Kristiyan Kostadinov 1aebf165db fix(common): viewport scroller not finding elements inside the shadow DOM (#41644)
The `ViewportScroller` figures out which element to scroll into view using `document.getElementById`. The problem is that it won't find elements inside the shadow DOM.

These changes add some extra logic that goes through all the shadow roots to look for the element.

Fixes #41470.

PR Close #41644
2021-04-15 12:47:05 -07:00
jeripeierSBB a99aa29040 fix(animations): allow animations on elements in the shadow DOM (#40134)
When determining whether to run an animation, the `TransitionAnimationPlayer`
checks to see if a DOM element is attached to the document. This is done by
checking to see if the element is "contained" by the document body node.

Previously, if the element was inside a shadow DOM, the engine would
determine that the element was not attached, even if the shadow DOM's
host was attached to the document. This commit updates the `containsElement()`
method on `AnimationDriver` implementations to also include shadow DOM
elements as being contained if their shadow host element is contained.

Further, when using CSS keyframes to trigger animations, the styling
was always added to the `head` element of the document, even for
animations on elements within a shadow DOM. This meant that those
elements never receive those styles and the animation would not run.
This commit updates the insertion of these styles so that they are added,
to the element's "root node", which is the nearest shadow DOM host, or the
`head` of the document if the element is not in a shadow DOM.

Closes #25672

PR Close #40134
2021-04-15 12:45:52 -07:00
Dmitrij Kuba 6bceb709df fix(router): Only retrieve stored route when reuse strategy indicates it should reattach (#30263)
When creating the router state, the `RouteReuseStrategy#retrieve` should
only be called when `RouteReuseStrategy#shouldAttach` returns `true`.
That is, we should only retrieve a stored route when the reuse strategy
indicates that there is one stored and that it should be reattached.

This now matches the behavior in the route activation:
1d12c50f63/packages/router/src/operators/activate_routes.ts (L170-L172)

Fixes #23162

PR Close #30263
2021-04-15 11:32:59 -07:00
George Kalpakas 9ffd9f6f37 build(docs-infra): upgrade cli command docs sources to d902a289b (#41641)
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](37b5f1c99...d902a289b):

**Modified**
- help/build.json
- help/test.json

PR Close #41641
2021-04-15 11:30:58 -07:00
Renovate Bot 766b157b63 build: update @babel/cli to version 7.13.14 (#41634)
PR Close #41634
2021-04-15 11:29:59 -07:00
Joey Perrott dd4c3dba3f refactor(dev-infra): move `getRepoBaseDir()` to `GitClient` (#41527)
As `getRepoBaseDir()` relies on git, it should be a method on `GitClient` for retrieval
rather than its own utility outside of the common GitClient used for all git ineractions.

PR Close #41527
2021-04-15 11:28:12 -07:00
Alan Agius 5332a4a919 refactor: update `$schema` and `id` keywords (#41574)
In Angular CLI version 12, JSON Schema `draft-04` will no longer be supported. Therefore `id` will need to be updated to `$id`.

- We replace id with $id, this no longer valid in draft-07.
- Replace all $schemas to http://json-schema.org/draft-07/schema, this is needed to "pin" the schema to draft-07.

More information about this draft can be found https://json-schema.org/draft-07/json-schema-release-notes.html

PR Close #41574
2021-04-14 18:50:32 -07:00
Martin Sikora 0d55d4557f test(router): add Router regression test for hash location strategy (#40409)
This situation can probably happen only when using
`HashLocationStrategy` and by manually changing hash that triggers a route
guard that returns a new `UrlTree`. Then hash in the browser might not
match the current route because navigation was canceled, while hash in
the URL remained set by the user.

Related to #37048

PR Close #40409
2021-04-14 18:48:26 -07:00
Michael Hladky 4329ccae2c docs: add rx-angular to resources.json (#39291)
PR Close #39291
2021-04-14 15:50:44 -07:00
Alan Agius b649273f6c docs: remove `entryComponent` from deprecated list (#41408)
This has been removed in https://github.com/angular/angular-cli/pull/20402

PR Close #41408
2021-04-14 15:49:33 -07:00
Kristiyan Kostadinov dde81ba0cd perf(compiler): reduce amount of generated code for safe accesses and nullish coalescing (#41563)
This is follow-up from #41437 and it reduces the amount of code we generate for safe property accesses (`a?.b`) and nullish coalescing (`a ?? b`) by:
1. Reusing variables in nested nullish coalescing expressions.
2. Not initializing temporary variables to `null`. The way our code is generated means that the value will always be overwritten before we compare against it so the initializer didn't really matter.

Fixes #41491.

PR Close #41563
2021-04-14 15:48:21 -07:00
Andrew Scott a1b2718b92 fix(router): recursively merge empty path matches (#41584)
When recognizing routes, the router merges nodes which map to the same
empty path config. This is because auxiliary outlets under empty path
parents need to match the parent config. This would result in two
outlet matches for that parent which need to be combined into a single
node: The regular 'primary' match and the match for the auxiliary outlet.
In addition, the children of the merged nodes should also be merged to
account for multiple levels of empty path parents.

Fixes #41481

PR Close #41584
2021-04-14 15:47:07 -07:00
Charles Lyding 1b43158af6 fix(compiler-cli): do not error with prepocessing if component has no inline styles (#41602)
The asynchronous preprocessing check was not accounting for components that did not have any inline styles. In that case, the cache did not have an entry which then allowed the asynchronous check to run and fail the compilation. The caching during the asynchronous analysis phase now handles components without inline styles.

PR Close #41602
2021-04-14 15:46:21 -07:00
Joey Perrott a63cf7221b feat(dev-infra): prevent attempting to merge draft, closed or merged pull requests (#41604)
During pull request validation, assert that the pull request is not in
draft mode, already merged or already closed.

PR Close #41604
2021-04-14 15:44:55 -07:00
Renovate Bot 1043aa42ad build: update typescript to version 4.2.4 (#41618)
PR Close #41618
2021-04-14 15:44:17 -07:00
Alan Agius 2af894d164 refactor: format renovate configuration with 2 spaces (#41619)
Format renovate configuration file with 2 spaces

PR Close #41619
2021-04-14 15:43:14 -07:00
Alan Agius 3acac55a31 ci: configure Renovate to disable updates for dependencies versioned `0.0.0-PLACEHOLDER` (#41619)
With this change we disable Renovate from updating `@angular/*` peerDependencies which are versioned `0.0.0-PLACEHOLDER`.

Example PR: https://github.com/angular/angular/pull/41615

PR Close #41619
2021-04-14 15:43:14 -07:00
Zach Arend eaeb7ef54b
release: bump the next branch to v12.1.0-next.0 (#41629) 2021-04-14 13:30:42 -07:00
Zach Arend a37637245e docs: release notes for the v11.2.10 release 2021-04-14 12:48:19 -07:00
Pete Bacon Darwin 3923201f95 refactor(compiler-cli): change how partial-linkers are matched to declaration versions (#41578)
Previously, it was not possible to block a partial-linker from trying to
process a declaration that was defined in a newer version of Angular than
that of the partial-linker. For example, if a partial-linker was published as
part of version 12.0.0, there was no way for a partially-compiled declaration
compiled via version 13.0.0 to tell the 12.0.0 linker that it would be invalid
to attempt to process it.

This commit adds a new `minVersion` property to partial-declarations, which is
interpreted as the "minimum partial-linker version" that can process this
declaration. When selecting a partial-linker for such a declaration, the known
linker version ranges are checked to find the most recent linker whose version
range has an overlap with the interpreted declaration range.

This approach allows us to set a minimum version for a declaration, which
can inform an old partial-linker that will it not be able to accurately
process the declaration.

Note that any pre-release part to versions are ignored in this selection
process.

The file-linker can be configured, via the `unknownDeclarationVersionHandling`
property of `LinkerOptions`, to handle such a situation in one of three ways:

- `error` - the version mismatch is a fatal error
- `warn` - a warning is sent to the logger but the most recent partial-linker
  will attempt to process the declaration anyway.
- `ignore` - the most recent partial-linker will, silently, attempt to process
  the declaration.

The default is to throw an error.

Closes #41497

PR Close #41578
2021-04-14 11:00:40 -07:00
Alan Agius 5a8bc1bfe1 build: `ng_package` no longer generate minified UMDs (#41425)
In version 12, applications will only be allowed to be built in Ivy, this makes the minified UMDs redundant since they cannot be processed by NGCC.

With this change, we remove the minified UMDs from the generated APF package.

BREAKING CHANGE:  Minified UMD bundles are no longer included in the distributed NPM packages.

PR Close #41425
2021-04-14 10:43:08 -07:00
Joey Perrott beafa22de9 feat(upgrade): update supported range of node versions (#41544)
Update the supported range of node versions for Angular.  Angular now
supports node >=12.14.1 to <16.0.0, dropping support for Node v10.

PR Close #41544
2021-04-14 09:40:18 -07:00
Joey Perrott fc597f1db5 feat(service-worker): update supported range of node versions (#41544)
Update the supported range of node versions for Angular.  Angular now
supports node >=12.14.1 to <16.0.0, dropping support for Node v10.

PR Close #41544
2021-04-14 09:40:18 -07:00
Joey Perrott c30b171d20 feat(router): update supported range of node versions (#41544)
Update the supported range of node versions for Angular.  Angular now
supports node >=12.14.1 to <16.0.0, dropping support for Node v10.

PR Close #41544
2021-04-14 09:40:18 -07:00
Joey Perrott c901b4d11f feat(platform-server): update supported range of node versions (#41544)
Update the supported range of node versions for Angular.  Angular now
supports node >=12.14.1 to <16.0.0, dropping support for Node v10.

PR Close #41544
2021-04-14 09:40:18 -07:00
Joey Perrott ef0d1c3545 feat(platform-browser): update supported range of node versions (#41544)
Update the supported range of node versions for Angular.  Angular now
supports node >=12.14.1 to <16.0.0, dropping support for Node v10.

PR Close #41544
2021-04-14 09:40:18 -07:00
Joey Perrott b714f7b931 feat(platform-browser-dynamic): update supported range of node versions (#41544)
Update the supported range of node versions for Angular.  Angular now
supports node >=12.14.1 to <16.0.0, dropping support for Node v10.

PR Close #41544
2021-04-14 09:40:18 -07:00
Joey Perrott 590d4dd578 feat(localize): update supported range of node versions (#41544)
Update the supported range of node versions for Angular.  Angular now
supports node >=12.14.1 to <16.0.0, dropping support for Node v10.

PR Close #41544
2021-04-14 09:40:18 -07:00
Joey Perrott 86621bec58 feat(language-service): update supported range of node versions (#41544)
Update the supported range of node versions for Angular.  Angular now
supports node >=12.14.1 to <16.0.0, dropping support for Node v10.

PR Close #41544
2021-04-14 09:40:18 -07:00
Joey Perrott a0006a6bfb feat(forms): update supported range of node versions (#41544)
Update the supported range of node versions for Angular.  Angular now
supports node >=12.14.1 to <16.0.0, dropping support for Node v10.

PR Close #41544
2021-04-14 09:40:18 -07:00
Joey Perrott 12fc08bf9c feat(elements): update supported range of node versions (#41544)
Update the supported range of node versions for Angular.  Angular now
supports node >=12.14.1 to <16.0.0, dropping support for Node v10.

PR Close #41544
2021-04-14 09:40:18 -07:00
Joey Perrott 75cc8133ad feat(compiler): update supported range of node versions (#41544)
Update the supported range of node versions for Angular.  Angular now
supports node >=12.14.1 to <16.0.0, dropping support for Node v10.

PR Close #41544
2021-04-14 09:40:18 -07:00
Joey Perrott b7bd23817e feat(compiler-cli): update supported range of node versions (#41544)
Update the supported range of node versions for Angular.  Angular now
supports node >=12.14.1 to <16.0.0, dropping support for Node v10.

PR Close #41544
2021-04-14 09:40:18 -07:00
Joey Perrott e0250e567a feat(common): update supported range of node versions (#41544)
Update the supported range of node versions for Angular.  Angular now
supports node >=12.14.1 to <16.0.0, dropping support for Node v10.

PR Close #41544
2021-04-14 09:40:18 -07:00
Joey Perrott d583d926db feat(bazel): update supported range of node versions (#41544)
Update the supported range of node versions for Angular.  Angular now
supports node >=12.14.1 to <16.0.0, dropping support for Node v10.

PR Close #41544
2021-04-14 09:40:17 -07:00
Joey Perrott 547363a851 feat(animations): update supported range of node versions (#41544)
Update the supported range of node versions for Angular.  Angular now
supports node >=12.14.1 to <16.0.0, dropping support for Node v10.

PR Close #41544
2021-04-14 09:40:17 -07:00
Joey Perrott e66a5fbca6 feat(core): update supported range of node versions (#41544)
Update the supported range of node versions for Angular.  Angular now
supports node >=12.14.1 to <16.0.0, dropping support for Node v10.

BREAKING CHANGE: Angular no longer maintains support for node v10

PR Close #41544
2021-04-14 09:40:17 -07:00
Joey Perrott ee615e0744 build: upgrade to node 14 (#41544)
Upgrade local development environment for the angular repo to use node 14
dropping node 10 from supported for development within the angular repo.

PR Close #41544
2021-04-14 09:40:17 -07:00
Joey Perrott 0bc539af29 Revert "fix(compiler-cli): autocomplete literal types in templates. (#41456)" (#41623)
This reverts commit 1d12c50f63.

PR Close #41623
2021-04-14 09:16:34 -07:00
Andrew Scott de93a7a4bb fix(language-service): resolve to the pre-compiled style when compiled css url is provided (#41538)
With this commit, the language service will first try to locate a
pre-compiled style file with the same name when a `css` is provided in
the `styleUrls`. This prevents a missing resource diagnostic for when the
compiled file is not available in the language service environment and also
allows "go to definition" to go to that pre-compiled file.

Fixes angular/vscode-ng-language-service#1263

PR Close #41538
2021-04-14 09:15:00 -07:00
Andrew Scott bd34bc9e89 fix(language-service): bound attributes should not break directive matching (#41597)
The language service uses an elements attributes to determine if it
matches a directive in the component scope. We do this by accumulating
all attribute bindings and matching against the selectors for the
available directives. The compiler itself does a similar thing. In
addition, the compiler does not use the value of `BoundAttribute`s to
match directives (cdf1ea1951/packages/compiler/src/render3/view/util.ts (L174-L206)). This commit changes the language
service to also ignore bound attribute values for directive matching.

Fixes https://github.com/angular/vscode-ng-language-service/issues/1278

PR Close #41597
2021-04-13 18:23:49 -07:00
Paul Gschwendtner fd9a7ca8c9 build: update to latest version of `rules_nodejs` v3.3.0 (#41599)
Updates to the latest version of `rules_nodejs` that supports
the most recent NodeJS lts version v14.16.1.

Additionally the latest version of `rules_nodejs` provides
[a package for runfile resolution](https://github.com/bazelbuild/rules_nodejs/pull/2568) w/ types that we can leverage.

PR Close #41599
2021-04-13 17:37:28 -07:00
mgechev f7e391a912 perf(core): optimize getDirectives (#41525)
This commit introduces the following optimizations:

1. We return an empty array for text nodes in `getDirectives` because
Angular does not support attaching logic to them. This optimization
improves performance of `getDirectives` significantly because text nodes
often result in expensive calls to `loadLContext` since we can't resolve
it from a parent node.
1. `getDirectives` now calls `loadLContext` with second argument `false`
so it doesn't throw an error. This brings another significant
improvement because prevents the VM from deoptimizing calls.

BREAKING CHANGE:

Previously the `ng.getDirectives` function threw an error in case a
given DOM node had no Angular context associated with it (for example
if a function was called for a DOM element outside of an Angular app).
This behavior was inconsistent with other debugging utilities under `ng`
namespace, which handled this situation without raising an exception.
Now calling the `ng.getDirectives` function for such DOM nodes would
result in an empty array returned from that function.

PR Close #41525
2021-04-13 16:06:32 -07:00
mgechev a07f303708 feat(core): introduce getDirectiveMetadata global debugging utility (#41525)
This commit introduces a global debugging method
`ng.getDirectiveMetadata` which returns the metadata for a directive or
component instance.

PR Close #41525
2021-04-13 16:06:32 -07:00
Zach Arend 1d12c50f63 fix(compiler-cli): autocomplete literal types in templates. (#41456)
This adds string literals, number literals, `true`, `false`, `null` and
`undefined` to autocomplete results in templates.

For example, when completing an input of union type.

Component: `@Input('input') input!: 'a'|'b'|null;`
Template: `[input]="|"`

Provide `'a'`, `'b'`, and `null` as autocompletion entries.

Previously we did not include literal types because we only included
results from the component context (`ctx.`) and the template scope.

PR Close #41456
2021-04-13 13:51:47 -07:00
Pete Bacon Darwin ba84fa6f42 refactor(compiler-cli): remove i18n options from `LinkerOptions` (#41554)
There were three options being made available to users of the linker:

- ` enableI18nLegacyMessageIdFormat`
-  `i18nNormalizeLineEndingsInICUs`
- ` i18nUseExternalIds`

None of these should actually be configurable at linking time
because partially-linked libraries have tighter restrictions on
what i18n options can be used.

This commit removes those options from the `LinkerOptions` interface.
It was considered to add a check for backwards compatibilty to ensure
that if these options were being passed, and were different to the expected
defaults, we would throw an informative error. But from looking at the
Angular CLI (the only known client of the linker) it has never been setting
these options so they have already always been set to the defaults.

BREAKING CHANGE:

Linked libraries no longer generate legacy i18n message ids. Any downstream
application that provides translations for these messages, will need to
migrate their message ids using the `localize-migrate` command line tool.

Closes #40673

PR Close #41554
2021-04-13 13:39:46 -07:00
pavlenko 261bce65fb docs: replace Codelyzer recommendation with Angular-ESLint in accessibility guide (#41294)
Replace Codelyzer recommendation with Angular-ESLint in accessibility guide since that tool is deprecated and was removed from the Angular CLI.

Closes #41573

PR Close #41294
2021-04-13 13:06:16 -07:00
Alex Rickabaugh 78236bfdca fix(language-service): use script versions for incremental compilations (#41475)
This commit has the Language Service take advantage of versioned source
files added in the compiler previously. With this change, the Language
Service's incremental compilations will now be correct even if the TS
Language service mutates `ts.SourceFile`s without changing their object
identity, as we know it does in certain corner cases.

No test is added here as it is difficult to reproduce this behavior in the
LS's artificial testing environment. A test for this case exists in the
LS extension repo, where it will be used to validate that a workaround three
is no longer necessary.

PR Close #41475
2021-04-13 13:05:36 -07:00