Commit Graph

20112 Commits

Author SHA1 Message Date
Joey Perrott 17d2c8d7fa build: ensure action: merge label is included on release PRs (#40016)
The release PRs should include the `action: merge`, `PullApprove: disable` and `comp: build & ci`
labels.

PR Close #40016
2021-01-25 10:49:56 -08:00
Joey Perrott 64628a4d7d fix(dev-infra): write to unique log file for `FATAL_ERROR`s in release tooling (#40524)
Write to the unique log file, to prevent being overwritten, for `FATAL_ERROR`
failures in the release tooling.  This will help to assist in determining where
something goes wrong in the process as well as being able to resume the action.

PR Close #40524
2021-01-25 10:47:41 -08:00
Joey Perrott 2980d85b8c feat(dev-infra): support --no-branch-prompt to suppress the merge tool branch target confirmation (#40528)
Add support for a `--no-branch-prompt` flag for the `ng-dev pr merge` tool.  This
flag enables suppression of the confirmation prompt for which branches the specified
PR will merge into.

PR Close #40528
2021-01-25 10:45:57 -08:00
JiaLiPassion 1f53301fd3 refactor(zone.js): refactor zone rollup config (#40481)
When migrating zone.js from gulp to bazel, some legacy build config files are still there,
we have `rollup-es5.config.js` and `rollup-es5_global-es2015.config.js`, since in gulp build
system, build `es5` or `esm` files are set in the config file, but in the bazel world,
the output format is not config in the config.js file, but is required by the downstream
bazel target. So we don't really need the two rollup config files any longer.

Another difference is in `rollup-es5.config.js`, the `external` and `global` libraries names
are also config there, and these settings are also valid for `es2015` build, these settings
are not in the `es2015.config.js` for some legacy reasons. So we don't need to keep this
difference either.

PR Close #40481
2021-01-25 10:43:39 -08:00
Hoel IRIS 21bc16d4d8 fix(service-worker): handle error with console.error (#40236)
This commit reverts commit [_fix(service-worker): handle error with
ErrorHandler_](https://github.com/angular/angular/pull/39990/commits/552419d).

With Angular v11.0.4 and commit [_fix(service-worker): handle error with
ErrorHandler_](https://github.com/angular/angular/pull/39990/commits/552419d)
Angular start to send all service worker registration errors to the Angular
standard `ErrorHandler#handleError()` interface, instead of logging them in the
console.
But users existing `ErrorHandler#handleError()` implementations are not adapted
to service worker registration errors and it might result in broken apps or
bad UI.
Passing to `ErrorHandler` is desirable for some and undesirable for others and
the same is true for passing to `console.error()`.
But `console.error()` was used for a long time and thus it is preferable to keep
it as long as a good solution is not found with `ErrorHandler`.

Right now it's hard to define a good solution for `ErrorHandler` because:

1. Given the nature of the SW registration errors (usually outside the control
   of the developer, different error messages on each browser/version, often
   quite generic error messages, etc.), passing them to the `ErrorHandler` is
   not particularly helpful.
2. While `ErrorHandler#handleError()` accepts an argument of type `any` (so
   theoretically we could pass any object without changing the public API), most
   apps expect an `Error` instance, so many apps could break if we changed the
   shape.
3. Ideally, the Angular community want to re-think the `ErrorHandler` API
   and add support for being able to pass additional metadata for each error
   (such as the source of the error or some identifier, etc.). This change,
   however, could potentially affect many apps out there, so the community must
   put some thought into it and design it in a way that accounts for the needs
   of all packages (not just the SW).
4. Given that we want to more holistically revisit the `ErrorHandler` API, any
   changes we make in the short term to address the issue just for the SW will
   make it more difficult/breaky for people to move to a new API in the future.

To see the whole explanation see GitHub PR #40236.

PR Close #40236
2021-01-25 10:11:58 -08:00
Newsha Hosseiny Nik 7a1d719091 docs: remove an extra "and" in the tutorial (#40541)
PR Close #40541
2021-01-25 10:02:02 -08:00
Nejc Zdovc 677782236b docs: fix pullapprove url (#40550)
PR Close #40550
2021-01-25 10:01:02 -08:00
Justin Santa Barbara a78493ffd7 docs: Fix syntax in interpolation example (#40554)
Correcting a typo in the example.
PR Close #40554
2021-01-25 09:59:50 -08:00
Jessica Janiuk fc64fa8e1a Revert "fix(compiler): support multiple `:host-context()` selectors (#40494)" (#40531)
This reverts commit 07b7af332f.

Reason for revert: Google3 failures

PR Close #40531
2021-01-22 16:45:39 -08:00
Jessica Janiuk c64a56fbcc Revert "fix(core): fix possible XSS attack in development through SSR (#40525)" (#40533)
This reverts commit bb3b315eee.

Reason for Revert: Issues with Google3 TAP Failures

PR Close #40533
2021-01-22 16:44:34 -08:00
Misko Hevery bb3b315eee fix(core): fix possible XSS attack in development through SSR (#40525)
This is a follow up fix for
894286dd0c.

It turns out that comments can be closed in several ways:
- `<!-->`
- `<!-- -->`
- `<!-- --!>`

All of the above are valid ways to close comment per:
https://html.spec.whatwg.org/multipage/syntax.html#comments

The new fix surrounds `<` and `>` with zero width space so that it
renders in the same way, but it prevents the comment to be closed eagerly.

PR Close #40525
2021-01-22 14:19:52 -08:00
cexbrayat c5599ccd3e docs: fix NG0201 error description (#40500)
PR Close #40500
2021-01-22 13:35:01 -08:00
Joey Perrott e25413c6da build: update to @bazel/bazelisk@1.7.3 (#40519)
Update to the latest version of bazelisk as part of preperation for supporting
new Macs with M1 chips.

Addresses https://github.com/angular/angular/issues/40498

PR Close #40519
2021-01-22 10:25:49 -08:00
Misko Hevery 1e4b51e9f7 fix(core): improve injector debug information in `ngDevMode` (#40476)
- `LViewDebug` now properly shows when `TNode` has `NO_NODE_INJECTOR`.
- Provide `injectorResolutionPath` property `DebugNode`

PR Close #40476
2021-01-22 10:21:25 -08:00
Pete Bacon Darwin 07b7af332f fix(compiler): support multiple `:host-context()` selectors (#40494)
In `ViewEncapsulation.Emulated` mode, the compiler must generate additional
combinations of selectors to handle the `:host-context()` pseudo-class function.

Previously, when there is was more than one `:host-context()` selector in a
rule, the compiler was generating invalid selectors.

This commit generates all possible combinations of selectors needed to
match the same elements as the native `:host-context()` selector.

Fixes #19199

PR Close #40494
2021-01-22 10:19:44 -08:00
Pete Bacon Darwin dc06873c72 fix(compiler-cli): handle pseudo cycles in inline source-maps (#40435)
When a source-map has an inline source, any source-map linked from
that source should only be loaded if itself is also inline; it should not
attempt to load a source-map from the file-system. Otherwise we can
find ourselves with inadvertent infinite cyclic dependencies.

For example, if a transpiler takes a file (e.g. index.js) and generates
a new file overwriting the original file - capturing the original
source inline in the new source-map (index.js.map) - the source
file loader might read the inline original file (also index.js) and
then try to load the `index.js.map` file from disk - ad infinitum.

Note that the first call to `loadSourceFile()` is special, since you can
pass in the source-file and source-map contents directly as in-memory
strrngs. This is common if the transpiler has just generated these and has
not yet written them to disk.
When the contents are passed into `loadSourceFile()` directly, they are
not treated as "inline" for the purposes described above since there is
no chance of these "in-memory" source and source-map contents being caught
up in a cyclic dependency.

Fixes #40408

PR Close #40435
2021-01-21 14:06:57 -08:00
ayazhafiz d482f5cdd3 feat(language-service): view template typecheck block (#39974)
This patch adds an API to retrieve the template typecheck block for a
template (if any) at a file location, and a selection of the TS node
in the TCB corresponding to the template node at which the request for
a TCB was made (if any).

Probably not something we want to land soon, but a useful debugging tool
for folks working with TCBs.

PR Close #39974
2021-01-21 14:05:29 -08:00
Charles Lyding 2b2a847ad7 refactor(migrations): remove rxjs usage within static queries migration (#38657)
rxjs was only used within one location within the static queries migration to workaround
a previous limitation that schematics could not directly use a promise.  However, promise
support has been available since 8.0.  This change removes the observable promise wrapping.
It also removes an any cast that was previously needed to workaround rxjs version mismatches
during compilation.

PR Close #38657
2021-01-21 14:04:20 -08:00
Harun Urhan 575a2d162c feat(common): implement `appendAll()` method on `HttpParams` (#20930)
Adds an `appendAll()` method to `HttpParams` that can construct the HTTP
request/response body from an object of parameters and values.

This avoids calling `append()` multiple times when multiple parameters
need to be added.

Fixes #20798

PR Close #20930
2021-01-21 14:01:34 -08:00
Joey Perrott c9033d6193 build: set the repository information for ts-api-guardian (#40512)
Set the repository information in the package.json for ts-api-guardian to
allow it to be published via wombat proxy.

PR Close #40512
2021-01-21 13:53:08 -08:00
George Kalpakas ac253d01ed build(docs-infra): upgrade cli command docs sources to c366e223b (#40501)
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](e1bcfba66...c366e223b):

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

PR Close #40501
2021-01-21 13:52:07 -08:00
hafiz 5a8e9394df Remove myself from language-service reviews (#40509)
I am no longer actively working on the language service.
PR Close #40509
2021-01-21 13:50:52 -08:00
Wataru.Kasahara 3f92be4ec3 docs: remove old content from CLI configuration guide (#38243)
PR Close #38243
2021-01-21 13:49:23 -08:00
Alison Gale f0733d109e fix(router): Fix occasional error when creating url tree in IE 11 and Edge (#40488)
For the Google Cloud Console within Google we observed errors in the
shallowEqual function for users in IE and Edge. This patch was made within
Google and the errors went away. This commit upstreams the change into Angular.

PR Close #40488
2021-01-21 12:25:16 -08:00
Joey Perrott 0e95460cf8 build: bump ts-api-guardian to 0.5.1 (#40511)
Update to new patch version of the experimental ts-api-guardian package.

PR Close #40511
2021-01-21 12:23:18 -08:00
Joey Perrott 71ea1a6199 build: set up publishing registry for ts-api-guardian (#40511)
Set the ts-api-guardian to be published via the wombot proxy.

PR Close #40511
2021-01-21 12:23:18 -08:00
JoostK 69385f7df4 test(core): verify that token IDs that exceed the bloom filter size are handled correctly (#40489)
This commits adds additional expectations to verify that the bloom
filter is able to correctly handle token IDs that exceed the size of
the bloom filter (which is currently 256 bits).

PR Close #40489
2021-01-20 17:02:02 -08:00
JoostK fad1083873 perf(core): simplify bloom bucket computation (#40489)
The injector system uses a bloom filter to determine if a token is
possibly defined in the node injector tree, which is stored across
multiple bloom buckets that each represent 32 bits of the full 256-bit
wide bloom hash. This means that a computation is required to determine
the exact bloom bucket which is responsible for storing any given 32-bit
interval, which was previously computed using three bitmask operations
and three branches to derive the bloom bucket offset.

This commit exploits the observation that all bits beyond the low 5 bits
of the bloom hash are an accurate representation for the bucket offset,
if shifted right such that those bits become the least significant bits.
This reduces the three bitmask operations and three branches with a
single shift operation, while additionally offering a code size
improvement.

PR Close #40489
2021-01-20 17:02:02 -08:00
Andrew Scott 5bbb5ea955 refactor(language-service): do not mutate the original template node span (#40484)
Rather than mutating the span on the template when renaming literal strings,
this commit updates the logic to mutate the `TextSpan` equivalent that
is used by the Language Service.

PR Close #40484
2021-01-20 16:59:54 -08:00
Alex Mokin 3cf4e3c7c5 fix(router): always stringify matrix parameters (#25095)
Fix a case where matrix parameters weren't stringified when they are passed as a first command
when creating a url tree. Fix return type in parseMatrixParams method
because it always returns {[key: string]: string}

Closes #23165

PR Close #25095
2021-01-20 16:19:45 -08:00
Kapunahele Wong 51d6aed677 docs: clarify name collision info, add example snippet, and fix example CSS (#40451)
Fixes #40403 and fixes imgs and layout of example
that are unrestrained and thus are too big in StackBlitz.

PR Close #40451
2021-01-20 16:13:43 -08:00
Pete Bacon Darwin 315b272f9f docs: add missing type parameter to testing example (#40479)
Without this type parameter the call to `resolve()` is invalid.

PR Close #40479
2021-01-20 16:12:15 -08:00
Pete Bacon Darwin 9491318c26 build(docs-infra): move docs-watch settings to a base package (#40479)
This new `base-authoring-package` captures all the settings, which
turns of potentially fatal checks, in one place. This new package is
then used as a base for all the docs-watch related packages, rather
than dotting the settings in a variety of different packages. This also
has the benefit that the standard configuration for doc-gen is fatal
on failed checks by default.

PR Close #40479
2021-01-20 16:12:15 -08:00
Pete Bacon Darwin ead9ccd566 build(docs-infra): fail gently if a changed file is unknown (#40479)
When using `docs-watch` we try to match the changed file
to a dgeni package in order to trigger a minimal set of processors.

Previously, if the changed file could not be matched we emitted an
ugly error. Now we provide a helpeful message.

PR Close #40479
2021-01-20 16:12:15 -08:00
Pete Bacon Darwin 4a9f7daf37 docs: remove unused "docregions" (#40479)
This commit removes all the docregion tags in examples that are not
being referenced in any doc.

PR Close #40479
2021-01-20 16:12:15 -08:00
Pete Bacon Darwin fb97e67fcb build(docs-infra): fail if there are unused example regions (#40479)
We can define regions in our examples that can be referenced
and rendered in guides as code snippets. It is quite hard to ensure
that these regions are maintained correctly. One reason for this is
it is hard to know whether a region is being used or not.

This commit adds a new processor that checks for unused named
regions in examples and fails if any are found.

Fixes #19761

PR Close #40479
2021-01-20 16:12:15 -08:00
Pete Bacon Darwin 5dd604a15d build(docs-infra): improve docs-watch example matching (#40479)
In the `docs-watch` job we attempt to guess what additional files need
to be processed given a change to a single file. Previously we were not
finding links to examples that were defined over multiple lines. E.g.

```
<code-pane
  header="src/app/app.component.html"
  region="hero-birthday-template"
  path="pipes/src/app/app.component.html">
</code-pane>
```

This commit improves the regular expression to handle these cases.

PR Close #40479
2021-01-20 16:12:15 -08:00
Pete Bacon Darwin c6a2267bb4 build(docs-infra): remove outdated comment (#40479)
The comment referred to pre v9 Angular. The `http` package has
now been completely removed.

PR Close #40479
2021-01-20 16:12:15 -08:00
Andrew Kushnir 0b46f814d0 docs: release notes for the v11.1.0 release 2021-01-20 15:11:51 -08:00
twerske 3cfb4b4ef9 docs: add embedded videos to error guides (#40453)
add embedded youtube videos
provide visual debugging for top errors

PR Close #40453
2021-01-20 08:47:00 -08:00
Keen Yee Liau e1e1db3c01 fix(language-service): Paths on Windows should be normalized (#40492)
Many `ts.LanguageService` APIs accept a filename, for example
```ts
getQuickInfoAtPosition(fileName: string, position: number)
```
The requirement is that `fileName` is agnostic to the platform (Linux, Mac,
Windows, etc), and is always normalized to TypeScript's internal
`NormalizedPath`.

This is evident from the way these APIs are called from the language server:
```ts
  private onHover(params: lsp.TextDocumentPositionParams) {
    const lsInfo = this.getLSAndScriptInfo(params.textDocument);
    if (lsInfo === undefined) {
      return;
    }
    const {languageService, scriptInfo} = lsInfo;
    const offset = lspPositionToTsPosition(scriptInfo, params.position);
    const info = languageService.getQuickInfoAtPosition(scriptInfo.fileName, offset);
    // ...
  }
```
9fca9c6651/server/src/session.ts (L594)
Here `scriptInfo.fileName` is always a `ts.server.NormalizedPath`.

However, https://github.com/angular/angular/pull/39917 accidentally leaked
the platform-specific paths, and caused a mismatch between the incoming paths
and the paths stored in the internal data structure `fileToComponent`.

This PR fixes the bug by always normalizing the paths, and updating the
type to reflect the format of the underlying data.

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

PR Close #40492
2021-01-20 08:46:03 -08:00
Andrew Scott 402e2e6189 refactor(language-service): de-duplicate rename and reference results (#40454)
The initial implementation assumed that the consuming editors would
de-duplicate rename locations. In fact, vscode treats overlapping rename
locations as distinct and errors when trying to preview the renames.

This commit updates the language service to de-duplicate exact file+span
matches before returning rename and reference locations.

While vscode _does_ de-duplicate reference results, it still makes sense
to de-duplicate them on our side when possible to make tests more
understandable. If a template has 3 instances of a variable, it makes
sense to get get 3 reference results rather than 4+ with some duplicates.

PR Close #40454
2021-01-19 14:21:15 -08:00
David Shevitz 5e95153d44 docs: Return SVG topic to documentation; light edits for clarity (#40487)
PR Close #40487
2021-01-19 14:18:51 -08:00
Andrew Scott 3e97a1ea43 fix(language-service): fix go to definition for template variables and references (#40455)
The current "go to definition" is broken for template variables and
references when a template is overridden. This is because we get the
file url from the source span, which uses the overridden name
'override.html'. Instead, we can retrieve the template file from the
compiler in the same manner that is done for references.

Another way to fix this would have been to use the real template file path when
overriding a template, but this was the more straightforward fix since
the strategy was already used in find references and rename locations.

fixes https://github.com/angular/vscode-ng-language-service/issues/1054

PR Close #40455
2021-01-19 13:03:14 -08:00
Kristiyan Kostadinov 1d1304c70c fix(forms): error if control is removed as a result of another one being reset (#40462)
When a form is reset, it goes through `_forEachChild` to call `reset` on each of its children.
The problem is that if a control is removed while the loop is running (e.g. by a subscription),
the form will throw an error, because it built up the list of available control before the loop
started.

These changes fix the issue by adding a null check before invoing the callback.

Fixes #33401.

PR Close #40462
2021-01-19 11:41:23 -08:00
twerske afabb83696 refactor(core): add links to top compiler errors (#40326)
add links to 5 compiler error messages
navigate user to AIO new /errors pages for debugging

PR Close #40326
2021-01-19 10:14:57 -08:00
twerske bfdca0b87f refactor(core): add links to top runtime errors (#40326)
add links to 5 runtime error messages
navigate user to AIO new /errors pages for debugging

PR Close #40326
2021-01-19 10:14:56 -08:00
Aristeidis Bampakos 0568c7387f docs: add Angular Builders to community resources (#40475)
PR Close #40475
2021-01-19 09:22:26 -08:00
abarghoud 2c95f57266 feat(docs-infra): use Record type instead of key-value (#40463)
use Record type instead of key-value

Closes #39804

PR Close #40463
2021-01-19 09:21:23 -08:00
Alexey Elin b636406043 docs: fix broken link to XSRF common protection mechanism (#40458)
PR Close #40458
2021-01-19 09:17:50 -08:00