Commit graph

20542 commits

Author SHA1 Message Date
George Kalpakas
96f5c86fbe build(docs-infra): take disambiguated doc paths into account when generating the sitemap (#41842) (#41854)
In ##41788, the `disambiguateDocsPathsProcessor` was introduced to fix
an issue with case-insensitively equal paths. This processor may alter
the paths of some docs and thus their final URL in the app.

Previously, both the `disambiguateDocPathsProcessor` and the
`createSitemap` processor (which relies on the docs' computed paths to
generate the sitemap file) were configured to run before the
"rendering-docs" phase. However, this resulted in the
`disambiguateDocPathsProcessor`'s running after `createSitemap`, which
meant that the sitemap did not include the updated doc paths.

This commit fixes it by ensuring that the
`disambiguateDocPathsProcessor` is explicitly run before the
`createSitemap` processor, so that the latter will be able to take into
account any changes made by the former.

PR Close #41842

PR Close #41854
2021-04-28 09:13:42 -07:00
George Kalpakas
84e1b10485 test(docs-infra): make it easier to identify the failing URL in testFirebaseRedirection.spec.ts (#41842) (#41854)
This commit includes the URL under test in the test description in
`testFirebaseRedirection.spec.ts` to make it easier to identify the
affected URL when a test fails.

It also avoids unnecessarily creating multiple `FirebaseRedirector`
instances by sharing instances between tests.

PR Close #41842

PR Close #41854
2021-04-28 09:13:42 -07:00
George Kalpakas
2b235b59a0 test(docs-infra): update firebase-test-utils to support regex-based redirects (#41842) (#41854)
This commit updates the utilities in `firebase-test-utils/` to also
support testing Firebase redirects that are configured using regular
expressions (via the `regex` property).
See the [Firebase docs][1] for more details.

[1]: https://firebase.google.com/docs/hosting/full-config#redirects

PR Close #41842

PR Close #41854
2021-04-28 09:13:42 -07:00
George Kalpakas
6f4212f96f refactor(docs-infra): prepare firebase-test-utils for accepting regex-based redirects (#41842) (#41854)
Currently, the utilities for testing Firebase redirects assume that the
redirects are configured using the glob-based `source` property.
However, Firebase also supports configuring redirects using regular
expressions (via the `regex` property).
See the [Firebase docs][1] for more details.

This commit refactors the utilities in `firebase-test-utils/` to make it
easy to add support for such regex-based redirect configurations.

[1]: https://firebase.google.com/docs/hosting/full-config#redirects

PR Close #41842

PR Close #41854
2021-04-28 09:13:42 -07:00
George Kalpakas
ccb0ac3a74 test(docs-infra): fix create-example tests on Windows (#41842) (#41854)
Previously, the tests in `create-example.spec.ts` made assertions using
some hard-coded absolute paths (something like `/foo/bar`). This caused
the tests to fail on Windows, where the absolute paths are prefixed with
the drive letter (something like `C:/foo/bar`).

This commit uses `path.resolve()` to ensure paths are converted to the
format used on the current OS.

PR Close #41842

PR Close #41854
2021-04-28 09:13:42 -07:00
George Kalpakas
a26bbf78bc fix(docs-infra): apply custom autoLinkCode filters to single-word <code> elements (#41709) (#41854)
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

PR Close #41854
2021-04-28 09:13:42 -07:00
George Kalpakas
3d1f6938c2 fix(docs-infra): do not process generated nodes for auto-linking (#41709) (#41854)
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

PR Close #41854
2021-04-28 09:13:42 -07:00
Jessica Janiuk
4aafcc06ed Revert "feat(dev-infra): create the prettier formatter for ng-dev format tooling (#41824)" (#41844)
This reverts commit 4d760ba8f0.

PR Close #41844
2021-04-27 13:24:29 -07:00
Joey Perrott
4d760ba8f0 feat(dev-infra): create the prettier formatter for ng-dev format tooling (#41824)
Add support to use prettier for formatting using `ng-dev format`.

PR Close #41824
2021-04-27 12:23:06 -07:00
Pete Bacon Darwin
eedbb758d2 build(docs-infra): update dgeni-packages to fix version list (#41841)
The current version was not being computed correctly for
next and rc deployments of the angular.io website.

Fixes #41829

PR Close #41841
2021-04-27 12:22:02 -07:00
Zach Arend
e7586581af ci: add Zach Arend to pullapprove groups (#41839)
Add Zach Arend to the pullapprove groups for public api, size tracking,
and circular deps.

PR Close #41839
2021-04-27 11:35:04 -07:00
Joey Perrott
84a44a9b0f fix(dev-infra): add github token requirement for discover-new-conflicts (#41825)
Add the github token option/requirement for the pr discover-new-conflicts
command.

PR Close #41825
2021-04-27 10:23:18 -07:00
Amadou Sall
c78baccf8d docs: remove the section "Using components vs services from other modules" (#41835)
This section states that "Importing a module with services means that you will have a new instance of that service". This is only true for lazy-loaded `NgModules`. For non-lazy-loaded modules, my understanding is that the providers arrays are flattened into the root injector meaning that importing a module with a service doesn't create a new instance of that service.

PR Close #41835
2021-04-27 10:16:51 -07:00
Pete Bacon Darwin
de39b49c6d fix(compiler): strip scoped selectors from @font-face rules (#41815)
`@font-face` rules cannot contain nested selectors. Nor can they be
nested under a selector. Normally this would be a syntax error by the
author of the styles. But in some rare cases, such as importing styles
from a library, and applying `:host ::ng-deep` to the imported styles,
we can end up with broken css if the imported styles happen to contain
`@font-face` rules.

This commit works around this problem by sanitizing such cases (erasing
any scoping selectors) during emulated ShadowDOM encapsulation style
processing.

Fixes #41751

PR Close #41815
2021-04-27 09:12:29 -07:00
Kapunahele Wong
7756ead0bf docs: add metadata documentation to httpClient (#41706)
PR Close #41706
2021-04-26 15:17:52 -07:00
Chau Tran
072a0bf30a docs: add chau tran to GDE resources (#41817)
PR Close #41817
2021-04-26 15:16:41 -07:00
Pete Bacon Darwin
aa578f56bf docs: fix links to docs with ambiguous paths (#41788)
These docs were linking directly to docs that have ambiguous paths.
These changes ensure that these links are not affected by the
disambiguation processing of those docs.

PR Close #41788
2021-04-26 12:12:01 -07:00
Pete Bacon Darwin
9f958077d2 build(docs-infra): add path disambiguation (#41788)
When two documents have the same `outputPath`, only differing by
letter casing, there can be problems on case-insensitive file-systems:
Only one of each of the docs would end up being written.

Moreover, the Webpack 5 bundler will error if it comes across files
that have this kind of ambiguous paths.

This commit adds a new docType: `disambiguator`, which will display
a list of the docs that match an ambiguous path. Each of the ambiguous
docs is then given a unique path and outputPath to ensure there are no
collisions.

PR Close #41788
2021-04-26 12:12:01 -07:00
Pete Bacon Darwin
09f3531c44 build(docs-infra): no duplicate docTypes in postProcessHtml processor (#41788)
This processor was being initialized with the same docTypes twice.

PR Close #41788
2021-04-26 12:12:01 -07:00
George Kalpakas
21f1466d84 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:13 -07:00
George Kalpakas
6fb18b8fd5 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:05 -07:00
Kapunahele Wong
8ea1927910 docs: improve accessibility of architecture example (#41314)
PR Close #41314
2021-04-26 09:13:51 -07:00
Kapunahele Wong
619f774dbd docs: make inputs-outputs example more accessible (#41288)
PR Close #41288
2021-04-26 09:12:19 -07:00
Kapunahele Wong
f31277879a docs: improve accessibility of http example (#41057)
PR Close #41057
2021-04-26 09:11:08 -07:00
Sam Severance
163c076f97 docs: Indicate HttpClientModule being imported (#41749)
PR Close #41749
2021-04-23 11:38:35 -07:00
Emily Wenberg
dd46b87bc7 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:52 -07:00
Jessica Janiuk
42c64aa376 Revert "build(docs-infra): fix StackblitzBuilder after jsdom update (#41725)" (#41768)
This reverts commit 2a2c239a0a.

PR Close #41768
2021-04-22 10:14:48 -07:00
Aristeidis Bampakos
ad2d239b13 docs: ident the library shematics guide properly (#41755)
PR Close #41755
2021-04-22 08:41:03 -07:00
George Kalpakas
2a2c239a0a 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:22 -07:00
George Kalpakas
0ae0ac68f3 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:21 -07:00
Joey Perrott
d061be99a9 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:23 -07:00
Kapunahele Wong
b9818f99ba docs: add instructions for opting into latest Language Service (#41600)
PR Close #41600
2021-04-21 17:29:07 -07:00
JiaLiPassion
1d1fa1a8f3 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:10 -07:00
JiaLiPassion
6ac9e2e991 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:10 -07:00
Andrew Kushnir
03d2fc2834
release: cut the v11.2.11 release 2021-04-21 09:50:07 -07:00
Pete Bacon Darwin
8f3e5a5982 build(docs-infra): update docs examples to Angular v11.2.10 (#41689) (#41716)
This commit updates the docs examples to Angular v11.2.10. See the [diff between 11.0.1 and 11.2.10 (FW) and 11.2.9 (CLI)][1].

The changes are fairly trivial including:

- Removal of `emitDecoratorMetadata` from tsconfig.json files, where no JIT compilation is required.
- Setting `enableI18nLegacyMessageIdFormat` to `false` for CLI based applications - the i18n example was already migrated away from legacy message IDs.

[1]: https://github.com/cexbrayat/angular-cli-diff/compare/11.2.9..11.0.1

PR Close #41689

PR Close #41716
2021-04-20 13:13:09 -07:00
Pete Bacon Darwin
81260c4009 refactor(docs-infra): tidy up systemjs boilerplate for upgrade examples (#41689) (#41716)
The ngUpgrade examples mostly rely upon SystemJS configuration.
This commit tidies up how these examples are built and tested so that
it will be easier to migrate them to work with Angular 11.2.x

PR Close #41689

PR Close #41716
2021-04-20 13:13:09 -07:00
Kapunahele Wong
20e09177b7 docs: add margin to button boilerplate CSS for examples (#41413)
PR Close #41413
2021-04-20 11:37:29 -07:00
Daniel Díaz
7459f6d705 docs: rewrites animation query () method use (#41710)
PR Close #41710
2021-04-20 09:40:30 -07:00
unknown
c6dde4cd8c docs: add Material Design for Bootstrap to UI Component resources (#41702)
PR Close #41702
2021-04-20 09:39:16 -07:00
Oluwole Majiyagbe
866b30972b docs: add API CMS capability to Angular App resources (#40924)
PR Close #40924
2021-04-20 09:37:52 -07:00
Ajit Singh
a76f07bd13 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:18 -07:00
Joey Perrott
f5248c6c23 build: remove entities dependency from root package.json (#41705)
Remove the dependency on `entities` in the root package.json as it is unused.  `entities` is
used in aio, however the package.json in aio manages these dependencies.

PR Close #41705
2021-04-19 14:17:20 -07:00
Bendik Skarpnes
2a136e2eda docs: fix styling issues in example CSS (#41222)
PR Close #41222
2021-04-19 14:15:46 -07:00
Pierre Portejoie
7a153f78aa docs: fix tutorial indicating the app is working when an error is actually displayed (#40732)
PR Close #40732
2021-04-19 14:14:59 -07:00
Andrew Kushnir
3631934f2d Revert "fix(zone.js): should continue to executue listeners when throw error (#41562)" (#41707)
This reverts commit 5c48cd30b5.

Reason: that change introduces race conditions on CI.

PR Close #41707
2021-04-19 13:33:12 -07:00
Andrew Kushnir
26a0285dea Revert "test(zone.js): should invoke XHR task even onload handler throw error. (#41562)" (#41707)
This reverts commit 6910118b0d.

Reason: this change introduces race conditions on CI.

PR Close #41707
2021-04-19 13:33:12 -07:00
JiaLiPassion
8c831a257c 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-19 08:38:44 -07:00
JiaLiPassion
c4a7f1ccc0 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-19 08:38:44 -07:00
Amadou Sall
8f6c166aea docs: add missing preposition in the animations guide (#41697)
PR Close #41697
2021-04-19 08:35:12 -07:00