angular/tools
Alan Agius 70d0639bc1
fix(core): introduce BootstrapContext for improved server bootstrapping (#63639)
* fix(core): introduce `BootstrapContext` for improved server bootstrapping

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.
2025-09-09 10:56:38 -07:00
..
bazel build: add modified version of tsec that can work with interop (#61336) 2025-05-14 08:31:33 -07:00
contributing-stats refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
esm-interop build: update legacy ESM interop rules to support explicit .js entrypoints (#61420) 2025-05-16 15:53:27 +00:00
gulp-tasks refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
legacy-saucelabs refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
manual_api_docs docs: call out the available variables in track expressions (#61252) 2025-05-16 07:51:11 +00:00
npm-patches fix(core): introduce BootstrapContext for improved server bootstrapping (#63639) 2025-09-09 10:56:38 -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: update tools directory to use rules_js for building (#61658) 2025-05-26 09:58:38 +00:00
symbol-extractor build: fix symbol extractor script (#61407) 2025-05-16 13:59:11 +00:00
testing build: update tools directory to use rules_js for building (#61658) 2025-05-26 09:58:38 +00:00
tslint refactor: add explicit types for exports relying on inferred call return type (#61316) 2025-05-13 22:46:00 +00:00
BUILD.bazel build: migrate symbol-extractor to ts_project (#61209) 2025-05-08 09:23:48 -07:00
defaults.bzl build: update compiler-cli to not be stamped when used for the compiler in ng_project (#61539) 2025-05-21 09:14:35 +00:00
defaults2.bzl build: migrate examples to use rules_js (#61652) 2025-05-26 11:01:31 +00:00
jsconfig.json chore(vscode): add jsconfig.json and remove .settings dir 2015-10-29 13:53:21 +00:00
ng_benchmark.bzl refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
postinstall-patches.js refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
tsconfig-test.json build: migrate symbol-extractor to ts_project (#61209) 2025-05-08 09:23:48 -07:00
tsconfig.json build: update tools directory to use rules_js for building (#61658) 2025-05-26 09:58:38 +00:00
types.d.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00