Commit graph

26131 commits

Author SHA1 Message Date
Andrew Scott
dedac8d3f7 feat(router): Add test helper for trigger navigations in tests (#48552)
In order to test components and services which depend on router navigations, such as `ActivatedRoute` instances, tests currently need to provide a fair bit of boilerplate _or_ they can set up a stub for `ActivatedRoute` and list it in the `providers` to override it in `TestBed`. This approach of stubbing the `ActivatedRoute` creates a situation that can easily cause the test to break. The stub often only mocks out the dependencies that the component/service _currently_ needs. This dependencies might change over time and break the test in an unexpected way. In addition, it is difficult to get the structure of `ActivatedRoute` exactly correct.

This change will allow unit tests to quickly set up routes, trigger real navigations in the Router, and get instances of component's to test along with real instances of `ActivatedRoute`. This all comes without needing to know that the component depends on `ActivatedRoute` at all. This becomes more important when considering that a component may be refactored in the future to use `@Input` rather than access data on the `ActivatedRoute` instance (see #18967). Tests which mock out `ActivatedRoute` would all break, but those which use `navigateForTest` would continue to work without needing any updates.

resolves #15779
resolves #48608

PR Close #48552
2023-01-25 19:31:38 +00:00
Andrew Scott
930020c578 refactor(router): Move afterNextNavigation helper function to a reusable location (#48552)
There may be use-cases in the future where `afterNextNavigation` is used
in other locations. For example, a test helper function which navigates
should likely wait for all redirects to complete rather than simply
waiting for the promise returned from `navigate` to resolve.

PR Close #48552
2023-01-25 19:31:38 +00:00
Iván Navarro
a055196c55 fix(common): warn if using ngSrcset without a configured image loader (#48804)
Warn the user in the console in case the `ngSrcset` is present and no
loader is configured. In this case, the default loader is used and
it ignores this attribute.

PR Close #48804
2023-01-25 19:27:00 +00:00
Matthieu Riegler
5915c7236e refactor(upgrade): rewrite the downgrade component adapter (#48715)
To remove the non-null assertions linked to #24571, DowngradeComponentAdapter has been refactored and the public methods have been simplifed.

PR Close #48715
2023-01-25 18:32:05 +00:00
Matthieu Riegler
67c9d5250c refactor(upgrade): code cleaning on upgrade module (#48715)
This commit removes unused code, non-null assertions linked to #24571 and improves readability

PR Close #48715
2023-01-25 18:32:05 +00:00
Matthieu Riegler
223912028e refactor(upgrade): code cleaning on tests (#48715)
This commit removes the null assertions linked to #24571

PR Close #48715
2023-01-25 18:32:05 +00:00
Kristiyan Kostadinov
06e161f2dd fix(compiler): incorrect code when non-null assertion is used after a safe access (#48801)
Fixes that the expression converter was producing code that throws a runtime error if a non-null assertion is used as a part of a safe read, write or call.

Fixes #48742.

PR Close #48801
2023-01-25 18:31:37 +00:00
Matthieu Riegler
fd539a298e docs: fix the documentation for BootstrapOptions (#48834)
Inline code was being rendered on aio, this commit fixes this.

PR Close #48834
2023-01-25 18:31:08 +00:00
Virginia Dooley
14aefa1b03 docs: add new files for HTTP content (#47684)
PR Close #47684
2023-01-25 18:29:47 +00:00
Jessica Janiuk
c91606b67e release: cut the v15.2.0-next.2 release 2023-01-25 09:09:50 -08:00
Jessica Janiuk
d7b4b42f0c docs: release notes for the v15.1.2 release 2023-01-25 08:54:26 -08:00
Kristiyan Kostadinov
e7318fc758 feat(core): add ng generate schematic to remove unnecessary modules (#48832)
Adds a new mode to the `@angular/core:standalone` schematic that automatically deletes modules that may not be necessary after the previous step of converting them to standalone.

PR Close #48832
2023-01-25 16:20:27 +00:00
Angular Robot
10634048ea docs: update Angular CLI help [main] (#48827)
Updated Angular CLI help contents.

PR Close #48827
2023-01-24 21:27:02 +00:00
dario-piotrowicz
87fe3161d4 refactor: remove unnecessary test support check utilities (#47543)
remove the following utilities used in unit tests which check for features
that are supported by all supported browsers:
 - supportsCustomElements
 - supportsWebAnimation
 - supportsRegExUnicodeFlag
 - supportsTemplateElement

also remove the following utilities which check for features that are
not supported (and aren't going to be) by any of the supported browsers:
 - supportsDeprecatedCustomCustomElementsV0
 - supportsDeprecatedShadowDomV0

PR Close #47543
2023-01-24 21:06:09 +00:00
Charles Lyding
402fcc57bb refactor(localize): bundle message digest algorithm directly in npm package (#48799)
The main entry point for the `@angular/localize` package no longer imports
the `@angular/compiler` package and now has no external dependencies. This
allows the main functionality of the package to be used without requiring
any other Angular packages. Only the message digest algorithm implementation
from the `@angular/compiler` package was being used and this code is now
bundled directly into the final npm package for `@angular/localize`.
The `tooling` secondary entry point still leverages and requires Angular
related packages (`@angular/compiler`/`@angular/compiler-cli`). However,
the tooling functionality is not intended to be used and/or bundled in
a web application.

Closes #48163

PR Close #48799
2023-01-24 18:31:25 +00:00
Angular Robot
3440778671 build: update cross-repo angular dependencies (#48437)
See associated pull request for more information.

PR Close #48437
2023-01-24 18:30:43 +00:00
Matthieu Riegler
c2cd0c548d fix(docs-infra): consistent table width with min-width:100% (#48815)
Let's have a consistent min-width of the tables across AIO to improve the look of the docs.

fixes #43840

PR Close #48815
2023-01-24 18:30:04 +00:00
Matthieu Riegler
bc8cfa2552 fix(compiler): handle css selectors with space after an escaped character. (#48558)
In Css, selectors with escaped characters require a space after if the following character is a hex character. ie: .\fc ber which matches class="über"
These escaped selectors happen for example when esbuild run with `optimization.minify`

fixes #48524

PR Close #48558
2023-01-24 17:46:33 +00:00
Kristiyan Kostadinov
a154db8a81 feat(core): add ng generate schematic to convert declarations to standalone (#48790)
Implements a new `ng generate @angular/core:standalone` schematic that allows the user to convert all the declarations in a set of NgModules to standalone.

PR Close #48790
2023-01-24 16:48:19 +00:00
Kristiyan Kostadinov
b37a624985 build: set up ng generate schematics for core (#48790)
Adds the necessary boilerplate to allow for `ng generate` schematics to be included with `@angular/core`.

PR Close #48790
2023-01-24 16:48:19 +00:00
Kristiyan Kostadinov
69c3d2849d refactor(migrations): minor improvements to existing schematic utilties (#48790)
Makes the following minor improvements to our current schematic utilities:
* `closestNode` now takes a TS predicate function instead of a `SyntaxKind`. This allows it automatically infer the type of the match.
* `getImportSpecifier` now accepts a regex for the module name. This will be useful for some upcoming migrations.
* Splits the logic for creating the migration program options into a separate function so that it's easier to reuse.
* `createMigrationProgram` now returns the program directly, instead of a literal with some other information.
* `FakeReadFileFn` and `createMigrationCompilerHost` aren't exported anymore since they aren't used anywhere.

PR Close #48790
2023-01-24 16:48:19 +00:00
Kristiyan Kostadinov
e4b28456a9 refactor(migrations): allow for aliases to be specified in the import manager (#48790)
Adds the ability to set an alias when adding an import through the `ImportManager`. This will be required in some upcoming schematics.

PR Close #48790
2023-01-24 16:48:19 +00:00
Dylan Hunn
c03e6a6097 docs: Use of $any() has no runtime incidence. (#48785)
Some users are woried about `$any()` as function calls are to be avoided in templates. This sentence clarifies the situation.

fixes #48781

PR Close #48785
2023-01-24 16:47:33 +00:00
JoostK
4da1f2948c fix(compiler-cli): resolve deprecation warning (#48812)
This commit updates one usage of the `ts.factory.createMethodDeclaration` API
to avoid a deprecated function signature, which avoids logging a warning.

PR Close #48812
2023-01-24 16:45:12 +00:00
Alan Agius
28da74cffc test: update size golden to reflect Angular cross dependency updates (#48809)
The increase is caused by changes in Material which causes more CSS to be generated.

Before
```css
.mat-pseudo-checkbox {
  color: #0000008a;
}
.mat-pseudo-checkbox:after {
  color: #fafafa;
}
.mat-pseudo-checkbox-disabled {
  color: #b0b0b0;
}
.mat-primary .mat-pseudo-checkbox-checked,
.mat-primary .mat-pseudo-checkbox-indeterminate {
  background: #1976d2;
}
.mat-pseudo-checkbox-checked,
.mat-pseudo-checkbox-indeterminate,
.mat-accent .mat-pseudo-checkbox-checked,
.mat-accent .mat-pseudo-checkbox-indeterminate {
  background: #d32f2f;
}
.mat-warn .mat-pseudo-checkbox-checked,
.mat-warn .mat-pseudo-checkbox-indeterminate {
  background: #f44336;
}
.mat-pseudo-checkbox-checked.mat-pseudo-checkbox-disabled,
.mat-pseudo-checkbox-indeterminate.mat-pseudo-checkbox-disabled {
  background: #b0b0b0;
}
```

After
```css
.mat-pseudo-checkbox-full {
  color: #0000008a;
}
.mat-pseudo-checkbox-full.mat-pseudo-checkbox-disabled {
  color: #b0b0b0;
}
.mat-primary .mat-pseudo-checkbox-checked.mat-pseudo-checkbox-minimal:after,
.mat-primary
  .mat-pseudo-checkbox-indeterminate.mat-pseudo-checkbox-minimal:after {
  color: #1976d2;
}
.mat-primary .mat-pseudo-checkbox-checked.mat-pseudo-checkbox-full,
.mat-primary .mat-pseudo-checkbox-indeterminate.mat-pseudo-checkbox-full {
  background: #1976d2;
}
.mat-primary .mat-pseudo-checkbox-checked.mat-pseudo-checkbox-full:after,
.mat-primary .mat-pseudo-checkbox-indeterminate.mat-pseudo-checkbox-full:after {
  color: #fafafa;
}
.mat-pseudo-checkbox-checked.mat-pseudo-checkbox-minimal:after,
.mat-pseudo-checkbox-indeterminate.mat-pseudo-checkbox-minimal:after {
  color: #d32f2f;
}
.mat-pseudo-checkbox-checked.mat-pseudo-checkbox-full,
.mat-pseudo-checkbox-indeterminate.mat-pseudo-checkbox-full {
  background: #d32f2f;
}
.mat-pseudo-checkbox-checked.mat-pseudo-checkbox-full:after,
.mat-pseudo-checkbox-indeterminate.mat-pseudo-checkbox-full:after {
  color: #fafafa;
}
.mat-accent .mat-pseudo-checkbox-checked.mat-pseudo-checkbox-minimal:after,
.mat-accent
  .mat-pseudo-checkbox-indeterminate.mat-pseudo-checkbox-minimal:after {
  color: #d32f2f;
}
.mat-accent .mat-pseudo-checkbox-checked.mat-pseudo-checkbox-full,
.mat-accent .mat-pseudo-checkbox-indeterminate.mat-pseudo-checkbox-full {
  background: #d32f2f;
}
.mat-accent .mat-pseudo-checkbox-checked.mat-pseudo-checkbox-full:after,
.mat-accent .mat-pseudo-checkbox-indeterminate.mat-pseudo-checkbox-full:after {
  color: #fafafa;
}
.mat-warn .mat-pseudo-checkbox-checked.mat-pseudo-checkbox-minimal:after,
.mat-warn .mat-pseudo-checkbox-indeterminate.mat-pseudo-checkbox-minimal:after {
  color: #f44336;
}
.mat-warn .mat-pseudo-checkbox-checked.mat-pseudo-checkbox-full,
.mat-warn .mat-pseudo-checkbox-indeterminate.mat-pseudo-checkbox-full {
  background: #f44336;
}
.mat-warn .mat-pseudo-checkbox-checked.mat-pseudo-checkbox-full:after,
.mat-warn .mat-pseudo-checkbox-indeterminate.mat-pseudo-checkbox-full:after {
  color: #fafafa;
}
.mat-pseudo-checkbox-disabled.mat-pseudo-checkbox-checked.mat-pseudo-checkbox-minimal:after,
.mat-pseudo-checkbox-disabled.mat-pseudo-checkbox-indeterminate.mat-pseudo-checkbox-minimal:after {
  color: #b0b0b0;
}
.mat-pseudo-checkbox-disabled.mat-pseudo-checkbox-checked.mat-pseudo-checkbox-full,
.mat-pseudo-checkbox-disabled.mat-pseudo-checkbox-indeterminate.mat-pseudo-checkbox-full {
  background: #b0b0b0;
}
```

Closes #48701

PR Close #48809
2023-01-24 16:44:32 +00:00
Angular Robot
4cd331b4e2 build: update cross-repo angular dependencies (#48809)
See associated pull request for more information.

(cherry picked from commit f254c98403303aeee20b5d7b94b4799907aa2de9)

PR Close #48809
2023-01-24 16:44:32 +00:00
Angular Robot
09053f770d build: update github/codeql-action action to v2.1.39 (#48816)
See associated pull request for more information.

PR Close #48816
2023-01-24 16:43:02 +00:00
Matthieu Riegler
f2c8ac5335 refactor(service-worker): removing some todos (#48707)
Removing some outdated/unnecessary todos.

PR Close #48707
2023-01-24 16:40:23 +00:00
Matthieu Riegler
82c8b7ae9e build(docs-infra): replace base64 images for stackblitz by svgs (#48774)
PNG converted to base64 don't work on stackblitz.
As stackblitz does't support binary files for dynamicaly created projects, we now use only svgs.

Fixes: #48773

PR Close #48774
2023-01-24 16:39:28 +00:00
Yann Thomas LE MOIGNE
a63983d1ba build: Fix version of images in recommended-Dockerfile. node:14-browsers doesn't exist anymore in Dockerhub (#48803)
Change the version of recommended-Dockerfile image to cim/node:16.13-browsers.

Closes #48802

PR Close #48803
2023-01-24 16:38:32 +00:00
Angular Robot
0ad013670e build: update eslint dependencies to v5.49.0 (#48818)
See associated pull request for more information.

PR Close #48818
2023-01-24 16:37:36 +00:00
Paul Gschwendtner
f54448c0e9 build: remove unused build optimizer dependency (#48797)
This dependency is no longer used and causes other versions
of e.g. typescript to be installed. We should remove it.

PR Close #48797
2023-01-23 13:39:04 +00:00
Paul Gschwendtner
55d00a7014 build: update lock file to reflect latest package.json (#48797)
It looks like running `yarn` in the repository results in some
lock file changes. Likely due to a rebase and changes landing
in the meanwhile, the lock file became a little outdated.

This commit uploads the lock file as `yarn` suggests.

PR Close #48797
2023-01-23 13:39:04 +00:00
Paul Gschwendtner
b6e3840ed4 refactor(bazel): remove unnecessary banner stamping code (#48798)
The `ng_package` rule supports replacing `0.0.0-PLACEHOLDER`
in license files that are inserted as part of rollup. This
requires additional logic to detect stamping, reading the status
files and then replacing the placeholder.

All of this already handled as part of normal package substitutions
and we can replace this unnecessary complexity.

See: da50feb23f/internal/pkg_npm/pkg_npm.bzl (L195)

PR Close #48798
2023-01-20 18:39:22 +00:00
Alan Agius
840530ffd8 docs: update supported Chrome version description (#48782)
- Update Chrome supported version description to match other browsers.
- Updates browserslist configuration in build section to match supported browsers

PR Close #48782
2023-01-20 17:07:53 +00:00
Virginia Dooley
2d0ca73d73 docs: Document extracted from the original Introduction document, which is to be retired. Linting suggested corrections made. Restructuring or rewording sentences to be shorter and clearer. (#47907)
PR Close #47907
2023-01-20 01:21:07 +00:00
Virginia Dooley
bca76ed43a docs: Document extracted from the original Introduction document, which is to be retired. Linting suggested corrections made. Restructuring or rewording sentences to be shorter and clearer. (#47906)
docs: Document extracted from the original Introduction document, which is to be retired. Linting suggested corrections made.  Restructuring or rewording sentences to be shorter and clearer.

docs: revised understanding doc and pullapprove.yml

PR Close #47906
2023-01-19 21:32:34 +00:00
Payam Valadkhan
08b72b77e3 refactor(bazel): Extract the helper patchNgHostWithFileNameToModuleName to its own file for 1P use (#48739)
Some 1P tools require to use the helper patchNgHostWithFileNameToModuleName, and the present location of this helper leads to circular depedency. So it is required to move this helper into a separate module to facilitate importing.

PR Close #48739
2023-01-19 17:34:57 +00:00
Andrew Kushnir
9e1e5ccdfe ci: increase payload size for an integration test app (#48772)
The most recent commit added extra logic that brought the payload size above the limit. Likely an actual limit was already pretty close to the threshold, so we are just updating the payload.

PR Close #48772
2023-01-18 13:32:42 -08:00
Andrew Scott
4dcab333ae fix(router): 'createUrlTreeFromSnapshot' with empty paths and named outlets (#48734)
The details of this commit are pretty thoroughly described in the tests
and code comments. In short, it is sometimes ambiguous where to apply commands in
a `SegmentGroup` tree that is created from an `ActivatedRoute` when
dealing with empty paths. This adjusts the strategy to tolerate more
ambiguity while still allowing developers to be explicit.

This is a fix-forward for b/265215141

PR Close #48734
2023-01-18 10:46:43 -08:00
Andrew Scott
b5137d82cc test(router): update createUrlTree tests to not use mocks (#48734)
The mocks in the tests make them hard to understand and they don't always test real router behavior

PR Close #48734
2023-01-18 10:46:43 -08:00
AleksanderBodurri
3a688cb5ec build(devtools): fix issue where esbuild configs were not being set properly in DevTools (#48762)
Previously, a createConfig helper function was created to consolidate common esbuild configurations for DevTools. This function is asynchronous, but when it was used to set the configuration in various esbuild config files, it was used as if it was synchronous.

This commit fixes this issue by wrapping the output of the function in await, so that it propagates the configurations to esbuild correctly.

PR Close #48762
2023-01-18 10:45:13 -08:00
Alan Agius
42ca9c0b02 docs: update documentation to use ng generate config and ng generate environments (#48757)
In Angular CLI 15.1  new sub commands to generate configuration and environments files were added. This commit updates several docs to mention these commands.

Closes #48364

PR Close #48757
2023-01-18 10:44:14 -08:00
Angular Robot
fe6a2bd9e2 build: update dependency rimraf to v4 (#48726)
See associated pull request for more information.

PR Close #48726
2023-01-18 10:43:21 -08:00
Andrew Kushnir
8377acd94f release: cut the v15.2.0-next.1 release 2023-01-18 10:26:02 -08:00
Andrew Kushnir
318d94d4e1 docs: release notes for the v15.1.1 release 2023-01-18 10:13:45 -08:00
Paul Gschwendtner
9130635eac test: update size golden to reflect Angular cross dependency updates (#48747)
The `main` bundle size has increased, as well as the CSS styles from
Angular Material. Only the `main` bundle exceeded the golden, but
we update all other entries to make future updates easier and to prevent
gradually getting closer and closer to the threshold.

Investigating/comparing the `main` bundles before and after the update
did not unveil any significant changes, except for thousands of
different identifiers, with different length due to mangling. That
seems to be the only reason for having exceeded the threshold.

Very likely there were more size-affecting changes over time. Also
for example the downleveling of class fields for Safari v15 support.
See: https://github.com/angular/angular-cli/issues/24355#issuecomment-1333477033

PR Close #48747
2023-01-17 10:46:44 -08:00
Angular Robot
1849ae2675 build: update cross-repo angular dependencies (#48747)
See associated pull request for more information.

PR Close #48747
2023-01-17 10:46:44 -08:00
Andrew Scott
fb7b8a95f2 docs: Fix example in breaking changes to apply to correct sentence (#48758)
The "for example..." was supposed to apply to the production code, not the test code sentence.

fixes #48744

PR Close #48758
2023-01-17 09:21:50 -08:00
Angular Robot
b99bd9ebf6 build: update eslint dependencies to v5.48.2 (#48756)
See associated pull request for more information.

PR Close #48756
2023-01-17 09:17:03 -08:00