Commit graph

29561 commits

Author SHA1 Message Date
Daniel Díaz
74ca3c5c7a docs: fix typo in AOT compiler (#43640)
PR Close #43640
2021-10-01 12:24:01 -04:00
little-pinecone
7cd87ea4c4 docs: add button type in form array example (#43666)
add a button type in the example of creating a dynamic form so that the button that adds the alias control does not submit the entire form

PR Close #43666
2021-10-01 12:23:09 -04:00
George Kalpakas
7aea5256de docs: update commit message guidelines to reflect current requirements (#43650)
Update the commit message guidelines in `CONTRIBUTING.md` to reflect
recent changes in our dev-infra tooling:
- Remove the mention of the 100 chars/line limit, since that is
  [no longer in effect][1].
- Mention Deprecation sections:
  According to our [Deprecation practices][2], we should document
  deprecations in the Changelog, which our tooling supports via
  [DEPRECATED][3] sections in commit messages. Yet this was not
  mentioned in the commit message guidelines.

[1]: a07cb097e9/.ng-dev/commit-message.ts (L7)
[2]: https://angular.io/guide/releases#deprecation-practices
[3]: b51360a7cc/ng-dev/commit-message/parse.ts (L77)

PR Close #43650
2021-10-01 08:55:01 -07:00
xiaohanxu-nick
544cb43eed docs: fix missing step in get started example (#43646)
PR Close #43646
2021-10-01 08:45:59 -07:00
dario-piotrowicz
bd45f7d46f docs: disable erroneous "browser" code links (#43554)
fix the keyword "browser" present in code segments being incorrectly
generated as a link to "api/animations/browser" by applying the
no-auto-link class

PR Close #43554
2021-10-01 08:36:07 -07:00
dario-piotrowicz
6e7454df86 docs(animations): improve the aio animations introduction (#42885)
improve slightly the angular.io animation introduction guide, such
improvement are styling, information and clarity related

PR Close #42885
2021-10-01 08:34:19 -07:00
Renovate Bot
e53f84c8b6 build(devtools): update angular-framework to bd4d3e2 2021-09-30 14:32:03 -07:00
Alex Rickabaugh
9d9d05911d release: cut the v13.0.0-next.9 release (#43656)
PR Close #43656
2021-09-30 13:23:26 -07:00
Alex Rickabaugh
e5b0c39a77 docs: release notes for the v12.2.8 release (#43655)
PR Close #43655
2021-09-30 13:15:05 -07:00
Alex Rickabaugh
a07cb097e9 Revert "Revert "refactor(migrations): support use of an ESM @angular/compiler package (#43627)"" (#43637)
This reverts commit ab3de40ba3, which is
itself a revert of the original commit. Thus, this restores the changes
to schematics in support of ESM.

Now that g3 has a local modification for load_esm, we can restore this
functionality.

PR Close #43637
2021-09-29 14:46:03 -07:00
JoostK
94c6dee708 refactor(compiler-cli): remove listLazyRoutes operation (#43591)
Now that `Route.loadChildren` no longer accepts a string, there is no
need for tooling to find all string-based `loadChildren` to setup lazy
imports for them. As a result, the `listLazyRoutes` operation that
enumerates all string-based `loadChildren` occurrences is no longer
needed and is therefore removed from the compiler.

The `listLazyRoutes` API remains on the `Program` interface to avoid
breaking external tools that may be using this method, but those tools
should ultimately move away from using this API.

PR Close #43591
2021-09-29 14:45:18 -07:00
JoostK
361273fad5 refactor(router): remove support for loadChildren string syntax (#43591)
This commit removes the ability to configure lazy routes using a string
for `loadChildren`, together with the supporting classes to load an
`NgModuleFactory` at runtime.

BREAKING CHANGE:

It is no longer possible to use `Route.loadChildren` using a string
value. The following supporting classes were removed from
`@angular/core`:

- `NgModuleFactoryLoader`
- `SystemJsNgModuleFactoryLoader`

The `@angular/router` package no longer exports these symbols:

- `SpyNgModuleFactoryLoader`
- `DeprecatedLoadChildren`

The signature of the `setupTestingRouter` function from
`@angular/core/testing` has been changed to drop its `NgModuleFactoryLoader`
parameter, as an argument for that parameter can no longer be created.

PR Close #43591
2021-09-29 14:45:18 -07:00
JoostK
05c08cac9a docs: refactor example apps to use dynamic imports for loadChildren (#43591)
The string syntax for `loadChildren` has been deprecated and is being
removed, so this commit refactors the examples to the new syntax.

PR Close #43591
2021-09-29 14:45:17 -07:00
Andrew Kushnir
7dccbdd27b feat(core): add support for Types in ViewContainerRef.createComponent (#43022)
With Ivy it's possible to create a `ComponentFactory` instance based on the generated Component def, thus the `ViewContainerRef.createComponent` can accept a Component instance and create a factory inside, rather than requiring additional complexity of creating a ComponentFactory outside (by invoking `ComponentFactoryResolver`).

This should simplify the API that is used for creating components dynamically.

DEPRECATION:

Angular no longer requires component factories to dynamically create components. The factory-based signature of the `ViewContainerRef.createComponent` function is deprecated in favor of a different signature that allows passing component classes instead.

PR Close #43022
2021-09-29 13:49:13 -07:00
Alex Rickabaugh
ab3de40ba3 Revert "refactor(migrations): support use of an ESM @angular/compiler package (#43627)"
This reverts commit c008e0fa90. This commit
breaks in g3. We will need to plan a mitigation first.
2021-09-29 11:35:57 -07:00
Andrew Scott
09d325a9e6 test(router): refactor tests to not use deprecated loadChildren (#43578)
Many of the tests in the router code use the deprecated loadChildren as a string. This
has been deprecated for years and can easily be changed to just a function that
returns the module.

PR Close #43578
2021-09-29 11:14:07 -07:00
Renovate Bot
5897ee8da7 build(devtools): update angular-framework to 71f8be3 2021-09-29 10:13:48 -07:00
Chris
9c2b8c2902 docs: clarify description of :host and :host-context selectors (#41332)
Fixes #39466

PR Close #41332
2021-09-29 10:00:05 -07:00
Daniel Díaz
6a3492b751 docs: fix typo in observables file (#43630)
PR Close #43630
2021-09-29 09:59:38 -07:00
Pete Bacon Darwin
d1589604a8 build(docs-infra): ensure all overloads are shown in interfaces (#43614)
In the API docs, concrete classes do not list the "implementation" overload on a method, since this is not strictly part of its API.
There is already a special case for abstract methods that do not have such an implementation overload.

But we were missing the case where the method was part of an interface. In interfaces none of the methods have implementation overloads.

Fixes #43001

PR Close #43614
2021-09-29 09:58:48 -07:00
Doug Parker
e0a72857cc fix(bazel): construct a manifest file even when warnings are emitted (#43582)
Refs #42966.

Previously if _any_ diagnostics were emitted, regardless of their category, the manifest would not be generated. This means that if a target emits only warnings and no errors, it would still fail to build because it does not generate all the required output files (specifically the `.es5.MF` file). Now the manifest file is generated as long as there are no error diagnostics in the result. This makes `ng_module()` support compiler warnings as a user would expect.

Added a test which uses extended template diagnostics to trigger the invalid banana in box diagnostic. This generates a warning and uses Skylib's `build_test()` to verify that it builds successfully. Unfortunately there is no easy way to verify that the warning diagnostic is emitted at all. `expected_diagnostics` should be able to do that, but it doesn't seem to have any effect on `ng_module()` and may not be integrated. Instead, testing that a target with warnings builds correctly is the best we can easily do here without a deeper investigation.

PR Close #43582
2021-09-29 09:58:24 -07:00
Doug Parker
62d7005a52 feat(bazel): add strict_templates and experimental_extended_template_diagnostics to ng_module() rule (#43582)
Refs #42966.
Fixes #33452.

This allows `ng_module()` targets to be built with strict templates enabled, it mostly works the way we already do this internally. Also adds extended template diagnostics behind an experimental option so it can be used internally and for tests.

`strict_templates` can only be used if `type_check` is also enabled and `experimental_extended_template_diagnostics` can only be used if `strict_templates` is enabled.

PR Close #43582
2021-09-29 09:58:23 -07:00
dario-piotrowicz
10277802b8 docs: amend wrong links to async pipe (#43576)
PR Close #43576
2021-09-29 09:57:58 -07:00
Andrew Kushnir
51149ab530 docs: deprecate aotSummaries usage in TestBed (#43395)
DEPRECATION:

In Ivy, AOT summary files are unused. Passing AOT summary files in TestBed has no effect, so the `aotSummaries` usage in TestBed is deprecated and will be removed in a future version of Angular.

PR Close #43395
2021-09-29 09:54:23 -07:00
Charles Lyding
c008e0fa90 refactor(migrations): support use of an ESM @angular/compiler package (#43627)
Currently, migrations and schematics must be in CommonJS format. However, framework packages will only be ESM from v13 and onward. To support this configuration, dynamic import expressions are now used to load `@angular/compiler`. Dynamic imports within Node.js allow the `@angular/core` migrations’ CommonJS code to load ESM code. Unfortunately, TypeScript will currently, unconditionally down-level dynamic import into a require call. `require` calls cannot load ESM code and will result in a runtime error. To workaround this, a Function constructor is used to prevent TypeScript from changing the dynamic import. Once TypeScript provides support for keeping the dynamic import this workaround can be dropped and replaced with a standard dynamic import.  Due to the use of the dynamic import, a reference to the compiler module must now be passed to all locations that use values from the `@angular/compiler` package.

PR Close #43627
2021-09-29 08:46:52 -07:00
Charles Lyding
11f26d5145 refactor(migrations): remove remaining @angular/compiler deep imports (#43627)
A base class that can be used to implement a Render3 Template AST visitor is now used throughout the `@angular/core` migrations. This class is used instead of the `NullVisitor` found within the `@angular/compiler` because the `NullVisitor` requires a deep import which is no longer supported with the ESM bundled packages as of v13. The `NullVisitor` is also fairly trivial in regards to its implementation and the new base class also provides additional helper methods for migration specific behavior. This removes all remaining deep imports of the `@angular/compiler` package from the `@angular/core` migrations while avoiding the need to modify the `@angular/compiler` package.

PR Close #43627
2021-09-29 08:46:51 -07:00
Charles Lyding
db5392f383 refactor(migrations): remove most template AST deep imports (#43627)
Most of the deep imports into the `@angular/compiler` package in the `@angular/core` migrations are for template AST types that are available as exports from the main entry point of the package (albeit under slightly different names). For the available main entry point exports, the deep imports have been transitioned to no longer use the deep import.

PR Close #43627
2021-09-29 08:46:51 -07:00
Raj Sekhar
4555d8a316 docs: fix broken link to measure performance (#43628)
* "Chrome DevTools Network Performance page" was pointing to a broken link, that was giving 404 error
* The new link points to the right article where it explains the resource timing & network analysis
PR Close #43628
2021-09-28 14:43:46 -07:00
Bobby Galli
cb0d8d214e docs: fix typos in .vscode/README.md (#43621)
PR Close #43621
2021-09-28 14:28:14 -07:00
Kristiyan Kostadinov
8f7fdc59af fix(compiler-cli): not evaluating new signature for __spreadArray (#43618)
In TypeScript 4.4 the `__spreadArray` function has three parameters, however we only allowed two which can result in an error.

PR Close #43618
2021-09-28 14:27:31 -07:00
Andrew Kushnir
8d34f86edb docs: deprecate PlatformRef.bootstrapModuleFactory and factory-based signature of ApplicationRef.bootstrap (#43560)
DEPRECATION:

Ivy made it possible to avoid the need to resolve Component and NgModule factories. Framework APIs allow to use Component and NgModule Types directly. As a result, the `PlatformRef.bootstrapModuleFactory` and a factory-based signature of the `ApplicationRef.bootstrap` method are now obsolete and are now deprecated.

The `PlatformRef.bootstrapModuleFactory` calls can be replaced with `PlatformRef.bootstrapModule` ones. The `ApplicationRef.bootstrap` method allows to provide Component Type, so this can be used a replacement for the factory-based calls.

PR Close #43560
2021-09-28 14:17:08 -07:00
Dmitrij Kuba
4f3beffdbf feat(router): emit activate/deactivate events when an outlet gets attached/detached (#43333)
Previously the events of `RouterOutlet` (activate/deactivate) were not fired
when an outlet got attached/detached with `RouteReuseStrategy`. The changes configure
`RouterOutlet` to emit events when an outlet gets attached/detached.

Fixes #25521, #20501

PR Close #43333
2021-09-28 14:16:39 -07:00
wszgrcy
8d2b6affcd fix(compiler-cli): correctly interpret token arrays in @Injectable deps (#43226)
When specifying the `deps` array in the `@Injectable` decorator to
inject dependencies into the injectable's factory function, it should
be possible to use an array literal to configure how the dependency
should be resolved by the DI system.

For example, the following example is allowed:

```ts
@Injectable({
  providedIn: 'root',
  useFactory: a => new AppService(a),
  deps: [[new Optional(), 'a']],
})
export class AppService {
  constructor(a) {}
}
```

Here, the `'a'` string token should be injected as optional. However,
the AOT compiler incorrectly used the array literal itself as injection
token, resulting in a failure at runtime. Only if the token were to be
provided using `[new Optional(), new Inject('a')]` would it work
correctly.

This commit fixes the issue by using the last non-decorator in the
array literal as the token value, instead of the array literal itself.

Note that this is a loose interpretation of array literals: if a token
is omitted from the array literal then the array literal itself is used
as token, but any decorator such as `new Optional()` would still have
been applied. When there's multiple tokens in the list then only the
last one will be used as actual token, any prior tokens are silently
ignored. This behavior mirrors the JIT interpretation so is kept as is
for now, but may benefit from some stricter checking and better error
reporting in the future.

Fixes #42987

PR Close #43226
2021-09-28 14:15:48 -07:00
Renovate Bot
e6fe0f7f16 build(devtools): update angular-framework to c8eb298 2021-09-28 11:49:06 -07:00
dario-piotrowicz
38daf7a36e build(docs-infra): bump @angular-eslint packages to 12.5.0 (#43574)
update the four @angular-eslint packages from 12.4.1 to 12.5.0,
also add the caret to allow minor version updates

PR Close #43574
2021-09-27 14:27:49 -07:00
Ricardo Chavarria
de662da8e2 docs: Add Ricardo Chavarria to GDE resources (#43571)
update size image
update preview
docs: replace an avatar with smaller size
Change order


PR Close #43571
2021-09-27 14:25:56 -07:00
JoostK
988cca7ef5 fix(ngcc): do not fail for packages which correspond with Object members (#43589)
Prior to this commit ngcc stored its package configuration in JavaScript
objects, which caused the builtin `Object` members to be found as
package configuration. This would subsequently crash as their shape was
not as expected.

This commit moves away from using raw JavaScript objects in favor of a
Map. To code was refactored such that `PartiallyProcessedConfig` is
now a class.

Fixes #43570

PR Close #43589
2021-09-27 14:21:53 -07:00
Kristiyan Kostadinov
66fb311d20 fix(core): incorrect signature for initTestEnvironment (#43615)
Fixes that one of the signatures of `initTestEnvironment` wasn't using the correct type.

PR Close #43615
2021-09-27 14:21:32 -07:00
Adrien Crivelli
bdf5887077 docs(router): params or queryParams are not advised against (#43562)
According to @atscott:

> We no longer speculate about future deprecations. There are no current plans to remove
> `params` or `queryParams` and there's no benefit to advising against their use.

PR Close #43562
2021-09-27 14:21:10 -07:00
Kristiyan Kostadinov
f055a886f3 build: remove api-extractor workaround (#43563)
In #43281 I had to add a `resolutions`for `typescript` due to the `api-extractor` being locked down to an older version. Now that it has been updated, we don't need the workaround anymore.

PR Close #43563
2021-09-27 10:57:04 -07:00
Rafael Santana
10c7ace6ca docs: close tags properly (#43610)
PR Close #43610
2021-09-27 10:54:55 -07:00
enisfr
49e0b17e56 docs: links added for each builder schema (#43564)
closes #43542

Signed-off-by: enisfr <enisfurkane@gmail.com>

docs: links pointed to the schema files.

closes angular#43542

docs: tslint removed.

closes angular#43542

docs: typo.

closes angular#43542

PR Close #43564
2021-09-27 10:51:48 -07:00
Renovate Bot
6cac36acaf build: update dependency typescript to v4.4.3 (#43557)
PR Close #43557
2021-09-27 10:47:08 -07:00
JoostK
81d09d14dc docs: deprecate input setter coercion fields (#43506)
Since the `strictTemplates` flag has been introduced in Angular the
compiler has been able to type-check input bindings to the declared
input type of the corresponding directive. When a getter/setter pair is
being used for the input it may be desirable to let the setter accept a
broader set of types than what is returned by the getter, for example
when the setter first converts the input value. However, until
TypeScript 4.3 a getter/setter pair was required to have identical types
so this pattern could not be accurately declared.

To mitigate this limitation, it was made possible to declare
input setter coercion fields in directives that are used when
type-checking input bindings. However, since TypeScript 4.3 the
limitation has been removed; setters can now accept a wider type than
what is returned by the getter. This means that input coercion fields
are no longer needed, as their effects can be achieved by widening the
type of the setter.

PR Close #43506
2021-09-27 10:46:43 -07:00
Andrew Scott
3e37e8979d fix(language-service): provide dom event completions (#43299)
Native DOM events were previously not included in the completions
because the dom schema registry would filter out events completely. This
change updates the registry to include events in the private
element->property map and excludes events from lookups outside of the
new `allKnownEventsOfElement` function.

fixes https://github.com/angular/vscode-ng-language-service/issues/1479

PR Close #43299
2021-09-27 10:45:58 -07:00
Teri Glover
353cad283d docs: Edits to remove jargon (#43000)
PR Close #43000
2021-09-27 10:44:21 -07:00
Alex Rickabaugh
22eebbafbc release: cut the v13.0.0-next.8 release (#43613)
PR Close #43613
2021-09-27 10:27:54 -07:00
George Kalpakas
9d290bd012 ci: correctly handle commit message with carriage returns in payload-size.sh (#43569)
Previously, if a commit message contained a carriage return in its
header, the `payload-size.sh` script would fail to upload the payload
size data to Firebase, because the JSON payload would be messed up when
trying to concatenate the commit message headers. See an example
[here][1].

This commit avoids this problem by replacing carriage returns before
concatenating the commit message headers with the JSON payload string.

[1]: https://app.circleci.com/pipelines/github/angular/angular/37437/workflows/d0fa4adf-43bb-464e-a2fd-d87da15226dd

PR Close #43569
2021-09-24 10:56:41 -07:00
George Kalpakas
d02c8da7bd fix(docs-infra): display deprecation notes for properties (#43566)
Previously, deprecation notes for deprecated class/interface properties
were not shown in the API docs. This commit fixes it by ensuring that
deprecation notes are shown for properites (similar to how it works for
methods).

PR Close #43566
2021-09-24 10:56:05 -07:00
George Kalpakas
e131540f71 fix(service-worker): do not unassign clients from a broken version (#43518)
Previously, when a version was found to be broken, any clients assigned
to that version were unassigned (and either assigned to the latest
version or to none if the latest version was the broken one). A version
could be considered broken for several reasons, but most often it is a
response for a hashed asset that eiher does not exist or contains
different content than the SW expects. See
https://github.com/angular/angular/issues/28114#issuecomment-923122967
for more details.

However, assigning a client to a different version (or the network) in
the middle of a session, turned out to be more risky than keeping it on
the same version. For angular.io, for example, it has led to #28114.

This commit avoids making things worse when identifying a broken version
by keeping existing clients to their assigned version (but ensuring that
no new clients are assigned to the broken version).

NOTE:
Reloading the page generates a new client ID, so it is like a new client
for the SW, even if the tab and URL are the same.

PR Close #43518
2021-09-24 10:54:21 -07:00