angular/packages/core/schematics/test
Alan Agius 28926ba92c feat(core): introduce BootstrapContext for improved server bootstrapping (#63562)
This commit introduces a number of changes to the server bootstrapping process to make it more robust and less error-prone, especially for concurrent requests.

Previously, the server rendering process relied on a module-level global platform injector. This could lead to issues in server-side rendering environments where multiple requests are processed concurrently, as they could inadvertently share or overwrite the global injector state.

The new approach introduces a `BootstrapContext` that is passed to the `bootstrapApplication` function. This context provides a platform reference that is scoped to the individual request, ensuring that each server-side render has an isolated platform injector. This prevents state leakage between concurrent requests and makes the overall process more reliable.

BREAKING CHANGE:
The server-side bootstrapping process has been changed to eliminate the reliance on a global platform injector.

Before:
```ts
const bootstrap = () => bootstrapApplication(AppComponent, config);
```

After:
```ts
const bootstrap = (context: BootstrapContext) =>
  bootstrapApplication(AppComponent, config, context);
```

A schematic is provided to automatically update `main.server.ts` files to pass the `BootstrapContext` to the `bootstrapApplication` call.

In addition, `getPlatform()` and `destroyPlatform()` will now return `null` and be a no-op respectively when running in a server environment.

PR Close #63562
2025-09-09 10:57:09 -07:00
..
add_bootstrap_context_to_server_main_spec.ts feat(core): introduce BootstrapContext for improved server bootstrapping (#63562) 2025-09-09 10:57:09 -07:00
all-migrations.spec.ts build: remove all usages of @bazel/runfiles (#62804) 2025-07-25 10:04:55 +02:00
application_config_core_spec.ts refactor(platform-browser): remove deprecated ApplicationConfig export (#63529) 2025-09-02 11:48:19 -07:00
BUILD.bazel build: rename defaults2.bzl to defaults.bzl (#63383) 2025-08-25 15:45:01 -07:00
cleanup_unused_imports_migration_spec.ts build: remove all usages of @bazel/runfiles (#62804) 2025-07-25 10:04:55 +02:00
control_flow_migration_spec.ts build: remove all usages of @bazel/runfiles (#62804) 2025-07-25 10:04:55 +02:00
helpers.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
inject_migration_spec.ts fix(core): Fixed inject migration schematics for migrate destructured properties (#62832) 2025-09-02 10:59:46 -07:00
ngclass_to_class_migration_spec.ts fix(migrations): fix bug in ngclass-to-class migration (#63617) 2025-09-08 12:30:00 -07:00
output_migration_spec.ts build: remove all usages of @bazel/runfiles (#62804) 2025-07-25 10:04:55 +02:00
project_tsconfig_paths_spec.ts build: migrate to using new jasmine_test (#62086) 2025-06-18 08:27:26 +02:00
queries_migration_spec.ts build: remove all usages of @bazel/runfiles (#62804) 2025-07-25 10:04:55 +02:00
router_current_navigation_spec.ts feat(router): add a currentNavigation signal to the Router service. (#63011) 2025-08-06 09:54:53 -07:00
router_last_successful_navigation_spec.ts feat(router): convert lastSuccessfulNavigation to signal (#63057) 2025-08-13 11:29:01 -07:00
self_closing_tags_migration_spec.ts build: remove all usages of @bazel/runfiles (#62804) 2025-07-25 10:04:55 +02:00
signal_input_migration_spec.ts build: remove all usages of @bazel/runfiles (#62804) 2025-07-25 10:04:55 +02:00
signals_migration_spec.ts build: remove all usages of @bazel/runfiles (#62804) 2025-07-25 10:04:55 +02:00
standalone_migration_spec.ts build: remove all usages of @bazel/runfiles (#62804) 2025-07-25 10:04:55 +02:00
standalone_routes_spec.ts build: remove all usages of @bazel/runfiles (#62804) 2025-07-25 10:04:55 +02:00