Commit graph

20487 commits

Author SHA1 Message Date
George Kalpakas
335ec2ef80 test(docs-infra): change URL separator from \t to --> in URLS_TO_REDIRECT.txt (#41680)
Previously, the `URLS_TO_REDIRECT.txt` file was expected to separate
URLs by a `\t` character. This could easily been mistaken for a regular
space and would often result in test errors when updating the file.

This commit updates the `URLS_TO_REDIRECT.txt` file and the
corresponding test helpers to use `-->` (potentially surrounded by
whitespace) as a separator for the URLs. This also gives a hint about
the "from" --> "to" relationship of the redirect URL pair.

PR Close #41680
2021-04-19 08:26:02 -07:00
George Kalpakas
e0bbada214 test(docs-infra): ignore empty lines in URLS_TO_REDIRECT.txt (#41680)
Previously, the `URLS_TO_REDIRECT.txt` file was expected to not contain
any empty lines. This could easily result in test errors when updating
the file, since it is common for IDEs/editors to automatically ensure
there is an empty line at the end of a saved file
([example failure][1]).

This commit updates the test helpers to be able to cope with empty or
whitespace-only lines in `URLS_TO_REDIRECT.txt` by ignoring such lines.

[1]: https://circleci.com/gh/angular/angular/965534

PR Close #41680
2021-04-19 08:26:02 -07:00
Kirk Larkin
e174407829 docs: correct appUnless desc re true/false (#41656)
PR Close #41656
2021-04-19 08:23:12 -07:00
George Kalpakas
43f95b9e40 docs: fix broken links to CLI wiki in the "Component styles" guide (#41516)
Fixes #41362

PR Close #41516
2021-04-19 08:22:21 -07:00
va-stefanek
161f61116e docs: change link to the styles configuration guide (#41516)
PR Close #41516
2021-04-19 08:22:21 -07:00
Eduard Bondarenko
095bb520ff docs: move lazy loading section to the best practices section (#41378)
PR Close #41378
2021-04-16 17:27:01 -07:00
Gérôme Grignon
be73f7b0fb docs: add mention to CSS styles for hero-detail (#41214)
PR Close #41214
2021-04-16 17:26:30 -07:00
sovtara
3c49671baf docs: fix the property name in the example (#41410)
AppHighlight directive from the example doesn't have myHighlight attribute.
It only has appHighlight property. So we should use appHighlight instead of myHighlight.

PR Close #41410
2021-04-16 17:25:40 -07:00
Dharmen Shah
69b25ad8f0 docs: separate steps for github actions (#41594)
PR Close #41594
2021-04-16 17:25:03 -07:00
Dharmen Shah
c0d85f510e docs: add github actions in CI story (#41594)
PR Close #41594
2021-04-16 17:25:02 -07:00
Joey Perrott
d99e8f1c85 feat(dev-infra): prevent pr merges of features or breaking changes on rc (#41660)
Prevent pull requests targeting `target: rc` from merging PRs with breaking
changes or features from being merged.

PR Close #41660
2021-04-16 13:09:48 -07:00
Zach Arend
296f887383 fix(compiler-cli): autocomplete literal types in templates
This adds string literals, number literals, `true`, `false`, `null` and
`undefined` to autocomplete results in templates.

For example, when completing an input of union type.

Component: `@Input('input') input!: 'a'|'b'|null;`
Template: `[input]="|"`

Provide `'a'`, `'b'`, and `null` as autocompletion entries.

Previously we did not include literal types because we only included
results from the component context (`ctx.`) and the template scope.

This is the second attempt at this. The first attmpet is in , then was
reverted in 75f881e078.
2021-04-16 08:56:35 -07:00
Teri Glover
21d3084512 docs: edits to remove jargon and abbreviations (#41530)
PR Close #41530
2021-04-15 16:00:54 -07:00
Teri Glover
6c43a949b8 docs: update copy in schematics.md (#41521)
PR Close #41521
2021-04-15 14:38:07 -07:00
Kristiyan Kostadinov
3aa92355ef fix(common): viewport scroller not finding elements inside the shadow DOM (#41644)
The `ViewportScroller` figures out which element to scroll into view using `document.getElementById`. The problem is that it won't find elements inside the shadow DOM.

These changes add some extra logic that goes through all the shadow roots to look for the element.

Fixes #41470.

PR Close #41644
2021-04-15 12:47:07 -07:00
Dmitrij Kuba
f4376fc0d4 fix(router): Only retrieve stored route when reuse strategy indicates it should reattach (#30263)
When creating the router state, the `RouteReuseStrategy#retrieve` should
only be called when `RouteReuseStrategy#shouldAttach` returns `true`.
That is, we should only retrieve a stored route when the reuse strategy
indicates that there is one stored and that it should be reattached.

This now matches the behavior in the route activation:
1d12c50f63/packages/router/src/operators/activate_routes.ts (L170-L172)

Fixes #23162

PR Close #30263
2021-04-15 11:33:01 -07:00
Martin Sikora
c4b0753908 test(router): add Router regression test for hash location strategy (#40409)
This situation can probably happen only when using
`HashLocationStrategy` and by manually changing hash that triggers a route
guard that returns a new `UrlTree`. Then hash in the browser might not
match the current route because navigation was canceled, while hash in
the URL remained set by the user.

Related to #37048

PR Close #40409
2021-04-14 18:48:27 -07:00
Michael Hladky
b616f731b2 docs: add rx-angular to resources.json (#39291)
PR Close #39291
2021-04-14 15:50:45 -07:00
Andrew Scott
8d6281311c fix(router): recursively merge empty path matches (#41584)
When recognizing routes, the router merges nodes which map to the same
empty path config. This is because auxiliary outlets under empty path
parents need to match the parent config. This would result in two
outlet matches for that parent which need to be combined into a single
node: The regular 'primary' match and the match for the auxiliary outlet.
In addition, the children of the merged nodes should also be merged to
account for multiple levels of empty path parents.

Fixes #41481

PR Close #41584
2021-04-14 15:47:09 -07:00
Joey Perrott
62c6fc20f0 feat(dev-infra): prevent attempting to merge draft, closed or merged pull requests (#41604)
During pull request validation, assert that the pull request is not in
draft mode, already merged or already closed.

PR Close #41604
2021-04-14 15:44:56 -07:00
Paul Gschwendtner
4d79c1d7db build: update to latest version of rules_nodejs v3.3.0 (#41607)
Updates to the latest version of `rules_nodejs` that supports
the most recent NodeJS lts version v14.16.1.

Additionally the latest version of `rules_nodejs` provides
[a package for runfile resolution](https://github.com/bazelbuild/rules_nodejs/pull/2568) w/ types that we can leverage.

PR Close #41607
2021-04-14 15:42:08 -07:00
Zach Arend
3a2b5906ae release: cut the v11.2.10 release 2021-04-14 12:34:31 -07:00
Joey Perrott
b8c4da9ae8 Revert "fix(compiler-cli): autocomplete literal types in templates. (#41456)" (#41623)
This reverts commit 1d12c50f63.

PR Close #41623
2021-04-14 09:16:36 -07:00
Andrew Scott
3d549809c3 fix(language-service): resolve to the pre-compiled style when compiled css url is provided (#41538)
With this commit, the language service will first try to locate a
pre-compiled style file with the same name when a `css` is provided in
the `styleUrls`. This prevents a missing resource diagnostic for when the
compiled file is not available in the language service environment and also
allows "go to definition" to go to that pre-compiled file.

Fixes angular/vscode-ng-language-service#1263

PR Close #41538
2021-04-14 09:15:01 -07:00
Andrew Scott
3dbcc7f7a1 fix(language-service): bound attributes should not break directive matching (#41597)
The language service uses an elements attributes to determine if it
matches a directive in the component scope. We do this by accumulating
all attribute bindings and matching against the selectors for the
available directives. The compiler itself does a similar thing. In
addition, the compiler does not use the value of `BoundAttribute`s to
match directives (cdf1ea1951/packages/compiler/src/render3/view/util.ts (L174-L206)). This commit changes the language
service to also ignore bound attribute values for directive matching.

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

PR Close #41597
2021-04-13 18:23:50 -07:00
Zach Arend
df04b9be7d fix(compiler-cli): autocomplete literal types in templates. (#41456)
This adds string literals, number literals, `true`, `false`, `null` and
`undefined` to autocomplete results in templates.

For example, when completing an input of union type.

Component: `@Input('input') input!: 'a'|'b'|null;`
Template: `[input]="|"`

Provide `'a'`, `'b'`, and `null` as autocompletion entries.

Previously we did not include literal types because we only included
results from the component context (`ctx.`) and the template scope.

PR Close #41456
2021-04-13 13:51:48 -07:00
pavlenko
04235fa079 docs: replace Codelyzer recommendation with Angular-ESLint in accessibility guide (#41294)
Replace Codelyzer recommendation with Angular-ESLint in accessibility guide since that tool is deprecated and was removed from the Angular CLI.

Closes #41573

PR Close #41294
2021-04-13 13:06:18 -07:00
Joey Perrott
4847c146dc fix(dev-infra): only create authenticated github instance once in yargs (#41603)
Fix github token option for yargs to only create an authenticated token one time.

PR Close #41603
2021-04-13 11:50:50 -07:00
JoostK
cfd67c1c81 refactor(compiler-cli): track a dependency on a default import on WrappedNodeExpr (#41586)
Previously, the `DefaultImportRecorder` interface was used as follows:

1. During the analysis phase, the default import declaration of an
   identifier was recorded.

2. During the emit phase each emitted identifier would be recorded.
   The information from step 1 would then be used to determine the
   default import declaration of the identifier which would be
   registered as used.

3. A TypeScript transform would taint all default imports that were
   registered as used in step 2 such that the imports are not elided
   by TypeScript.

In incremental compilations, a file may have to be emitted even if its
analysis data has been reused from the prior compilation. This would
mean that step 1 is not executed, resulting in a mismatch in step 2 and
ultimately in incorrectly eliding the default. This was mitigated by
storing the mapping from identifier to import declaration on the
`ts.SourceFile` instead of a member of `DefaultImportTracker` such that
it would also be visible to the `DefaultImportRecorder` of subsequent
compiles even if step 1 had not been executed.

Ultimately however, the information that is being recorded into the
`DefaultImportRecorder` has a longer lifetime than a single
`DefaultImportRecorder` instance, as that is only valid during a single
compilation whereas the identifier to import declaration mapping
outlives a single compilation. This commit replaces the registration of
this mapping by attaching the default import declaration on the output
AST node that captures the identifier. This enables the removal of
all of the `DefaultImportRecorder` usages throughout the analysis phase
together with the `DefaultImportRecorder` interface itself.

PR Close #41586
2021-04-13 07:37:29 -07:00
JoostK
43050a16de fix(compiler-cli): prevent eliding default imports in incremental recompilations (#41586)
The Angular compiler has to actively keep default import statements
alive if they were only used in type-only positions, but have been
emitted as value expressions for DI purposes. A problem occurred in
incremental recompilations, where the relationship between an identifier
usage and its corresponding default import would not be considered. This
could result in the removal of the default import statement and caused
a `ReferenceError` at runtime.

This commit fixes the issue by storing the association from an
identifier to its default import declaration on the source file itself,
instead of within the `DefaultImportTracker` instance. The
`DefaultImportTracker` instance is only valid for a single compilation,
whereas the association from an identifier to a default import
declaration is valid as long as the `ts.SourceFile` is the same
instance.

A subsequent commit refactor the `DefaultImportTracker` to no longer
be responsible for registering the association, as its lifetime is
conceptually too short to do so.

Fixes #41377

PR Close #41586
2021-04-13 07:37:28 -07:00
JoostK
01b7e3973a test(compiler-cli): disable emitDecoratorMetadata in the compiler test environment (#41586)
The `emitDecoratorMetadata` compiler option does not have to be enabled
as Angular decorators are transformed by the AOT compiler. Having the
option enabled in our tests can hide issues around import preservation,
as with `emitDecoratorMetadata` enabled the TypeScript compiler itself
does not elide imports even if they are only used in type-positions.
This is unlike having `emitDecoratorMetadata` disabled, however; in that
case the Angular compiler has to actively trick TypeScript into
retaining default imports when an identifier in a type-only position has
been reified into a value position for DI purposes.

A subsequent commit addresses a bug in default import preservation
that relies on this flag being `false`.

PR Close #41586
2021-04-13 07:37:28 -07:00
JoostK
616145e1a7 perf(compiler-cli): allow incremental compilation in the presence of redirected source files (#41587)
When multiple occurrences of the same package exist within a single
TypeScript compilation unit, TypeScript deduplicates the source files
by introducing redirected source file proxies. Such proxies are
recreated during an incremental compilation even if the original
declaration file did not change, which caused the compiler not to reuse
any work from the prior compilation.

This commit changes the incremental driver to recognize a redirected
source file and treat them as their unredirected source file.

PR Close #41587
2021-04-13 07:35:33 -07:00
Alex Rickabaugh
09eb1257d8 fix(compiler-cli): show a more specific error for Ivy NgModules (#41534)
When an Ivy NgModule is imported into a View Engine build, it doesn't have
metadata.json files that describe it as an NgModule, so it appears to VE
builds as a plain, undecorated class. The error message shown in this
situation generic and confusing, since it recommends adding an @NgModule
annotation to a class from a library.

This commit adds special detection into the View Engine compiler to give a
more specific error message when an Ivy NgModule is imported.

PR Close #41534
2021-04-13 07:34:47 -07:00
aschaap
9cda866703 docs: change (+) operator to Number function to match code (#41570)
PR Close #41570
2021-04-12 21:08:22 -07:00
aschaap
4795c5e7d8 docs(docs-infra): fix (+) not accepting null error by using Number instead (#41570)
Fix unexpected error when following the tutorial (when going through it with stricter type checking enforced). While (+) converts a string to an integer, it does not account for the possibility that `this.route.snapshot.paramMap.get('id')` could return null (type: string | null). Since this null case is not a practical outcome, it is a matter of types; switching from (+) to the `Number` function eliminates this issue, making the tutorial more robust.
PR Close #41570
2021-04-12 21:08:22 -07:00
aschaap
332653d353 docs: replaced erroneous instances of HeroDetailsComponent with HeroDetailComponent (#41569)
PR Close #41569
2021-04-12 21:07:36 -07:00
Nishu Goel
a0ce686ec4 docs: add Nishu Goel to GDE list (#41347)
PR Close #41347
2021-04-12 21:06:02 -07:00
Joey Perrott
4378bc3a1b refactor(dev-infra): use a singleton for GitClient (#41589)
Creates a singleton class for GitClient rather than relying on creating an instance to
require being passed around throughout its usages.

PR Close #41589
2021-04-12 21:05:30 -07:00
Alex Rickabaugh
f76873e4d5 fix(language-service): use 'any' instead of failing for inline TCBs (#41513)
In environments such as the Language Service where inline type-checking code
is not supported, the compiler would previously produce a diagnostic when a
template would require inlining to check. This happened whenever its
component class had generic parameters with bounds that could not be safely
reproduced in an external TCB. However, this created a bad user experience
for the Language Service, as its features would then not function with such
templates.

Instead, this commit changes the compiler to use the same strategy for
inline TCBs as it does for inline type constructors - falling back to `any`
for generic types when inlining isn't available. This allows the LS to
support such templates with slightly weaker type-checking semantics, which
a test verifies. There is still a case where components that aren't
exported require an inline TCB, and the compiler will still generate a
diagnostic if so.

Fixes #41395

PR Close #41513
2021-04-12 21:02:21 -07:00
Alan Cohen
db90ba40eb docs: change ActivatedRouteStub code sample to work with strictNullChecks on (#41559)
convertToParamMap() does not accept undefined.
Fix code sample so it can be used in strict mode without requiring changes.

PR Close #41559
2021-04-12 21:01:40 -07:00
Pete Bacon Darwin
99c9f7c709 ci: remove old compliance tests (#41556) (#41585)
Now that we can run the new compliance tests on Windows,
we can delete the old ones, simplifying and speeding up our CI.

PR Close #41556

PR Close #41585
2021-04-12 16:40:40 -07:00
Pete Bacon Darwin
6a943883c2 ci: enable compliance tests on Windows (#41556) (#41585)
Now that we have updated the Bazel node.js rules we can run all the
compliance tests in Windows on CI.

PR Close #41556

PR Close #41585
2021-04-12 16:40:40 -07:00
Kristiyan Kostadinov
419c189ad3 fix(core): error if DebugRenderer2.destroyNode is called twice in a row (#41565)
Fixes an error that will be thrown if  `DebugRenderer2.destroyNode` is called with a node that has already been destroyed. The error happened, because we had a non-null assertion, even though the value can be null.

Note that this fix applies only to ViewEngine, because Ivy doesn't provide the `DebugRenderer2`. I decided to resolve it, because it fix is straightforward and this error has been showing up in our logs for a long time now, making actual errors harder to find.

PR Close #41565
2021-04-12 10:30:13 -07:00
Joey Perrott
f0633c0c9a build: add breakingChangesLabel to merge configuration (#41546)
Sets the breakingChangesLabel property to properly confirm breaking changes.

PR Close #41546
2021-04-12 10:11:19 -07:00
Joey Perrott
b5bf0a7c0d feat(dev-infra): verify breaking changes are properly labeled before merging (#41546)
During merging with `ng-dev pr merge` tooling will ensure that pull requests are
properly labeled for breaking changes.  Pull requests with commits noting breaking
changes must also be labeled as such, additionally pull requests with breaking
change labels must contain commits noting breaking changes.

Fixes #38776

PR Close #41546
2021-04-12 10:11:18 -07:00
Sagar Pandita
04ef24d87b docs: remove 'ui-jar' from Resources (#41552)
This commit removes 'ui-jar' from Resources, since it is not
compatible with the latest versions of Angular.

Fixes #41030

PR Close #41552
2021-04-12 10:05:51 -07:00
Joey Perrott
7946f6385b feat(dev-infra): create ReleaseNotes class for generating release notes during publishing (#41476)
Generate release notes to be used for entries in both CHANGELOG.md files as well as
Github releases.

PR Close #41476
2021-04-09 07:49:50 -07:00
Joey Perrott
9f67bace6a test(dev-infra): extract commit message build function into testing util function (#41476)
Creates a testing utility function to build commit message strings.

PR Close #41476
2021-04-09 07:49:50 -07:00
Aristeidis Bampakos
9bfa94f264 docs: add entry for prod tsconfig in library files (#41512)
Add an entry for TypeScript configuration file used in production

PR Close #41512
2021-04-09 07:46:53 -07:00
Andrew Scott
e34299af25 fix(router): handle new navigations from a NavigationEnd event (#41262) (#41511)
This commit removes the line to set `currentNavigation` to `null` in the
navigation transitions subscription of the router. This logic is
already handled in the `finalize` stage of the transition pipe and has
been found to cause issues if a new navigation is triggered from a
subscription to the `NavigationEnd` event.

fixes #37460

PR Close #41262

PR Close #41511
2021-04-08 16:52:04 -07:00