Commit graph

6107 commits

Author SHA1 Message Date
Angular Robot
5b1c7c10a0 build: update dependency @rollup/plugin-commonjs to v24 (#48530)
See associated pull request for more information.

PR Close #48530
2023-01-13 10:35:19 -08:00
Paul Gschwendtner
1898190c28 build: update ng-dev and account for stamping changes (#48731)
* updates ng-dev and build-tooling since the previous SHAs are
no longer existent after the CircleCI incident snapshot build removal.
* accounts for the new stamping variables.

PR Close #48731
2023-01-13 14:10:39 +00:00
Bob Watson
0b57e24eb6 docs: add first-app-lesson-13 example (#48512)
PR Close #48512
2023-01-12 11:44:07 -08:00
Bob Watson
1edf5874d7 docs: add first-app-lesson-12 example (#48512)
PR Close #48512
2023-01-12 11:44:07 -08:00
Bob Watson
d2333b4d35 docs: add first-app-lesson-11 example (#48512)
PR Close #48512
2023-01-12 11:44:07 -08:00
Bob Watson
25ec456b9f docs: add first-app-lesson-10 example (#48512)
PR Close #48512
2023-01-12 11:44:07 -08:00
Bob Watson
d894e40dd5 docs: add first-app-lesson-09 example (#48512)
PR Close #48512
2023-01-12 11:44:07 -08:00
Bob Watson
b3283bd271 docs: add first-app-lesson-08 example (#48512)
PR Close #48512
2023-01-12 11:44:06 -08:00
Bob Watson
76daeb6ff7 docs: add first-app-lesson-07 example (#48512)
PR Close #48512
2023-01-12 11:44:06 -08:00
Bob Watson
3344d839bf docs: add first-app-lesson-06 example (#48512)
PR Close #48512
2023-01-12 11:44:06 -08:00
Bob Watson
a19888cf06 docs: add first-app-lesson-05 example (#48512)
PR Close #48512
2023-01-12 11:44:06 -08:00
Bob Watson
af3947d2b1 docs: add first-app-lesson-04 example (#48512)
PR Close #48512
2023-01-12 11:44:06 -08:00
Bob Watson
3519651f72 docs: add first-app-lesson-03 example (#48512)
PR Close #48512
2023-01-12 11:44:06 -08:00
Bob Watson
f7eef20a52 docs: add first-app-lesson-02 example (#48512)
PR Close #48512
2023-01-12 11:44:06 -08:00
Bob Watson
dd8a5d56e3 docs: add first-app-lesson-01 example (#48512)
PR Close #48512
2023-01-12 11:44:05 -08:00
Andrew Scott
926c35f4ac docs: Deprecate class and InjectionToken and resolvers (#47924)
Class and `InjectionToken`-based guards and resolvers are not as configurable,
are less re-usable, require more boilerplate, cannot be defined inline with the route,
and require more in-depth knowledge of Angular features (`Injectable`/providers).
In short, they're less powerful and more cumbersome.

In addition, continued support increases the API surface which in turn increases
bundle size, code complexity, the learning curve and API surface to teach,
maintenance cost, and cognitive load (needing to grok several different types
of information in a single place).

Lastly, supporting only the `CanXFn` types for guards and `ResolveFn` type
for resolvers in the `Route` interface will enable better code
completion and integration with TypeScript. For example, when writing an
inline functional resolver today, the function is typed as `any` and
does not provide completions for the `ResolveFn` parameters. By
restricting the type to only `ResolveFn`, in the example below
TypeScript would be able to correctly identify the `route` parameter as
`ActivatedRouteSnapshot` and when authoring the inline route, the
language service would be able to autocomplete the function parameters.

```
const userRoute: Route = {
  path: 'user/:id',
  resolve: {
    "user": (route) => inject(UserService).getUser(route.params['id']);
  }
};
```

Importantly, this deprecation only affects the support for class and
`InjectionToken` guards at the `Route` definition. `Injectable` classes
and `InjectionToken` providers are _not_ being deprecated in the general
sense. Functional guards are robust enough to even support the existing
class-based guards through a transform:

```
function mapToCanMatch(providers: Array<Type<{canMatch: CanMatchFn}>>): CanMatchFn[] {
  return providers.map(provider => (...params) => inject(provider).canMatch(...params));
}
const route = {
  path: 'admin',
  canMatch: mapToCanMatch([AdminGuard]),
};
```

With regards to tests, because of the ability to map `Injectable`
classes to guard functions as outlined above, nothing _needs_ to change
if projects prefer testing guards the way they do today. Functional
guards can also be written in a way that's either testable with
`runInContext` or by passing mock implementations of dependencies.
For example:

```
export function myGuardWithMockableDeps(
  dep1 = inject(MyService),
  dep2 = inject(MyService2),
  dep3 = inject(MyService3),
) { }

const route = {
  path: 'admin',
  canActivate: [() => myGuardWithMockableDeps()]
}

// test file
const guardResultWithMockDeps = myGuardWithMockableDeps(mockService1, mockService2, mockService3);
const guardResultWithRealDeps = TestBed.inject(EnvironmentInjector).runInContext(myGuardWithMockableDeps);
```

DEPRECATED: Class and `InjectionToken` guards and resolvers are
deprecated. Instead, write guards as plain JavaScript functions and
inject dependencies with `inject` from `@angular/core`.

PR Close #47924
2023-01-11 15:01:08 -08:00
Angular Robot
7f68a709a7 docs: update Angular CLI help (#48704)
Updated Angular CLI help contents.

Closes #48701

PR Close #48704
2023-01-11 15:00:21 -08:00
Andrew Scott
8375a8c9a8 docs: Add heading to the router writable properties deprecation (#48684)
The deprecation note is missing a header. This commit adds one.

PR Close #48684
2023-01-11 14:59:04 -08:00
mgechev
f09b6e4507 docs: add angular devsat q1 2023 (#48683)
PR Close #48683
2023-01-11 14:58:35 -08:00
Jens
01be0e2874 docs: Add support for previous Chrome release (#48669)
Previous Chrome stable version should also be supported
PR Close #48669
2023-01-11 14:57:44 -08:00
Matthieu Riegler
518cc63022 docs: remove unused style guides. (#48587)
PR Close #48587
2023-01-11 14:57:09 -08:00
Bob Watson
7281dbc913 docs: minor copy edit to suggestion (#48484)
PR Close #48484
2023-01-11 14:56:31 -08:00
Bob Watson
874f197720 docs: minor copy edit to suggestion (#48484)
PR Close #48484
2023-01-11 14:56:31 -08:00
Bob Watson
84285c1ef8 docs: minor copy edit to suggestion (#48484)
PR Close #48484
2023-01-11 14:56:31 -08:00
Bob Watson
1c4eb67354 docs: minor copy edit to suggestion (#48484)
PR Close #48484
2023-01-11 14:56:30 -08:00
Aristeidis Bampakos
deb27df160 docs: review router guards section in router guide (#48484)
PR Close #48484
2023-01-11 14:56:30 -08:00
Angular Robot
fda96a6fc9 build: update dependency puppeteer-core to v19 (#48183)
See associated pull request for more information.

PR Close #48183
2023-01-11 14:55:17 -08:00
Vladyslav Slipchenko
b0318f8b39 docs(docs-infra): fix wording inconsistency of the i18n common prepare section references (#47582)
PR Close #47582
2023-01-11 14:54:08 -08:00
Paul Gschwendtner
d4a56721a4 ci: use readonly github token for querying CLI snapshot repo (#48681)
Currently the Github action-triggered code uses the `GITHUB_TOKEN`
for querying the CLI snapshot builds repository. This does not work
because the Github actions token is scoped to the orginating
repository, even for queries to a read public repository.

We fix this by using a personal access token. The token is
readonly and only exists to avoid potential rate limiting.

PR Close #48681
2023-01-10 11:13:34 -08:00
Paul Gschwendtner
111e2c7876 test(docs-infra): increase jasmine default timeout for e2e specs (#48671)
Similar to the Saucelabs job, the jasmine default timeout can be
increased to avoid the common jasmine timeouts. We cannot control
how fast Selenium e.g. loads a page or not.

PR Close #48671
2023-01-10 08:10:23 -08:00
Alan Agius
d4eaaefe30 fix(docs-infra): correctly read example type (#48665)
Prior to this change the universal example was broken as the example type was not retrieved correctly in bazel which caused the `_renameFile` method to be called with incorrect context.

Closes #48664

PR Close #48665
2023-01-10 08:09:54 -08:00
Alan Agius
a29203ff1f docs: update universal example (#48665)
This change updates the universal example to align with latest CLI changes.

PR Close #48665
2023-01-10 08:09:54 -08:00
Angular Robot
3714909c98 build: update dependency jsdom to v21 (#48660)
See associated pull request for more information.

PR Close #48660
2023-01-10 08:09:04 -08:00
Virginia Dooley
6a009a3e66 docs: Custom data Pipes doc, fixed live-example link. (#48656)
PR Close #48656
2023-01-10 08:08:07 -08:00
piyush132000
0510f4ef32 docs: updated docs removed unnecessary imports and empty methods (#48628)
Removed empty methods and unnecessary imports in files

PR Close #48628
2023-01-10 08:06:04 -08:00
Alan Agius
2dc31576ab ci: add Angular CLI help pages action (#48577)
This commits adds an action to update the Angular CLI help contents that are used by AIO to generate CLI guides.

This also changes the setup to include the files are source files instead of having to clone the repository each time. This also simplifies the PR review process of the PR opened by the action.

PR Close #48577
2023-01-10 08:01:38 -08:00
Matthieu Riegler
43ced455d6 docs: remove empty constructors & ngOnInit() (#48576)
PR Close #48576
2023-01-05 14:49:38 -08:00
Matthieu Riegler
51ff78143d docs: remove onInit from Tour Of Heroes. (#48576)
Following #24008, the schematics don't produce ngOnInit and the constructor. Let's reflect that in the Tour of Heroes tutorial.

Fixes #48575

PR Close #48576
2023-01-05 14:49:37 -08:00
Andrew Scott
15eccef4eb docs(router): Clean up error handler deprecations (#48551)
`errorHandler` and `malformedUriErrorHandler` were already deprecated in
the Router class public API. This change updates the deprecation to
extend to `RouterModule.forRoot` configuration options.

PR Close #48551
2023-01-05 14:49:00 -08:00
Andrew Scott
31b94c762f feat(router): Add a withNavigationErrorHandler feature to provideRouter (#48551)
`withNavigationErrorHandler` is a close replacement for the
`RouterModule.forRoot.errorHandler` / `Router.errorHandler`.
It provides a quick, short way for users to define a function to handle
`NavigationError` events.

PR Close #48551
2023-01-05 14:49:00 -08:00
Renan Ferro
29efedf0e4 docs(docs-infra): update precedence of binding dynamic example and commentary (#48636)
PR Close #48636
2023-01-04 12:16:40 -08:00
piyush132000
2fb6df281b docs: updated docs removed unnecessary imports and empty methods (#48546)
Removed empty methods and unnecessary imports in files

PR Close #48546
2023-01-04 12:13:24 -08:00
Angular Robot
c51e3e33ce build: update eslint dependencies to v5.47.0 (#48548)
See associated pull request for more information.

PR Close #48548
2023-01-04 12:09:15 -08:00
Angular Robot
aa51e9b217 build: update all non-major dependencies (#48462)
See associated pull request for more information.

PR Close #48462
2023-01-04 11:38:40 -08:00
robertIsaac
c5a84851ea docs: add NG0403.md for Bootstrapped NgModule doesn't specify which component to initialize error (#48483)
- update `errors.ts` to annotate the error NG0403, so that the runtime can add a link to that guide when an error is thrown
- update `application_ref_spec.ts` to include the new link of the error
- update `errors.md` as a result of running `yarn bazel test packages/core/test`

Fixes #47985

PR Close #48483
2023-01-04 09:59:24 -08:00
mgechev
2d539e14eb docs: hide state of js survey (#48578)
PR Close #48578
2023-01-02 12:19:50 +00:00
Derek Cormier
0ae80a78a3 build(bazel): improve remote caching for AIO local deps build (#48579)
Fix non-hermetic zipping of example zips by fixing the zip entry timestamps.

I also hardcoded stamp values in stable-status.txt and volatile-status.txt using the workspace status command for the aio_local_deps config to improve cache performance. The Bazel remote cache appears to not ignore volatile-status.txt when there are no other changes, unlike the local Bazel cache:

https://github.com/bazelbuild/bazel/issues/10075#issuecomment-546872111

PR Close #48579
2023-01-02 12:16:12 +00:00
Derek Cormier
8c9f067125 build(bazel): prevent remote cache misses on dgeni build (#48585)
Using 'always' as the stamp attribute caused stable-status.txt
to always be included as an input, which has different values on
different ci executors causing a cache miss.

We run the regular aio build without stamping on ci so only include
status files when stamping is explicitly enabled.

PR Close #48585
2022-12-24 11:25:40 +00:00
piyush132000
8561868d4f docs: updated docs removed unnecessary imports and empty methods (#48513)
Removed empty methods and unnecessary imports in files

PR Close #48513
2022-12-21 13:08:18 +00:00
Paul Gschwendtner
90c2088679 build: make devmode a noop and ensure it never runs (#48521)
This is basically a pre-step for combining devmode and prodmode into a
single compilation. We are already achieving this now, and can claim
with confidence that we reduced possible actions by half. This is
especially important now that prodmode is used more often, but rules
potentially still using the devmode ESM sources. We can avoid double
compilations (which existed before the whole ESM migration too!).

We will measure this more when we have more concrete documentation
of the changes & a better planning document.

Changes:

  * ts_library will no longer generate devmode `d.ts`. Definitions are
    generated as part of prodmode. That way only prodmode can be exposed
    via providers.
  * applied the same to `ng_module`.
  * updates migrations to bundle because *everything* using `ts_library`
    is now ESM. This is actually also useful in the future if
    schematics rely on e.g. the compiler.
  * updates schematics for localize to also bundle. similar reason as
    above.

PR Close #48521
2022-12-19 19:50:45 +00:00