Commit graph

709 commits

Author SHA1 Message Date
Matthieu Riegler
21ca49cf62 refactor(core): rename ExperimentalIsolatedShadowDom to IsolatedShadowDom
This API is still experimental
2025-11-11 08:46:06 -08:00
Doug Parker
ec9dc94cee feat(platform-browser): add context to createApplication
This is necessary to use SSR safely with `createApplication` and avoid constraining users to `bootstrapApplication`. It is one more step towards feature parity between `createApplication` and `bootstrapApplication`.
2025-11-10 14:18:29 -08:00
Doug Parker
ab67988d2e feat(platform-browser): resolve JIT resources in createApplication
Previously, `createApplication` didn't work with JIT components. This commit brings it closer to feature parity with `bootstrapApplication`.
2025-11-10 14:18:29 -08:00
arturovt
d3f67f6ca8 refactor(core): mark VERSION as @__PURE__ for better tree-shaking
Annotate the `new Version(...)` call with `/* @__PURE__ */` to signal to optimizers that the constructor is side-effect free.

Without this hint, bundlers such as Terser or ESBuild may conservatively retain the `VERSION` instantiation even when unused. With the annotation, the constant can be tree-shaken away in production builds if not referenced, reducing bundle size.
2025-11-10 12:04:04 -08:00
SkyZeroZx
5343001835 refactor(platform-browser): remove unused Platform ID dependency from DomRendererFactory2
Eliminates the unnecessary injection and usage of Platform ID in the renderer factory logic, along with related test scaffolding cleanup
2025-11-06 12:00:46 -08:00
Alan Agius
26fed34e0e
build: format md files
This commit configures prettier to format markdown files.
2025-11-06 10:03:05 -08:00
SkyZeroZx
97169b4689 refactor(platform-browser): remove redundant providedIn: 'root' from injection tokens
Removes unnecessary `providedIn: 'root'` declarations from injection tokens
2025-11-04 00:31:52 +00:00
Kristiyan Kostadinov
b9e2ccdda8 refactor(common): remove unused import (#64699)
Cleans up unused code to improve readability and maintainability.

PR Close #64699
2025-10-30 19:27:33 +00:00
Andrew Scott
a253739ac8
refactor(core): Remove zone toggles for test and standalone
The migration is complete internally. All that remains is bootstrapModule
2025-10-28 15:57:58 +01:00
Jessica Janiuk
70332b0453 fix(core): pass element removal property through in all locations (#64565)
The `requireSynchronousElementRemoval` property was not being passed in all the locations it was needed. This was preventing leave animation timing from behaving properly in some cases.

fixes: #64525

PR Close #64565
2025-10-21 18:08:34 +00:00
SkyZeroZx
8d1e9796d6 docs: add references to SSR guide for caching options (#64347)
PR Close #64347
2025-10-21 15:12:15 +00:00
Matthieu Riegler
95e1632650 refactor(platform-browser): remove unecessary export. (#64469)
The usage has been removed from g3.

PR Close #64469
2025-10-16 18:52:54 +00:00
SkyZeroZx
df780fae18 docs: Add docs for EVENT_MANAGER_PLUGINS (#64453)
PR Close #64453
2025-10-16 14:54:47 +00:00
Matthieu Riegler
29c397f883 fix(platform-browser): DomEventsPlugin should always be the last plugin to be called for supports(). (#50394)
This fixes the issues when `BrowserModule` is not the first module imported.

Fixes #37149 #37850

PR Close #50394
2025-10-15 21:12:46 +00:00
Kristiyan Kostadinov
f5b50ec20d refactor: clean up explicit standalone flags from tests (#63963)
Since standalone is the default, we can dropn the `standalone: true` flags from our tests.

PR Close #63963
2025-09-22 14:27:34 +00:00
Matthieu Riegler
c50d659509 refactor(core): protect InjectionToken usage of ngDevMode (#63875)
Since those are top level APIs, `ngDevMode` might not be available at runtime if they're invoked before the variable is set.

fixes #62796

PR Close #63875
2025-09-19 21:27:45 +00:00
Matthieu Riegler
fec7c288e9 fix(core): Error on invalid APP_ID (#63252)
An invalid APP_ID could be responsible to generating broken CSS selectors. (eg `:` is an example for a character that breaks a selector by being a separator for pseudo-selectors.)
We now throw an error if the provided value is not alphanumerical

PR Close #63252
2025-09-19 15:00:10 +00:00
Andrew Scott
8ad26edb72 refactor(platform-browser): Remove zone provideres from BrowserTestingModule (#63872)
This removes the Zone providers from the `BrowserTestingModule`. These
already exist by default in all other entrypoints to Angular
environments (TestBed compiler, bootstrapModule, and createApplication).

PR Close #63872
2025-09-17 21:17:59 +00:00
Andrew Scott
0d028e0f77 refactor(platform-browser): Remove zonejs compatibility detector (#63847)
The zoneless scheduler is always enabled, so if hydration works with zoneless, it works
for all Angular apps. There is no need for detection of custom zone implementations

PR Close #63847
2025-09-16 22:16:49 +00:00
Andrew Scott
d5e00f9591 refactor(core): Make the zoneless-by-default change a flag flip (#63382)
This makes the zoneless-by-default change a flag flip that can be
individually enabled in tests, createApplication, and bootstrapModule
for gradual rollout. In addition, the "require on CD provider" check is
also made individually flippable for gradual rollout.

PR Close #63382
2025-09-16 18:56:54 +00:00
Andrew Scott
45fed3d201 fix(core): Remove Zone-based change provider from internals by default (#63382)
This change removes the internally provided `ZoneJS`-based change
detection scheduler. This makes Angular Zoneless by default and allows
tree-shaking of the Zone change detection providers.

BREAKING CHANGE: Angular no longer provides a change detection scheduler
for ZoneJS-based change detection by default. Add
`provideZoneChangeDetection` to the providers of your
`bootstrapApplication` function or your `AppModule` (if using
`bootstrapModule`). This provider addition will be covered by an
automated migration.

PR Close #63382
2025-09-16 18:56:53 +00:00
Kristiyan Kostadinov
8f59295019 refactor(core): remove unnecessary deps arrays (#63823)
We don't need to use the `deps` array syntax anymore since we have the `inject` function. These changes clean up the relevant usages.

PR Close #63823
2025-09-16 16:51:52 +00:00
Jessica Janiuk
4924108630 refactor(core): dispatch enter and leave animations at the right times (#63450)
This updates the enter and leave logic to use the stored LView data to dispatch the enter and leave animations at the right points in the lifecycle. This should fix issues with signals not being available yet, parallel animations, and also eliminate the need for the element registry.

fixes: #63391
fixes: #63388
fixes: #63369

PR Close #63450
2025-09-10 22:24:00 +00:00
Andrew Scott
c3576506b3 refactor(core): Update tests for zoneless by default (#63668)
This updates tests and examples only to prepare for zoneless by default.

These changes were identified and made as part of #63382. Anything that
failed gets `provideZoneChangeDetection` unless the fixes were easily
and quickly determined.

It also adds the zoneless provider to the `initTestEnvironment` calls
for tests in this repo to prevent regressions before #63382 is merged.

PR Close #63668
2025-09-09 14:41:56 -07:00
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
Alan Agius
ce8db665f9 refactor(platform-browser): remove deprecated ApplicationConfig export (#63529)
Removes the deprecated `ApplicationConfig` export from `@angular/platform-browser`.
This export was deprecated in a prior version and developers should import `ApplicationConfig` from `@angular/core` instead.

BREAKING CHANGE:

The deprecated `ApplicationConfig` export from `@angular/platform-browser` has been removed.
Please import `ApplicationConfig` from `@angular/core` instead.

PR Close #63529
2025-09-02 11:48:19 -07:00
Andrew Scott
c795960ada feat(common): Add experimental support for the Navigation API (#63406)
The navigation API is part of interop 2025. You can find the
implementation status for each major browser here:

https://wpt.fyi/results/navigation-api?label=master&label=experimental&aligned&view=interop&q=label%3Ainterop-2025-navigation

https://developer.mozilla.org/en-US/docs/Web/API/Navigation_API

BREAKING CHANGE: (test only) - `TestBed` now provides a fake `PlatformLocation`
implementation that supports the Navigation API. This may break some
tests, though we have not observed any failures internally. You can revert to the
old default for `TestBed` by providing the `MockPlatformLocation` from
`@angular/common/testing` in your providers:
`{provide: PlatformLocation, useClass: MockPlatformLocation}`

PR Close #63406
2025-08-28 11:48:03 -07:00
Joey Perrott
2fcafb65c5 build: rename defaults2.bzl to defaults.bzl (#63383)
Use defaults.bzl for the common macros

PR Close #63383
2025-08-25 15:45:01 -07:00
Ryan Bendel
d24d5742db feat(platform-browser): Add IsolatedShadowDom encapsulation method (#62723)
IsolatedShadowDom encapsulation fixes style leakage in Shadowdom encapsulation by removing sharedstyleshost from dom-renderer IsolatedShadowdom class. Updates docs.

PR Close #62723
2025-08-06 16:48:37 +02:00
Joey Perrott
fa8d8b8396 build: migrate all npm packages to use new rules_js based npm_package rule (#62954)
Use a common rule for all npm_packages

PR Close #62954
2025-08-05 19:08:45 +00:00
SkyZeroZx
52b8e07d6e feat(platform-browser): Warns on conflicting hydration and blocking navigation (#62963)
Adds an internal token to detect when both hydration and blocking initial navigation are enabled. Logs a warning during app initialization if this unsupported combination is found, helping developers avoid misconfiguration and potential runtime issues.

PR Close #62963
2025-08-05 18:16:10 +02:00
Jessica Janiuk
857675fedb refactor(core): this delays removal of stylesheets when the element registry is present (#62943)
When animate.leave is used, stylesheet pruning causes issues. Stylesheets with the appropriate animations get pruned before the animations can run. This will delay the removal in the case that the registry is present.

fixes: #62942

PR Close #62943
2025-08-01 12:54:22 +00:00
Joey Perrott
cbc258eec8 build: remove ts_project_interop infrastructure (#62908)
Remove the interop macros and final usages

PR Close #62908
2025-07-31 09:12:58 +00:00
Jessica Janiuk
d23c5e4670 refactor(core): Tiny animation optimization (#62896)
This removes one redundant check to reduce code size.

PR Close #62896
2025-07-30 13:56:46 +00:00
Joey Perrott
49b7729e88 build: remove usages of rules_nodejs (#62885)
Remove rules_nodejs usages with direct migrations to rule_js alternatives

PR Close #62885
2025-07-30 08:51:27 +00:00
Joey Perrott
793ff35602 build: move http_server and generate_api_docs into defaults2.bzl (#62878)
Move http_server and generate_api_docs into defaults2.bzl as they are rules_js compliant

PR Close #62878
2025-07-29 16:53:54 +00:00
Jessica Janiuk
9766116cea refactor(animations): deprecate the animations package (#62795)
This deprecates the animations package in favor of using `animate.enter` and `animate.leave` with intent to remove the full package in v22.2.

DEPRECATED: @angular/animations

PR Close #62795
2025-07-29 09:50:09 +00:00
Joey Perrott
17ada9838b build: move tsec to new toolchain (#62825)
Migrate tsec tooling/macro to use tsec directly as a js_binary and rely on ts_project dependencies.

PR Close #62825
2025-07-28 20:07:05 +02:00
Kristiyan Kostadinov
74d99ed379 fix(platform-browser): resolve component resources before bootstrapping in JIT mode (#62758)
Currently if the app has some external resources and it gets bootstrapped in JIT mode, the user will get an error about calling `resolveComponentResources`. These changes add a call to `resolveComponentResources` automatically inside `bootstrapApplication`.

Note that we don't need similar logic for `bootstrapModule`, because it calls into `compileNgModuleFactory` internally which in turn calls `resolveComponentResources`.

PR Close #62758
2025-07-23 11:05:20 -04:00
Jessica Janiuk
882522c1ad refactor(compiler): Tree shake Element Registry (#62682)
This creates a feature to detect usages of animate.leave and only enables the element removal registry when necessary

PR Close #62682
2025-07-23 09:37:16 -04:00
Jessica Janiuk
6b1f4b9e8b feat(core): add enter and leave animation instructions (#62682)
This adds the instructions to support enter and leave animations on nodes.

PR Close #62682
2025-07-23 09:37:16 -04:00
Kristiyan Kostadinov
cec91c0035 feat(core): add option to infer the tag names of components in tests (#62283)
Currently when testing a component using `TestBed.createComponent`, we always create the component as a `div` which isn't aligned with the runtime. The runtime tries to parse out the tag name from the first selector in `@Component` and only falls back to `div` if there isn't one. This behavior difference can cause components to not behave like they would in production which reduces the usefulness of the tests.

These changes add the `inferTagName` option to `TestBed.createComponent` and `TestBed.configureTestingModule` that allows apps to opt into inferring the tag name from the selector in the same way as the runtime. Currently the new option is set to `false`, but we intend to change it to `true` in a future version.

PR Close #62283
2025-07-23 07:30:36 -04:00
Joey Perrott
8bf97d1370 build: remove all usages of the interop_deps attr for ts_project and ng_project (#62732)
Remove all of the usages of interop_deps as attributes in the repo

PR Close #62732
2025-07-21 13:03:09 -04:00
Joey Perrott
23d58777b4 build: migrate to new toolchain usage for api goldens (#62688)
Migrate api golden usage to be based on rules_js toolchain implementation

PR Close #62688
2025-07-17 18:13:42 -04:00
Andrew Kushnir
96014b5f85 refactor(core): include DI path into cyclic dependency error message (#50902)
This commit updates the logic to better handle a situation when there is a cyclic DI dependency detected. Previously, the error message used to contain the name of the token that triggered the problem. With this change, the DI resolution path would also be included, so that it's easier to find and resolve the cycle.

PR Close #50902
2025-07-10 10:35:12 -07:00
SkyZeroZx
44a203916a refactor(platform-browser): use RuntimeError for hydration feature conflicts (#62414)
Replace generic Error with RuntimeError

PR Close #62414
2025-07-03 08:08:07 +00:00
Joey Perrott
b84859073b build: migrate to use web test runner rules (#62292)
Migrate karma tests throughout the repo to use the new web test runner based rule instead

PR Close #62292
2025-06-26 17:19:10 +00:00
Joey Perrott
3a0cfd544d build: migrate to using new jasmine_test (#62086)
Use the new jasmine_test based on rules_js instead of jasmine_node_test from rules_nodejs

PR Close #62086
2025-06-18 08:27:26 +02:00
Joey Perrott
dfbdbbe882 refactor: use zone.js from npm instead of packages/zone.js throughout repo (#61977)
Use zone.js from npm isntead of from the repo going forward

PR Close #61977
2025-06-10 12:02:03 -07:00
Joey Perrott
9354efc86a build: remove unnecessary zone.js dep from various build targets (#61901)
Remove unnecessary zone.js dep from various build targets

PR Close #61901
2025-06-05 09:12:27 -07:00