From d303cde96d0fc08680f65dea7d67754e7d5a1b54 Mon Sep 17 00:00:00 2001 From: Andrew Scott Date: Tue, 28 Oct 2025 14:57:58 +0000 Subject: [PATCH] refactor(core): Remove zone toggles for test and standalone The migration is complete internally. All that remains is bootstrapModule (cherry picked from commit a253739ac8e4401fa420d64901b229766462a27a) --- integration/standalone-bootstrap/size.json | 2 +- packages/core/src/application/create_application.ts | 4 ---- packages/core/src/platform/bootstrap.ts | 6 +----- .../animations-standalone/bundle.golden_symbols.json | 5 ----- .../test/bundling/defer/bundle.golden_symbols.json | 5 ----- .../bundling/hydration/bundle.golden_symbols.json | 5 ----- .../test/bundling/router/bundle.golden_symbols.json | 5 ----- .../standalone_bootstrap/bundle.golden_symbols.json | 5 ----- packages/core/testing/src/test_bed_compiler.ts | 4 ---- packages/platform-browser/testing/src/browser.ts | 12 +----------- 10 files changed, 3 insertions(+), 50 deletions(-) diff --git a/integration/standalone-bootstrap/size.json b/integration/standalone-bootstrap/size.json index 2e05f6219ec..c86d7f2b76a 100644 --- a/integration/standalone-bootstrap/size.json +++ b/integration/standalone-bootstrap/size.json @@ -1,4 +1,4 @@ { - "dist/main.js": 94769, + "dist/main.js": 89237, "dist/polyfills.js": 33802 } diff --git a/packages/core/src/application/create_application.ts b/packages/core/src/application/create_application.ts index 1c6e444981f..0433798ac4e 100644 --- a/packages/core/src/application/create_application.ts +++ b/packages/core/src/application/create_application.ts @@ -21,11 +21,8 @@ import {ProfilerEvent} from '../render3/profiler_types'; import {errorHandlerEnvironmentInitializer} from '../error_handler'; import {RuntimeError, RuntimeErrorCode} from '../errors'; import {PlatformRef} from '../platform/platform_ref'; -import {internalProvideZoneChangeDetection} from '../change_detection/scheduling/ng_zone_scheduling'; import {validAppIdInitializer} from './application_tokens'; -const ZONELESS_BY_DEFAULT = true; - /** * Internal create application API that implements the core application creation logic and optional * bootstrap logic. @@ -68,7 +65,6 @@ export function internalCreateApplication(config: { // bootstrap level as well as providers passed to the bootstrap call by a user. const allAppProviders = [ provideZonelessChangeDetectionInternal(), - ZONELESS_BY_DEFAULT ? [] : internalProvideZoneChangeDetection({}), errorHandlerEnvironmentInitializer, ...(ngDevMode ? [validAppIdInitializer] : []), ...(appProviders || []), diff --git a/packages/core/src/platform/bootstrap.ts b/packages/core/src/platform/bootstrap.ts index caf81223319..be2d885e6d0 100644 --- a/packages/core/src/platform/bootstrap.ts +++ b/packages/core/src/platform/bootstrap.ts @@ -28,7 +28,6 @@ import {stringify} from '../util/stringify'; import {isPromise} from '../util/lang'; import {PendingTasksInternal} from '../pending_tasks_internal'; -const REQUIRE_ONE_CD_PROVIDER_CREATE_APPLICATION = false; const REQUIRE_ONE_CD_PROVIDER_BOOTSTRAP_MODULE = false; /** @@ -106,10 +105,7 @@ export function bootstrap( ); } if (!envInjector.get(PROVIDED_ZONELESS) && !envInjector.get(PROVIDED_NG_ZONE)) { - if ( - (REQUIRE_ONE_CD_PROVIDER_CREATE_APPLICATION && isApplicationBootstrapConfig(config)) || - (REQUIRE_ONE_CD_PROVIDER_BOOTSTRAP_MODULE && !isApplicationBootstrapConfig(config)) - ) { + if (REQUIRE_ONE_CD_PROVIDER_BOOTSTRAP_MODULE && !isApplicationBootstrapConfig(config)) { throw new Error( 'Missing change detection configuration: ' + 'please add either `provideZoneChangeDetection()` or `provideZonelessChangeDetection()` ' + diff --git a/packages/core/test/bundling/animations-standalone/bundle.golden_symbols.json b/packages/core/test/bundling/animations-standalone/bundle.golden_symbols.json index 06a097789cc..942e4aef89f 100644 --- a/packages/core/test/bundling/animations-standalone/bundle.golden_symbols.json +++ b/packages/core/test/bundling/animations-standalone/bundle.golden_symbols.json @@ -176,7 +176,6 @@ "NgModuleRef", "NgOnChangesFeatureImpl", "NgZone", - "NgZoneChangeDetectionScheduler", "NodeInjector", "NodeInjectorDestroyRef", "NodeInjectorFactory", @@ -270,10 +269,8 @@ "WebAnimationsPlayer", "WebAnimationsStyleNormalizer", "XhrFactory", - "ZONELESS_BY_DEFAULT", "ZONELESS_ENABLED", "ZoneAwareEffectScheduler", - "ZoneStablePendingTask", "\\u0275PRE_STYLE", "\\u0275\\u0275defineComponent", "\\u0275\\u0275defineInjectable", @@ -521,7 +518,6 @@ "getNearestLContainer", "getNextLContainer", "getNgDirectiveDef", - "getNgZoneOptions", "getNodeInjectable", "getNullInjector", "getOrBorrowReactiveLViewConsumer", @@ -588,7 +584,6 @@ "instructionState", "internalCreateApplication", "internalImportProvidersFrom", - "internalProvideZoneChangeDetection", "interpolateParams", "invalidCssUnitValue", "invalidDefinition", diff --git a/packages/core/test/bundling/defer/bundle.golden_symbols.json b/packages/core/test/bundling/defer/bundle.golden_symbols.json index 7461aca1cd1..05990f3a621 100644 --- a/packages/core/test/bundling/defer/bundle.golden_symbols.json +++ b/packages/core/test/bundling/defer/bundle.golden_symbols.json @@ -181,7 +181,6 @@ "NgModuleRef", "NgOnChangesFeatureImpl", "NgZone", - "NgZoneChangeDetectionScheduler", "NodeInjector", "NodeInjectorDestroyRef", "NodeInjectorFactory", @@ -244,10 +243,8 @@ "VIEW_REFS", "ViewEncapsulation", "ViewRef", - "ZONELESS_BY_DEFAULT", "ZONELESS_ENABLED", "ZoneAwareEffectScheduler", - "ZoneStablePendingTask", "\\u0275\\u0275advance", "\\u0275\\u0275defer", "\\u0275\\u0275deferWhen", @@ -471,7 +468,6 @@ "getNearestLContainer", "getNextLContainer", "getNgDirectiveDef", - "getNgZoneOptions", "getNodeInjectable", "getNullInjector", "getOrBorrowReactiveLViewConsumer", @@ -540,7 +536,6 @@ "instructionState", "internalCreateApplication", "internalImportProvidersFrom", - "internalProvideZoneChangeDetection", "invokeAllTriggerCleanupFns", "invokeDirectivesHostBindings", "invokeHostBindingsInCreationMode", diff --git a/packages/core/test/bundling/hydration/bundle.golden_symbols.json b/packages/core/test/bundling/hydration/bundle.golden_symbols.json index a7fed5eae6f..6609d6a84c3 100644 --- a/packages/core/test/bundling/hydration/bundle.golden_symbols.json +++ b/packages/core/test/bundling/hydration/bundle.golden_symbols.json @@ -158,7 +158,6 @@ "NgModuleRef", "NgOnChangesFeatureImpl", "NgZone", - "NgZoneChangeDetectionScheduler", "NodeInjector", "NodeInjectorDestroyRef", "NodeInjectorFactory", @@ -234,10 +233,8 @@ "ViewEncapsulation", "ViewRef", "XhrFactory", - "ZONELESS_BY_DEFAULT", "ZONELESS_ENABLED", "ZoneAwareEffectScheduler", - "ZoneStablePendingTask", "\\u0275\\u0275defineComponent", "\\u0275\\u0275defineInjectable", "\\u0275\\u0275directiveInject", @@ -486,7 +483,6 @@ "getNextLContainer", "getNgContainerSize", "getNgDirectiveDef", - "getNgZoneOptions", "getNoOffsetIndex", "getNodeInjectable", "getNullInjector", @@ -557,7 +553,6 @@ "instructionState", "internalCreateApplication", "internalImportProvidersFrom", - "internalProvideZoneChangeDetection", "invokeDirectivesHostBindings", "invokeHostBindingsInCreationMode", "isAngularZoneProperty", diff --git a/packages/core/test/bundling/router/bundle.golden_symbols.json b/packages/core/test/bundling/router/bundle.golden_symbols.json index 1051bf9588f..f7717bbdbe3 100644 --- a/packages/core/test/bundling/router/bundle.golden_symbols.json +++ b/packages/core/test/bundling/router/bundle.golden_symbols.json @@ -190,7 +190,6 @@ "NgModuleRef2", "NgOnChangesFeatureImpl", "NgZone", - "NgZoneChangeDetectionScheduler", "NoLeftoversInUrl", "NoMatch", "NodeInjector", @@ -318,10 +317,8 @@ "ViewRef", "XSS_SECURITY_URL", "XhrFactory", - "ZONELESS_BY_DEFAULT", "ZONELESS_ENABLED", "ZoneAwareEffectScheduler", - "ZoneStablePendingTask", "\\u0275EmptyOutletComponent", "\\u0275\\u0275NgOnChangesFeature", "\\u0275\\u0275attribute", @@ -682,7 +679,6 @@ "getNextLContainer", "getNgDirectiveDef", "getNgModuleDef", - "getNgZoneOptions", "getNodeInjectable", "getNullInjector", "getOrBorrowReactiveLViewConsumer", @@ -779,7 +775,6 @@ "instructionState", "internalCreateApplication", "internalImportProvidersFrom", - "internalProvideZoneChangeDetection", "interpolation1", "invokeDirectivesHostBindings", "invokeHostBindingsInCreationMode", diff --git a/packages/core/test/bundling/standalone_bootstrap/bundle.golden_symbols.json b/packages/core/test/bundling/standalone_bootstrap/bundle.golden_symbols.json index fc2d65dc258..12a2fa67cd6 100644 --- a/packages/core/test/bundling/standalone_bootstrap/bundle.golden_symbols.json +++ b/packages/core/test/bundling/standalone_bootstrap/bundle.golden_symbols.json @@ -129,7 +129,6 @@ "NgModuleRef", "NgOnChangesFeatureImpl", "NgZone", - "NgZoneChangeDetectionScheduler", "NodeInjector", "NodeInjectorDestroyRef", "NodeInjectorFactory", @@ -193,10 +192,8 @@ "ViewEncapsulation", "ViewRef", "XhrFactory", - "ZONELESS_BY_DEFAULT", "ZONELESS_ENABLED", "ZoneAwareEffectScheduler", - "ZoneStablePendingTask", "\\u0275\\u0275defineComponent", "\\u0275\\u0275defineInjectable", "\\u0275\\u0275directiveInject", @@ -389,7 +386,6 @@ "getNearestLContainer", "getNextLContainer", "getNgDirectiveDef", - "getNgZoneOptions", "getNodeInjectable", "getNullInjector", "getOrBorrowReactiveLViewConsumer", @@ -447,7 +443,6 @@ "instructionState", "internalCreateApplication", "internalImportProvidersFrom", - "internalProvideZoneChangeDetection", "invokeDirectivesHostBindings", "invokeHostBindingsInCreationMode", "isAngularZoneProperty", diff --git a/packages/core/testing/src/test_bed_compiler.ts b/packages/core/testing/src/test_bed_compiler.ts index 28b85fed3a7..dc25dfa2a5a 100644 --- a/packages/core/testing/src/test_bed_compiler.ts +++ b/packages/core/testing/src/test_bed_compiler.ts @@ -42,7 +42,6 @@ import { ɵgetInjectableDef as getInjectableDef, ɵInternalEnvironmentProviders as InternalEnvironmentProviders, ɵprovideZonelessChangeDetectionInternal as provideZonelessChangeDetectionInternal, - ɵinternalProvideZoneChangeDetection as internalProvideZoneChangeDetection, ɵisComponentDefPendingResolution, ɵisEnvironmentProviders as isEnvironmentProviders, ɵNG_COMP_DEF as NG_COMP_DEF, @@ -92,8 +91,6 @@ enum TestingModuleOverride { OVERRIDE_TEMPLATE, } -const ZONELESS_BY_DEFAULT = true; - function isTestingModuleOverride(value: unknown): value is TestingModuleOverride { return ( value === TestingModuleOverride.DECLARATION || value === TestingModuleOverride.OVERRIDE_TEMPLATE @@ -938,7 +935,6 @@ export class TestBedCompiler { providers: [ ...this.rootProviderOverrides, provideZonelessChangeDetectionInternal(), - ZONELESS_BY_DEFAULT ? [] : internalProvideZoneChangeDetection({}), TestBedApplicationErrorHandler, { provide: ENVIRONMENT_INITIALIZER, diff --git a/packages/platform-browser/testing/src/browser.ts b/packages/platform-browser/testing/src/browser.ts index a6f202566a7..1434367bd39 100644 --- a/packages/platform-browser/testing/src/browser.ts +++ b/packages/platform-browser/testing/src/browser.ts @@ -6,21 +6,11 @@ * found in the LICENSE file at https://angular.dev/license */ import {ɵprovideFakePlatformNavigation} from '@angular/common/testing'; -import { - APP_ID, - createPlatformFactory, - NgModule, - StaticProvider, - ɵprovideZonelessChangeDetectionInternal as provideZonelessChangeDetectionInternal, - ɵinternalProvideZoneChangeDetection as internalProvideZoneChangeDetection, - PlatformRef, -} from '@angular/core'; +import {APP_ID, createPlatformFactory, NgModule, StaticProvider, PlatformRef} from '@angular/core'; import {TestComponentRenderer} from '@angular/core/testing'; import {BrowserModule, platformBrowser} from '../../index'; import {DOMTestComponentRenderer} from './dom_test_component_renderer'; -const ZONELESS_BY_DEFAULT = true; - /** * Platform for testing *