mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
refactor(core): Remove zone toggles for test and standalone
The migration is complete internally. All that remains is bootstrapModule
(cherry picked from commit a253739ac8)
This commit is contained in:
committed by
Kristiyan Kostadinov
parent
3fbaaa0176
commit
d303cde96d
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"dist/main.js": 94769,
|
||||
"dist/main.js": 89237,
|
||||
"dist/polyfills.js": 33802
|
||||
}
|
||||
|
||||
@@ -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 || []),
|
||||
|
||||
@@ -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<M>(
|
||||
);
|
||||
}
|
||||
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()` ' +
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user