17861 Commits

Author SHA1 Message Date
Paul Gschwendtner
ae10a541bf fix(dev-infra): ensure ts-node is registered with commonjs as module (#37217)
We recently added support for automatic registration of `ts-node`
when the dev-infra configuration is loaded.

In addition to registering ts-node, we should also ensure that the
`commonjs` module is set up. By default, `ts-node` would use ES module
imports that are not supported by default in NodeJS.

PR Close #37217
2020-05-21 10:35:24 -07:00
Kara Erickson
b797913d10 release: cut the v9.1.9 release 9.1.9 2020-05-20 15:26:59 -07:00
George Kalpakas
1465372a0e fix(elements): do not break when the constructor of an Angular Element is not called (#36114) (#37226)
Previously, the correct behavior of Angular custom elements relied on
the constructor being called (and thus the `injector` property being
initialized). However, some polyfills (e.g. `document-register-element`)
do not call the constructor of custom elements, which resulted in the
`injector` property being undefined and the `NgElementStrategy` failing
to be instantiated.

This commit fixes it by being tolerant to the `injector` property being
undefined and falling back to the injector passed to the
`createCustomElement()` config.

NOTE:
We don't have proper tests exercising the situation where the
constructor is not called. For now this is tested using a Google
internal test suite (which is how this issue was caught).
This commit also adds a rudimentary unit test to emulate this situation.

PR Close #36114

PR Close #37226
2020-05-20 14:49:21 -07:00
George Kalpakas
a33cb2d39b fix(elements): capture input properties set before upgrading the element (#36114) (#37226)
Previously, if an element started out as a regular `HTMLElement` (not a
Custom Element) and was later upgraded to a Custom Element, any
properties corresponding to component inputs that were set on the
element before upgrading it would not be captured correctly and thus not
reflected on the instantiated component.

This commit fixes it by ensuring that such properties are captured
correctly.

Jira issue: [FW-2006](https://angular-team.atlassian.net/browse/FW-2006)

Fixes #30848
Closes #31416

PR Close #36114

PR Close #37226
2020-05-20 14:49:21 -07:00
George Kalpakas
1202d17b4c test(elements): clean up TestStrategy between tests (#36114) (#37226)
Previously, the `TestStrategy` `NgElementStrategy` used in
`createCustomElement()` tests was created once and re-used in each test
(due to complications related to how `customElements.register()` works).
As a result, the `TestStrategy` instance's state (e.g. inputs) could be
polluted from previous tests and affect subsequent ones.

This commit ensures the strategy instance is reset before each test.

PR Close #36114

PR Close #37226
2020-05-20 14:49:21 -07:00
George Kalpakas
d837828317 test(elements): only declare helpers if needed (#36114) (#37226)
Previously, helper modules/components classes were declared even if the
tests were not run (because the environment did not support Custom
Elements for example).

This commit moves the declaration of the helpers inside the `describe()`
block, so they are not declared unnecessarily. This is in preparation of
adding more helpers that need to access variables declared inside the
`describe()` block.

PR Close #36114

PR Close #37226
2020-05-20 14:49:21 -07:00
George Kalpakas
dc210bc75b refactor(elements): remove unused imports and properties (#36114) (#37226)
- Remove imports that are not used.
- Remove private class properties that are not used outside of the
  constructor.

PR Close #36114

PR Close #37226
2020-05-20 14:49:21 -07:00
George Kalpakas
75ead94ed5 refactor(elements): simplify accessing NgElementStrategy (#36114) (#37226)
Previously, we had to check whether `NgElementStrategy` had been
instantiated before accessing it. This was tedious and error prone,
since it was easy to forget to add the check in new call sites.

This commit switches to using a getter, so that the check has to be
performed in one place and is transparent to call sites (including any
future ones).

PR Close #36114

PR Close #37226
2020-05-20 14:49:21 -07:00
George Kalpakas
6ac0042aef fix(elements): correctly handle getting/setting properties before connecting the element (#36114) (#37226)
`createCustomElements()` creates some getters/setters for properties
corresponding to component inputs that delegate to the
`NgElementStrategy`. However, it is not guaranteed that the element's
`NgElementStrategy` will have been created when these getters/setters
are called, because some polyfills (e.g. `document-register-element`) do
not call the constructor.

Previously, trying to get/set input properties before connecting the
element to the DOM (via `connectedCallback()`) would fail due to
`NgElementStrategy` not being created.

This commit ensures that the `NgElementStrategy` is always created
before used inside the input property getters/setters (similar to how it
is done for other methods of `NgElement`).

Mentioned in https://github.com/angular/angular/pull/31416/files#r300326698.

PR Close #36114

PR Close #37226
2020-05-20 14:49:21 -07:00
Andrew Scott
3eee53603c docs: update docs for microbenchmarks (#37140)
Update docs in the micro benchmarks to include:
* How to run with no turbo inlining
* Where to find the profiles in the DevTools
* Best way to debug benchmarks (using the profile_in_browser rather than --inspect-brk)

PR Close #37140
2020-05-20 13:37:28 -07:00
Joey Perrott
5c94fa97c1 build: complete removal of bazel format yarn commands (#37148)
Remove bazel yarn format deprecation message to complete the removal of
formatting bazel related files via yarn command command.

PR Close #37148
2020-05-20 13:32:41 -07:00
Joey Perrott
468f4a3f9e feat(dev-infra): create logging utils with support for defined logging levels (#37192)
Creates common logging functions at different levels. Allows for providing
logging statements which are actually printed to the console based on the
LOG_LEVEL environment variable.

PR Close #37192
2020-05-20 13:32:06 -07:00
Andrew Kushnir
a2393bef02 fix(dev-infra): ignore dev-infra scope while checking for features in patch branch (#37210)
This commit updates the script that checks master and patch branches to ignore features with `dev-infra` scope
 while verifying that there are no feature commits in patch branch. It's ok and in fact desirable for dev-infra features to be on the patch branch.

PR Close #37210
2020-05-20 13:31:38 -07:00
Pete Bacon Darwin
5bd1c7bbf7 ci: testing folders in compiler-cli should not require fw-testingapproval (#37220)
The `fw-testing` PullApprove group is really designed to
capture the top level public testing API groups in packages
like `common` and `router`.

The compiler-cli also has some folders that contain the path
segment `testing` but these should not require `fw-testing`
PullApprove approval.

This commit excludes the whole of `compiler-cli` package from
the `fw-testing` group.

PR Close #37220
2020-05-20 13:31:07 -07:00
Kara Erickson
19313f7dad Revert "fix(elements): correctly handle getting/setting properties before connecting the element (#36114)"
This reverts commit 363f14c8939461e21a1c2a23cce42066d0a6cee5
because it is causing the side effects test to break on the
9.1.x branch.
2020-05-20 11:07:39 -07:00
Kara Erickson
4e2500278c Revert "refactor(elements): simplify accessing NgElementStrategy (#36114)"
This reverts commit fa073bafbd1441547b9e3834f70f2c4e7bde534
because it is causing the side effects test to break on the
9.1.x branch.
2020-05-20 11:07:17 -07:00
Kara Erickson
2c4cfa6f2c Revert "refactor(elements): remove unused imports and properties (#36114)"
This reverts commit 2ed66acdd9545238e0e79f006ac7ac98bea2fc45
because it is causing the side effects test to break on the
9.1.x branch.
2020-05-20 11:06:52 -07:00
Kara Erickson
c8f0c3b637 Revert "test(elements): only declare helpers if needed (#36114)"
This reverts commit 7e56222afbede515b0d5bcd8a74cd57db13dd9ad
because it is causing the side effects test to break on the
9.1.x branch.
2020-05-20 11:06:29 -07:00
Kara Erickson
cf4883240b Revert "test(elements): clean up TestStrategy between tests (#36114)"
This reverts commit d98d0dbf17a9dfca7f605cce7e307b482feed33a
because it is causing the side effects test to break on the
9.1.x branch.
2020-05-20 11:06:08 -07:00
Kara Erickson
6f3157fe6d Revert "fix(elements): capture input properties set before upgrading the element (#36114)"
This reverts commit 1c8f1799d494254074e71c460db47dd65f58575a
because it is causing the side effects test to break on the
9.1.x branch.
2020-05-20 11:05:46 -07:00
Kara Erickson
12d8af50dd Revert "fix(elements): do not break when the constructor of an Angular Element is not called (#36114)"
This reverts commit 87b9f08d3bc186143650522c703009056ee0ddd7
because it is causing the side effects test to break on the
9.1.x branch.
2020-05-20 11:04:55 -07:00
Kara Erickson
94fc8463cc release: cut the v9.1.8 release 9.1.8 2020-05-20 10:03:36 -07:00
George Kalpakas
87b9f08d3b fix(elements): do not break when the constructor of an Angular Element is not called (#36114)
Previously, the correct behavior of Angular custom elements relied on
the constructor being called (and thus the `injector` property being
initialized). However, some polyfills (e.g. `document-register-element`)
do not call the constructor of custom elements, which resulted in the
`injector` property being undefined and the `NgElementStrategy` failing
to be instantiated.

This commit fixes it by being tolerant to the `injector` property being
undefined and falling back to the injector passed to the
`createCustomElement()` config.

NOTE:
We don't have proper tests exercising the situation where the
constructor is not called. For now this is tested using a Google
internal test suite (which is how this issue was caught).
This commit also adds a rudimentary unit test to emulate this situation.

PR Close #36114
2020-05-20 09:43:38 -07:00
George Kalpakas
1c8f1799d4 fix(elements): capture input properties set before upgrading the element (#36114)
Previously, if an element started out as a regular `HTMLElement` (not a
Custom Element) and was later upgraded to a Custom Element, any
properties corresponding to component inputs that were set on the
element before upgrading it would not be captured correctly and thus not
reflected on the instantiated component.

This commit fixes it by ensuring that such properties are captured
correctly.

Jira issue: [FW-2006](https://angular-team.atlassian.net/browse/FW-2006)

Fixes #30848
Closes #31416

PR Close #36114
2020-05-20 09:43:38 -07:00
George Kalpakas
d98d0dbf17 test(elements): clean up TestStrategy between tests (#36114)
Previously, the `TestStrategy` `NgElementStrategy` used in
`createCustomElement()` tests was created once and re-used in each test
(due to complications related to how `customElements.register()` works).
As a result, the `TestStrategy` instance's state (e.g. inputs) could be
polluted from previous tests and affect subsequent ones.

This commit ensures the strategy instance is reset before each test.

PR Close #36114
2020-05-20 09:43:38 -07:00
George Kalpakas
7e56222afb test(elements): only declare helpers if needed (#36114)
Previously, helper modules/components classes were declared even if the
tests were not run (because the environment did not support Custom
Elements for example).

This commit moves the declaration of the helpers inside the `describe()`
block, so they are not declared unnecessarily. This is in preparation of
adding more helpers that need to access variables declared inside the
`describe()` block.

PR Close #36114
2020-05-20 09:43:37 -07:00
George Kalpakas
2ed66acdd9 refactor(elements): remove unused imports and properties (#36114)
- Remove imports that are not used.
- Remove private class properties that are not used outside of the
  constructor.

PR Close #36114
2020-05-20 09:43:37 -07:00
George Kalpakas
fa073bafbd refactor(elements): simplify accessing NgElementStrategy (#36114)
Previously, we had to check whether `NgElementStrategy` had been
instantiated before accessing it. This was tedious and error prone,
since it was easy to forget to add the check in new call sites.

This commit switches to using a getter, so that the check has to be
performed in one place and is transparent to call sites (including any
future ones).

PR Close #36114
2020-05-20 09:43:37 -07:00
George Kalpakas
363f14c893 fix(elements): correctly handle getting/setting properties before connecting the element (#36114)
`createCustomElements()` creates some getters/setters for properties
corresponding to component inputs that delegate to the
`NgElementStrategy`. However, it is not guaranteed that the element's
`NgElementStrategy` will have been created when these getters/setters
are called, because some polyfills (e.g. `document-register-element`) do
not call the constructor.

Previously, trying to get/set input properties before connecting the
element to the DOM (via `connectedCallback()`) would fail due to
`NgElementStrategy` not being created.

This commit ensures that the `NgElementStrategy` is always created
before used inside the input property getters/setters (similar to how it
is done for other methods of `NgElement`).

Mentioned in https://github.com/angular/angular/pull/31416/files#r300326698.

PR Close #36114
2020-05-20 09:43:37 -07:00
Igor Minar
a9edbc3a4e docs(dev-infra): update .circleci/README.md (#37212)
The info about the pw storage is out of date.

We should really just point the reader to a go link, something like go/angular/passwords and keep
the info about secrets there.

PR Close #37212
2020-05-20 09:40:52 -07:00
Igor Minar
e62fa67440 docs: remove Vikram and Alex from aio (#37212)
Vikram and Alex are now Angular alumni. They made a mark on Angular and I hope we'll
get to collaborate with them in the future.

PR Close #37212
2020-05-20 09:40:52 -07:00
Igor Minar
57236f1e11 docs: fix broken link in DEVELOPER.md (#37212)
The TOC at the top refers to an anchor that does not exist.

This change adds the missing anchor while preserving the old one in case someone depends on it.

PR Close #37212
2020-05-20 09:40:52 -07:00
Igor Minar
14ffecdf09 docs(dev-infra): update ngcontainer docs (#37185)
Update developer instructions by clarify and adding missing login details for the hub.docker.com image server.

PR Close #37185
2020-05-20 09:38:45 -07:00
Joey Perrott
9ae3e1199d fix(dev-infra): make commit-message-filter script executable for merge (#37209)
Marks the commit-mesage-filter.js file as executable, allowing it
to be run by 'git filter-branch' during the merge script process.

PR Close #37209
2020-05-19 15:35:28 -07:00
Joey Perrott
947f542185 build: fix deprecation notice in scripts/github/merge-pr script (#37208)
The deprecation notice for the merge-pr script errantly referenced
'ng dev' rather than 'ng-dev', this PR corrects this.

PR Close #37208
2020-05-19 15:30:20 -07:00
Paul Gschwendtner
353195c9c5 feat(dev-infra): register ts-node when reading configuration (#37196)
`ts-node` is now an optional peer dependency of the shared dev-infra
package. Whenever a `ng-dev` command runs, and a TypeScript-based
configuration file exists, `ts-node` is set up if available.

That allows consumers of the package (as the components repo) to more
conveniently use a TypeScript-based configuration for dev-infra.

Currently, commands would need to be proxied through `ts-node`
which rather complicates the setup:

```
NG_DEV_COMMAND="ts-node ./node_modules/@angular/dev-infra-private/cli.js"
```

I'm thinking that it should be best-practice to use TypeScript for
writing the configuration files. Given that the tool is used primarily
in Angular projects (for which most sources are TypeScript), this should
be acceptable.

PR Close #37196
2020-05-19 15:21:58 -07:00
Joey Perrott
72505dfd6f build: Add deprecation notice to merge-pr script to nudge to new tooling (#37204)
Adds a deprecation notice to the old merge-pr script informing the
user the script will be removed in favor of the ng-dev merge tooling.
This currently serves as a warning, and does not fail to perform the
merge.

PR Close #37204
2020-05-19 15:04:29 -07:00
Ajit Singh
a63f634592 docs: remove https://angular.io from internal links (#37157)
PR #36601 itroduces icons on all links if the link contains https:// or http:// but there were some internal links left which contained https://angular.io. Removed https://angular.io from all these links.

PR Close #37157
2020-05-19 10:11:42 -07:00
Sonu Kapoor
18d08a3857 refactor(docs-infra): remove rev property from Resource interface and data (#37181)
The `rev` property has been in the initial commit that introduced
`resources.json` (196203f6d76ac5240d1485dbd9701bfb026eab56) and has been
added to all new entries since (always with the value `true`). This
field is a remnant from back when this data was stored in a Firebase
Database and the `rev` field indicated whether the entry has been
reviewed/approved by a DevRel lead or something. Now that the data is
kept in the repository and the reviewing is done as part of the
corresponding PR, this field is no longer necessary.

PR Close #37181
2020-05-19 10:10:57 -07:00
m-ahmadi
c4234577db docs(router): corrected minor typo (#37166)
This commit corrects a typo and rephrases the first sentence of the `redirectTo`
description to be more understandable.

PR Close #37166
2020-05-18 16:23:32 -07:00
George Kalpakas
4830d664da build(docs-infra): upgrade cli command docs sources to 7653f8616 (#37155)
Updating [angular#9.1.x](https://github.com/angular/angular/tree/9.1.x) from [cli-builds#9.1.x](https://github.com/angular/cli-builds/tree/9.1.x).

##
Relevant changes in [commit range](98de22823...7653f8616):

**Modified**
- help/e2e.json

PR Close #37155
2020-05-18 16:22:18 -07:00
Joey Perrott
e26879ad1d feat(dev-infra): create rebase-pr tool in ng-dev (#37055)
Creates a tool in ng-dev which rebases a PR automatically and pushes
the rebase commits back to the PR.  This is meant to be a replacement
to the local merge script currently in the repo and currently has
feature parity.

PR Close #37055
2020-05-18 16:18:33 -07:00
Joey Perrott
c5c3113f00 build: remove local rebase-pr script (#37055)
Remove the local rebase-pr script with a deprecation message
informing the user to instead perform rebases via ng-dev

PR Close #37055
2020-05-18 16:18:33 -07:00
Andrew Scott
178a78f9ed docs(router): add docs for RouterLink inputs (#37018)
The RouterLink and RouterLinkWithHref inputs do not have any docs. This comment adds jsdoc comments to the inputs.

PR Close #37018
2020-05-18 14:55:42 -07:00
Andrew Scott
7de7871dd9 fix(router): update type for routerLink to include null and undefined (#37018)
PR #13380 added support for `null` and `undefined` but the type on the parameter was not updated.
This would result in a compilation error if `fullTemplateTypeCheck` is enabled.
Fixes #36544

PR Close #37018
2020-05-18 14:55:42 -07:00
Paul Gschwendtner
784cf46a93 ci: update components repo unit tests job commit (#37183)
Updates the commit the `components-repo-unit-tests` job runs
against. The goal is that we run against a revision that at
least contains: https://github.com/angular/components/pull/19273.

The new commit contains fixes for a flaky test in the datepicker that we
saw failing in the components-repo-unit-tests job too:
https://app.circleci.com/pipelines/github/angular/angular/15359/workflows/27ffae7c-a7b8-46a3-9c9e-6dd22ca4734d/jobs/712643.

PR Close #37183
2020-05-18 14:50:15 -07:00
Paul Gschwendtner
ba9e63a278 fix(dev-infra): incorrect base revision for merge script autosquash (#37184)
As mentioned in the previous commit, the autosquash strategy has
not been used in the components repo, so we could easily regress.

After thorough manual testing of the autosquash strategy again,
now that the merge script will be moved to framework, it came
to mind that there is a bug with the base revision in the
autosquash merge strategy. The problem is that the base revision
of a given PR is relying on the amount of commits in a PR.

This is prone to error because the amount of commits could easily
change in the autosquash merge strategy, because fixup or squash
commits will be collapsed. Basically invalidating the base revision.

To fix this, we fixate the base revision by determining the actual
SHA. This one is guaranteed to not change after the autosquash rebase.

The current merge script in framework fixates the revision by creating
a separate branch, but there is no benefit in that, compared to just
using an explicit SHA that doesn't need to be cleaned up..

PR Close #37184
2020-05-18 11:55:32 -07:00
Paul Gschwendtner
83231f2174 fix(dev-infra): merge script autosquash should be interactive (#37184)
The components repo does not use the autosquash merge strategy, so
recent changes to that seem to broke the autosquash strategy.

Since we don't run the rebase in interactive mode, the `--autosquash`
flag has no effect. This is by design in Git. We can make it work by
setting the git sequence editor to `true` so that the rebase seems
like an interactive one to Git, while it isn't one for the user.

This matches conceptually with the merge script currently used in
framework. The only difference is that we allow a real interactive
rebase if the `commit message fixup` label is applied. This allows
commit message modifications (and others) if needed.

PR Close #37184
2020-05-18 11:55:32 -07:00
Paul Gschwendtner
62e3196849 build: configure dev-infra merge script (#37184)
Sets up the dev-infa merge script in the framework ng-dev configuration
file. This allow us to use the script in the future.

PR Close #37184
2020-05-18 11:55:31 -07:00
Paul Gschwendtner
127a06c031 feat(dev-infra): integrate merge script into ng-dev cli (#37184)
Integrates the merge script into the `ng-dev` CLI. The goal is that
caretakers can run the same command across repositories to merge a pull
request. The command is as followed: `yarn ng-dev pr merge <number>`.

PR Close #37184
2020-05-18 11:55:31 -07:00