Commit graph

24081 commits

Author SHA1 Message Date
George Kalpakas
0dca774cf2 build(docs-infra): upgrade cli command docs sources to c0a0bfb65 (#45408)
Updating [angular#master](https://github.com/angular/angular/tree/master) from
[cli-builds#master](https://github.com/angular/cli-builds/tree/master).

##
Relevant changes in
[commit range](bff1908b4...c0a0bfb65):

**Modified**
- help/add.json

PR Close #45408
2022-03-24 10:50:19 -07:00
Alan Agius
fc97499676 build(docs-infra): remove defaultProject workspace option (#45410)
The `defaultProject` workspace option has been deprecated. The project to use will be determined from the current working directory.

See: https://github.com/angular/angular-cli/pull/22852

PR Close #45410
2022-03-24 10:49:57 -07:00
Alan Agius
5ff459e700 test: remove defaultProject workspace option (#45410)
The `defaultProject` workspace option has been deprecated. The project to use will be determined from the current working directory.

See: https://github.com/angular/angular-cli/pull/22852

PR Close #45410
2022-03-24 10:49:57 -07:00
Mike
85782e607d docs(router): Fix typo on segments (#45411)
PR Close #45411
2022-03-24 10:49:35 -07:00
Dylan Hunn
fe0e42a996 fix(forms): Make UntypedFormBuilder assignable to FormBuilder, and vice versa. (#45421)
There was a subtle bug involving the opt-out class for FormBuilder, which I discovered during the ongoing migration. The types must be structurally the same, because people pass around FormBuilders, in addition to passing around the controls they produce. This PR ensures FormBuilder and UntypedFormBuilder are assignable to each other.

PR Close #45421
2022-03-24 10:49:10 -07:00
Joey Perrott
38ad849d98 fix(docs-infra): prevent framing of AIO with X-Frame-Options (#45419)
Prevent the docs site from being place in an iframe.

PR Close #45419
2022-03-23 12:20:49 -07:00
Alex Rickabaugh
8155428ba6 perf(compiler-cli): ignore the module.id anti-pattern for NgModule ids (#45024)
In early versions of Angular, it was sometimes necessary to provide a
`moduleId` to `@Component` metadata, and the common pattern for doing this
was to set `moduleId: module.id`. This relied on the bundler to fill in a
value for `module.id`.

However, due to the superficial similarity between `Component.moduleId` and
`NgModule.id`, many users ended up setting `id: module.id` in their
NgModules. This is an anti-pattern that has a few negative effects,
including preventing the NgModule from tree-shaking properly.

This commit changes the compiler to ignore `id: module.id` in NgModules, and
instead provide a warning which suggests removing the line entirely.

PR Close #45024
2022-03-22 11:11:54 -07:00
Alex Rickabaugh
34c5b7a499 refactor(compiler-cli): support non-error diagnostics from traits (#45024)
Previously, the `TraitCompiler` would naively consider a compilation as
failed if either analysis or resolution produced any diagnostics. This
commit adjusts the logic to only consider error diagnostics, which allows
warnings to be produced from `DecoratorHandler`s.

This is a precursor commit to introducing such a warning. As such, the
logic here will be tested in the next commit.

PR Close #45024
2022-03-22 11:11:53 -07:00
Alex Rickabaugh
27b4af7240 fix(compiler-cli): full side-effectful registration of NgModules with ids (#45024)
Angular contains an NgModule registry, which allows a user to declare
NgModules with string ids and retrieve them via those ids, using the
`getNgModuleById` API.

Previously, we attempted to structure this registration in a clever fashion
to allow for tree-shaking of registered NgModules (that is, those with ids).
This sort of worked due to the accidental alignment of behaviors from the
different tree-shakers involved. However, this trick relies on the
generation of `.ngfactory` files and how they're specifically processed in
various bundling scenarios. We intend to remove `.ngfactory` files, hence
we can no longer rely on them in this way.

The correct solution here is to recognize that `@NgModule({id})` is
inherently declaring a global side-effect, and such classes should not
really be eligible for tree-shaking in the first place. This commit removes
all the old registration machinery, and standardizes on generating a side-
effectful call to `registerNgModuleType` for NgModules that have ids.

There is some risk here that NgModules with unnecessary `id`s may not
tree-shake as a result of this change, whereas they would have in previous
circumstances. The fix here should be to remove the `id` if it's not needed.
Specifying an `id` is a request that the NgModule be retained regardless of
any other references, in case it is later looked up by string id.

PR Close #45024
2022-03-22 11:11:53 -07:00
Alex Rickabaugh
e57b4105ac refactor(compiler-cli): linker honors associated statements for a field (#45024)
When `@angular/compiler` processes metadata and compiles a definition field,
it might also choose to return statements that are associated with that
definition, and should be included after the type being compiled. Currently,
the linker ignores these statements, as there are none generated that are
relevant in the linking operation.

A challenge to supporting such associated statements is that the linker
operates on "declare" expressions, and replaces those expressions with other
expressions. It does not have the capability to append statements after the
whole type. The linker actually faces this challenge with statements from
the `ConstantPool` as well, and solves this problem by generating an IIFE
expression that executes the statements and then returns the definition
expression.

Previously, an `EmitScope` processed the definition and converted it to an
expression, as well as collected constant statements from a `ConstantPool`.
A special `IifeEmitScope` implementation was used when emitting into a
context where top-level constant statements couldn't be added at all, and
uses the IIFE strategy in this case.

This commit adds blanket support for associated statements to the linker
using this IIFE strategy. The main `EmitScope` now uses the IIFE strategy to
emit associated statements, and `IifeEmitScope` has been renamed to
`LocalEmitScope`. Now, the `LocalEmitScope` represents constant statements
as associated statements to the main `EmitScope` implementation, so they
get included in the IIFE as well.

Tests are adjusted/added to cover this new behavior. This is a refactoring
commit because no live generated code is affected - there are no cases where
associated statements are present in linked definitions today.

PR Close #45024
2022-03-22 11:11:53 -07:00
Alex Rickabaugh
72e7d09e61 refactor(compiler): change NgModule scoping emit flag to enum (#45024)
The `compileNgModule` operation previously supported a flag `emitInline`,
which controlled whether template scoping information for the NgModule was
emitted directly into the compiled NgModule definition, or whether an
associated statement was generated which patched the information onto the
NgModule definition. Both options are useful in different contexts.

This commit changes this flag to an enum (and renames it), which allows for
a third option - do not emit any template scoping information. This option
is added to better represent the actual behavior of the Angular Linker,
which sometimes configures `compileNgModule` to use the side-effectful
statement generation but which does not actually emit such associated
statements. In other words, the linker effectively does not generate
scoping information for NgModules at all (in some configurations) and this
option more directly expresses that behavior.

This is a refactoring as no generated code is changed as a result of
introducing this flag, due to the linker's behavior of not emitting
associated statements.

PR Close #45024
2022-03-22 11:11:53 -07:00
Renovate Bot
9d8ff5d022 build: update dependency @types/chrome to ^0.0.180 (#45357)
PR Close #45357
2022-03-21 16:59:56 -07:00
George Kalpakas
650715062d build(docs-infra): upgrade cli command docs sources to bff1908b4 (#45395)
Updating [angular#master](https://github.com/angular/angular/tree/master) from
[cli-builds#master](https://github.com/angular/cli-builds/tree/master).

##
Relevant changes in
[commit range](a517160a2...bff1908b4):

**Added**
- help/cache.json

**Modified**
- help/add.json
- help/analytics.json
- help/build.json
- help/config.json
- help/deploy.json
- help/doc.json
- help/e2e.json
- help/extract-i18n.json
- help/generate.json
- help/lint.json
- help/new.json
- help/run.json
- help/serve.json
- help/test.json
- help/update.json
- help/version.json

##
Relevant changes in
[commit range](207de70b7...bff1908b4) since PR #45385:

**Added**
- help/cache.json

**Modified**
- help/config.json

##
Closes #45330
Closes #45346
Closes #45361
Closes #45385

PR Close #45395
2022-03-21 16:58:00 -07:00
Ben Brook
15dbb4dc7d docs(docs-infra): fix TypeScript casing (#45307)
PR Close #45307
2022-03-21 16:57:11 -07:00
Alan Agius
b716a81e30 docs: replace defaultCollection with schematicCollections (#45406)
`defaultCollection` has deprecated in favor of `schematicCollections`.

Related to https://github.com/angular/angular-cli/pull/22860

PR Close #45406
2022-03-21 16:56:10 -07:00
Paul Gschwendtner
e80df0d149 build: update to bazel v5 for new runfiles API used in dev-infra (#45407)
https://blog.bazel.build/2022/01/19/bazel-5.0.html#starlark-build-language

PR Close #45407
2022-03-21 16:55:36 -07:00
JoostK
fffa023803 fix(compiler): scope css rules within @layer blocks (#45396)
This commit starts scoping CSS rules nested within `@layer` blocks.

Fixes #45389

PR Close #45396
2022-03-21 14:51:45 -07:00
Alan Agius
aec9abd374 fix(docs-infra): don't wrap subcommands in code element (#45343)
With this change we no longer wrap subcommands titles and sub navigation items in code element for nicer UI

PR Close #45343
2022-03-21 14:49:27 -07:00
Dylan Hunn
c26915c8cf refactor(core): Make the typed forms migration apply to all usages of the symbols. (#45311)
Previously, the migration only migrated constructor calls. Now, the migration will rewrite every usage, in all contexts. Both ways are technically correct, but migrating all symbols is likely to produce clearer and more readable results.

PR Close #45311
2022-03-21 14:40:59 -07:00
dario-piotrowicz
79d334b138 feat(animations): provide warnings for non-animatable CSS properties (#45212)
warn developers when they are trying to animate non-animatable CSS
properties so that can more easily understand why something is not being
animated as they would expect it to

resolves #27577

PR Close #45212
2022-03-21 14:33:19 -07:00
Joey Perrott
a049840e0d build(docs-infra): move to circleci v2 api for aio-builds (#45349)
Move to the CircleCI v2 api as the authentication fails for downloading artifacts using the v1 methods.

CircleCI v2 api now requires authentication to occur view the headers instead of being done in a
query parameter, all of the CircleCI interactions are now performed through one fetchFromCircleCi method
which ensures the token is provided in the headers as expected.

PR Close #45349
2022-03-17 14:03:26 -07:00
Kristiyan Kostadinov
2a75754ee8 fix(animations): apply default params when resolved value is null or undefined (#45339)
The animations package supports adding default parameter values to an animation that will be used as a fallback if some parameters aren't defined. The problem is that they're applied using a spread expression which means that any own property of the animation parameters will override the defaults, even if it resolves to null or undefined. This can lead to obscure errors like "Cannot read property toString of undefined" for an animation that looks like `{params: {foo: undefined}}` with defaults `{foo: 123}`.

I ran into this issue while debugging some test failures on Material.

These changes address the issue by:
1. Applying the defaults if the resolved value is null or undefined.
2. Updating the validation function to use a null check instead of `hasOwnProperty`.

PR Close #45339
2022-03-17 14:02:37 -07:00
AlirezaEbrahimkhani
59a5b54c23 docs: add how to access the resolved data (#45345)
complete resolver example and add how to access the resolved data in component

resolves angular#45313

PR Close #45345
2022-03-16 15:05:24 -07:00
Renovate Bot
9d5ad672b4 build: lock file maintenance (#45341)
PR Close #45341
2022-03-16 14:36:28 -07:00
Andrew Scott
2b6749f5a0
release: cut the v14.0.0-next.7 release (#45368) 2022-03-16 12:41:35 -07:00
Andrew Scott
34c48a3f9a
docs: release notes for the v13.3.0 release (#45366) 2022-03-16 12:27:54 -07:00
Andrew Scott
306fb5e3b1
docs: release notes for the v13.2.7 release (#45364) 2022-03-16 11:35:43 -07:00
Renovate Bot
3ad033c3fb build: update github/codeql-action action to v1.1.5 (#45358)
PR Close #45358
2022-03-16 11:21:45 -07:00
why520crazy
e47ba49b5f docs: add ngx-gantt to "EXPLORE ANGULAR RESOURCES" page (#45351)
PR Close #45351
2022-03-15 16:29:23 -07:00
Amer Yousuf
9db9091349 fix(forms): improve error message for invalid value accessors (#45192)
improve error message for invalid value accessors when accessor is not provided as array

PR Close #45192
2022-03-15 13:26:03 -07:00
Lee Cooper
8a7e624cda fix(docs-infra): fix tour of heroes global styles (#45329)
fix button styles in src/styles.css that are missing from code snippets

PR Close #45329
2022-03-15 13:24:52 -07:00
alirezaghey
c12b3276ec docs: fix small English typo (#45340)
PR Close #45340
2022-03-14 13:10:19 -07:00
Andrew Scott
c30511276a docs: Fix typo in issue template (#45327)
PR Close #45327
2022-03-14 09:31:01 -07:00
Derek Cormier
22d1dc0acb build(bazel): add bazel build and test targets for aio build (#45022)
First step towards a migration of aio to bazel. Not yet built by ci.

PR Close #45022
2022-03-14 09:25:34 -07:00
Renovate Bot
0dbd50bea5 build: update dependency eslint-plugin-jsdoc to v38 (#45332)
PR Close #45332
2022-03-14 09:23:42 -07:00
Alan Agius
7f043c98b7 build(docs-infra): upgrade cli command docs sources to a517160a2 (#45225)
Updating [angular#master](https://github.com/angular/angular/tree/master) from [cli-builds#master](https://github.com/angular/cli-builds/tree/master).

PR Close #45225
2022-03-10 15:51:18 -08:00
Alan Agius
34218ecdb4 feat(docs-infra): remove hidden commands processor (#45225)
Hidden commands are no longer included in help JSON output.

PR Close #45225
2022-03-10 15:51:18 -08:00
Alan Agius
8f06fa3b20 feat(docs-infra): update CLI templates to match changes with new parser and folder structure (#45225)
The underlying parser that the CLI uses changed which caused minor changes in the generated JSON helps especially for subcommands.

The folder structure of the Angular CLI repo also changed slightly.

More context: https://github.com/angular/angular-cli/pull/22778

PR Close #45225
2022-03-10 15:51:18 -08:00
Jessica Janiuk
5f7c4f67d0 refactor(core): Switch over to new closure LOCALE vs getLocale() (#45302)
This is a change requested via an LSC due to a deprecation.

PR Close #45302
2022-03-10 12:48:29 -08:00
Paul Gschwendtner
8848d2dd28 docs: add manual changelog edits from 13.3.x to main branch (#45323)
Adds the manual changelog edits from the `13.3.x` branch to the
main branch (where users primarily will look at).

PR Close #45323
2022-03-10 12:08:26 -08:00
Andrew Scott
79580bba4c
docs: release notes for the v13.3.0-rc.0 release (#45322) 2022-03-10 11:31:59 -08:00
Andrew Scott
a08ea3f643 refactor(router): Make a few adjustments to createUrlTree for clarity (#45306)
* `tree` function now accepts the old root rather than the old
  `UrlTree`. The `urlTree` argument was only used to get the `root`.
  This change makes it more clear what that pararmeter is used for and
  what's actually being used
* Move the `oldRoot` (previously `urlTree`) to be the first argument of `tree`.
  This change now mirrors the argument order for `replaceSegment` and
  can be read from left to right more easily "in this root,
  replace this old segment group with this new segment group".
* Extract `newRoot` to a variable. This just makes it more clear what's
  going on at the end rather than combining a bunch of operations into
  one.

These changes are being made so that hopefully a future refactor can be
done which does not rely on the `urlTree` argument at all in the
`createUrlTree` function. These refactorings will make it easier to see
1:1 functionlity in these various places.

PR Close #45306
2022-03-09 13:52:38 -08:00
Alistair Kane
2e2c80acd5 docs: update <div> to <p> in lifecycle-hooks.md (#45063)
Changes <div> to <p> in description to match the elements in the screenshot.

Update lifecycle-hooks.md

Changes <div> to <p> in description to match the elements in the screenshot.

PR Close #45063
2022-03-09 13:52:15 -08:00
JiaLiPassion
c7cab69af1 docs(core): update triggerEventHandler samples (#45279)
PR Close #45279
2022-03-09 13:51:54 -08:00
JiaLiPassion
225e4f2dbe feat(core): triggerEventHandler accept optional eventObj (#45279)
Close #44724

`DebugNode.triggerEventHandler()` should accept the `eventObj` as an
optional parameter. So the user don't have to write code like

```
elem.triggerEventHandler('click', null);
```

PR Close #45279
2022-03-09 13:51:54 -08:00
Andrew Kushnir
89d71b545e docs: update CHANGELOG to fix broken markdown (#45305)
PR Close #45305
2022-03-09 13:51:26 -08:00
Andrew Kushnir
a301b36f1f
release: cut the v14.0.0-next.6 release (#45301) 2022-03-09 09:04:59 -08:00
Andrew Kushnir
51b67eba93
docs: release notes for the v13.2.6 release (#45300) 2022-03-09 09:02:09 -08:00
Andrew Scott
be220fa683 fix(language-service): Prioritize Angular-specific completions over DOM completions (#45293)
When authoring Angular templates, developers are likely to be most interested in
the current Directive/Component inputs and outputs, then potential
attributes which would match other directives to the element,
and lastly the plethora of DOM events and attributes.

This change ensures that Angular-specific information appears above DOM
information by prepending the first printable ASCII characters to the
sort text.

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

PR Close #45293
2022-03-08 14:48:37 -08:00
Paul Gschwendtner
dc6094acdc ci: update payload size goldens to reflect zone.js update (#45289)
ZoneJS has been updated as part of the lock file refresh by Renovate. The
polyfills bundle reduced in size by around 4k which is due to some code
simplication in ZoneJS being finally released. This is the commit responsible
for the major reduction (also mentioning the reduction):

0f298a13db

PR Close #45289
2022-03-08 13:15:14 -08:00