Commit graph

29561 commits

Author SHA1 Message Date
Dylan Hunn
cc6380cf97 release: cherry-pick the v12.2.14 release notes (#44341) (#44619)
resolves #44475

PR Close #44619
2022-01-07 18:09:40 +00:00
Andrew Kushnir
0cf5501d5c build: use correct target name (#44651)
Dev mode output was switched from ES5 -> ES2015 recently and as a part of those changes, some target names that contained `_es5` postfixes were changes to `_es2015` instead. This commit fixes the issue with one of the recently merged BUILD files that contained the old (`_es5`) postfix.

PR Close #44651
2022-01-06 16:42:22 -08:00
alkavats1
bb346fce45 docs(common): url link format updated (#44645)
fix the url link format from http to https in BAZEL.md && component-styles.md

PR Close #44645
2022-01-06 23:49:47 +00:00
Joey Perrott
84ff67f991 build: update .bazelversion (#44641)
Update to the latest version of bazel.

PR Close #44641
2022-01-06 23:49:02 +00:00
JoostK
f8af49eb75 fix(compiler-cli): fix crash during type-checking of library builds (#44587)
When building a library, the `rootDir` option is configured to ensure
that all source files are present within the entry-point that is being
build. This imposes an extra constraint on the reference emit logic,
which does not allow emitting a reference into a source file outside of
this `rootDir`.

During the generation of type-check blocks we used to make a best-effort
estimation of whether a type reference can be emitted into the
type-check file. This check was relaxed in #42492 to support emitting
more syntax forms and type references, but this change did not consider
the `rootDir` constraint that is present in library builds. As such, the
compiler might conclude that a type reference is eligible for emit into
the type-check file, whereas in practice this would cause a failure.

This commit changes the best-effort estimation into a "preflight"
reference emit that is fully accurate as to whether emitting a type
reference is possible.

Fixes #43624

PR Close #44587
2022-01-06 23:44:24 +00:00
JoostK
1955d0ad88 refactor(compiler-cli): implement realpath in NgtscCompilerHost (#44587)
The `NgtscCompilerHost` is implemented using the `FileSystem`
abstraction of the compiler, which is implemented for tests using an
in-memory `MockFileSystem`. If the in-memory filesystem contains
symlinks, then using `NgtscCompilerHost` would not reflect their
resolved real path. Instead, the TypeScript compiler would use its
default implementation based on the real filesystem, which is unaware of
the in-memory `MockFileSystem` setup.

This change does not currently address any issues, but is being fixed
as it prevented a reproduction scenario from behaving correctly.

PR Close #44587
2022-01-06 23:44:24 +00:00
JoostK
03edc7d631 test(compiler-cli): properly support symlinks in MockFileSystem (#44587)
This commit fixes an issue with symlink handling in `MockFileSystem`,
where entries within a symlink would fail to resolve.

PR Close #44587
2022-01-06 23:44:24 +00:00
JoostK
c1a9bb38aa refactor(compiler-cli): use absoluteFromSourceFile to obtain a source file path (#44587)
Using `absoluteFromSourceFile` leverages the cache of the resolved
absolute path, instead of having to compute it each time.

PR Close #44587
2022-01-06 23:44:24 +00:00
JoostK
7052e27677 refactor(compiler-cli): improve DX for reference emit failures (#44587)
In certain scenarios, the compiler may have crashed with an
`Unable to write a reference` error which would be particularly hard
to diagnose. One of the primary reasons for this failure is when the
`rootDir` option is configured---typically the case for libraries---
and a source file is imported using a relative import from an external
entry-point. This would normally report TS6059 for the invalid relative
import, but the crash prevents this error from being surfaced.

This commit refactors the reference emit logic to result in an explicit
`Failure` state with a reason as to why the failure occurred. This state
is then used to report a `FatalDiagnosticException`, preventing a hard
crash.

Closes #44414

PR Close #44587
2022-01-06 23:44:24 +00:00
Andrew Kushnir
67df935b41 refactor(forms): use shared RuntimeError class (#44398)
This commit performs some refactoring of the AbstractControl-based classes to employ shared `RuntimeError` class and also updates the code to avoid duplication and improve minification.

PR Close #44398
2022-01-06 23:43:19 +00:00
Andrew Kushnir
a84f99fd1c refactor(core): move runtime error code logic (#44398)
This commit moves some logic to make the location of runtime error codes consistent across packages. Now all error codes are located in `packages/core/src/errors.ts` file.

PR Close #44398
2022-01-06 23:43:18 +00:00
Andrew Kushnir
66e59bc11a refactor(core): make RuntimeError reusable across packages (#44398)
This commit updates the code around the `RuntimeError` class to make it more reusable between packages (currently it's only usable inside the `core` package). Specifically:
- the error formatting logic was updated to handle cases when there is no error message provided
- there is no special Set that contains a set of error codes for which we have guides on angular.io. Instead, this is now encoded into the error code itself (making such codes negative integers). Having a separate Set makes it non-tree-shakable, which we want to avoid.

This change should allow to employ the `RuntimeError` class in other packages to further standardize this subsystem and make the errors thrown by the framework consistent.

As a part of the refactoring, the `common` package code was also updated to follow the same logic as `core`, since the `RuntimeError` class was used there as well.

PR Close #44398
2022-01-06 23:43:18 +00:00
Yuchao Wu
7b9169e5e1 docs(animations): fix grammar (#44607)
Fix grammar issues based on suggestions in issue #44403

Fixes #44403

PR Close #44607
2022-01-06 18:40:02 +00:00
shejialuo
7f51f1dcae docs(docs-infra): improve the content of attribute directives (#44628)
Improve docs "Understanding Angular-Directives-Attribute Directives"

In `highlight.directive.1.ts`, add the `private` keyword for `el` property
to make it correct and consistent with subsequent examples.

For section "Setting the value with user input", add a step to tell the
reader change the method `onMouseEnter`, thus more readable.

For section "Binding to a second property", delete the aliase for the
`Input` property, and changes the name back to `appHighlight` in the code
to make it consistent with the whole tutorial.

PR Close #44628
2022-01-06 18:36:46 +00:00
Kristiyan Kostadinov
359103274b test: clean up more entryComponents usages (#44561)
Cleans up some more tests that were using `entryComponents`.

PR Close #44561
2022-01-06 18:36:22 +00:00
Yousaf Nawaz
ea91edb55a docs: fix typos in using libraries guide (#44634)
correct word typically, typescript and import

PR Close #44634
2022-01-06 00:23:06 +00:00
Dario Piotrowicz
b69a5148aa docs(animations): fix links to the AnimationBuilder.build method (#44594)
In angular.io links to the AnimationBuilder.build method are broken and do not
point to the api docs page, fix such broken links

Also apply minor wording and related improvements

PR Close #44594
2022-01-06 00:22:43 +00:00
alkavats1
2d14724965 docs(common): url link format updated (#44638)
fix the url link format from http to https in i18-common-locale-id.md file

PR Close #44638
2022-01-05 23:21:10 +00:00
Kristiyan Kostadinov
e39f804f1e test(upgrade): fix flaky tests (#44597)
Fixes a couple of tests that have been flaking our test runs. The two tests actually failed consistently when run in isolation, but they passed if at least one test ran before them. My understanding was that they failed, because they were running outside of the `NgZone` which meant that the errors being thrown inside of a `Promise` weren't being flushed.

PR Close #44597
2022-01-05 23:20:43 +00:00
Paul Gschwendtner
12e042405b ci: temporarily disable components-repo-unit-tests job (#44505)
Temporarily disables the components repo unit tests job that
breaks due to us changing the devmode output to ES2015 in Angular Bazel.

This is a trivial thing to solve in the COMP repo but the job needs
to be disabled first, so that the changes can be released.

PR Close #44505
2022-01-05 23:20:21 +00:00
Paul Gschwendtner
d60ebaa48a test: update example di tests to work with es2015 (#44505)
* `forwardRef` does not work with ES2015 and TypeScript's decorator
  downlevel emit. This is a known limitation we work around in Angular
  applications by either compiling tests with the Angular compiler, or
  by running a custom decorator downlevel transform (like in the CLI).

PR Close #44505
2022-01-05 23:20:21 +00:00
Paul Gschwendtner
807c6a4e10 test: update acceptance core tests to work with es2015 (#44505)
Updates the acceptance core tests to work with ES2015 devmode output.
There were two issues surfacing:

* The NodeJS test execution failed because Domino does not handle
  destructuring syntax properly. This is because `Node.children` is not
  an iterable.

* `forwardRef` does not work with ES2015 and TypeScript's decorator
  downlevel emit. This is a known limitation we work around in Angular
  applications by either compiling tests with the Angular compiler, or
  by running a custom decorator downlevel transform (like in the CLI).

PR Close #44505
2022-01-05 23:20:21 +00:00
Paul Gschwendtner
92806ff042 test: update router tests to work with es2015 temporal dead zone (#44505)
Update router tests to work with the the es2015 temporal dead zone.

Somewhat similar to: https://github.com/angular/angular/issues/30106.

PR Close #44505
2022-01-05 23:20:20 +00:00
Paul Gschwendtner
890d06959b test: update ngtsc specs to work with es2015 output (#44505)
Updates the ngtsc specs to work with ES2015 output.

PR Close #44505
2022-01-05 23:20:20 +00:00
Paul Gschwendtner
c46d533b22 build: switch devmode output to es2015 (#44505)
To make our test output i.e. devmode output more aligned
with what we produce in the NPM packages, or to be more
aligned with what Angular applications will usually consume,
the devmode output is switched from ES5 to ES2015.

Additionally various tsconfigs (outside of Bazel) have been
updated to match with the other parts of the build. The rules
are:

ES2015 for test configurations, ES2020 for actual code that will
end up being shipped (this includes the IDE-only tsconfigs).

PR Close #44505
2022-01-05 23:20:20 +00:00
Andrew Kushnir
8388151f4d refactor(forms): make validators code compatible with property renaming (#44500)
This commit refactors the code of the base validators class to make it compatible with the property renaming optimization. Currently the code makes an assumption that the field with a specified name (defined as a string) can be found on an object, but with property renaming optimization this is not correct.

PR Close #44500
2022-01-05 18:43:36 +00:00
Chris Mancini
6a55affacd docs(router): fix code block for IsActiveMatchOptions (#44635)
PR Close #44635
2022-01-05 17:47:08 +00:00
Dario Piotrowicz
7278a9c584 docs(animations): fix filter-animations docregion (#44544)
the filter animation example in the complex-animation-sequences guide
talks about entering and leaving elements, but the presented html
snipped exluded the *ngFor which actually adds and removes the elements,
so add the *ngFor section to make the example complete and
understandable

PR Close #44544
2022-01-05 17:46:10 +00:00
Dario Piotrowicz
d5ced77d31 refactor(docs-infra): fix eslint issues for aio ugrade-* examples (#44534)
fix the eslint issues in the aio/content/examples/upgrade-* folders
and remove their ignorePattern in the examples eslintrc file

PR Close #44534
2022-01-04 16:34:06 -08:00
JoostK
c7ac2dfcf8 refactor(compiler): remove output AST functions (#44411)
These functions are not used anymore so they are removed.

PR Close #44411
2022-01-04 15:54:10 -08:00
JoostK
d196cbc332 refactor(compiler): remove class related output AST types (#44411)
The Ivy compiler no longer generates classes so this commit removes
the supporting output nodes.

PR Close #44411
2022-01-04 15:54:10 -08:00
JoostK
8cadfe1f5b refactor(compiler): remove type-casting related output AST types (#44411)
The Ivy compiler no longer generates code for type-checking purposes
using the output AST types. Instead, it uses TypeScript AST nodes and
its printer for type-checking. This commit removes the type-related
output nodes.

PR Close #44411
2022-01-04 15:54:10 -08:00
JoostK
f352c2bed9 refactor(compiler): remove some unused output AST types (#44411)
This kind of output is no longer emitted into generated code, so the
supporting output AST is removed.

PR Close #44411
2022-01-04 15:54:10 -08:00
JoostK
e0458a6d14 refactor(compiler): remove unused method from binding parser (#44411)
This method is no longer called so is being removed.

PR Close #44411
2022-01-04 15:54:10 -08:00
JoostK
b5ad12b788 refactor(compiler): make template preparser null-safe (#44411)
This commit removes some non-null assertion operations to improve
null-safety.

PR Close #44411
2022-01-04 15:54:10 -08:00
JoostK
f40802f1bd refactor(compiler): remove unused unsupported function (#44411)
This function is no longer used so is being removed.

PR Close #44411
2022-01-04 15:54:10 -08:00
JoostK
d9befd25e1 refactor(compiler): make keySpan required in binding parser (#44411)
Now that ViewEngine has been removed the `keySpan` property can be
made required, as it is always provided in the Ivy compiler

PR Close #44411
2022-01-04 15:54:10 -08:00
JoostK
f86e02e01e refactor(compiler): cleanup distinction in parse logic (#44411)
This removes the special casing of parse-validation logic that was only
used by Ivy.

PR Close #44411
2022-01-04 15:54:10 -08:00
JoostK
a758b8866e refactor(compiler): remove BindingForm enum (#44411)
The Ivy compiler only uses `BindingForm.Expression`, so all other
variants are removed.

PR Close #44411
2022-01-04 15:54:10 -08:00
JoostK
da159a5144 refactor(compiler): cleanup AST fixup of listener instructions (#44411)
This commit refactors the generation of listener instructions to no
longer fixup the output AST that was designed for ViewEngine.

PR Close #44411
2022-01-04 15:54:09 -08:00
JoostK
7862f5657e refactor(compiler): remove unused assertion function (#44411)
This code is no longer used now that ViewEngine has been removed.

PR Close #44411
2022-01-04 15:54:09 -08:00
JoostK
e8812bc04e refactor(compiler): cleanup unsafe usage of null value for ng-content selector (#44411)
This commit improves the null-safety of the ng-content selector and
updates a comment that turned out to be slightly inaccurate.

Closes #38407

PR Close #44411
2022-01-04 15:54:09 -08:00
JoostK
722d8ef880 refactor(compiler): remove unused code from output logic (#44411)
This code is no longer used now that ViewEngine has been removed.

PR Close #44411
2022-01-04 15:54:09 -08:00
JoostK
26eee35dc2 refactor(compiler): remove unused AstPath (#44411)
This code is no longer used now that ViewEngine has been removed.

PR Close #44411
2022-01-04 15:54:09 -08:00
JoostK
a0c36ac0f5 refactor(compiler): remove unused logic from ConstantPool (#44411)
The `ConstantPool.getDefinition` method is not being used anymore, so
this commit removes anything that is related to this method.

PR Close #44411
2022-01-04 15:54:09 -08:00
JoostK
f3de9224e4 refactor(compiler): remove unused type declarations (#44411)
This code is no longer used now that ViewEngine has been removed.

PR Close #44411
2022-01-04 15:54:09 -08:00
JoostK
1d39a5e6ac refactor(compiler): remove syntax error logic (#44411)
This code is no longer used now that ViewEngine has been removed.

PR Close #44411
2022-01-04 15:54:09 -08:00
dario-piotrowicz
f2b858d24f refactor(animations): add unit test for leaving animated child (#44489)
add a new unit test to make sure that leaving elements queried via
a parent queried via animateChild are correctly removed

note: this tests the fix introduced in PR #44357

PR Close #44489
2022-01-04 15:53:36 -08:00
Andrew Kushnir
d4015f762f test: remove newlines to make a test more stable (#44616)
One of the tests was not taking into account newlines in the text content of an element, thus failing in some browsers. This commit makes the test more stable by removing newlines and comparing the output after that.

PR Close #44616
2022-01-04 15:53:00 -08:00
dario-piotrowicz
a864d1c926 fix(docs-infra): adjust code link styling height (#44376)
the height of code links (anchors inside code tags or
code tags inside anchors) is inconsistent, fix such
issue by also making sure that code links to external
resources do not get wrongly styled

PR Close #44376
2022-01-04 12:19:08 -08:00