Commit Graph

20759 Commits

Author SHA1 Message Date
George Kalpakas a938849148 fix(docs-infra): apply custom `autoLinkCode` filters to single-word `<code>` elements (#41709)
Previously, the `autoLinkCode` Dgeni post-processor would not apply the
custom filters when matching the whole contents of a `<code>` element.
This meant that custom filters would not be applied to single-word
`<code>` elements.

You can see occurrences of this issue in the following sections of the
"Reactive forms" guide:
- [Creating nested form groups][1]
  (look for `street, city, state, and zip controls`)
- [Using the FormBuilder service to generate controls][2]
  (look for `group method`)

This commit fixes this by also applying the custom filters when
processing the whole contents of a `<code>` element.

This commit also updates the `filterPipes` custom filter to allow
matching a pipe's name in a single-word `<code>` element (where there is
no preceeding `|` character).

[1]: https://v10.angular.io/guide/reactive-forms#creating-nested-form-groups
[2]: https://v10.angular.io/guide/reactive-forms#using-the-formbuilder-service-to-generate-controls

PR Close #41709
2021-04-26 10:59:08 -07:00
George Kalpakas de19b8bb88 fix(docs-infra): do not process generated nodes for auto-linking (#41709)
While generating the docs, when a `<code>` element is inspected for
auto-linking, the `autoLinkCode` Dgeni post-processor will break its
contents up into words and generate text nodes for those words that
should not be auto-linked.

Previously, our text node visitor would visit these generated text nodes
and try to auto-link them too. As a result, it would unnecessarily
process nodes that had already been checked (and could potentially
generate links that would otherwise be ignored).

You can see an occurrence of this issue in the
[Create the product list][1] section of the
"Getting started with Angular" tutorial (look for `<a>`).

This commit fixes this by ensuring the visitor will skip the current
node and any nodes generated by `autoLinkCode`.

[1]: https://v11.angular.io/start#create-the-product-list

PR Close #41709
2021-04-26 10:59:07 -07:00
Kristiyan Kostadinov 18b33e79d3 perf(core): avoid storing LView in __ngContext__ (#41358)
Currently we save a reference to an `LView` on most DOM nodes created by Angular either by saving
the `LView` directly in the `__ngContext__` or by saving the `LContext` which has a reference to
the `LView`. This can be a problem if the DOM node is retained in memory, because the `LView` has
references to all of the child nodes of the view, as well as other internal data structures.

Previously we tried to resolve the issue by clearing the `__ngContext__` when a node is removed
(see https://github.com/angular/angular/pull/36011), but we decided not to proceeed, because it can
slow down destruction due to a megamorphic write.

These changes aim to address the issue while reducing the performance impact by assigning a unique
ID when an `LView` is created and adding it to `__ngContext__`. All active views are tracked in
a map where their unique ID is used as the key. We don't need to worry about leaks within that map,
because `LView`s are an internal data structure and we have complete control over when they are
created and destroyed.

Fixes #41047.

PR Close #41358
2021-04-26 09:31:41 -07:00
Alan Agius 6d9e3400e1 test(service-worker): replace `global || window` with `globalThis` (#41739)
`global` property is not available in the browser, previously this was polyfilled through `core-js`. This now fails with `global is not defined`, since global cannot be accessed when not defined.

PR Close #41739
2021-04-26 09:29:59 -07:00
Alan Agius 30a24b6bf5 test: use `global` util instead of `global` property. (#41739)
`global` property is not available in the browser, previously this was polyfilled through core-js.

(cherry picked from commit 827cf41386dcd7e496e107d6b32c54281bc935f1)

PR Close #41739
2021-04-26 09:29:58 -07:00
Alan Agius 87873ed422 build: remove `core-js` in favor of `core-js-bundle` (#41739)
`core-js` is a CJS package which cannot be used directly in the browser. `core-js-bundle` is the bundled version of the package which can be used in directly in the browser.

PR Close #41739
2021-04-26 09:29:58 -07:00
Renovate Bot bd986cb460 build: update bazel packages (#41795)
PR Close #41795
2021-04-26 09:27:01 -07:00
George Kalpakas 6465b5056a build(docs-infra): fix e2e testing SystemJS-based docs examples (#41796)
This commits makes the SystemJS-based docs examples more self-contained
by ensuring the necessary WebDrivers are fetched before running the e2e
tests.
This is a follow-up to #41689. (See there for more discussion.)

PR Close #41796
2021-04-26 09:25:12 -07:00
George Kalpakas 27ad7624d0 fix(docs-infra): fix external link icons positioning (#41794)
While trying to fix the appearance of `<code>` elements inside of
anchors with external URLs in #41694, the positioning of external link
icons was broken for anchors that would span multiple lines (see #41774
for details).

This commit fixes the positioning of external link icons, while still
preserving the correct appearance of `<code>` elements inside anchors
with external URLs.

NOTE:
Different types of links with external URLs can be seen in the following
docs sections:
- http://localhost:4200/docs#assumptions
- http://localhost:4200/guide/http#security-xsrf-protection
- http://localhost:4200/guide/workspace-config#generation-schematics

Fixes #41774

PR Close #41794
2021-04-26 09:24:04 -07:00
Kapunahele Wong 01e546f116 docs: improve accessibility of architecture example (#41314)
PR Close #41314
2021-04-26 09:13:49 -07:00
Kapunahele Wong 326884736e docs: make inputs-outputs example more accessible (#41288)
PR Close #41288
2021-04-26 09:12:17 -07:00
Kapunahele Wong 70fb3e958b docs: improve accessibility of http example (#41057)
PR Close #41057
2021-04-26 09:11:07 -07:00
Alan Agius 73105aa7d6 ci: remove trailing comma from renovate config (#41790)
Renovate configuration is strict JSON which doesn’t allow trailing commas or comments.

Closes #41789
PR Close #41790
2021-04-23 11:53:11 -07:00
Sam Severance 9f88da220c docs: Indicate `HttpClientModule` being imported (#41749)
PR Close #41749
2021-04-23 11:38:34 -07:00
Paul Gschwendtner 50713310bf build: use platform from shared dev-infra package for remote execution (#41767)
Uses the new shared RBE platform from the dev-infra package.

PR Close #41767
2021-04-23 11:01:40 -07:00
Paul Gschwendtner 1b00533f8b test(dev-infra): publish test should not rely on external http request (#41767)
A test for the dev-infra publish tool currently relies on an external
http request by accident. This will break if we disallow internet
access within RBE containers.

PR Close #41767
2021-04-23 11:01:40 -07:00
Paul Gschwendtner 59bb24148e feat(dev-infra): create shared platform for remote execution (#41767)
Introduces a shared Bazel platform for remote execution builds
using Google cloud. Previously we used `bazel_toolchains` for
providing the platform w/ additional CPP and Java toolchains

`bazel_toolchains` no longer provides default toolchains with the
latest version, but provides a tool (linux and windows only) for
generating toolchain/platforms, which then need to be checked
into the repository. This is quite inconvenient and cumbersome
(especially with no macOS support), so we just provide our own
platform and CPP toolchain within `//dev-infra`. This is more
simple than all the effort we'd need to make the toolchain
generation tool work (while it would also increase the amount
of checked-in sources significantly; with more unused toolchains
for CPP or Java)

PR Close #41767
2021-04-23 11:01:40 -07:00
Keen Yee Liau a0a373be8d test: delete integration test for language service plugin (#41740)
This commit deletes the integration test for `@angular/language-service`
as a plugin to the standard tsserver.

In version 12, Ivy LS will replace legacy View Engine LS as the default,
and Ivy LS plugin cannot be loaded via `tsconfig.json` due to the need to
run ngcc. This makes the test irrelevant.

PR Close #41740
2021-04-23 11:00:40 -07:00
Emily Wenberg 98fc4f4b2f fix(upgrade): preserve $interval.flush when ngMocks is being used (#30229)
Also preserve any other properties that the user may have decorated
$interval with.

PR Close #30229
2021-04-23 09:44:50 -07:00
George Kalpakas 81f61b276b build(docs-infra): upgrade cli command docs sources to 2310e277b (#41780)
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](064c3356e...2310e277b):

**Modified**
- help/build.json

PR Close #41780
2021-04-23 09:41:34 -07:00
Kristiyan Kostadinov de4fafb818 refactor(core): add single type for injector token (#41580)
Currently we have a lot of places where we repeat the type `Type<T>|AbstractType<T>|InjectionToken<T>` which makes it cumbersome to add another type or to type something else with the same signature.

These changes add a new type that can be used instead.

Fixes #39792.

PR Close #41580
2021-04-22 10:47:12 -07:00
Andrew Kushnir 3ceb3dea67 refactor(core): replace loadLContext with getLContext calls (#41606)
This commit refactors the code to replace `loadLContext` with `getLContext` calls. The only difference between these two functions is that the `loadLContext` supports throwing an error in case `LContext` can not be found. The investigation performed in #41525 revealed that throwing while retrieving `LContext` might have undesirable performance implications, so we should avoid that to make sure there are no accidental perf regressions in other parts of code that used `loadLContext`. Moreover, in most of the places the `loadLContext` was already called in a mode that prevented an error from being thrown, so this refactoring should have no effect on the actual behavior.

PR Close #41606
2021-04-22 10:46:12 -07:00
Keen Yee Liau 64567d3d39 docs: Remove Protractor test from CI examples (#41733)
Protractor tests are no longer included in new projects starting from
Angular version 12.

PR Close #41733
2021-04-22 10:44:41 -07:00
Renovate Bot e0fb18a133 build: update @babel/cli to version 7.13.16 (#41734)
PR Close #41734
2021-04-22 10:44:00 -07:00
Pete Bacon Darwin c3a512a9e9 fix(compiler-cli): match string indexed partial declarations (#41747)
Some partial libraries have been minified, which results in the declaration
calls being being converted from property accesses to indexed accesses.
This commit ensures that the linker can process these calls.

Fixes #41655

PR Close #41747
2021-04-22 10:43:08 -07:00
Pete Bacon Darwin 7744e1e673 fix(compiler-cli): allow linker to process minified booleans (#41747)
Some partial libraries have been minified, which results in boolean literals
being converted to `!0` and `!1`. This commit ensures that the linker can
process these values.

Fixes #41655

PR Close #41747
2021-04-22 10:43:08 -07:00
George Kalpakas 6ca6302cf1 build(docs-infra): upgrade cli command docs sources to 064c3356e (#41765)
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](79d820c92...064c3356e):

**Modified**
- help/build.json
- help/e2e.json
- help/generate.json
- help/new.json

PR Close #41765
2021-04-22 08:44:42 -07:00
Aristeidis Bampakos dfdd4a2d74 docs: ident the library shematics guide properly (#41755)
PR Close #41755
2021-04-22 08:41:01 -07:00
George Kalpakas 122c8ba0e3 build(docs-infra): fix `StackblitzBuilder` after `jsdom` update (#41725)
In commit c617f1f768, `jsdom` was updated
from v9 to v16. This includes a breaking change that caused
`StackblitzBuilder` to fail to generate the StackBlitz examples.
However, this failure went unnoticed, because `StackblitzBuilder` still
completed successfully after failing to generate the examples. (This has
been fixed in the previous commit.)

This commit updates `StackblitzBuilder` to use the new `jsdom` API.

PR Close #41725
2021-04-22 08:38:20 -07:00
George Kalpakas 5a80bc6eb5 build(docs-infra): exit with an error code if generating StackBlitz examples fails (#41725)
Previously, failing to generate one or more StackBlitz examples would
log the errors but exit the command successfully. This made it easy to
miss such failures.

This commit fixes this by exiting the process with an error code if
generating one or more StackBlitz examples fails.
(In order to be able to see all potential errors, all examples are
attempted to be generated before exiting the process.)

PR Close #41725
2021-04-22 08:38:20 -07:00
Joey Perrott a4a55f0687 fix(dev-infra): verify python3 is available before release (#41753)
Verify that the /usr/bin/python points to the python3 interpreter binary.

PR Close #41753
2021-04-21 17:31:22 -07:00
Alan Agius 8bfd9e886b build: update typed-graphqlify to version 3.1.1 (#41738)
Use latest version of typed-graphqlify

PR Close #41738
2021-04-21 17:30:28 -07:00
Alan Agius e00a9c1b99 build: update `chalk` to version 4.0.1 (#41738)
Update `chalk` to `4.0.1` so that it can be managed by Renovate.

PR Close #41738
2021-04-21 17:30:28 -07:00
Kapunahele Wong 6611d5c1c9 docs: add instructions for opting into latest Language Service (#41600)
PR Close #41600
2021-04-21 17:29:05 -07:00
JiaLiPassion c3614662cb test(zone.js): should invoke XHR task even onload handler throw error. (#41562)
Close #41520.

This case related to the issue #41522.

```
Zone.root
  .fork({
    name: 'xhr',
    onHasTask(delegate, currentZone, zone, taskState) {
      console.log('hasMacrotask', taskState.macroTask);
      return delegate.hasTask(zone, taskState);
    },
  })
  .run(() => {
    const xhr = new XMLHttpRequest();
    xhr.open('GET', 'https://cdnjs.cloudflare.com/ajax/libs/zone.js/0.11.4/zone.min.js');
    xhr.addEventListener('load', () => {
      throw new Error();
    });
    xhr.send();
  });
```

zone.js invoke all `onload` event handlers before change the XHR task's state from
`scheduled` to `notscheduled`, so if any `onload` listener throw error, the XHR task
wlll be hang to `scheduled`, and leave the macroTask status in the zone wrongly.

This has been fixed in the previous commit, this commit add test to verify the case.

PR Close #41562
2021-04-21 15:54:08 -07:00
JiaLiPassion 008eaf3b7d fix(zone.js): should continue to executue listeners when throw error (#41562)
Close #41522

`zone.js` patches event listeners and run all event listeners together, if
one event handler throws error, the listeners afterward may not be invoked.

Reproduction:

```
export class AppComponent implements AfterViewInit {
  @ViewChild('btn') btn: ElementRef;
  title = 'event-error';

  constructor(private ngZone: NgZone) {}

  ngAfterViewInit() {
    this.ngZone.runOutsideAngular(() => {
      this.btn.nativeElement.addEventListener('click', () => {
        throw new Error('test1');
      });
      this.btn.nativeElement.addEventListener('click', () => {
        console.log('add eventlistener click');
      });
    });
  }
}
```

Until now no Angular users report this issue becuase in the `ngZone`, all
error will be caught and will not rethrow, so the event listeners afterward
will still continue to execute, but if the event handlers are outside of `ngZone`,
the error will break the execution.

This commit catch all errors, and after all event listeners finished invocation,
rethrow the errors in seperate `microTasks`, the reason I am using `microTask` here
is to handle multiple errors case.

PR Close #41562
2021-04-21 15:54:08 -07:00
Andrew Kushnir e7ab84051e docs: release notes for the v12.0.0-rc.0 release 2021-04-21 17:31:05 +00:00
Andrew Kushnir ff26e8529c docs: release notes for the v11.2.11 release 2021-04-21 17:18:10 +00:00
Renovate Bot c0eabb2e70 build: update io_bazel_rules_sass to version 1.32.11 (#41713)
PR Close #41713
2021-04-20 16:02:08 -07:00
Kapunahele Wong a2b671e61b docs: add margin to button boilerplate CSS for examples (#41413)
PR Close #41413
2021-04-20 11:37:27 -07:00
Kristiyan Kostadinov 73824d5337 fix(compiler): not generating update instructions for ng-template inside alternate namespaces (#41669)
We have a check that determines whether to generate property binding instructions for an `ng-template`. The check looks at whether the tag name is exactly `ng-template`, but the problem is that if the tag is placed in a non-HTML namespace (e.g. `svg`), the tag name will actually be `:namespace:ng-template` and the check will fail.

These changes resolve the issue by looking at the tag name without the namespace.

Fixes #41308.

PR Close #41669
2021-04-20 09:44:44 -07:00
George Kalpakas 364ff96f28 build(docs-infra): upgrade cli command docs sources to 79d820c92 (#41719)
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](d902a289b...79d820c92):

**Modified**
- help/generate.json

PR Close #41719
2021-04-20 09:42:42 -07:00
Renovate Bot c2011c0ba1 build: update semver to version 7.3.5 (#41715)
PR Close #41715
2021-04-20 09:41:57 -07:00
Renovate Bot 6eb21b8d48 build: update cldr to version 6.1.0 (#41712)
PR Close #41712
2021-04-20 09:41:12 -07:00
Daniel Díaz e238f2c33a docs: rewrites animation query () method use (#41710)
PR Close #41710
2021-04-20 09:40:29 -07:00
unknown 0a19fc095d docs: add Material Design for Bootstrap to UI Component resources (#41702)
PR Close #41702
2021-04-20 09:39:15 -07:00
Renovate Bot 48b7c95e4a build: update domino to version 2.1.6 (#41666)
PR Close #41666
2021-04-20 09:38:36 -07:00
Oluwole Majiyagbe 03f3dcb700 docs: add API CMS capability to Angular App resources (#40924)
PR Close #40924
2021-04-20 09:37:50 -07:00
Ajit Singh 251bec159a docs: documentation of descendants property of @ContentChildren (#35927)
documentation of decendants property of @ContentChildren was not clear when decendants was set to false it did not pick up direct children when any directive was used on the elements. With Ivy the functionality follows the following pattern only query direct children (in the sense of elements in a template) when descendants: false is specified.

Fixes #20074

PR Close #35927
2021-04-19 15:57:17 -07:00
Renovate Bot 853016dca2 build: update firebase-tools to version 9.10.0 (#41686)
PR Close #41686
2021-04-19 15:10:58 -07:00