angular/packages/core/test/bundling
Alan Agius 9d1fb33f5e fix(core): introduce BootstrapContext for improved server bootstrapping (#63640)
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.

(cherry picked from commit 8bf80c9d2314b4f2bcf3df83ae01552a6fc49834)

PR Close #63640
2025-09-09 10:46:27 -07:00
..
animation_world refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
animations refactor(core): Remove global event delegation code. (#57893) 2024-09-26 14:18:18 -07:00
animations-standalone fix(core): introduce BootstrapContext for improved server bootstrapping (#63640) 2025-09-09 10:46:27 -07:00
core_all refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
cyclic_import refactor(core): Remove global event delegation code. (#57893) 2024-09-26 14:18:18 -07:00
defer fix(core): introduce BootstrapContext for improved server bootstrapping (#63640) 2025-09-09 10:46:27 -07:00
forms_reactive refactor(core): Remove global event delegation code. (#57893) 2024-09-26 14:18:18 -07:00
forms_template_driven refactor(core): Remove global event delegation code. (#57893) 2024-09-26 14:18:18 -07:00
hello_world refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
hello_world_i18n refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
hydration fix(core): introduce BootstrapContext for improved server bootstrapping (#63640) 2025-09-09 10:46:27 -07:00
image-directive fix(common): prevent warning about oversize image twice (#58021) 2024-10-02 11:46:18 +00:00
injection refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
router fix(core): introduce BootstrapContext for improved server bootstrapping (#63640) 2025-09-09 10:46:27 -07:00
standalone_bootstrap fix(core): introduce BootstrapContext for improved server bootstrapping (#63640) 2025-09-09 10:46:27 -07:00
todo refactor(core): Remove global event delegation code. (#57893) 2024-09-26 14:18:18 -07:00
todo_i18n refactor: update license text to point to angular.dev (#57902) 2024-09-24 15:28:46 +02:00
README.md fix(core): remove individual commands for updating gold files (#45198) 2022-03-01 19:16:53 +00:00

Bundle

js_expected_symbol_test

This folder contains tests which assert that most of the code is tree shaken away. This is asserted by keeping gold files of all symbols which are expected to be retained. When doing renaming it is often necessary to update the gold files; to do so use these scripts:

yarn run symbol-extractor:check
yarn run symbol-extractor:update