angular/tools
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
..
bazel build: use common jasmine rule from dev-infra (#63568) 2025-09-03 16:34:08 +00:00
contributing-stats refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
gulp-tasks refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
legacy-saucelabs refactor: replace fast-glob usage with tinyglobby (#60264) 2025-03-07 10:57:23 -08:00
manual_api_docs build: rename defaults2.bzl to defaults.bzl (#63383) 2025-08-25 15:45:01 -07:00
pnpm-patches feat(core): introduce BootstrapContext for improved server bootstrapping (#63562) 2025-09-09 10:57:09 -07:00
saucelabs ci: remove circleci as we no longer rely on it (#58615) 2024-11-12 18:39:25 +00:00
saucelabs-daemon build: rename defaults2.bzl to defaults.bzl (#63383) 2025-08-25 15:45:01 -07:00
symbol-extractor build: rename defaults2.bzl to defaults.bzl (#63383) 2025-08-25 15:45:01 -07:00
testing build: rename defaults2.bzl to defaults.bzl (#63383) 2025-08-25 15:45:01 -07:00
tslint build: migrate tslint rules from dev-infra to local (#62709) 2025-07-22 10:07:13 -04:00
BUILD.bazel build: rename defaults2.bzl to defaults.bzl (#63383) 2025-08-25 15:45:01 -07:00
defaults.bzl build: separate zone.js dependencies into their own directory (#63425) 2025-09-05 12:52:55 -07:00
jsconfig.json chore(vscode): add jsconfig.json and remove .settings dir 2015-10-29 13:53:21 +00:00
ng_benchmark.bzl build: rename defaults2.bzl to defaults.bzl (#63383) 2025-08-25 15:45:01 -07:00
tsconfig-test.json build: migrate symbol-extractor to ts_project (#61156) 2025-05-07 11:28:59 -07:00
tsconfig.json build: only require workspace build packages for web tests when provided (#62443) 2025-07-03 08:34:25 +00:00
types.d.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00