Commit Graph

7687 Commits

Author SHA1 Message Date
Jessica Janiuk e3b709314f Revert "build: convert CLDR locale extraction from Gulp to Bazel tool" (#42521)
This reverts commit b9759522260cd57392e44fe63c5b17a9f102c101.

PR Close #42521
2021-06-08 10:06:24 -07:00
Jessica Janiuk cb59bdfebd Revert "build: wire up new CLDR generation tool within Bazel" (#42521)
This reverts commit 40bf84c89decea1de08e43936c9886a391b02173.

PR Close #42521
2021-06-08 10:06:24 -07:00
Jessica Janiuk cc55fd6e11 Revert "build: add documentation for `generate-locales-tool`" (#42521)
This reverts commit 12d84d041a2b27bec77f18d7e433b01f105ac784.

PR Close #42521
2021-06-08 10:06:24 -07:00
Jessica Janiuk fa4b0b31c0 Revert "build: simplify generation of closure locale file" (#42521)
This reverts commit 5fca35de0de8da24b8a046616404e74ecb4547b4.

PR Close #42521
2021-06-08 10:06:24 -07:00
Paul Gschwendtner b762820485 build: simplify generation of closure locale file (#42230)
In the past, the closure file has been generated so that all individual
locale files were imported individually. This resulted in a huge
slow-down in g3 due to the large amount of imports.

With 90bd984ff7 this changed so that we
inline the locale data for the g3 closure locale file. Also the file
only contained data for locales being supported by Closure. For this a
list of locales has been extracted from Closure Compiler, as well as a
list of locale aliases.

This logic is prone to CLDR version updates, and also broke as part of
the Gulp -> Bazel migration where this logic has been slightly modified
but caused issues in G3. e.g. a locale `zh-Hant` was requested in g3,
but the locale data had the name of the alias locale that provided the
data at index zero (which represents the locale name). Note that the
locale names at index zero always could differentiate from the requested
`goog.LOCALE` due to the aliasing logic. This just didn't come up before.

We simplify this logic by generating a `goog.LOCALE` case for all
locales CLDR provides data for. We don't need to bother about aliasing
because with the refactorings to the CLDR generation tool, all locales
are built (which also captures the aliases), and we can generate the locale
file on the fly (which has not been done before).

PR Close #42230
2021-06-07 15:34:39 -07:00
Paul Gschwendtner 7b288471bf build: add documentation for `generate-locales-tool` (#42230)
The CLDR extraction tool has been reworked to run as part of Bazel.
This adds a initial readme explaining what the tool generates. It's
far from a detailed description but it can serve as foundation for more
detailed explanations.

PR Close #42230
2021-06-07 15:34:39 -07:00
Paul Gschwendtner 4641fc71a2 build: wire up new CLDR generation tool within Bazel (#42230)
Introduces a few Starlark macros for running the new Bazel
CLDR generation tool. Wires up the new tool so that locales
are generated properly. Also updates the existing
`closure-locale` file to match the new output generated by the Bazel tool.

This commit also re-adds a few locale files that aren't
generated by CLDR 37, but have been accidentally left in
the repository as the Gulp script never removed old locales
from previous CLDR versions. This problem is solved with the
Bazel generation of locale files, but for now we re-add these
old CLDR 33 locale files to not break developers relying on these
(even though the locale data indicies are incorrect; but there might
be users accessing the data directly)

PR Close #42230
2021-06-07 15:34:38 -07:00
Paul Gschwendtner 1f75a657a8 build: convert CLDR locale extraction from Gulp to Bazel tool (#42230)
Converts the CLDR locale extraction script to a Bazel tool.
This allows us to generate locale files within Bazel, so that
locales don't need to live as sources within the repo. Also
it allows us to get rid of the legacy Gulp tooling.

The migration of the Gulp script to a Bazel tool involved the
following things:

  1. Basic conversion of the `extract.js` script to TypeScript.
     This mostly was about adding explicit types. e.g. adding `locale:
     string` or `localeData: CldrStatic`.

  2. Split-up into separate files. Instead of keeping the large
     `extract.js` file, the tool has been split into separate files.
     The logic remains the same, just that code is more readable and
     maintainable.

  3. Introduction of a new `index.ts` file that is the entry-point
     for the Bazel tool. Previously the Gulp tool just generated
     all locale files, the default locale and base currency files
     at once. The new entry-point accepts a mode to be passed as
     first process argument. based on that argument, either locales
     are generated into a specified directory, or the default locale,
     base currencies or closure file is generated.

     This allows us to generate files with a Bazel genrule where
     we simply run the tool and specify the outputs. Note: It's
     necessary to have multiple modes because files live in separate
     locations. e.g. the default locale in `@angular/core`, but the
     rest in `@angular/common`.

  4. Removal of the `cldr-data-downloader` and custom CLDR resolution
     logic. Within Bazel we cannot run a downloader using network.

     We switch this to something more Bazel idiomatic with better
     caching. For this a new repository rule is introduced that
     downloads the CLDR JSON repository and extracts it. Within
     that rule we determine the supported locales so that they
     can be used to pre-declare outputs (for the locales) within
     Bazel analysis phase. This allows us to add the generated locale
     files to a `ts_library` (which we want to have for better testing,
     and consistent JS transpilation).

     Note that the removal of `cldr-data-downloader` also requires us to
     add logic for detecting locales without data. The CLDR data
     downloader overwrote the `availableLocales.json` file with a file
     that only lists locales that CLDR provides data for. We use the
     official `availableLocales` file CLDR provides, but filter out
     locales for which no data is available. This is needed until we
     update to CLDR 39 where data is available for all such locales
     listed in `availableLocales.json`.

PR Close #42230
2021-06-07 15:34:38 -07:00
Paul Gschwendtner 9421bcd978 refactor: remove checked-in locale files (#42230)
This is a pre-refactor commit allowing us to move
the CLDR locale generation to Bazel where files would
no longer be checked-in, except for the `closure-locale`
file that is synced into Google3.

PR Close #42230
2021-06-07 15:34:38 -07:00
Andrew Scott a493ea9bcb fix(language-service): fix autocomplete info display for some cases (#42472)
Before this commit, attribute completion display parts were retrieved
but not assigned. In addition, the switch case was non-exhaustive
because it did not include `StructuralDirectiveAttribute`.

PR Close #42472
2021-06-07 12:25:53 -07:00
Paul Gschwendtner 38c592ea0a build: remove unused no-strict tsconfig file (#42506)
In the past, when we enabled `--strict` in the repository, we added
another tsconfig for code not being migrated to be `--strict`
compatible. This was done for the deprecated http and webworker
packages. Since these are now removed, we can rmeove the logic.

PR Close #42506
2021-06-07 10:47:47 -07:00
Andrew Kushnir f4c55e464a docs: provide more info on the `NO_ERRORS_SCHEMA` schema (#42327)
The `NO_ERRORS_SCHEMA` schema can be used to ignore errors related to unknown elements or properties, but since it suppresses these errors it may also hide real problems in a template. This commit updates the `NO_ERRORS_SCHEMA` docs to mention that.

Closes #39454.

PR Close #42327
2021-06-07 10:46:34 -07:00
Kristiyan Kostadinov afd68e5674 feat(compiler): emit diagnostic for shadow dom components with an invalid selector (#42245)
This is based on a discussion we had a few weeks ago. Currently if a component uses `ViewEncapsulation.ShadowDom` and its selector doesn't meet the requirements for a custom element tag name, a vague error will be thrown at runtime saying something like "Element does not support attachShadowRoot".

These changes add a new diagnostic to the compiler that validates the component selector and gives a better error message during compilation.

PR Close #42245
2021-06-07 10:44:57 -07:00
Pete Bacon Darwin cc904b5226 docs(core): clarify deprecation of `entryComponents` (#42248)
These may still be needed in View Engine libraries.

Closes #39958

PR Close #42248
2021-06-07 10:02:01 -07:00
Paul Gschwendtner 2d0ff0a5d3 ci: add lint error for files with missing trailing new-line (#42478)
For quite a while it is an unspoken convention to add a trailing
new-line files within the Angular repository. This was never enforced
automatically, but has been frequently raised in pull requests through
manual review. This commit sets up a lint rule so that this is
"officially" enforced and doesn't require manual review.

PR Close #42478
2021-06-04 13:31:03 -07:00
Paul Gschwendtner 71e14a71f5 test: update compiler-cli compliance goldens due to TS 4.3 emit format regression (#42022)
Updates the compiler-cli compliance goldens. The golden updates are
required due to a regression in TypeScript 4.3 that causes the emitter
to not incorrectly preserve lines when emitting a node list.

This can be reverted once https://github.com/microsoft/TypeScript/pull/44070
is available.

PR Close #42022
2021-06-04 11:17:09 -07:00
Paul Gschwendtner 25f763cff8 feat(core): support TypeScript 4.3 (#42022)
Switches the repository to TypeScript 4.3 and the latest
version of tslib. This involves updating the peer dependency
ranges on `typescript` for the compiler CLI and for the Bazel
package. Tests for new TypeScript features have been added to
ensure compatibility with Angular's ngtsc compiler.

PR Close #42022
2021-06-04 11:17:09 -07:00
Renovate Bot 69296254da build: update dependency google-closure-compiler to v20210601 (#42475)
PR Close #42475
2021-06-04 10:34:58 -07:00
Jessica Janiuk 00b1444d12 Revert "feat(forms): add `ng-submitted` class to forms that have been submitted." (#42474)
This reverts commit f024d7556081f8913f21761bb8e6aab8d08be110.

PR Close #42474
2021-06-03 17:42:02 -07:00
Kristiyan Kostadinov ba084857ea feat(compiler): support safe keyed read expressions (#41911)
Currently we support safe property (`a?.b`) and method (`a?.b()`) accesses, but we don't handle safe keyed reads (`a?.[0]`) which is inconsistent. These changes expand the compiler in order to support safe key read expressions as well.

PR Close #41911
2021-06-03 13:22:41 -07:00
Dylan Hunn 47270d9e63 feat(forms): add `ng-submitted` class to forms that have been submitted. (#42132)
As previously discussed in pull/31070 and issues/30486, this would be useful because it is often desirable to apply styles to fields that are both `ng-invalid` and `ng-pristine` after the first attempt at form submission, but Angular does not provide any simple way to do this (although evidently Angularjs did). This will now be possible with a descendant selector such as `.ng-submitted .ng-invalid`.

In this implementation, the directive that sets control status classes on forms and formGroups has its set of statuses widened to include `ng-submitted`. Then, in the event that `is('submitted')` is invoked, the `submitted` property of the control container is returned iff it exists. This is preferred over checking whether the container is a `Form` or `FormGroup` directly to avoid reflecting on those classes.

Closes #30486.

PR Close #42132
2021-06-03 13:21:29 -07:00
JoostK 69e57827e2 refactor(compiler-cli): remove unused return type transform (#41996)
With the removal of the `ModuleWithProviders` transform in the parent commit,
the underlying dts transform can also be removed as it is not used elsewhere.

PR Close #41996
2021-06-03 11:38:58 -07:00
JoostK ce8720910d refactor(compiler-cli): remove `ModuleWithProviders` generic type transform (#41996)
The `ModuleWithProviders` type has required a generic type since Angular 10,
so it is no longer necessary for the compiler to transform usages of the
`ModuleWithProviders` type without the generic type, as that should have
been reported as a compile error. This commit removes the detection logic
from ngtsc.

PR Close #41996
2021-06-03 11:38:58 -07:00
iRealNirmal 751cd83ae3 fix(forms): the `min` and `max` validators should work correctly with `0` as a value (#42412)
Prior to this change the `min` and `max` validator directives would not
set the `min` and `max` attributes on the host element. The problem was
caused by the truthy check in host binding expression that was
calculated as `false` when `0` is used as a value. This commit updates
the logic to leverage nullish coalescing operator in these host binding
expressions, so `0` is treated as a valid value, thus the `min` and
`max` attributes are set correctly.

Partially closes #42267

PR Close #42412
2021-06-03 11:34:46 -07:00
JoostK 85c7f7691e fix(common): infer correct type when `trackBy` is used in `ngFor` (#41995)
When a `trackBy` function is used that accepts a supertype of the iterated
array's type, the loop variable would undesirably be inferred as the supertype
instead of the array's item type. This commit adds an inferred type parameter
to `TrackByFunction` to allow an extra degree of freedom, enabling the
loop value to be inferred as the most narrow type.

Fixes #40125

PR Close #41995
2021-06-03 11:33:26 -07:00
JoostK 9d290b4fef test(compiler-cli): move `TrackByFunction` from `fake_common` to `fake_core` (#41995)
The `TrackByFunction` is declared in `@angular/core` so it should also be
included in `fake_core` instead of `fake_common`.

PR Close #41995
2021-06-03 11:33:26 -07:00
JoostK 481540dd4e test(compiler-cli): load type declarations from fake_common (#41995)
The ngtsc test targets have fake declarations files for `@angular/core`
and `@angular/common` and the template type checking tests can leverage
the fake common declarations instead of declaring its own types.

PR Close #41995
2021-06-03 11:33:26 -07:00
JoostK bd1836b999 fix(compiler-cli): exclude type-only imports from cycle analysis (#42453)
Type-only imports are known to be elided by TypeScript, so the compiler
can be certain that such imports do not contribute to potential import
cycles. As such, type-only imports are no longer considered during cycle
analysis.

Regular import statements that would eventually be fully elided by
TypeScript during emit if none of the imported symbols are used in a
value position continue to be included in the cycle analysis, as the
cycle analyzer is unaware of these elision opportunities. Only explicit
`import type` statements are excluded.

PR Close #42453
2021-06-03 11:31:59 -07:00
Vahid Mohammadi 374fa2c26f fix(common): initialize currencyCode in currencyPipe (#40505)
currencyCode should be initialized with the injected default currency code

PR Close #40505
2021-06-03 10:52:28 -07:00
Paul Gschwendtner a16f82b851 refactor(dev-infra): move shared browser bazel setup into dedicated bazel folder (#42268)
This change moves the `dev-infra/browsers` folder into `dev-infra/bazel`.
The browser folder is providing custom configuration for Bazel, so it
should live within the `bazel` folder for a more well-structured
`dev-infra` folder.

PR Close #42268
2021-06-03 10:37:41 -07:00
Renovate Bot f3f10140b5 build: lock file maintenance (#42264)
PR Close #42264
2021-06-02 13:16:58 -07:00
Andrew Scott fe22c2b0b6 fix(language-service): Correct rename info for pipe name expressions (#41974)
Prior to this PR, attempting to get rename info for pipe name expressions would defer to the
typescript language service, which would return no rename info. This was not caught because
the test was written incorrectly.

This PR corrects the test behavior and adjusts the logic in getting rename info to account
for indirect renames (like pipe names).

PR Close #41974
2021-06-02 13:15:48 -07:00
Andrew Scott 6a2e3e2b2c docs: change Navigation from type to interface (#42281)
Navigation type should be interface so it can be documented on aio site.

fixes #37384

PR Close #42281
2021-06-01 14:13:20 -07:00
Alex Rickabaugh e039075a28 fix(compiler-cli): better detect classes that are indirectly exported (#42207)
The compiler flag `compileNonExportedClasses` allows the Angular compiler to
process classes which are not exported at the top level of a source file.
This is often used to allow for AOT compilation of test classes inside
`it()` test blocks, for example.

Previously, the compiler would identify exported classes by looking for an
`export` modifier on the class declaration itself. This works for the
trivial case, but fails for indirectly exported classes:

```typescript
// Component is declared unexported.
@Component({...})
class FooCmp {...}

// Indirect export of FooCmp
export {FooCmp};
```

This is not an immediate problem for most application builds, since the
default value for `compileNonExportedClasses` is `true` and therefore such
classes get compiled regardless.

However, in the Angular Language Service now, `compileNonExportedClasses` is
forcibly overridden to `false`. That's because the tsconfig used by the IDE
and Language Service is often far broader than the application build's
configuration, and pulls in test files that can contain unexported classes
not designed with AOT compilation in mind.

Therefore, the Language Service has trouble working with such structures.

In this commit, the `ReflectionHost` gains a new API for detecting whether a
class is exported. The implementation of this method now not only considers
the `export` modifier, but also scans the `ts.SourceFile` for indirect
exports like the example above. This ensures the above case will be
processed directly in the Language Service.

This new operation is cached using an expando symbol on the `ts.SourceFile`,
ensuring good performance even when scanning large source files with lots of
exports (e.g. a FESM file under `ngcc`).

Fixes #42184.

PR Close #42207
2021-06-01 12:16:46 -07:00
Kristiyan Kostadinov 3e192bfa4d build: fix linting against jasmine focus functions (#42415)
We were linting against usages of `fdescribe` and `fit` by referencing the `no-jasmine-focus` rule which isn't installed, causing tslint to log the following:

```
Could not find implementations for the following rules specified in the configuration:
    no-jasmine-focus
Try upgrading TSLint and/or ensuring that you have all necessary custom rules installed.
If TSLint was recently upgraded, you may have old rules configured which need to be cleaned
```

These changes switch to using the built-in `ban` rule.

PR Close #42415
2021-06-01 10:16:55 -07:00
Andrew Scott 1b8bbddff5 docs: list supported values for `read` in decorator metadata (#42370)
fixes #20927

PR Close #42370
2021-06-01 10:12:23 -07:00
Andrew Scott 62b5a6cb07 docs: add docs for DebugElement (#42352)
fixes #36048

PR Close #42352
2021-05-27 17:02:24 -07:00
Igor Minar 184de5048a docs: expand documentation for ROUTES (#42398)
Previously the docs were very minimalistic. The most important thing missing from the docs
was that people should primarily use higher level APIs instead of using ROUTES directly.

It would be nice to holistically overhaul more of the router API docs, but that's out of
scope of this change.

Fixes #39350

PR Close #42398
2021-05-27 16:47:39 -07:00
Igor Minar e73fef4d0b docs: add a note about <select> and nested <option>s in Ivy compat guide (#42338)
An internal change in Ivy has surfaced issues in previosly broken code. This change adds a note to the
Ivy compatibility guide as well as the TrackByFunction api docs.

Fixes #35896

PR Close #42338
2021-05-27 11:12:25 -07:00
Andrew Kushnir 516923e3dc docs: clarify when the `ngDoBootstrap` hook is invoked (#42362)
Closes #35242.

PR Close #42362
2021-05-26 14:23:45 -07:00
Joey Perrott 4e9b61aaf9 docs: remove/update broken links in resources appearing on aio (#42232)
Remove or update broken links to resources from the resources and
contributors pages on aio.

Closes #39719

PR Close #42232
2021-05-26 14:21:12 -07:00
Andrew Scott 9193ea20e4 docs: clarify providedIn options (#42355)
The list for the possible options of providedIn was not totally clear. This commit ensures each possible value is included explicitly in the docs.

fixes #29330

PR Close #42355
2021-05-26 20:10:31 +00:00
Kristiyan Kostadinov a787f78074 test: clean up internal testing utilities (#42177)
We have some internal proxies for all of the Jasmine functions, as well as some other helpers. This code hasn't been touched in more than 5 years, it can lead to confusion and it isn't really necessary since the same can be achieved using Jasmine.

These changes remove most of the code and clean up our existing unit tests.

PR Close #42177
2021-05-26 20:07:25 +00:00
Igor Minar 14abc68ccf docs(common): rewrite docs for NgForOf#ngForTrackBy (#42329)
Clarify the prupose of the tracking function and document how to create a good one.

Fixes #40461

PR Close #42329
2021-05-26 20:05:39 +00:00
Andrew Scott 8228170919 docs: document shallow equality emit for ActivatedRoute (#42280)
fixes #40769

PR Close #42280
2021-05-25 22:15:39 +00:00
Pete Bacon Darwin c2ed612da3 docs: convert the last `my-app` components to `app-root` (#42256)
Most of these were fixed in other PRs but there were are couple of stragglers.
Note that `my-app` components in non-documentation facing code, such as
compliance tests have not been changed.

Fixes #20235

PR Close #42256
2021-05-25 22:13:36 +00:00
Andrew Scott 6da0c97423 docs: add note about redirects after absolute redirect (#42277)
This commit addresses the documentation portion of #19069.

PR Close #42277
2021-05-25 22:13:07 +00:00
Andrew Scott 9f50495f28 docs: update date pipe api reference to indicate it is a pure pipe (#42320)
This note was included in #37099 but the PR was closed without being merged.

Fixes #33897

PR Close #42320
2021-05-25 22:10:32 +00:00
iRealNirmal 3d9062dad7 fix(forms): Add float number support for min and max validator (#42223)
Added float number support for minValidator and maxValidator

Closes #42215

PR Close #42223
2021-05-25 20:31:09 +00:00
iRealNirmal 3a6af8e629 fix(platform-browser): update started state on reset (#41608)
This commit fixes the state of variable _started on call of reset method.

Earlier behaviour was on call of `reset()` method we are not setting back
`_started` flag's value to false and it created various issue for end user
which were expecting this behaviour as per name of method.

We provided end user `reset()` method, but it was empty method and on call
of it wasn't doing anything. As end user/developer were not able to
reuse animation not animation after call of reset method.

In this PR on call of `reset()` method we are setting flag `_started` value to false
which can be accessed by `hasStarted()`.

Resolves #18140

PR Close #41608
2021-05-25 20:28:41 +00:00
Kapunahele Wong d7768c61ad docs: edit copy for tick() in testing and api docs (#35697)
Fixes #35696

PR Close #35697
2021-05-25 18:03:32 +00:00
Andrew Scott 3fe8762376 docs: clarify location.subscribe behavior (#42272)
`Location.go` does not trigger the browser's `popstate` event because
the Angular Router uses `pushState` and `replaceState`. This can be
confusing when calling `Location.go` and using `Location.subscribe`.
This commit clarifies the behavior of `Location.subscribe` and points
developers to the `onUrlChanges` subscription instead.

Fixes #12691

PR Close #42272
2021-05-25 17:57:52 +00:00
Andrew Scott ef33806480 docs: add small clarity around navigationCancel (#42282)
Add small clarity to sentence in documentation for navigation cancel event
to indicate that router guards returning false or urlTree is only one of
several reasons a NavigationCancel event happens.

fixes #26613

PR Close #42282
2021-05-25 17:55:22 +00:00
Joey Perrott 9f09c3b9b1 build(core): update supported range of node versions to be less restrictive (#42205)
Update the supported range of node versions for to be less restrictive, no longer causing
yarn or npm to fail engine's checks for future versions of node.

While this change will no longer cause yarn or npm to fail these engine's check, this does
not reflect a change in the officially supported versions of node for Angular.  Angular
continues to maintain support for Active LTS and Maintenance LTS versions of node.

PR Close #42205
2021-05-25 17:48:47 +00:00
Joey Perrott 5a6229ccd5 build(upgrade): update supported range of node versions to be less restrictive (#42205)
Update the supported range of node versions for to be less restrictive, no longer causing
yarn or npm to fail engine's checks for future versions of node.

While this change will no longer cause yarn or npm to fail these engine's check, this does
not reflect a change in the officially supported versions of node for Angular.  Angular
continues to maintain support for Active LTS and Maintenance LTS versions of node.

PR Close #42205
2021-05-25 17:48:46 +00:00
Joey Perrott c06feb8e8f build(service-worker): update supported range of node versions to be less restrictive (#42205)
Update the supported range of node versions for to be less restrictive, no longer causing
yarn or npm to fail engine's checks for future versions of node.

While this change will no longer cause yarn or npm to fail these engine's check, this does
not reflect a change in the officially supported versions of node for Angular.  Angular
continues to maintain support for Active LTS and Maintenance LTS versions of node.

PR Close #42205
2021-05-25 17:48:46 +00:00
Joey Perrott 617d3f124f build(router): update supported range of node versions to be less restrictive (#42205)
Update the supported range of node versions for to be less restrictive, no longer causing
yarn or npm to fail engine's checks for future versions of node.

While this change will no longer cause yarn or npm to fail these engine's check, this does
not reflect a change in the officially supported versions of node for Angular.  Angular
continues to maintain support for Active LTS and Maintenance LTS versions of node.

PR Close #42205
2021-05-25 17:48:46 +00:00
Joey Perrott 3a4b7a4480 build(platform-server): update supported range of node versions to be less restrictive (#42205)
Update the supported range of node versions for to be less restrictive, no longer causing
yarn or npm to fail engine's checks for future versions of node.

While this change will no longer cause yarn or npm to fail these engine's check, this does
not reflect a change in the officially supported versions of node for Angular.  Angular
continues to maintain support for Active LTS and Maintenance LTS versions of node.

PR Close #42205
2021-05-25 17:48:46 +00:00
Joey Perrott 0a3bc6092c build(platform-browser): update supported range of node versions to be less restrictive (#42205)
Update the supported range of node versions for to be less restrictive, no longer causing
yarn or npm to fail engine's checks for future versions of node.

While this change will no longer cause yarn or npm to fail these engine's check, this does
not reflect a change in the officially supported versions of node for Angular.  Angular
continues to maintain support for Active LTS and Maintenance LTS versions of node.

PR Close #42205
2021-05-25 17:48:46 +00:00
Joey Perrott 99c92bc8ed build(platform-browser-dynamic): update supported range of node versions to be less restrictive (#42205)
Update the supported range of node versions for to be less restrictive, no longer causing
yarn or npm to fail engine's checks for future versions of node.

While this change will no longer cause yarn or npm to fail these engine's check, this does
not reflect a change in the officially supported versions of node for Angular.  Angular
continues to maintain support for Active LTS and Maintenance LTS versions of node.

PR Close #42205
2021-05-25 17:48:46 +00:00
Joey Perrott 81b31ea2fd build(localize): update supported range of node versions to be less restrictive (#42205)
Update the supported range of node versions for to be less restrictive, no longer causing
yarn or npm to fail engine's checks for future versions of node.

While this change will no longer cause yarn or npm to fail these engine's check, this does
not reflect a change in the officially supported versions of node for Angular.  Angular
continues to maintain support for Active LTS and Maintenance LTS versions of node.

PR Close #42205
2021-05-25 17:48:46 +00:00
Joey Perrott e003ebfa8c build(language-service): update supported range of node versions to be less restrictive (#42205)
Update the supported range of node versions for to be less restrictive, no longer causing
yarn or npm to fail engine's checks for future versions of node.

While this change will no longer cause yarn or npm to fail these engine's check, this does
not reflect a change in the officially supported versions of node for Angular.  Angular
continues to maintain support for Active LTS and Maintenance LTS versions of node.

PR Close #42205
2021-05-25 17:48:46 +00:00
Joey Perrott 324bd89114 build(forms): update supported range of node versions to be less restrictive (#42205)
Update the supported range of node versions for to be less restrictive, no longer causing
yarn or npm to fail engine's checks for future versions of node.

While this change will no longer cause yarn or npm to fail these engine's check, this does
not reflect a change in the officially supported versions of node for Angular.  Angular
continues to maintain support for Active LTS and Maintenance LTS versions of node.

PR Close #42205
2021-05-25 17:48:46 +00:00
Joey Perrott e48e697f18 build(elements): update supported range of node versions to be less restrictive (#42205)
Update the supported range of node versions for to be less restrictive, no longer causing
yarn or npm to fail engine's checks for future versions of node.

While this change will no longer cause yarn or npm to fail these engine's check, this does
not reflect a change in the officially supported versions of node for Angular.  Angular
continues to maintain support for Active LTS and Maintenance LTS versions of node.

PR Close #42205
2021-05-25 17:48:45 +00:00
Joey Perrott e29afbc373 build(compiler): update supported range of node versions to be less restrictive (#42205)
Update the supported range of node versions for to be less restrictive, no longer causing
yarn or npm to fail engine's checks for future versions of node.

While this change will no longer cause yarn or npm to fail these engine's check, this does
not reflect a change in the officially supported versions of node for Angular.  Angular
continues to maintain support for Active LTS and Maintenance LTS versions of node.

PR Close #42205
2021-05-25 17:48:45 +00:00
Joey Perrott 5a80c785bb build(compiler-cli): update supported range of node versions to be less restrictive (#42205)
Update the supported range of node versions for to be less restrictive, no longer causing
yarn or npm to fail engine's checks for future versions of node.

While this change will no longer cause yarn or npm to fail these engine's check, this does
not reflect a change in the officially supported versions of node for Angular.  Angular
continues to maintain support for Active LTS and Maintenance LTS versions of node.

PR Close #42205
2021-05-25 17:48:45 +00:00
Joey Perrott 267500e3df build(common): update supported range of node versions to be less restrictive (#42205)
Update the supported range of node versions for to be less restrictive, no longer causing
yarn or npm to fail engine's checks for future versions of node.

While this change will no longer cause yarn or npm to fail these engine's check, this does
not reflect a change in the officially supported versions of node for Angular.  Angular
continues to maintain support for Active LTS and Maintenance LTS versions of node.

PR Close #42205
2021-05-25 17:48:45 +00:00
Joey Perrott 1d08acb104 build(bazel): update supported range of node versions to be less restrictive (#42205)
Update the supported range of node versions for to be less restrictive, no longer causing
yarn or npm to fail engine's checks for future versions of node.

While this change will no longer cause yarn or npm to fail these engine's check, this does
not reflect a change in the officially supported versions of node for Angular.  Angular
continues to maintain support for Active LTS and Maintenance LTS versions of node.

PR Close #42205
2021-05-25 17:48:45 +00:00
Joey Perrott a5b3f80e1c build(animations): update supported range of node versions to be less restrictive (#42205)
Update the supported range of node versions for to be less restrictive, no longer causing
yarn or npm to fail engine's checks for future versions of node.

While this change will no longer cause yarn or npm to fail these engine's check, this does
not reflect a change in the officially supported versions of node for Angular.  Angular
continues to maintain support for Active LTS and Maintenance LTS versions of node.

PR Close #42205
2021-05-25 17:48:45 +00:00
Andrew Scott a39169851e docs: clarify pathMatch strategy prefix (#42287)
This commit clarifies the description of the default `pathMatch`
strategy (prefix) to indicate that the path segments must each match to
a config.

fixes #39737

PR Close #42287
2021-05-24 15:43:31 -07:00
Pete Bacon Darwin bf505ad707 docs(core): tighten up PipeTransform example types (#42240)
The example was using `any` type but then assuming that the value was a string.

Fixes #42239

PR Close #42240
2021-05-24 17:08:34 +00:00
Alan Agius 7f6213a2f4 fix(migrations): add migration to replace `/deep/` with `::ng-deep` (#42214)
With this change we add a migration to replace the deprecated shadow-piercing selector from `/deep/` with deprecated but recommended `::ng-deep`.

The main motivation for this change is that the CSS optimizer CSSNano which is used by the Angular CLI no longer supports this non standard selector and causes build time errors due to the selector being minified incorrectly. However, CSSNano does support the recommended deprecated `::ng-deep` selector.

Closes: #42196

PR Close #42214
2021-05-21 22:13:29 +00:00
Renovate Bot d6bc61ab5f build: update angular (#42090)
PR Close #42090
2021-05-20 17:25:51 +00:00
Renovate Bot 5c44ec1b45 build: lock file maintenance (#42120)
PR Close #42120
2021-05-19 09:20:53 -07:00
Joey Perrott 2dd956421c build: remove publishConfig entry from package.json entries (#42104)
Remove publishConfig property from the package.json entry for each of the entries in
the publish configuration.  Using the wombat proxy is now ensured/managed by the
ng-dev release tooling.

PR Close #42104
2021-05-18 15:41:33 -07:00
David Shevitz 5b9a36cf95 docs: move all existing router documentation into a single location and add two new topics: an overview and a reference (#41972)
PR Close #41972
2021-05-18 15:39:38 -07:00
Paul Gschwendtner 3c726c3516 fix(compiler): unclear lexer error when using private identifier in expressions (#42027)
TypeScript supports ECMAScript private identifiers. It can happen that
developers intend to access such members from within an expression.

This currently results in an unclear error from the lexer. e.g.

```
'Parser Error: Unexpected token # at column 1 in [{{#myField}}] in C:/test.ts@5:2
```

We could improve such errors by tokenizing private identifiers similar to
how the TypeScript scanner processes them. Later we can report better
errors in the expression parser or in the typecheck block. This commit
causes all private identifier tokens to be disallowed, so it never
reaches the type checker. This is done intentionally as private
identifiers should not be considered valid Angular syntax, especially
because private fields are not guaranteed to be accessible from within
a component/directive definition (e.g. there cases where a template
function is generated outside of the class; which results in private
members not being accessible; and this results in mixed/confusing
behavior).

Fixes #36003.

PR Close #42027
2021-05-18 10:15:12 -07:00
MrJithil fc1bc0e0e8 docs: update examples to use correct `Injector.create()` overload (#42006)
The `Injector.create(providers, ...)` overload has been deprecated.
The examples now use the `Injector.create(options)` overload.

PR Close #42006
2021-05-17 10:53:28 -07:00
wagnermaciel 5960d4c513 docs(benchpress): reword a comment (#42096)
* this is a follow up on pr #42085 to change
  the wording of the comment explaining the fix.

PR Close #42096
2021-05-14 21:09:02 +00:00
Kristiyan Kostadinov 4bc5b4d93b fix(core): global listeners not being bound on non-node host elements (#42014)
We skip event listeners on non-element host nodes (e.g. `ng-container` or `ng-element`), because they don't map to a DOM node so there's nothing to bind the event to. The problem is that this also prevents listeners bound to global targets from being bound.

These changes add an extra condition to allow for the event to be bound if it has a custom event target resolver.

Fixes #14191.

PR Close #42014
2021-05-14 14:51:04 +00:00
wagnermaciel 2e7eb270df fix(benchpress): update the check for start and end events (#42085)
* recently, performance events started showing up with a -bpstart and -bpend
  suffix to indicate their being the start and end events for our performance
  testing. to fix this, we added an additional check for those suffixes in
  addition to the old checks.

PR Close #42085
2021-05-13 17:01:25 -07:00
Dylan Hunn a4ebe8656e fix(forms): registerOnValidatorChange should be called for ngModelGroup. (#41971)
The Validator and AsyncValidator interfaces provide a callback, `registerOnValidatorChange(fn)`. `registerOnValidatorChange` is supposed to be fired at least once to register `fn` with the validator. `fn` is then called by the validator whenever its inputs change. This was previously not happening for FormGroup validators, and is now fixed.

PR Close #41971
2021-05-13 13:57:47 -04:00
Renovate Bot 9e0eb7ee62 build: update dependency google-closure-compiler to v20210505 (#41980)
PR Close #41980
2021-05-13 13:32:54 -04:00
Renovate Bot 45083bc302 build: lock file maintenance (#42015)
PR Close #42015
2021-05-13 13:32:27 -04:00
Alex Rickabaugh a74eb52589 Revert "refactor(core): optimize calls to `split` and `slice` while computing version parts (#41208)"
This reverts commit 744bd2b64f.

This commit seems to cause issues in Safari.
2021-05-12 14:13:50 -04:00
JoostK 96624b71a7 fix(platform-browser): prevent memory leak of style nodes if shadow DOM encapsulation is used (#42005)
Prior to this change, any inserted `<style>` nodes into shadow dom trees would be retained
in memory, even after the shadow dom tree has been removed. This commit fixes the memory
leak by tracking the inserted `<style>` nodes per host element, such that removal of the
host element also releases the style nodes.

Fixes #36655

PR Close #42005
2021-05-10 16:12:19 -04:00
Alan Agius d2296bc265 test: refactor test to work with latest @types/jasmine (#41956)
In some cases we are using private APIs. This change adds casting were needed to make the build successful.

PR Close #41956
2021-05-10 11:36:00 -04:00
Renovate Bot 991ea6fc39 build: update all non-major dependencies (#41956)
PR Close #41956
2021-05-10 11:35:59 -04:00
JoostK a529d4f4f8 fix(core): do not retain dynamically compiled components and modules (#42003)
The JIT compiler has a mapping from component to the owning NgModule
and tracks whether a certain NgModule class has been verified; these
maps causes any JIT compiled component and NgModule to be retained even
if they are no longer referenced from anywhere else. This commit
switches the maps to `WeakMap` to allow garbage collecting any
components and NgModules that are no longer referenced elsewhere.

Fixes #19997

PR Close #42003
2021-05-10 10:36:21 -04:00
Pete Bacon Darwin 089daea98b refactor(compiler-cli): remove redundant `potentialSourceMapUrl` property (#42000)
Now that there is no need to work around the source-map bug in TypeScript
(https://github.com/Microsoft/TypeScript/issues/29300) we can just use
`resolvedTemplateUrl` for the source-map URL, rather than having a separate
property.

PR Close #42000
2021-05-10 10:33:27 -04:00
Pete Bacon Darwin 6912b1b364 docs(compiler-cli): fix typo (#42000)
PR Close #42000
2021-05-10 10:33:27 -04:00
Pete Bacon Darwin 8bcbfe0561 refactor(compiler-cli): remove unused import (#42000)
The `makeDiagnostic()` function is not used in this file.

PR Close #42000
2021-05-10 10:33:26 -04:00
Pete Bacon Darwin 0cb68632c6 refactor(compiler-cli): remove TS bug workaround (#42000)
The TS bug at https://github.com/Microsoft/TypeScript/issues/29300 was
fixed in TS 3.3, so the workaround is no longer required.

PR Close #42000
2021-05-10 10:33:26 -04:00
Pete Bacon Darwin d59f2b0d0c refactor(core): remove unnecessary cast (#41960)
The `as any` is no longer needed since `providedIn` can accept `'any'`.

PR Close #41960
2021-05-10 10:28:31 -04:00
Julien Marcou 744bd2b64f refactor(core): optimize calls to `split` and `slice` while computing version parts (#41208)
Reduce the number of calls made to `split` and `slice` while computing version parts by deconstructing the result.

PR Close #41208
2021-05-10 10:26:34 -04:00
Julien Marcou 562a782114 docs: fix package name in version.ts files in different packages (#41208)
PR Close #41208
2021-05-10 10:26:34 -04:00
Alex Rickabaugh cd252b99fe fix(compiler-cli): use '' for the source map URL of indirect templates (#41973)
Indirect templates are templates produced by a non-literal expression value
of the `template` field in `@Component`. The compiler can statically
determine the template string, but there is not guaranteed to be a physical
file which contains the bytes of the template string. For example, the
template string may be computed by a concatenation expression: 'a' + 'b'.

Previously, the compiler would use the TS file path as the source map path
for indirect templates. This is incorrect, however, and breaks source
mapping for such templates, since the offsets within the template string do
not correspond to bytes of the TS file.

This commit returns the compiler to its old behavior for indirect templates,
which is to use `''` as the source map URL for such templates.

Fixes #40854

PR Close #41973
2021-05-07 15:46:20 -04:00
Ajit Singh 4bc3cf216d feat(common): add URLSearchParams to request body (#37852)
URLSearch params are by default supported in the browser but are not supported by angular/http package added support for URLSearchParams

Fixes #36317

PR Close #37852
2021-05-07 10:45:02 -04:00
mgechev 544e6a5ca1 fix(core): invoke profiler around ngOnDestroy lifecycle hooks (#41969)
Invoke the profiler for `ngOnDestroy` lifecycle hooks for services,
components, directives, and pipes.

PR Close #41969
2021-05-07 10:04:21 -04:00
Andrew Scott 1be5d659a5 fix(language-service): fully de-duplicate reference and rename results (#40523)
Rather than de-duplicating results as we build them, a final de-duplication can be done at the end.
This way, there's no forgetting to de-duplicate results at some level.

Prior to this commit, results from template locations that mapped to
multiple different typescript locations would not be de-duplicated (e.g.
an input binding that is bound to two separate directives).

PR Close #40523
2021-05-06 17:54:14 -04:00
Andrew Scott 459af57a31 refactor(compiler-cli): Adjust generated TCB when checkTypeOfPipes is false (#40523)
When `checkTypeOfPipes` is set to `false`, our TCB currently generates
the a statement like the following when pipes appear in the template:
`(_pipe1 as any).transform(args)`

This did enable us to get _some_ information from the Language Service
about pipes in this case because we still had access to the pipe
instance. However, because it is immediately cast to `any`, we cannot
get type information about the transform access. That means actions like "go to
definition", "find references", "quick info", etc. will return
incomplete information or fail altogether.

Instead, this commit changes the TCB to generate `(_pipe1.transform as any)(args)`.
This gives us the ability to get complete information for the LS
operations listed above.

PR Close #40523
2021-05-06 17:54:14 -04:00
Andrew Scott a86ca4fe04 feat(language-service): Enable renaming of pipes (#40523)
This commit updates the logic in the LS renaming to handle renaming of
pipes, both from the name expression in the pipe metadata as well as
from the template.

The approach here is to introduce a new concept for renaming: an
"indirect" rename. In this type of rename, we find rename locations
in with the native TS Language Service using a different node than the
one we are renaming. Using pipes as an example, if we want to rename the
pipe name from the string literal expression, we use the transform
method to find rename locations rather than the string literal itself
(which will not return any results because it's just a string).

So the general approach is:
* Determine the details about the requested rename location, i.e. the
  targeted template node and symbol for a template rename, or the TS
  node for a rename outside a template.
* Using the details of the location, determine if the node is attempting
  to rename something that is an indirect rename (pipes, selectors,
  bindings). Other renames are considered "direct" and we use whatever
  results the native TSLS returns for the rename locations.
* In the case of indirect renames, we throw out results that do not
  appear in the templates (in this case, the shim files). These results will be
  for the "indirect" rename that we don't want to touch, but are only
  using to find template results.
* Create an additional rename result for the string literal expression
  that is used for the input/output alias, the pipe name, or the
  selector.

 Note that renaming is moving towards being much more accurate in its
 results than "find references". When the approach for renaming
 stabilizes, we may want to then port the changes back to being shared
 with the approach for retrieving references.

PR Close #40523
2021-05-06 17:54:13 -04:00
Andrew Scott c1bcbeb324 refactor(language-service): Separate reference and rename capabilities (#40523)
This commit separates the reference and rename functions into separate builders so it's easier
to locate functions specific to each

PR Close #40523
2021-05-06 17:54:13 -04:00
Andrew Scott 9bc8b343ea refactor(language-service): extract utility functions for reference and rename (#40523)
This commit extracts utility functions and separates them from the core logic of the
references and rename builder.

PR Close #40523
2021-05-06 17:54:13 -04:00
Andrew Scott b8bd3c3dd2 refactor(language-service): Update file names for references and rename (#40523)
This commit renames the files for the references and rename functionality to indicate
that they deal with _both_ references and rename, not just references.

PR Close #40523
2021-05-06 17:54:13 -04:00
Georgii Dolzhykov 209768a570 refactor(compiler): stricter types for HTML AST (#41360)
A Node can only be an instance of one of the six classes.
This relation can be accurately expressed using a union type.

PR Close #41360
2021-05-06 17:34:52 -04:00
va-stefanek 640ec7828f refactor(common): change missing NgSwitch provider error message (#41704)
change error message of invalid NgSwitch use and add corner cases tests

PR Close #41704
2021-05-06 15:44:38 -04:00
Kristiyan Kostadinov abcd4bbfaa fix(compiler): preserve @page rules in encapsulated styles (#41915)
Currently the compiler treats `@page` rules in the same way as `@media`, however that is incorrect and it results in invalid CSS, because `@page` allows style declarations at the root (e.g. `@page (margin: 50%) {}`) and it only allows a limited set of at-rules to be nested into it. Given these restrictions, we can't really encapsulate the styles since they apply at the document level when the user tries to print.

These changes make it so that `@page` rules are preserved so that we don't break the user's CSS.

More information: https://www.w3.org/TR/css-page-3

Fixes #26269.

PR Close #41915
2021-05-06 09:33:56 -04:00
Gopal Jayaraman 6b8baad940 fix(common): add body as an optional property on the options of HttpClient.delete (#19438) (#41723)
adding optional body for HTTP delete request options. This new param added as an optional so won't break the existing code also provide the capability the send the body when and where it required.

PR Close #41723
2021-05-04 21:09:58 -07:00
Gourav102 378bb04d7b docs(common): Corrected the wrong formatting (#41945)
Removed the extra backtick character for `getLocaleTimeFormat()` link.
PR Close #41945
2021-05-04 21:08:53 -07:00
nirmal bhagwani 1758d02972 feat(compiler): support directive selectors with attributes containing `$` (#41567)
This commit adds support for `$` in when selecting attributes.

Resolves #41244.

test(language-service): Add test to expose bug caused by source file change (#41500)

This commit adds a test to expose the bug caused by source file change in
between typecheck programs.

PR Close #41500

PR Close #41567
2021-05-04 21:06:58 -07:00
Pete Bacon Darwin 992c70df59 fix(localize): relax error to warning for missing target (#41944)
Some localization workflows want to use the extracted source translation
files directy back in the project as a target translation file.

The extraction process generates files that only contain "source" messages
and not "target" messages. This is actually valid for most translation formats
but currently the Angular localization process expects target translation files
to always contain target messages and will stop with an error in this case.

Now, instead of an error, the translation file loader will log a warning,
and then try to falback to a source message, only erroring if this is also
missing.

Fixes #21690

PR Close #41944
2021-05-04 21:05:54 -07:00
JoostK 6eafaa7b5e fix(compiler-cli): expose the linker as a Babel plugin (#41918)
This allows the linker to be used as a true Babel plugin. In a Babel
configuration file, include the linker as follows:

```js
{
  plugins: [
    '@angular/compiler-cli/linker/babel',
  ]
}
```

or, if you need to specify configuration options:

```js
{
  plugins: [
    ['@angular/compiler-cli/linker/babel', {linkerJitMode: true}],
  ]
}
```

PR Close #41918
2021-05-04 12:43:00 -07:00
Ben Lesh e387d22f83 fix(core): AsyncPipe now compatible with RxJS 7 (#41590)
Adds a fix to make sure that RxJS v7 Observable is compatible with AsyncPipe. This is a typings-only change.
For more information see: https://github.com/microsoft/TypeScript/issues/43643

PR Close #41590
2021-05-04 08:32:48 -07:00
Renovate Bot dac78d1ba1 build: update dependency yargs to v17 (#41920)
PR Close #41920
2021-05-04 08:31:47 -07:00
Andrew Scott 3777cf55aa Revert "fix(language-service): only provide template results on reference requests (#41041)" (#41930)
This reverts commit 10aa5641dd.

Issue resolved upstream https://github.com/microsoft/vscode/issues/117095

PR Close #41930
2021-05-03 14:27:42 -07:00
Renovate Bot f42796a8f5 build: lock file maintenance (#41924)
PR Close #41924
2021-05-03 14:27:06 -07:00
David Shevitz 3b589030a8 docs: Remove references to protractor from documentation (#41731)
PR Close #41731
2021-05-03 14:26:09 -07:00
Gopal Jayaraman 6e11febf60 fix(common): add right ContentType for boolean values with HttpClient request body(#38924) (#41885)
currently a boolean as body is seen as text/plain, where is should be seen as application/json, since it is valid JSON, like numbers.

PR Close #41885
2021-05-03 10:00:16 -07:00
Pete Bacon Darwin 9b4b281c52 fix(core): handle multiple i18n attributes with expression bindings (#41882)
When there are multiple attributes that are marked for i18n translation,
which contain expression bindings, we were generating i18n update op-codes
that did not accurately map to the correct value to be bound in the lView.
Each attribute's bindings were relative to the start of the lView first
attributes values rather than to their own.

This fix passes the current binding index to `generateBindingUpdateOpCodes()`
when processing i18n attributes to account for this.

Fixes #41869

PR Close #41882
2021-04-30 14:20:15 -07:00
JoostK e27ac018ed fix(animations): ensure consistent transition namespace ordering (#19854)
When including a component in a template, the component's host element
is immediately appended as child of the parent node upon creation.
Hence, `hostElement.parentNode` will be a valid reference. However, if
the parent component is being inserted as an embedded view—through
`ngIf` for example—then the parent's node itself will not have been
inserted yet. This means that we cannot properly determine the position
of the transition namespace, as any `containsElement` check will return
false given that the partial DOM tree has not been inserted yet, even
though it will be contained within an existing transition namespace once
the partial tree is attached.

This commit fixes the issue by not just looking at the existence of a
parent node, but rather a more extensive check using the driver's
`containsElement` method.

PR Close #19854
2021-04-30 14:15:47 -07:00
JoostK 35450c78f7 fix(compiler-cli): prefer non-aliased exports in reference emitters (#41866)
This commit changes the reference emitters in the Ivy compiler to prefer
non-aliased exports if they exist. This avoids selecting "private
exports" that may not be stable, e.g. the reexports that have been added
by the View Engine compiler. Such reexports are not stable and are
therefore not suitable to be emitted into partial compilations, as the
output of partial compilations should only reference stable symbols
from upstream libraries.

An alternative solution has been considered where ViewEngine-generated
exports would gain a certain prefix, such that the Ivy compiler could
just exclude those exports (see #41443). However, that solution would
be insufficient in case a library is built using partial compilation and
while depending itself on a VE-compiled library from earlier versions of
Angular, where the magic prefix would be missing. For such libraries,
ngcc would have generated reexports using the declared name if not already
present so this change does result in choosing the correct export.

Because ngcc always generates reexports using the declared name even if
an aliased export is present, this change causes those ngcc-generated
exports to be chosen in downstream libraries using partial compilation.
This is unfortunate as it means that the declared names become
effectively public even if the library author was intentionally
exporting it using an alias. This commit does not address this problem;
it is expected that this should not result in widespread issues across
the library ecosystem.

Fixes #41277

PR Close #41866
2021-04-30 14:15:10 -07:00
JoostK 2cc73526bc build: exclude compiler compliance tests from Saucelabs tests (#41866)
The legacy-unit-tests-saucelabs job does not need to compile the
compiler compliance tests as they are not used in those tests. Since
the compliance tests can be configured to use specific compiler options,
the generic tsconfig that is used in legacy-unit-tests-saucelabs may not
succeed to compile the compliance tests so this commit excludes those
source files.

PR Close #41866
2021-04-30 14:15:10 -07:00
Kristiyan Kostadinov 6581a1b48d perf(core): minor improvements to listener instructions (#41807)
Makes the following improvements to the listener instructions to make them slightly smaller and more memory-efficient.

1. Removes the default value from the `useCapture` parameter since it generates more code than just castint to `false`.
2. Removes the `useCapture` and `eventTargetResolver` parameters from `ɵɵsyntheticHostListener` since they won't be generated by the compiler, as far as I can tell.
3. Makes it so that we don't have to return a target name from a `GlobalTargetResolver`. This allows us to save on some memory, because we can return a reference to the target without having to wrap it in an object literal.

DEPRECATIONS:
`EventManagerPlugin.getGlobalEventTarget` is now deprecated and won't be called from Ivy code anymore. Global events will go through `addEventListener`.

PR Close #41807
2021-04-30 14:14:00 -07:00
Kristiyan Kostadinov 2dd96e08ae Revert "perf(core): avoid storing LView in __ngContext__ (#41358)" (#41901)
This reverts commit 18b33e79d3.

PR Close #41901
2021-04-30 14:12:52 -07:00
Kristiyan Kostadinov 36c7bebe40 test(core): make tests more resilient to header offset changes (#41883)
Updates some tests where values related to the `HEADER_OFFSET` are hardcoded, causing them to break when the offset is updated. This comes up once in a while during refactorings and these changes should save us some time in the future.

PR Close #41883
2021-04-29 13:51:07 -07:00
Cosmin Ababei 42a64f8676 docs: remove mention of scheduleTick in markForCheck (#41845)
markForCheck doesn't call scheduleTick, thus I removed the comment which mentioned this.
PR Close #41845
2021-04-28 12:34:49 -07:00
Pete Bacon Darwin da6ed1562e fix(compiler): strip scoped selectors from `@font-face` rules (#41815)
`@font-face` rules cannot contain nested selectors. Nor can they be
nested under a selector. Normally this would be a syntax error by the
author of the styles. But in some rare cases, such as importing styles
from a library, and applying `:host ::ng-deep` to the imported styles,
we can end up with broken css if the imported styles happen to contain
`@font-face` rules.

This commit works around this problem by sanitizing such cases (erasing
any scoping selectors) during emulated ShadowDOM encapsulation style
processing.

Fixes #41751

PR Close #41815
2021-04-27 09:12:28 -07:00
Joey Perrott af12d8deaa fix(core): update supported range of node versions to only include LTS versions (#41822)
Update the supported range of node versions for Angular to only include supported LTS versions.

PR Close #41822
2021-04-26 15:21:14 -07:00
Joey Perrott 7a4414401a fix(upgrade): update supported range of node versions to only include LTS versions (#41822)
Update the supported range of node versions for Angular to only include supported LTS versions.

PR Close #41822
2021-04-26 15:21:13 -07:00
Joey Perrott f3c2abec6c fix(service-worker): update supported range of node versions to only include LTS versions (#41822)
Update the supported range of node versions for Angular to only include supported LTS versions.

PR Close #41822
2021-04-26 15:21:13 -07:00
Joey Perrott 961296adf5 fix(router): update supported range of node versions to only include LTS versions (#41822)
Update the supported range of node versions for Angular to only include supported LTS versions.

PR Close #41822
2021-04-26 15:21:13 -07:00
Joey Perrott 1224726c42 fix(platform-server): update supported range of node versions to only include LTS versions (#41822)
Update the supported range of node versions for Angular to only include supported LTS versions.

PR Close #41822
2021-04-26 15:21:13 -07:00
Joey Perrott 8dd382eda5 fix(platform-browser): update supported range of node versions to only include LTS versions (#41822)
Update the supported range of node versions for Angular to only include supported LTS versions.

PR Close #41822
2021-04-26 15:21:13 -07:00
Joey Perrott f259c246a6 fix(platform-browser-dynamic): update supported range of node versions to only include LTS versions (#41822)
Update the supported range of node versions for Angular to only include supported LTS versions.

PR Close #41822
2021-04-26 15:21:13 -07:00
Joey Perrott 08ca922a68 fix(localize): update supported range of node versions to only include LTS versions (#41822)
Update the supported range of node versions for Angular to only include supported LTS versions.

PR Close #41822
2021-04-26 15:21:13 -07:00
Joey Perrott c3990b4fd4 fix(language-service): update supported range of node versions to only include LTS versions (#41822)
Update the supported range of node versions for Angular to only include supported LTS versions.

PR Close #41822
2021-04-26 15:21:13 -07:00
Joey Perrott ff4f77b0b9 fix(forms): update supported range of node versions to only include LTS versions (#41822)
Update the supported range of node versions for Angular to only include supported LTS versions.

PR Close #41822
2021-04-26 15:21:13 -07:00
Joey Perrott 2364f7c94a fix(elements): update supported range of node versions to only include LTS versions (#41822)
Update the supported range of node versions for Angular to only include supported LTS versions.

PR Close #41822
2021-04-26 15:21:13 -07:00
Joey Perrott e9952dd7f9 fix(compiler): update supported range of node versions to only include LTS versions (#41822)
Update the supported range of node versions for Angular to only include supported LTS versions.

PR Close #41822
2021-04-26 15:21:13 -07:00
Joey Perrott b9276eadae fix(compiler-cli): update supported range of node versions to only include LTS versions (#41822)
Update the supported range of node versions for Angular to only include supported LTS versions.

PR Close #41822
2021-04-26 15:21:13 -07:00
Joey Perrott bce3194f78 fix(common): update supported range of node versions to only include LTS versions (#41822)
Update the supported range of node versions for Angular to only include supported LTS versions.

PR Close #41822
2021-04-26 15:21:13 -07:00
Joey Perrott 6f0c7fb91c fix(bazel): update supported range of node versions to only include LTS versions (#41822)
Update the supported range of node versions for Angular to only include supported LTS versions.

PR Close #41822
2021-04-26 15:21:13 -07:00
Joey Perrott 8ad90475e3 fix(animations): update supported range of node versions to only include LTS versions (#41822)
Update the supported range of node versions for Angular to only include supported LTS versions.

PR Close #41822
2021-04-26 15:21:13 -07:00
Pete Bacon Darwin 4b4f565df1 docs: fix links to docs with ambiguous paths (#41788)
These docs were linking directly to docs that have ambiguous paths.
These changes ensure that these links are not affected by the
disambiguation processing of those docs.

PR Close #41788
2021-04-26 12:12:00 -07:00
Renovate Bot 9e113f9cc4 build: update to version (#41806)
PR Close #41806
2021-04-26 12:06:48 -07:00
Kristiyan Kostadinov 18b33e79d3 perf(core): avoid storing LView in __ngContext__ (#41358)
Currently we save a reference to an `LView` on most DOM nodes created by Angular either by saving
the `LView` directly in the `__ngContext__` or by saving the `LContext` which has a reference to
the `LView`. This can be a problem if the DOM node is retained in memory, because the `LView` has
references to all of the child nodes of the view, as well as other internal data structures.

Previously we tried to resolve the issue by clearing the `__ngContext__` when a node is removed
(see https://github.com/angular/angular/pull/36011), but we decided not to proceeed, because it can
slow down destruction due to a megamorphic write.

These changes aim to address the issue while reducing the performance impact by assigning a unique
ID when an `LView` is created and adding it to `__ngContext__`. All active views are tracked in
a map where their unique ID is used as the key. We don't need to worry about leaks within that map,
because `LView`s are an internal data structure and we have complete control over when they are
created and destroyed.

Fixes #41047.

PR Close #41358
2021-04-26 09:31:41 -07:00
Alan Agius 6d9e3400e1 test(service-worker): replace `global || window` with `globalThis` (#41739)
`global` property is not available in the browser, previously this was polyfilled through `core-js`. This now fails with `global is not defined`, since global cannot be accessed when not defined.

PR Close #41739
2021-04-26 09:29:59 -07:00
Alan Agius 30a24b6bf5 test: use `global` util instead of `global` property. (#41739)
`global` property is not available in the browser, previously this was polyfilled through core-js.

(cherry picked from commit 827cf41386dcd7e496e107d6b32c54281bc935f1)

PR Close #41739
2021-04-26 09:29:58 -07:00
Alan Agius 87873ed422 build: remove `core-js` in favor of `core-js-bundle` (#41739)
`core-js` is a CJS package which cannot be used directly in the browser. `core-js-bundle` is the bundled version of the package which can be used in directly in the browser.

PR Close #41739
2021-04-26 09:29:58 -07:00
Paul Gschwendtner 50713310bf build: use platform from shared dev-infra package for remote execution (#41767)
Uses the new shared RBE platform from the dev-infra package.

PR Close #41767
2021-04-23 11:01:40 -07:00
Emily Wenberg 98fc4f4b2f fix(upgrade): preserve $interval.flush when ngMocks is being used (#30229)
Also preserve any other properties that the user may have decorated
$interval with.

PR Close #30229
2021-04-23 09:44:50 -07:00
Kristiyan Kostadinov de4fafb818 refactor(core): add single type for injector token (#41580)
Currently we have a lot of places where we repeat the type `Type<T>|AbstractType<T>|InjectionToken<T>` which makes it cumbersome to add another type or to type something else with the same signature.

These changes add a new type that can be used instead.

Fixes #39792.

PR Close #41580
2021-04-22 10:47:12 -07:00
Andrew Kushnir 3ceb3dea67 refactor(core): replace loadLContext with getLContext calls (#41606)
This commit refactors the code to replace `loadLContext` with `getLContext` calls. The only difference between these two functions is that the `loadLContext` supports throwing an error in case `LContext` can not be found. The investigation performed in #41525 revealed that throwing while retrieving `LContext` might have undesirable performance implications, so we should avoid that to make sure there are no accidental perf regressions in other parts of code that used `loadLContext`. Moreover, in most of the places the `loadLContext` was already called in a mode that prevented an error from being thrown, so this refactoring should have no effect on the actual behavior.

PR Close #41606
2021-04-22 10:46:12 -07:00
Pete Bacon Darwin c3a512a9e9 fix(compiler-cli): match string indexed partial declarations (#41747)
Some partial libraries have been minified, which results in the declaration
calls being being converted from property accesses to indexed accesses.
This commit ensures that the linker can process these calls.

Fixes #41655

PR Close #41747
2021-04-22 10:43:08 -07:00
Pete Bacon Darwin 7744e1e673 fix(compiler-cli): allow linker to process minified booleans (#41747)
Some partial libraries have been minified, which results in boolean literals
being converted to `!0` and `!1`. This commit ensures that the linker can
process these values.

Fixes #41655

PR Close #41747
2021-04-22 10:43:08 -07:00
JiaLiPassion c3614662cb test(zone.js): should invoke XHR task even onload handler throw error. (#41562)
Close #41520.

This case related to the issue #41522.

```
Zone.root
  .fork({
    name: 'xhr',
    onHasTask(delegate, currentZone, zone, taskState) {
      console.log('hasMacrotask', taskState.macroTask);
      return delegate.hasTask(zone, taskState);
    },
  })
  .run(() => {
    const xhr = new XMLHttpRequest();
    xhr.open('GET', 'https://cdnjs.cloudflare.com/ajax/libs/zone.js/0.11.4/zone.min.js');
    xhr.addEventListener('load', () => {
      throw new Error();
    });
    xhr.send();
  });
```

zone.js invoke all `onload` event handlers before change the XHR task's state from
`scheduled` to `notscheduled`, so if any `onload` listener throw error, the XHR task
wlll be hang to `scheduled`, and leave the macroTask status in the zone wrongly.

This has been fixed in the previous commit, this commit add test to verify the case.

PR Close #41562
2021-04-21 15:54:08 -07:00
JiaLiPassion 008eaf3b7d fix(zone.js): should continue to executue listeners when throw error (#41562)
Close #41522

`zone.js` patches event listeners and run all event listeners together, if
one event handler throws error, the listeners afterward may not be invoked.

Reproduction:

```
export class AppComponent implements AfterViewInit {
  @ViewChild('btn') btn: ElementRef;
  title = 'event-error';

  constructor(private ngZone: NgZone) {}

  ngAfterViewInit() {
    this.ngZone.runOutsideAngular(() => {
      this.btn.nativeElement.addEventListener('click', () => {
        throw new Error('test1');
      });
      this.btn.nativeElement.addEventListener('click', () => {
        console.log('add eventlistener click');
      });
    });
  }
}
```

Until now no Angular users report this issue becuase in the `ngZone`, all
error will be caught and will not rethrow, so the event listeners afterward
will still continue to execute, but if the event handlers are outside of `ngZone`,
the error will break the execution.

This commit catch all errors, and after all event listeners finished invocation,
rethrow the errors in seperate `microTasks`, the reason I am using `microTask` here
is to handle multiple errors case.

PR Close #41562
2021-04-21 15:54:08 -07:00
Kristiyan Kostadinov 73824d5337 fix(compiler): not generating update instructions for ng-template inside alternate namespaces (#41669)
We have a check that determines whether to generate property binding instructions for an `ng-template`. The check looks at whether the tag name is exactly `ng-template`, but the problem is that if the tag is placed in a non-HTML namespace (e.g. `svg`), the tag name will actually be `:namespace:ng-template` and the check will fail.

These changes resolve the issue by looking at the tag name without the namespace.

Fixes #41308.

PR Close #41669
2021-04-20 09:44:44 -07:00
Renovate Bot c2011c0ba1 build: update semver to version 7.3.5 (#41715)
PR Close #41715
2021-04-20 09:41:57 -07:00
Renovate Bot 48b7c95e4a build: update domino to version 2.1.6 (#41666)
PR Close #41666
2021-04-20 09:38:36 -07:00
Ajit Singh 251bec159a docs: documentation of descendants property of @ContentChildren (#35927)
documentation of decendants property of @ContentChildren was not clear when decendants was set to false it did not pick up direct children when any directive was used on the elements. With Ivy the functionality follows the following pattern only query direct children (in the sense of elements in a template) when descendants: false is specified.

Fixes #20074

PR Close #35927
2021-04-19 15:57:17 -07:00
Renovate Bot ef4cf878b1 build: update google-closure-compiler to version 20210406.0.0 (#41687)
PR Close #41687
2021-04-19 14:16:14 -07:00
Andrew Kushnir d58747de8a Revert "fix(zone.js): should continue to executue listeners when throw error (#41562)" (#41707)
This reverts commit 5c48cd30b5.

Reason: that change introduces race conditions on CI.

PR Close #41707
2021-04-19 13:33:10 -07:00
Andrew Kushnir baa8c70416 Revert "test(zone.js): should invoke XHR task even onload handler throw error. (#41562)" (#41707)
This reverts commit 6910118b0d.

Reason: this change introduces race conditions on CI.

PR Close #41707
2021-04-19 13:33:10 -07:00
Renovate Bot 324d2f92da build: update shelljs to version 0.8.4 (#41673)
PR Close #41673
2021-04-19 08:52:58 -07:00
JiaLiPassion 6910118b0d test(zone.js): should invoke XHR task even onload handler throw error. (#41562)
Close #41520.

This case related to the issue #41522.

```
Zone.root
  .fork({
    name: 'xhr',
    onHasTask(delegate, currentZone, zone, taskState) {
      console.log('hasMacrotask', taskState.macroTask);
      return delegate.hasTask(zone, taskState);
    },
  })
  .run(() => {
    const xhr = new XMLHttpRequest();
    xhr.open('GET', 'https://cdnjs.cloudflare.com/ajax/libs/zone.js/0.11.4/zone.min.js');
    xhr.addEventListener('load', () => {
      throw new Error();
    });
    xhr.send();
  });
```

zone.js invoke all `onload` event handlers before change the XHR task's state from
`scheduled` to `notscheduled`, so if any `onload` listener throw error, the XHR task
wlll be hang to `scheduled`, and leave the macroTask status in the zone wrongly.

This has been fixed in the previous commit, this commit add test to verify the case.

PR Close #41562
2021-04-19 08:38:43 -07:00
JiaLiPassion 5c48cd30b5 fix(zone.js): should continue to executue listeners when throw error (#41562)
Close #41522

`zone.js` patches event listeners and run all event listeners together, if
one event handler throws error, the listeners afterward may not be invoked.

Reproduction:

```
export class AppComponent implements AfterViewInit {
  @ViewChild('btn') btn: ElementRef;
  title = 'event-error';

  constructor(private ngZone: NgZone) {}

  ngAfterViewInit() {
    this.ngZone.runOutsideAngular(() => {
      this.btn.nativeElement.addEventListener('click', () => {
        throw new Error('test1');
      });
      this.btn.nativeElement.addEventListener('click', () => {
        console.log('add eventlistener click');
      });
    });
  }
}
```

Until now no Angular users report this issue becuase in the `ngZone`, all
error will be caught and will not rethrow, so the event listeners afterward
will still continue to execute, but if the event handlers are outside of `ngZone`,
the error will break the execution.

This commit catch all errors, and after all event listeners finished invocation,
rethrow the errors in seperate `microTasks`, the reason I am using `microTask` here
is to handle multiple errors case.

PR Close #41562
2021-04-19 08:38:42 -07:00
Renovate Bot b64b6b3944 build: update mocha to version 8.3.2 (#41699)
PR Close #41699
2021-04-19 08:35:54 -07:00
Renovate Bot 6fcbda512b build: update glob to version 7.1.6 (#41667)
PR Close #41667
2021-04-19 08:24:27 -07:00
Renovate Bot cf6c5c1d2c build: update dependency-graph to version 0.11.0 (#41665)
PR Close #41665
2021-04-19 08:23:52 -07:00
Paul Gschwendtner 62e3f3279d fix(compiler): non-literal inline templates incorrectly processed in partial compilation (#41583)
Currently if a component defines a template inline, but not through a
string literal, the partial compilation references the template expression
as is. This is problematic because the component declaration can no longer
be processed by the linker later as there is no static interpretation. e.g.

```js
const myTemplate = `...`;

TestCmp.ɵcmp = i0.ɵɵngDeclareComponent({
  version: "0.0.0-PLACEHOLDER",
  type: TestCmp,
  selector: "test-cmp",
  ngImport: i0,
  template: myTemplate,
  isInline: true
});
```

To fix this, we use the the resolved template in such cases so that
the linker can process the template/component declaration as expected.

PR Close #41583
2021-04-16 09:33:05 -07:00
Paul Gschwendtner c855bf4c56 refactor(compiler): clean up template information passed for partial compilation (#41583)
With the introduction of the partial compilation, the Angular compiler's
existing `parseTemplate` method has been extended to pass through multiple
properties purely in favor of the partial compilation.

e.g. the `parseTemplate` function now accepts an "option" called `isInline`.
This option is just passed through and returned as part of the `ParsedTemplate`.

This is not ideal because the `parseTemplate` function doesn't care
whether the specified template was inline or not. This commit cleans
up the `parseTemplate` compiler function so that nothing needed only
for the partial compilation is added to it.

We introduce a new struct for additional template information that
is specific to the generation of the `declareComponent` function. With
that change, we can simplify the component decorator handler and keep
logic more local.

PR Close #41583
2021-04-16 09:33:05 -07:00
Zach Arend fe5bf7f53f fix(compiler-cli): autocomplete literal types in templates. (#41456) (#41645)
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 attempt is in
1d12c50f63 and it was reverted in 75f881e078150b0d095f2c54a916fc67a10444f6.

PR Close #41645
2021-04-16 08:54:27 -07:00
Julien Marcou 4412fcb670 build: update TypeScript to v4.2.4 (#41620)
Update TypeScript to be consistent across different packages.

PR Close #41620
2021-04-16 08:51:55 -07:00
Kristiyan Kostadinov 1aebf165db 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:05 -07:00
jeripeierSBB a99aa29040 fix(animations): allow animations on elements in the shadow DOM (#40134)
When determining whether to run an animation, the `TransitionAnimationPlayer`
checks to see if a DOM element is attached to the document. This is done by
checking to see if the element is "contained" by the document body node.

Previously, if the element was inside a shadow DOM, the engine would
determine that the element was not attached, even if the shadow DOM's
host was attached to the document. This commit updates the `containsElement()`
method on `AnimationDriver` implementations to also include shadow DOM
elements as being contained if their shadow host element is contained.

Further, when using CSS keyframes to trigger animations, the styling
was always added to the `head` element of the document, even for
animations on elements within a shadow DOM. This meant that those
elements never receive those styles and the animation would not run.
This commit updates the insertion of these styles so that they are added,
to the element's "root node", which is the nearest shadow DOM host, or the
`head` of the document if the element is not in a shadow DOM.

Closes #25672

PR Close #40134
2021-04-15 12:45:52 -07:00
Dmitrij Kuba 6bceb709df 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:32:59 -07:00
Alan Agius 5332a4a919 refactor: update `$schema` and `id` keywords (#41574)
In Angular CLI version 12, JSON Schema `draft-04` will no longer be supported. Therefore `id` will need to be updated to `$id`.

- We replace id with $id, this no longer valid in draft-07.
- Replace all $schemas to http://json-schema.org/draft-07/schema, this is needed to "pin" the schema to draft-07.

More information about this draft can be found https://json-schema.org/draft-07/json-schema-release-notes.html

PR Close #41574
2021-04-14 18:50:32 -07:00
Martin Sikora 0d55d4557f 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:26 -07:00
Kristiyan Kostadinov dde81ba0cd perf(compiler): reduce amount of generated code for safe accesses and nullish coalescing (#41563)
This is follow-up from #41437 and it reduces the amount of code we generate for safe property accesses (`a?.b`) and nullish coalescing (`a ?? b`) by:
1. Reusing variables in nested nullish coalescing expressions.
2. Not initializing temporary variables to `null`. The way our code is generated means that the value will always be overwritten before we compare against it so the initializer didn't really matter.

Fixes #41491.

PR Close #41563
2021-04-14 15:48:21 -07:00
Andrew Scott a1b2718b92 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:07 -07:00
Charles Lyding 1b43158af6 fix(compiler-cli): do not error with prepocessing if component has no inline styles (#41602)
The asynchronous preprocessing check was not accounting for components that did not have any inline styles. In that case, the cache did not have an entry which then allowed the asynchronous check to run and fail the compilation. The caching during the asynchronous analysis phase now handles components without inline styles.

PR Close #41602
2021-04-14 15:46:21 -07:00
Renovate Bot 1043aa42ad build: update typescript to version 4.2.4 (#41618)
PR Close #41618
2021-04-14 15:44:17 -07:00
Pete Bacon Darwin 3923201f95 refactor(compiler-cli): change how partial-linkers are matched to declaration versions (#41578)
Previously, it was not possible to block a partial-linker from trying to
process a declaration that was defined in a newer version of Angular than
that of the partial-linker. For example, if a partial-linker was published as
part of version 12.0.0, there was no way for a partially-compiled declaration
compiled via version 13.0.0 to tell the 12.0.0 linker that it would be invalid
to attempt to process it.

This commit adds a new `minVersion` property to partial-declarations, which is
interpreted as the "minimum partial-linker version" that can process this
declaration. When selecting a partial-linker for such a declaration, the known
linker version ranges are checked to find the most recent linker whose version
range has an overlap with the interpreted declaration range.

This approach allows us to set a minimum version for a declaration, which
can inform an old partial-linker that will it not be able to accurately
process the declaration.

Note that any pre-release part to versions are ignored in this selection
process.

The file-linker can be configured, via the `unknownDeclarationVersionHandling`
property of `LinkerOptions`, to handle such a situation in one of three ways:

- `error` - the version mismatch is a fatal error
- `warn` - a warning is sent to the logger but the most recent partial-linker
  will attempt to process the declaration anyway.
- `ignore` - the most recent partial-linker will, silently, attempt to process
  the declaration.

The default is to throw an error.

Closes #41497

PR Close #41578
2021-04-14 11:00:40 -07:00
Alan Agius 5a8bc1bfe1 build: `ng_package` no longer generate minified UMDs (#41425)
In version 12, applications will only be allowed to be built in Ivy, this makes the minified UMDs redundant since they cannot be processed by NGCC.

With this change, we remove the minified UMDs from the generated APF package.

BREAKING CHANGE:  Minified UMD bundles are no longer included in the distributed NPM packages.

PR Close #41425
2021-04-14 10:43:08 -07:00
Joey Perrott beafa22de9 feat(upgrade): update supported range of node versions (#41544)
Update the supported range of node versions for Angular.  Angular now
supports node >=12.14.1 to <16.0.0, dropping support for Node v10.

PR Close #41544
2021-04-14 09:40:18 -07:00
Joey Perrott fc597f1db5 feat(service-worker): update supported range of node versions (#41544)
Update the supported range of node versions for Angular.  Angular now
supports node >=12.14.1 to <16.0.0, dropping support for Node v10.

PR Close #41544
2021-04-14 09:40:18 -07:00
Joey Perrott c30b171d20 feat(router): update supported range of node versions (#41544)
Update the supported range of node versions for Angular.  Angular now
supports node >=12.14.1 to <16.0.0, dropping support for Node v10.

PR Close #41544
2021-04-14 09:40:18 -07:00
Joey Perrott c901b4d11f feat(platform-server): update supported range of node versions (#41544)
Update the supported range of node versions for Angular.  Angular now
supports node >=12.14.1 to <16.0.0, dropping support for Node v10.

PR Close #41544
2021-04-14 09:40:18 -07:00
Joey Perrott ef0d1c3545 feat(platform-browser): update supported range of node versions (#41544)
Update the supported range of node versions for Angular.  Angular now
supports node >=12.14.1 to <16.0.0, dropping support for Node v10.

PR Close #41544
2021-04-14 09:40:18 -07:00
Joey Perrott b714f7b931 feat(platform-browser-dynamic): update supported range of node versions (#41544)
Update the supported range of node versions for Angular.  Angular now
supports node >=12.14.1 to <16.0.0, dropping support for Node v10.

PR Close #41544
2021-04-14 09:40:18 -07:00
Joey Perrott 590d4dd578 feat(localize): update supported range of node versions (#41544)
Update the supported range of node versions for Angular.  Angular now
supports node >=12.14.1 to <16.0.0, dropping support for Node v10.

PR Close #41544
2021-04-14 09:40:18 -07:00
Joey Perrott 86621bec58 feat(language-service): update supported range of node versions (#41544)
Update the supported range of node versions for Angular.  Angular now
supports node >=12.14.1 to <16.0.0, dropping support for Node v10.

PR Close #41544
2021-04-14 09:40:18 -07:00
Joey Perrott a0006a6bfb feat(forms): update supported range of node versions (#41544)
Update the supported range of node versions for Angular.  Angular now
supports node >=12.14.1 to <16.0.0, dropping support for Node v10.

PR Close #41544
2021-04-14 09:40:18 -07:00
Joey Perrott 12fc08bf9c feat(elements): update supported range of node versions (#41544)
Update the supported range of node versions for Angular.  Angular now
supports node >=12.14.1 to <16.0.0, dropping support for Node v10.

PR Close #41544
2021-04-14 09:40:18 -07:00
Joey Perrott 75cc8133ad feat(compiler): update supported range of node versions (#41544)
Update the supported range of node versions for Angular.  Angular now
supports node >=12.14.1 to <16.0.0, dropping support for Node v10.

PR Close #41544
2021-04-14 09:40:18 -07:00
Joey Perrott b7bd23817e feat(compiler-cli): update supported range of node versions (#41544)
Update the supported range of node versions for Angular.  Angular now
supports node >=12.14.1 to <16.0.0, dropping support for Node v10.

PR Close #41544
2021-04-14 09:40:18 -07:00
Joey Perrott e0250e567a feat(common): update supported range of node versions (#41544)
Update the supported range of node versions for Angular.  Angular now
supports node >=12.14.1 to <16.0.0, dropping support for Node v10.

PR Close #41544
2021-04-14 09:40:18 -07:00
Joey Perrott d583d926db feat(bazel): update supported range of node versions (#41544)
Update the supported range of node versions for Angular.  Angular now
supports node >=12.14.1 to <16.0.0, dropping support for Node v10.

PR Close #41544
2021-04-14 09:40:17 -07:00