Commit graph

29561 commits

Author SHA1 Message Date
Joey Perrott
7a48c159f2 build: update to latest @angular/dev-infra-private to address issues related to verifying environment (#44137)
Update to the latest package which properly checks if the running version of ng-dev is the version
described in yarn lock.

PR Close #44137
2021-11-10 23:38:34 +00:00
Andrew Kushnir
16326058bf refactor(core): format recently updated file to comply the lint rules (#44136)
This commit updates a file that was changed recently, but that change triggered the `lint` CI job to fail, since the lint rules were slightly changed.

PR Close #44136
2021-11-10 23:36:56 +00:00
dario-piotrowicz
0bd01ca64a refactor(core): move outdated comment to view.ts (#44099)
remove the comment suggesting to use a const enum for ViewEncapsulation in
the renderer3/definitions.ts file and add a similar comment in the
view.ts file in which the enum is defined

Note: the new comment does not contain the suggestion of changing `None`
to `0` as it is unclear what benefits that would bring (for more info
see: https://github.com/angular/angular/pull/44099#discussion_r744157686)

PR Close #44099
2021-11-10 20:42:19 +00:00
Renovate Bot
4809bbd83c build: update angular (#44074)
PR Close #44074
2021-11-10 20:41:38 +00:00
ileil
790dfe5e25 docs: update review tag to topic (#44008)
PR Close #44008
2021-11-10 19:29:13 +00:00
Pete Bacon Darwin
393efa54e6 fix(compiler): ensure that partially compiled queries can handle forward references (#44113)
When a partially compiled component or directive is "linked" in JIT mode, the body
of its declaration is evaluated by the JavaScript runtime. If a class is referenced
in a query (e.g. `ViewQuery` or `ContentQuery`) but its definition is later in the
file, then the reference must be wrapped in a `forwardRef()` call.

Previously, query predicates were not wrapped correctly in partial declarations
causing the code to crash at runtime. In AOT mode, this code is never evaluated
but instead transformed as part of the build, so this bug did not become apparent
until Angular Material started running JIT mode tests on its distributable output.

This change fixes this problem by noting when queries are wrapped in `forwardRef()`
calls and ensuring that this gets passed through to partial compilation declarations
and then suitably stripped during linking.

See https://github.com/angular/components/pull/23882 and https://github.com/angular/components/issues/23907

PR Close #44113
2021-11-10 18:25:16 +00:00
Pete Bacon Darwin
67fbec39cb refactor(compiler): rename R3ProviderExpression and associated helpers (#44113)
This interface will be used in other situations so this change renames it to be more general as `MaybeForwardRefExpression`.

PR Close #44113
2021-11-10 18:25:16 +00:00
Renovate Bot
89aa94b7a2 build: lock file maintenance (#44111)
PR Close #44111
2021-11-10 18:22:57 +00:00
Pete Bacon Darwin
18cc7c8b04 test(compiler): remove IE11 match in JIT compiler tests (#44122)
Since we no longer support (nor test on) IE11 we can remove these matches
for `anonymous` functions.

PR Close #44122
2021-11-10 17:37:24 +00:00
Pavan Kumar Jadda
ac7d5faf5f docs: updates typescript configuration file links (#44131)
The links for `tsconfig.json` target and module sections no longer valid. This commit updates the document with correct links
PR Close #44131
2021-11-10 17:37:02 +00:00
AleksanderBodurri
88d52c0ac8 build(devtools): create custom no sandbox chrome browser rule
Previously, running tests in CI with the chromium-local browser would cause the following error "Running as root without --no-sandbox is not supported".

Now the karma test suites run in a custom no sandbox browser.
2021-11-10 12:30:54 -05:00
AleksanderBodurri
64942d3ed9 fix(devtools): add d3 and semver dsl umd modules to karma tests for ng-devtools and ng-devtools-backend
These modules are necessary because concatjs_devserver needs named amd/umd modules (https://bazelbuild.github.io/rules_nodejs/Concatjs.htmlrangle/angular-devtools#third-party-code)
2021-11-10 12:30:54 -05:00
AleksanderBodurri
0fe26a646e build(devtools): migrate shell-chrome to bazel
Allows shell-chrome to be built with bazel. Currently this is built in production mode with terser minified code and the appropriate manifest and content script files to make the chrome extension work properly.
2021-11-10 12:30:54 -05:00
AleksanderBodurri
cc21a34e9f build(devtools): migrate demo app to bazel
Allows the demo app to be builtmwith bazel and a dev server started with `yarn start`.
2021-11-10 12:30:54 -05:00
AleksanderBodurri
e60276f640 build(devtools): migrate ng-devtools library to bazel
Allows the ng-devtools library to be built with bazel. ng-devtools can now be used as a dependency in other bazel build rules.
2021-11-10 12:30:54 -05:00
AleksanderBodurri
9efd86e4f1 build(devtools): migrate ng-devtools-backend to bazel
Allows the ng-devtools-backend to be built with bazel. Allows ng-devtools-backend to be used as a dependency in other bazel build rules.
2021-11-10 12:30:54 -05:00
AleksanderBodurri
bd6d18d4b5 build(devtools): migrate demo-no-zone to be built with bazel and allow it to be served with concatjs_devserver
Allows the demo-no-zone application to be built with bazel and a devserver run with `bazel run projects/demo-no-zone/src:devserver`
2021-11-10 12:30:54 -05:00
AleksanderBodurri
3556129afe build(devtools): create bazel build rules for shared-utils and the protocol library
Allows shared-utils and protocol to be built with `bazel build projects/shared-utils` and `bazel build projects/protocol`. This lays down the necessary ground work to include these libraries as dependencies in other bazel build rules.
2021-11-10 12:30:54 -05:00
AleksanderBodurri
41ce9dc7d5 build(devtools): set up bazel and bazel tooling
Marks the beginning of a migration over to building Angular devtools with Bazel. This commit brings in tooling from the canonical angular bazel example repository and includes the necessary dependencies in the package.json
2021-11-10 12:30:52 -05:00
Pei Wang
7ac2a8cd67 ci: Windows support for tsec_test. (#43924)
Contents of generated tsconfig for tsec_test now depend on whether
Bazel uses symlinked runfiles for nodejs_test. The current
implementation assumes that symlinked runfiles are not available
on Windows.

PR Close #43924
2021-11-10 04:36:48 +00:00
raman
236bdff831 fix(platform-browser): use correct parent in animation removeChild callback (#44033)
Animation's `onRemovalComplete` callback is using incorrect `parentNode`.
Should be parentNode provided by `delegate.parentNode(element)` instead of direct `element.parentNode`.
This is not a problem with default renderer but can cause problems with custom renderer if it uses another
logic to add/remove nodes.

Fixes #44023

PR Close #44033
2021-11-10 01:21:56 +00:00
Andrew Scott
670cd10e30 refactor(language-service): Move language service code out of ivy/ folder (#44064)
This commit moves code in the language service package out of the ivy
subfolder. Ivy is the _only_ engine supported in v13+ so there's no need
to have a name for it.

PR Close #44064
2021-11-10 01:20:04 +00:00
Andrew Scott
4738569220 refactor(language-service): Remove View Engine code from language service package (#44064)
This commit removes ViewEngine-specific code from the langauge service
package. This code is no longer used since VE is not supported in v13+.

PR Close #44064
2021-11-10 01:20:04 +00:00
Renovate Bot
891318e805 build: update all non-major dependencies (#43974)
PR Close #43974
2021-11-09 21:00:17 +00:00
Kristiyan Kostadinov
247c18dee0 fix(compiler-cli): handle pre-release versions when checking version (#44109)
Currently the TS version checking function interprets a version like `1.2.3-rc.5` as `1.2.NaN` which would allow it to bypass the version checking altogether.

These changes add a little bit more logic to ensure that such versions are handled correctly. There's also an error if we don't manage to parse the version string.

Also it seemed like we never actually ran the version check unit tests, because they didn't have a test target.

PR Close #44109
2021-11-09 20:54:45 +00:00
kreuzerk
93b314d5d2 docs: including additional assets into libraries (#44076)
PR Close #44076
2021-11-09 20:54:21 +00:00
mgechev
d22bf7fa1d release(devtools): v1.0.4 2021-11-09 12:37:58 -08:00
mgechev
cc386b74b5 build(devtools): add .angular to gitignore 2021-11-09 12:36:12 -08:00
Renovate Bot
34b4bd7d6c build(devtools): update angular-cli to 7c4c781 2021-11-09 12:32:41 -08:00
Pete Bacon Darwin
28ef5af03f refactor(ngcc): improve logging of progress (#43996)
This commit adds additional information to encourage developers to contact
the author of View Engine libraries and ask them to update to partial Ivy.

Fixes #42308

PR Close #43996
2021-11-09 18:10:18 +00:00
George Kalpakas
74345f34ae build(docs-infra): remove unnecessary work-around for SW config generation (#44114)
Since angular.io is now updated to a version that includes the fix
from #43679, the work-around added in
841c5aebbf can now be removed.

PR Close #44114
2021-11-09 18:08:20 +00:00
mgechev
cd91b2cc27 release(devtools): v1.0.3 2021-11-09 10:08:07 -08:00
Paul Gschwendtner
26fc12e6f3 ci: instruct renovate to apply patch label to avoid divergence with other version branches (#44065)
Renovate currently always applies the minor label. This often causes
the patch/FF/RC branches to quickly diverge. We should always apply
the patch label with the goal of keeping infra-related changes in sync
as much as possible.. Then it is still possible to selectively apply the
minor/major label if needed (this forces the reviewer to actually think
about where this should go in, if it fails!).

PR Close #44065
2021-11-09 18:08:00 +00:00
Renovate Bot
b0d09a715a build(devtools): update angular-framework to e814a61 2021-11-09 10:05:04 -08:00
mgechev
ff78c66ae9 fix(devtools): handle ngFor and ngIf contexts in the profiler
Currently, we skip the time spent in evaluation of embedded view
templates because the passed context is either an NgIf or an NgForOf.

This change generalizes the implementation to work with views embedded
into a component.
2021-11-09 10:04:12 -08:00
dario-piotrowicz
c3b583864e fix(docs-infra): prevent automatic linking of 'number' (#44000)
add 'number' to the ignoreGenericWords set so that it doesn't get
wrongly linked to the decimalPipe during the aio docs generation
as it is a generic typescript term

PR Close #44000
2021-11-09 18:03:39 +00:00
dario-piotrowicz
0ae4187566 refactor(docs-infra): remove eslint directive comments from examples (#43831)
Linting has recently been removed from the examples provided in angular.io
(see PRs #43592 and #43746) such removal effects the downloadable and
stackblitz examples but linting is still generally used in the examples
in the aio project itself (they are being migrated from tslint to eslint in
PR #43218) thus eslint directive comments are still necessary in the code itself.

So the comments need to be present but need not to be exposed to the users
(not in the zips, stackblitzes nor docs themselves), these changes are
removing such comments during the examples' parsing phase (effectively
removing them from all three sources mentioned above).

Original discussion: https://github.com/angular/angular/pull/43218#discussion_r697305494

resolves #43788

PR Close #43831
2021-11-09 18:02:33 +00:00
JoostK
4f8eaac7ff fix(core): do not use Function constructors in development mode to avoid CSP violations (#43587)
This commit removes the dynamic creation of named arrays for internal
runtime storage arrays as they may cause CSP violations in development
mode,  when an application's CSP configuration does not include
`unsafe-eval`.

Named arrays for view data can still be enabled in development mode
using the `ngDevMode=namedConstructors` query parameter when loading the
application.

The usage of native class syntax for named arrays does not have the
desired effect when the code is downleveled to ES5. Since ES5 targets
are becoming increasingly more rare this is considered less of a problem
than the CSP violation.

Fixes #43494

PR Close #43587
2021-11-09 18:02:13 +00:00
profanis
50ed778921 docs(animations): express the seconds in numbers (#40098)
I've noticed that the seconds are expressed both by using numbers and words.
For example, the doc says `0.5 second` and not `half second`.
I believe is more readable to express them by using numbers and is consistent too.

PR Close #40098
2021-11-09 18:01:46 +00:00
JoostK
2a2744721b fix(compiler-cli): ensure literal types are retained when strictNullInputTypes is disabled (#38305)
Consider the `NgModel` directive which has the `ngModelOptions` input:

```ts
class NgModel {
  @Input() ngModelOptions: { updateOn: 'blur'|'change'|'submit' };
}
```

In a template this may be set using an object literal as follows:

```html
<input ngModel [ngModelOptions]="{updateOn: 'blur'}">
```

This assignment should be accepted, as the object's type aligns with the
`ngModelOptions` input in `NgModel`. However, if the `strictNullInputTypes`
option is disabled this assignment would inadvertently produce an error:

```
Type '{ updateOn: string; }' is not assignable to type '{ updateOn: "blur"|"change"|"submit"; }'.
  Types of property 'updateOn' are incompatible.
    Type 'string' is not assignable to type '"blur"|"change"|"submit"'
```

This is due to the `'blur'` value being inferred to be of type `string`
instead of retaining its literal type. The non-null assertion operator
that is automatically inserted for input binding assignments when
`strictNullInputTypes` is disabled inhibits TypeScript from inferring
the string value as its literal type.

This commit fixes the issue by omitting the insertion of the non-null
operator for object literals and array literals.

PR Close #38305
2021-11-09 18:01:24 +00:00
Joey Perrott
491dd3dcee refactor(compiler-cli): use relative imports within the @angular/compiler-cli package (#44118)
Intrapackage imports should always be done via relative imports rather than using the external
import location.

PR Close #44118
2021-11-08 22:08:27 +00:00
Joey Perrott
161cf92814 refactor(compiler): reverse testing of ternary operator to ensure typescript properly narrows types (#44089)
By checking if the providedIn is a function instead of everything but a function, typescript properly
narrows the typings for creating the expressions.

PR Close #44089
2021-11-08 21:30:34 +00:00
Pete Bacon Darwin
b39fd5fe50 docs: update getting started tutorial to use StackBlitz web-containers (#44085)
Previous commits changed the docs to use web-container versions for StackBlitz examples.
This commit updates the content of the tutorial to match.

Fixes #44079

PR Close #44085
2021-11-08 18:12:16 +00:00
Pete Bacon Darwin
dc7e5a1e01 build(docs-infra): remove link to custom Stackblitz for running tests (#44085)
Previously there was a custom version of the testing app for Stackblitz that would run the tests in the browser.
With the web-container approach, this is no longer necessary since the tests can be run directly from the command line.

Fixes #44047

PR Close #44085
2021-11-08 18:12:16 +00:00
Pete Bacon Darwin
9759799f63 build(docs-infra): ensure necessary boilerplate files appear in Stackblitz examples (#44085)
The `tsconfig.app.json` and similar were not appearing in the generated Stackblitz examples.

PR Close #44085
2021-11-08 18:12:16 +00:00
Pete Bacon Darwin
b4ecc158de build(docs-infra): remove unused code (#44085)
This import was not being used and so it is redundant and can be removed.

PR Close #44085
2021-11-08 18:12:16 +00:00
JoostK
b249e24979 fix(compiler): generate correct code for safe method calls (#44088)
When a safe method call such as `person?.getName()` is used, the
compiler would generate invalid code if the argument list also contained
a safe method call. For example, the following code:

```
person?.getName(config?.get('title').enabled)
```

would generate

```
let tmp;
ctx.person == null ? null : ctx.person.getName((tmp = tmp) == null ?
null : tmp.enabled)
```

Notice how the call to `config.get('title')` has completely disappeared,
with `(tmp = tmp)` having taken its place.

The issue occurred due to how the argument list would be converted
from expression AST to output AST twice. First, the outer safe method
call would first convert its arguments list. This resulted in a
temporary being allocated for `config.get('title')`, which was stored in
the internal `_resultMap`. Only after the argument list has been
converted would the outer safe method call realize that it should be
guarded by a safe access of `person`, entering the `convertSafeAccess`
procedure to convert itself. This would convert the argument list once
again, but this time the `_resultMap` would already contain the
temporary `tmp` for `config?.get('title')`. Consequently, the safe
method in the argument list would be emitted as `tmp`.

This commit fixes the issue by ensuring that nodes are only converted
once.

Closes #44069

PR Close #44088
2021-11-08 17:31:36 +00:00
Pete Bacon Darwin
49964c89e6 docs: add Angular 13 support information (#44098)
Closes #44097

PR Close #44098
2021-11-08 17:03:58 +00:00
Michael Urban
baab456e56 docs(animations): update developers on state of package (#44014)
Notify developers that @angular/animations package has been "significantly de-prioritized"

`animateChild` documentation now references #30477

References #30477# Please enter the commit message for your changes. Lines starting

PR Close #44014
2021-11-08 17:03:28 +00:00
George Kalpakas
37e02750a7 build(docs-infra): fix SystemJS-based docs examples (#43868)
Previously, the SystemJS-based docs examples (typically `ngUpgrade`
examples) were not compatible with Angular v13 (due to the removal of
UMD bundles from the published packages).

This commit makes the examples compatible with Angular v13 and
re-enables the tests for all SystemJS-based examples on CI.

PR Close #43868
2021-11-08 17:01:16 +00:00