Commit graph

29561 commits

Author SHA1 Message Date
Renovate Bot
35a1705595 build: update all non-major dependencies (#43760)
PR Close #43760
2021-10-07 20:56:11 +00:00
Renovate Bot
5b1b2fd2f9 build: update dependency google-closure-compiler to v20211006 (#43754)
PR Close #43754
2021-10-07 20:55:49 +00:00
hchiam
8920fa093b docs(docs-infra): fix a11y of external links (#43725)
prevent screen readers from falsely announcing "open_in_new" since they may not actually open new tabs/windows but simply send the current page to a domain outside angular.io

Fixes #43512

PR Close #43725
2021-10-07 20:55:23 +00:00
Andrew Scott
5e3266f65a
docs: release notes for the v13.0.0-next.15 release (#43770) 2021-10-07 12:21:27 -07:00
Renovate Bot
29d277e321 build(devtools): update dependency webpack to v5.58.0 2021-10-07 11:05:59 -07:00
Paul Gschwendtner
e0667efa6e feat(bazel): allow for custom conditions to be set in ng_package targets (#43764)
The APF v13 `ng_package` rule will generate the `exports` field if not
set. Currently it allows for additional subpath entries to be configured
manually. The packager does not allow for custom conditions in subpath
exports which are auto-generated.

This is sometimes useful and necessary though. e.g. in Angular Material,
we also need to expose the index Sass file through a `sass` conditional
that the Webpack Sass loader will pick up. For this, the packager needs
to support manual additional conditions (as long as they do not
conflict).

PR Close #43764
2021-10-07 16:50:49 +00:00
Joey Perrott
e1c2fbd2af release: bump the next branch to v13.1.0-next.0 (#43752)
PR Close #43752
2021-10-06 18:26:29 -07:00
Dylan Hunn
0a0cc67c39 release: cut the v13.0.0-next.14 release (#43751)
PR Close #43751
2021-10-06 16:21:44 -07:00
Alex Rickabaugh
48aa0039ea refactor(compiler-cli): update peerDependencies to require rxjs ^7.4.0 (#43748)
RxJS 7 versions prior to 7.4.0 export ES5 code, whereas Angular
applications using RxJS 6 today use ES2015. This was fixed in RxJS 7.4.0
which exposes ES2015 entrypoints as well. This commit updates Angular's
peer dependencies to require the newer RxJS.

PR Close #43748
2021-10-06 15:57:59 -07:00
Dylan Hunn
f1de27cd73 docs: release notes for the v12.2.9 release (#43750)
PR Close #43750
2021-10-06 15:56:36 -07:00
Pete Bacon Darwin
04fec60a61 ci: ignore "remark*" packages from automatic updates (#43735)
The most recent versions of remark have significant breaking changes
that we are not ready to incorporate. So this commit adds them to the ignore list.

PR Close #43735
2021-10-06 15:26:27 -07:00
Pete Bacon Darwin
663724116e ci: remove "remark" renovate group (#43735)
This group was causing an immortal PR to keep being created, even though
we do not want, currently, to update the versions of the "remark*" packages.

PR Close #43735
2021-10-06 15:26:27 -07:00
Kristiyan Kostadinov
adf4481211 feat(common): add injection token for default date pipe timezone (#43611)
Adds a new injection token called `DATE_PIPE_DEFAULT_TIMEZONE` that allows for the default timezone for all `DatePipe` instances to be specified.

Fixes #43031.

PR Close #43611
2021-10-06 13:53:09 -07:00
Dylan Hunn
5d7229e6b6 release: cut the v13.0.0-next.13 release (#43741)
PR Close #43741
2021-10-06 11:50:36 -07:00
Paul Gschwendtner
e0a0d05d45 feat(core): update node version support range to support v16 (#43740)
This commit updates the `node` engines range for all Angular
framework packages to:

* No longer support NodeJS v12 `< 12.20`. This is done because APF v13
  uses package export patterns which are only supported as of v12.20.
  https://nodejs.org/api/packages.html#packages_subpath_patterns.

* Allows for the latest v16 NodeJS versions. This matches with the CLI
  which added NodeJS v16 support with https://github.com/angular/angular-cli/pull/21854.

  We already limit this to `>= v16.10.0` in preparation to only
  supporting the LTS minors of Node v16.

BREAKING CHANGE: NodeJS versions older than `v12.20.0` are no longer
supported due to the Angular packages using the NodeJS package exports
feature with subpath patterns.

PR Close #43740
2021-10-06 10:55:44 -07:00
Paul Gschwendtner
cd1b52483e feat(bazel): expose esm2020 and es2020 conditions in APF package exports (#43740)
In addition to the existing `exports` conditional exports we ship
as part of APF v13, we want to expose the non-bundled ESM2020 output
through the `esm2020` conditional name. Additionally we will expose
the flat ES2020 files through the `es2020` conditional field, allowing
consumers (like the CLI) to prioritize certain formats.

e.g. consider the case with RXJS where it currently defaults to
the ESM5 output. The CLI could now set `es2015` as the conditional
to leverage the ES2015 output of RXJS. This unveils a problem though
since this would also mean that `ES2015` output of the framework Angular
packages would be used instead of the available ES2020 output. Here is
the additional `es2020` conditional helpful as it allows the CLI to
prioritize `es2020`, fallback to `es2015` and lastly fallback to `default`.
if none do match for a certain package.

PR Close #43740
2021-10-06 10:55:44 -07:00
George Kalpakas
841c5aebbf build(docs-infra): ensure ngsw.json generation is correct and deterministic (#43686)
As explained in #43679, currently the generation of the `ngsw.json` SW
manifest is non-deterministic and often incorrect. Until we can update
to an `@angular/service-worker` version that includes the fix from
PR #43679, we temporarily work-around the issue by re-generating the
`ngsw.json` manifest after `ng build` using the `ngsw-config` binary
exposed by `@angular/service-worker`.

NOTE:
This works around the issue, because the [FileSystem][1] class used by
the `ngsw-config` binary happens to be synchronous (unlike the
implementation provided by the Angular CLI), thus avoiding the race
conditions described in #43679.

[1]: c721135e37/packages/service-worker/cli/filesystem.ts (L15)

PR Close #43686
2021-10-06 10:05:55 -07:00
George Kalpakas
3d26a07ff3 build(docs-infra): update Angular Material to version 13.0.0-next.7 (#43686)
This commit updates angular.io to the latest prerelease version of
Angular CDK/Material (v13.0.0-next.7).

PR Close #43686
2021-10-06 10:05:54 -07:00
George Kalpakas
b8ab5ff0fb build(docs-infra): update AIO to align with new v13.0.0-next.9 CLI apps (#43686)
This commit updates angular.io to more closely align with new apps
created with the latest Angular CLI and remove redundant files/config
now that CLI has dropped support for differential loading.

PR Close #43686
2021-10-06 10:05:54 -07:00
George Kalpakas
81d3919102 refactor(docs-infra): prefix error messages with Angular version info (#43686)
Prefix error messages with the Angular version currently used in the
angular.io app. This applies to both errors logged to the console and
reported to Google Analytics and makes debugging certain errors easier.

PR Close #43686
2021-10-06 10:05:54 -07:00
George Kalpakas
72d1dfdd46 build(docs-infra): use $schema in ngsw-config.template.json to provide intellisense (#43686)
Add an appropriate `$schema` property in `ngsw-config.template.json` to
allow IDEs to provide intellisense about the various fields of the
config.

PR Close #43686
2021-10-06 10:05:54 -07:00
George Kalpakas
23ac3f7cef ci: test AIO/docs examples against the latest RxJS 7.x version (v7.3.1) (#43683)
Use the latest RxJS 7.x version (v7.3.1) with AIO and docs examples
tests to guard against regressions with RxJS v7.

PR Close #43683
2021-10-06 10:04:47 -07:00
George Kalpakas
99e18a07f6 ci: use the local Angular packages when testing AIO/docs examples with RxJS v7 (#43683)
The `test_aio_local` and `test_docs_examples` CI jobs, test the AIO app
and the docs examples using the locally built Angular packages. They
also include steps that install RxJS v7 and test the examples against
that as well, to avoid regressions with RxJS v7.

However, it turns out that the `yarn add` command used to install
RxJS v7 caused yarn to overwrite the local Agular packages in
`node_modules/` with the ones from NPM.

This commit ensures that the local Angular packages are restored in
`node_modules/` after adding RxJS v7. It also adds a check to ensure
that the restoration of local Angular packages did not affect the
version of RxJS.

PR Close #43683
2021-10-06 10:04:47 -07:00
George Kalpakas
ef090d1347 test(docs-infra): improve debugging when docs example tests fail without exiting (#43683)
When the docs examples tests run with `--cliSpecsConcurrency` greater
than 1 (as happens on CI), the output of each process is [buffered][1]
(to avoid interleaved output from multiple, parallel processes) and is
only printed out once the process exits (either successfully or with an
error). However, in cases where a process did not exit, the buffered
output would be never printed out, thus making debugging the failure
harder. This is the case, for example, if a build error happens during
`ng e2e`. This can be seen in action in [this CI job][2], where the job
fails due to no output, but the error (which is an incompatible TS
version) is never printed out.

To make debugging such situations easier in the future, this commit
updates the `spawnExt()` helper to reject (causing the buffered output
to be printed out) if there is no output from the spawned process for
more than 5 minutes.

[1]: c721135e37/aio/tools/examples/run-example-e2e.mjs (L293)
[2]: https://circleci.com/gh/angular/angular/1061751

PR Close #43683
2021-10-06 10:04:47 -07:00
George Kalpakas
3be5716952 refactor(docs-infra): remove redundant code from run-example-e2e.mjs (#43683)
This commit removes some code that was unused or had no effect from the
`run-example-e2e.mjs` script.

PR Close #43683
2021-10-06 10:04:47 -07:00
Alan Agius
52587e5b43 test: remove progress option from dev-server builder (#43730)
This change addresses the following failures
```
Schema validation failed with the following errors:
  Data path "" must NOT have additional properties(progress)
```

See failures in https://app.circleci.com/pipelines/github/angular/angular/38086/workflows/7fd378bb-2c9c-4b7e-9b1e-82c9fb3ba58d/jobs/1064226

PR Close #43730
2021-10-06 09:23:59 -07:00
dario-piotrowicz
6ac35d0660 fix(docs-infra): convert button-like elements to actual buttons (#43601)
some elements in the aio application are anchors or divs but behave
like buttons, it is semantically (and a11y) more correct to convert
them to actual button elements instead

PR Close #43601
2021-10-06 09:22:04 -07:00
Kristiyan Kostadinov
7a971ca379 refactor(language-service): fix typo in method name (#43698)
The `fineRenameLocations` method should be called `findRenameLocations`.

PR Close #43698
2021-10-06 09:21:32 -07:00
Pete Bacon Darwin
fa6aa1be55 build(docs-infra): ensure all overloads are shown in interfaces (#43734)
In the API docs, concrete classes do not list the "implementation" overload on a method, since this is not strictly part of its API.

We recently fixed the rendering of interfaces to display all the overloads, since there is no "implementation" overload.

This commit also fixes the rendering of "pseudo-classes", which are a combination of an interface
and a constant.

Fixes #43001

PR Close #43734
2021-10-06 09:21:08 -07:00
Andrew Kushnir
e3d6e97050 docs: deprecate ViewEngine-based JIT Compiler symbols (#43710)
DEPRECATION:

In ViewEngine, [JIT compilation](https://angular.io/guide/glossary#jit) required special providers (like `Compiler`, `CompilerFactory`, etc) to be injected in the app and corresponding methods to be invoked. With Ivy, JIT compilation takes place implicitly if the Component, NgModule, etc have not already been [AOT compiled](https://angular.io/guide/glossary#aot). Those special providers were made available in Ivy for backwards-compatibility with ViewEngine to make the transition to Ivy smoother. Since ViewEngine is deprecated and will soon be removed, those symbols are now deprecated as well:

- `ModuleWithComponentFactories`
- `Compiler`
- `CompilerFactory`
- `JitCompilerFactory`
- `NgModuleFactory`

Important note: this deprecation doesn't affect JIT mode in Ivy (JIT remains available with Ivy).

PR Close #43710
2021-10-05 18:51:55 -07:00
Dylan Hunn
7acf3bece4 release: cut the v13.0.0-next.12 release (#43726)
PR Close #43726
2021-10-05 18:09:34 -07:00
ivanwonder
69957f72e2 feat(language-service): provide snippets for attribute (#43590)
Support snippet completions for dom attribute whose value
is empty. For Example `<div (my¦) />`, the `insertText`
will return `(myOutput)="$0"`.

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

PR Close #43590
2021-10-05 17:29:26 -07:00
Kristiyan Kostadinov
c14085e434 feat(core): drop support for TypeScript 4.2 and 4.3 (#43642)
Bumps the minimum required TypeScript version to 4.4.2 and removes the integration tests for 4.1, 4.2 and 4.3.

BREAKING CHANGE:
TypeScript versions older than 4.4.2 are no longer supported.

PR Close #43642
2021-10-05 17:26:37 -07:00
Paul Gschwendtner
dbe656d1e0 fix(bazel): ngc-wrapped should not rely on linker for external workspaces (#43690)
Currently when `ngc-wrapped` runs in external/consumer workspaces, like
in the Angular Components project, the `ngc-wrapped` binary relies on
the linker due to the patched module resolution in `rules_nodejs` no
longer being default. The reliance on the linker of `rules_nodejs` is
problematic for workers as the required `node_modules` are not
re-linked for every build. This was previously not an issue before the
APF v13 changes because the `compiler-cli` module was loaded only once
through an import statement.

As of APF v13, the compiler-cli module is loaded dynamically for every
build. This dynamic import can then break as the worker does not
initially load the compiler-cli module when becoming online. Instead,
the module is loaded on the first build where the node modules might not
be linked properly anymore (due to e.g. other targets running at the same time).

We fix thi issue by doing the following things:

1. Enabling the patched module resolution for consumer/external
   workspaces. This would match how we use ngc-wrapped inside FW as
   well.

2. Caching the compiler CLI module. Instead of re-fetching the module
   through dynamic imports for every build (in a worker), we should use
   the cached version. This is semantically the same as with APF v12
   where a single import statement at file top-level was used.
   Technically, NodeJS should cache the module, but it doesn't hurt
   directly caching it as the module resolution will be patched by
   `rules_nodejs` and could perform unnecessary tasks.

PR Close #43690
2021-10-05 17:25:14 -07:00
Andrew Scott
d66a2bc9ec refactor(language-service): Remove option and bundle generation for View Engine (#43723)
This commit removes the option to enable the VE language service and removes the VE bundle entirely.
It also updates the name of the ivy bundle to "language-service.js" now that there is only one.

PR Close #43723
2021-10-05 17:24:08 -07:00
Alan Agius
d585fbc3d8 ci: change ownership of goldens/public-api/manage.js (#43664)
With this change we change ownership of `goldens/public-api/manage.js` from `public-api` to `dev-infra`. This file is a script to manage public-api golden files and therefore it should fall under the dev-infra umbrella.

PR Close #43664
2021-10-05 13:36:36 -07:00
George Kalpakas
fddb50b597 fix(service-worker): make ngsw.json generation deterministic and correct (#43679)
Previously, all asset-groups from `ngsw-config.json` were processed in
parallel. For each asset-group, we retrieved all files for the current
build, filtered out files that were already matched by other
asset-groups, determined which of the remaining files belonged to the
current asset-group and generated entries for the `ngsw.json` manifest.
This process was susceptible to race conditions when there were files
that would be matched by multiple asset-groups. This made the generation
of the `ngsw.json` manifest non-deterministic and violated the rule that
each file would belong to the first asset-group that matched it (based
on the asset-groups' order of appearance in `ngsw-config.json`), thus
leading to broken ServiceWorker behavior.

This commit fixes it by ensuring that the generation process is
deterministic and that asset-groups are processed in the proper order.

NOTE 1:
The generation process has been broken since the beginning, but we have
only noticed this recently. This is possibly related to the CLI's
switching from a virtual file system host (which has more consistent
timing characteristics) to the Node.js built-in `fs.promises` in
angular/angular-cli@d3bc530c10.

NOTE 2:
This commit also ensures that files in the `ngsw.json` hash-table are in
alphabetic order. Previously, the files were added to the hash-table in
blocks corresponding to each asset-group.
This change is not necessary (i.e. the order of keys in the hash-table
makes no difference in behavior), but it makes it easier to scan for a
file (for example, for debugging purposes).

PR Close #43679
2021-10-05 13:34:29 -07:00
Maximilian Köller
0dc45446fe feat(service-worker): expose more version update events (#43668)
This commit introduces a new `SwUpdate#versionUpdates` observalbe, which provides more granular
information about Service Worker version updates than the already existing `SwUpdate#available`
observable.

The new events emitted by `SwUpdate#versionUpdates` basically add the possibility for application to
get notified if a new version is available on the server (not yet downloaded) and if an installation
of a new version failed.

Closes #39840

DEPRECATED: The `SwUpdate#availalbe` observable is deprecated.

The new `SwUpdate#versionUpdates` observable provides the same information and more. Therefore, it
is possible to rebuild the same behavior as `SwUpdate#availalbe` using the events emitted by
`SwUpdate#versionUpdates` and filtering for `VersionReadyEvent` events.
As a result, the `SwUpdate#availalbe` observable is now redundant.

PR Close #43668
2021-10-05 11:00:07 -07:00
Maximilian Köller
59225f5586 feat(service-worker): SwUpdate#activeUpdate and SwUpdate#checkForUpdate should have a meaningful outcome (#43668)
Previously `activateUpdate` and `checkForUpdate` returned `Promise<void>`, which did not provide any
information of the actual outcome of the operation. Developers needed to subscribe to a
corresponding observable to obtain the outcome.

With this commit `SwUpdate#activateUpdate` will return `Promise<boolean>` which resolves to `true` if
an update was activated, to `false` if no new version is available and rejects in case of any error.
`SwUpdate#checkForUpdate` also returns a `Promise<boolean>` which resolves to `true` if an update is available, to `false` if no update was found and rejects in case of any error.

Closes #39840

BREAKING CHANGE: The return type of `SwUpdate#activateUpdate` and `SwUpdate#checkForUpdate` changed to `Promise<boolean>`.

Although unlikely, it is possible that this change will cause TypeScript type-checking to fail in
some cases. If necessary, update your types to account for the new
return type.

DEPRECATED: The `SwUpdate#activated` observable is deprecated.

The `SwUpdate#activated` observable only emits values as a direct response to calling
`SwUpdate#activateUpdate()` and was only useful for determining whether the call resulted in an
update or not. Now, the return value of `SwUpdate#activateUpdate()` can be used to determine the
outcome of the operation and therefore using `SwUpdate#activated` does not offer any benefit.

PR Close #43668
2021-10-05 11:00:07 -07:00
Renovate Bot
65debd4108 build(devtools): update angular-framework to b8940cb 2021-10-05 09:50:14 -07:00
Wey-Han Liaw
2ab2a080b6 fix(router): unset attachRef when router-outlet is destroyed to avoid mounting a destroyed component (#43697)
Previously, when a router-outlet is conditionally shown with an ngIf, and a sub-route was re-attached
via a custom RouteReuseStrategy, router-outlet would try to mount a destroyed component into the view
if the router-outlet is destroyed and re-initialized.

This commit fixes it by unsetting context.attachRef when router-outlet is destroyed, so when the
router-outlet is being initialized again, it no longer sees an attachRef that it needs to mount to the
view.

Fixes #43696

PR Close #43697
2021-10-05 09:48:39 -07:00
Kristiyan Kostadinov
318cf9144e test(core): fix failing unit test (#43714)
Fixes a unit test that now fails, because rethrowing errors is enabled by default. The problem is that we're checking the behavior of a component that throws during `ngOnDestroy`, but since the `resetTestingModule` call itself throws, the test is considered as failing.

PR Close #43714
2021-10-05 09:47:34 -07:00
Doug Parker
263feba5c2 fix(compiler-cli): handle nullable expressions correctly in the nullish coalescing extended template diagnostic (#43572)
Refs #42966.

Previously, checking a template with the syntax:

```html
<div>{{ foo() ?? 'test' }}</div>
```

Where `foo()` returns a nullable value:

```typescript
@Component(/* ... */)
class TestCmp {
  foo: (): string | null => null;
}
```

Would always log a nullish coalescing not nullable warning. This is because [`getSymbolOfNode(node.left)`](fe69193509/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/nullish_coalescing_not_nullable/index.ts (L30)) would return the [symbol of the function (`foo`)](fe69193509/packages/compiler-cli/src/ngtsc/typecheck/src/template_symbol_builder.ts (L536-L538)) rather than the symbol of its returned value (`foo()`). Fixed this by getting the symbol for the whole expression's span, rather than just the function receiver.

Also made some minor refactorings to `template_symbol_builder` to make a similar change to safe method calls. This behavior was originally for the language service in order to handle quick info, as the user highlighting a function name would actually apply to the entire expression. This is no longer true as the language service will correctly request the type from the function rather than the `Call` expression, so these hacks are not necessary anymore. This broke two existing test cases of exactly this behavior which were easily updated. Also added a test to the language service to confirm that it is not broken by this change.

PR Close #43572
2021-10-04 17:32:57 -07:00
Kristiyan Kostadinov
7fd0428aae fix(core): don't rethrow errors if test teardown has been disabled (#43635)
Fixes that the current logic was set up so that error rethrowing was enabled even when teardown is disabled.

PR Close #43635
2021-10-04 17:31:26 -07:00
Alan Agius
bdc6ff465a refactor(compiler-cli): remove source-map from dependencies (#43644)
`source-map` is only used during testing and therefore there is no need to list it as a dependency.

(cherry picked from commit ae7dc75bdce713acaa1658734791317a274982da)

PR Close #43644
2021-10-04 17:31:03 -07:00
Alan Agius
e7b647fc06 refactor(dev-infra): remove dependency on minimist (#43644)
Refactor scripts to use `yargs`. The main motivation for this is to align and use a single parser.

PR Close #43644
2021-10-04 17:31:03 -07:00
Alan Agius
9442a2f856 refactor(compiler-cli): remove dependency on minimist (#43644)
The compiler already has a dependency on another parser (`yargs`).

PR Close #43644
2021-10-04 17:31:03 -07:00
Dylan Hunn
dd0722fd1f release: cut the v13.0.0-next.11 release (#43707)
PR Close #43707
2021-10-04 17:23:50 -07:00
Kristiyan Kostadinov
81c7eb813c feat(core): add migration to opt out existing apps from new test module teardown behavior (#43353)
Since the `destroyAfterEach` teardown behavior is enabled by default now, existing tests that depended on the old behavior can start to fail. These changes add an automated migration that explicitly adds `destroyAfterEach: false` to existing tests.

The migration works by looking for `initTestEnvironment` calls across the entire app and adding the flag to them. If no calls were found, the migration will add the flag to all `configureTestingModule` and `withModule` calls instead.

PR Close #43353
2021-10-04 16:57:16 -07:00
Kristiyan Kostadinov
94ba59bc9d feat(core): enable test module teardown by default (#43353)
Sets the `destroyAfterEach` teardown behavior to be enabled by default.

PR Close #43353
2021-10-04 16:57:16 -07:00