Commit graph

872 commits

Author SHA1 Message Date
Andrew Kushnir
59837f4749 refactor(platform-server): import xhr2 dynamically in the ServerXhr class (#50095)
This commit updates the `@angular/common/http` and `@angular/platform-server` packages to allow dynamic import of the `xhr2` dependency. The `xhr2` dependency has side-effects that rely on a global scope and as a result in some environments those side-effectful calls fail. With the changes from this PR, the import is delayed until it's actually needed, which gives a chance for the underlying platform to setup global scope (via shims) as needed.

Co-authored-by: alan-agius4 <17563226+alan-agius4@users.noreply.github.com>

PR Close #50095
2023-05-08 14:32:43 -07:00
Jessica Janiuk
0b23ad7f56 test(core): add size tracking test for hydration apps (#49955)
This adds test to track size regressions when
hydration is enabled.

PR Close #49955
2023-04-24 09:57:52 -07:00
Alan Agius
ce0ce4cde1 docs: remove no longer available tests from readme (#49975)
This commit removes no longer available integration tests from the readme.

PR Close #49975
2023-04-24 09:57:23 -07:00
Alan Agius
38661a6f2b test: update platform-server tests to test both ngmodule and standalone application (#49927)
This commits update the platform-server test structure to add 2 applications in the Angular CLI workspace one based on ngmodules and another standalone. The same E2E suit is ran on both apps.

PR Close #49927
2023-04-19 14:56:29 +00:00
Alan Agius
03ae094e8f test: update platform-server integration tests to use the Angular CLI (#49900)
This commit updates the platform-server integration tests to use the Angular CLI as it makes it easier to add more tests and remove the custom webpack setup.

PR Close #49900
2023-04-18 19:47:02 +00:00
Matthieu Riegler
aebf1158f6 ci: Remove environment files and EnableProdMode on integration tests (#49746)
Since v15, prod mode is handled by the CLI with the `optimization` flag. We can remove the environement files and `enableProdMode` when the tests use the CLI.

PR Close #49746
2023-04-14 14:13:33 +00:00
Alan Agius
ddf0d4eabe fix(http): HTTP cache was being disabled prematurely (#49826)
This commit fixes an issue were on the server the HTTP cache was being disabled prematurely which caused HTTP calls performed in `ngOnInit` life cycle hooks not to be cached.

PR Close #49826
2023-04-13 14:04:00 +00:00
Alan Agius
71e9532d5d test: improve testing of HTTP and transfer state cache (#49810)
This commit improves the HTTP transfer state integration test by using `provideClientHydration` method and validates that no HTTP calls are performed during the client bootstrapping.

PR Close #49810
2023-04-12 09:45:34 -07:00
Alan Agius
079f4bc1ef fix(http): wait for all XHR requests to finish before stabilizing application (#49776)
Previously, since the `HttpXhrBackend` is a singleton, the macrotask was created and completed only for the initial request since it was stored as in property in the class instance. This commit replaces this logic to create a macro task for every XHR request.

Closes #49730

PR Close #49776
2023-04-11 13:44:30 -07:00
Paul Gschwendtner
d5e02427ea build: create script to update integration lock files (#49787)
* Adds a small script to conveniently re-generate lock files for
  integration tests.
* Updates the `.gitignore` for integration tests to ignore node
  modules. Some tests do not have a `.gitignore` (like the CLI
  boilerplate tests).

PR Close #49787
2023-04-11 10:26:43 -07:00
Paul Gschwendtner
4238ed8fb6 build: sort integration package.json dependencies (#49787)
This commits contains changes proposes by running `yarn install`
for these integration tests.

PR Close #49787
2023-04-11 10:26:43 -07:00
Paul Gschwendtner
63673ddd3f build: re-add lock files for integration tests (#49787)
The lock files for integration tests have been accidentally
removed with: 612eaca3c5

This commit re-adds them.

PR Close #49787
2023-04-11 10:26:42 -07:00
Andrew Scott
34b2d34d5b refactor(router): Remove RouterTestingModule in favor of RouterModule.forRoot (#49427)
`RouterTestingModule` is not needed as of v16. Instead, TestBed
automatically provides `MockPlatformLocation` in order to help test
navigations in the application. The location mocks in the
RouterTestingModule aren't necessary anymore.

There doesn't appear to be any real documentation around
`RouterTestingModule` other than the API docs.

PR Close #49427
2023-04-04 15:12:33 -07:00
Alan Agius
c024574f46 feat(core): expose makeStateKey, StateKey and TransferState (#49563)
This commits adds `makeStateKey`, `StateKey` and  `TransferState` methods in `@angular/core` as public API and deprecated the same exported symbols in `@angular/platform-browser`.

DEPRECATED:  `makeStateKey`, `StateKey` and  `TransferState` exports have been moved from `@angular/platform-browser` to `@angular/core`. Please update the imports.

```diff
- import {makeStateKey, StateKey, TransferState} from '@angular/platform-browser';
+ import {makeStateKey, StateKey, TransferState} from '@angular/core';
```

PR Close #49563
2023-03-29 10:18:02 -07:00
Alan Agius
45a6ac09fd fix(http): force macro task creation during HTTP request (#49546)
This commit adds a background macrotask when an XHR request is performed. The macrotask is started during `loadstart` and ended during `loadend` event.

The macrotask is needed so that the application is not stabilized during HTTP calls. This is important for server rendering, as the application is rendering when the application is stabilized.
The application is stabilized when there are no longer pending Macro and Micro tasks intercepted by Zone.js, Since an XHR request is none of these, we create a background macrotask so that Zone.js is
made aware that there is something pending.

Prior to this change, we patched the `HttpHandler` in `@angular/platform-server` but this is not enough, as there can be multiple `HttpHandler` in an application, example when importing `HttpClient` in a lazy loaded component/module.
Which causes a new unpatched instance of `HttpHandler` to be created in the child injector which is not intercepted by Zone.js and thus the application is stabalized and rendered before the XHR request is finalized.

NB: Zone.js is fundamental for SSR and currently, it's not possible to do SSR without it.

Closes: #49425

PR Close #49546
2023-03-29 09:13:41 -07:00
Alan Agius
6762f79b3d test: remove google-closure-compiler from tests (#49559)
google-closure-compiler does not support ES2022

(cherry picked from commit 54365418bb8388ffa9b6388ae438e4d6ac4e081d)

PR Close #49559
2023-03-23 08:18:45 -07:00
Alan Agius
6e26af52fa feat(bazel): (APF) Angular Package Format updates (#49559)
Several updates to Angular Package Format.

BREAKING CHANGE:

Several changes to the Angular Package Format (APF)
- Removal of FESM2015
- Replacing ES2020 with ES2022
- Replacing FESM2020 with FESM2022

PR Close #49559
2023-03-23 08:18:45 -07:00
Andrew Scott
07cbaa3e28 Revert "feat(bazel): (APF) Angular Package Format updates (#49332)" (#49555)
This reverts commit 842d569a94.

PR Close #49555
2023-03-22 16:01:20 -07:00
Andrew Scott
7ebbd6dc39 Revert "test: remove google-closure-compiler from tests (#49332)" (#49554)
This reverts commit 4d89696285.

PR Close #49554
2023-03-22 14:34:25 -07:00
Alan Agius
4d89696285 test: remove google-closure-compiler from tests (#49332)
google-closure-compiler does not support ES2022

(cherry picked from commit 54365418bb8388ffa9b6388ae438e4d6ac4e081d)

PR Close #49332
2023-03-22 14:00:20 -07:00
Alan Agius
842d569a94 feat(bazel): (APF) Angular Package Format updates (#49332)
Several updates to Angular Package Format.

BREAKING CHANGE:

Several changes to the Angular Package Format (APF)
- Removal of FESM2015
- Replacing ES2020 with ES2022
- Replacing FESM2020 with FESM2022

PR Close #49332
2023-03-22 14:00:19 -07:00
Alan Agius
c934a8e72b fix(platform-browser): only add ng-app-id to style on server side (#49465)
This commit fixes an issue where it causes issues in G3 when we add `ng-app-id` on browser apps.

PR Close #49465
2023-03-17 17:26:27 +01:00
Kristiyan Kostadinov
20f718782c build: update to TypeScript 5 final (#49458)
Updates the Framework and AIO to the final version of TypeScript 5.

PR Close #49458
2023-03-17 14:50:05 +01:00
Alan Agius
9636910c01 refactor(platform-browser): rename ng-app style attribute to ng-app-id (#49424)
`ng-app` is an AngularJS attribute, see https://docs.angularjs.org/api/ng/directive/ngApp. Using this attribute on a non AngularJS element can cause DI issues in AngularJS when running an AngularJS and Angular application on the same page.

As such, we avoid such problems the Angular `ng-app` attribute is renamed to `ng-app-id`.

PR Close #49424
2023-03-17 10:46:03 +01:00
Alan Agius
9ab9a2a817 refactor(platform-browser): combine DomSharedStylesHost and SharedStylesHost (#49424)
The mentioned 2 classes have been combined since it is no longer required to have a separate `SharedStylesHost` for SSR. This changes also reduces the memory usage footprint as remove 1 Map that stores the CSS strings.

PR Close #49424
2023-03-17 10:46:03 +01:00
Alan Agius
cf98777153 test: update tests to remove deprecated withServerTransition (#49422)
This commit removes the usages of `withServerTransition` form tests.

PR Close #49422
2023-03-15 17:08:18 -07:00
Alan Agius
2d7f48cf74 test: fix misconfiguration in tests (#49391)
Currently, tests are tested twice using "production" like configuration. This commit disabled "optimization" for non production builds.

PR Close #49391
2023-03-15 16:59:50 -07:00
Alan Agius
9165ff2517 fix(platform-browser): reuse server generated component styles (#48253)
Prior to this change component styles generated on the server where removed prior to the client side component being rendered and attached it's own styles. In some cases this caused flickering. To mitigate this `initialNavigation: enabledBlocking'` was introduced which allowed the remove of server styles to be defer to a latter stage when the application has finished initialization.

This commit changes the need for this, by not removing the server generated component styles and reuse them for client side rendering.

PR Close #48253
2023-03-09 09:33:34 -08:00
Matthieu Riegler
addd7f6249 refactor(dev-infra): remove obsolete todos (#49362)
These todos do not apply anymore, let's remove them.

PR Close #49362
2023-03-08 15:39:55 -08:00
Alan Agius
2beffeba8c build: remove core-js-bundle from dependencies (#49259)
This is no longer needed as Angular is ever green.

PR Close #49259
2023-03-01 11:19:48 -08:00
Kristiyan Kostadinov
99d874fe3b feat(core): add support for TypeScript 5.0 (#49126)
Updates the project to support TypeScript 5.0 and to resolve any errors that came up as a result of the update.

PR Close #49126
2023-02-28 08:24:47 -08:00
Andrew Kushnir
459fbb31d1 refactor(platform-browser): rename transfer_state.ts -> transfer_state_module.ts (#49222)
After the move of the `TransferState` logic, this file only contains a module that used to have the `TransferState` in provider list (but was refactored a while ago after `TransferState` became tree-shakable).

PR Close #49222
2023-02-27 13:08:40 -08:00
Kristiyan Kostadinov
79cdfeb392 feat(compiler): drop support for TypeScript 4.8 (#49155)
Drops support for TypeScript 4.8 from the compiler and removes all of the compatibility code we had for it.

BREAKING CHANGE:
* TypeScript 4.8 is no longer supported.

PR Close #49155
2023-02-23 10:39:43 -08:00
Andrew Kushnir
83a6e203e3 refactor(compiler): drop obsolete NgFactory and NgSummary config options (#48268)
The options to generate NgFactory and NgSummary files were added to Ivy for backwards compatibility with ViewEngine. Since ViewEngine was deprecated and removed, the NgFactory and NgSummary files are no longer used as well.

This commit drops obsolete options to generate NgFactory and NgSummary files. Also, the logic that generates those files is also removed.

PR Close #48268
2023-02-21 13:03:59 -08:00
Alan Agius
09e06fbfed test: remove cli-hello-world-ivy-compat integration test (#49111)
This now is the same as `cli-hello-world` since this test does not use View Engine

PR Close #49111
2023-02-17 11:07:28 -08:00
Alan Agius
48aa96ea13 refactor: remove Angular Compatibility Compiler (ngcc) (#49101)
This commit removes the NGCC code and all the related infra setup required to support it.

BREAKING CHANGE: Angular Compatibility Compiler (ngcc) has been removed and as a result Angular View Engine libraries will no longer work

PR Close #49101
2023-02-16 16:01:17 -08:00
Tim Gates
0920409fbc docs: fix simple typo, esnure -> ensure (#48588)
There is a small typo in integration/check-dependencies.js.

Should read `ensure` rather than `esnure`.

Signed-off-by: Tim Gates <tim.gates@iress.com>

PR Close #48588
2023-01-10 08:05:33 -08:00
Matthieu Riegler
279e7d4465 refactor: cleanup polyfills by importing zone.js directly in angular.json (#48380)
Since v15, polyfills can be passed directly into angular.json. Let's use this opportunity to reduce the number of unecessary files.

PR Close #48380
2022-12-13 13:37:08 -08:00
Kristiyan Kostadinov
dd42974b07 feat(core): support TypeScript 4.9 (#48005)
Updates to TypeScript 4.9 and resolves some of the errors and deprecation warnings that showed up as a result.

PR Close #48005
2022-12-06 10:45:33 -08:00
Alan Agius
612eaca3c5 build: update cross-repo dependencies to latest stable version (#48216)
With this change we update the cross-repo dependencies to the latest stable version

PR Close #48216
2022-11-29 12:29:46 -08:00
Derek Cormier
08943f524e build(bazel): fix load statement to point to new dev-infra package
This was introduced during a recent rebase.
2022-11-22 13:51:16 -07:00
Derek Cormier
7a134cf41a build(bazel): incrementally run aio example e2e tests
Replaces the workflow where all example e2es are run at once
2022-11-22 13:51:16 -07:00
Alan Agius
c9541f4c49 fix(localize): update ng add schematic to support Angular CLI version 15 (#47763)
Prior to this, the `@angular/localize/init` was added as a polyfill which caused the `@angular/localize` types not to be included in the TypeScript program which caused errors such as the below:

```
Error: src/app/app.component.ts:9:11 - error TS2304: Cannot find name '$localize'.
```

With the recent changes in the CLI (https://github.com/angular/angular-cli/pull/24032), adding `@angular/localize/init` as polyfil or in the `main.server.ts` is no longer necessary. Instead we add this as a TypeScript type. When users are running in JIT mode, we add `@angular/localize/init` as an additional entrypoint.

This change also exposes the `$localize` method as a global when importing `@angular/localize`.

Closes #47677

PR Close #47763
2022-10-17 09:58:21 +02:00
Kristiyan Kostadinov
ed11a13c3c feat(core): drop support for TypeScript 4.6 and 4.7 (#47690)
Updates the version range in the compiler to require at least TypeScript 4.8. Note that I'm keeping the backwards-compatibility layer for 4.7 around for now until internal projects have been migrated to 4.8.

BREAKING CHANGE:
TypeScript versions older than 4.8 are no longer supported.

PR Close #47690
2022-10-10 16:18:56 +00:00
Alan Agius
ce59f1a14d test: delete bazel_ngtsc_plugin integration test (#47584)
This does not provide any added value.

PR Close #47584
2022-09-30 10:53:04 -07:00
Alan Agius
249384b00c build: update Angular tooling packages to 15.0.0-next.3 (#47584)
- This update is needed to implement the changes in `ng add localize` https://github.com/angular/angular/pull/47569
- Add missing `root` options to all `angular.json`, this is required as otherwise the angular.json validation will fail.
- Remove `require.context` from test.ts integration test, as this is no longer needed.
- Update payloads golden files.

PR Close #47584
2022-09-30 10:53:04 -07:00
Kristiyan Kostadinov
85b5d125be build: fix rxjs 7 build failure (#47548)
Fixes that the `node` typings weren't included in the rxjs 7 typings test.

PR Close #47548
2022-09-26 13:43:19 -07:00
Angular Robot
ebc0135239 build: update all non-major dependencies (#47415)
See associated pull request for more information.

PR Close #47415
2022-09-13 09:19:51 -07:00
Alan Agius
16f96eeabf refactor(compiler-cli): remove enableIvy options (#47346)
This option has no longer any effect as Ivy is the only rendering engine.

BREAKING CHANGE: Angular compiler option `enableIvy` has been removed as Ivy is the only rendering engine.

PR Close #47346
2022-09-06 11:33:48 -07:00
Angular Robot
4cafd08866 build: update all non-major dependencies (#47225)
See associated pull request for more information.

PR Close #47225
2022-09-06 09:53:29 -07:00