Skip to content

Commit 3aa85a8

Browse files
alan-agius4AndrewKushnir
authored andcommitted
refactor(platform-browser): move ApplicationConfig to core (#49253)
This is needed to provide the merge configuration method which will reside in core. DEPRECATED: `ApplicationConfig` has moved, please import `ApplicationConfig` from `@angular/core` instead. PR Close #49253
1 parent 2beffeb commit 3aa85a8

File tree

5 files changed

+40
-13
lines changed

5 files changed

+40
-13
lines changed

goldens/public-api/core/index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ export const APP_ID: InjectionToken<string>;
4949
// @public
5050
export const APP_INITIALIZER: InjectionToken<readonly (() => Observable<unknown> | Promise<unknown> | void)[]>;
5151

52+
// @public
53+
export interface ApplicationConfig {
54+
providers: Array<Provider | EnvironmentProviders>;
55+
}
56+
5257
// @public
5358
export class ApplicationInitStatus {
5459
constructor(appInits: ReadonlyArray<() => Observable<unknown> | Promise<unknown> | void>);

goldens/public-api/platform-browser/index.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
55
```ts
66

7+
import { ApplicationConfig as ApplicationConfig_2 } from '@angular/core';
78
import { ApplicationRef } from '@angular/core';
89
import { ComponentRef } from '@angular/core';
910
import { DebugElement } from '@angular/core';
1011
import { DebugNode } from '@angular/core';
11-
import { EnvironmentProviders } from '@angular/core';
1212
import * as i0 from '@angular/core';
1313
import * as i1 from '@angular/common';
1414
import { InjectionToken } from '@angular/core';
@@ -26,10 +26,8 @@ import { ɵTransferState as TransferState } from '@angular/core';
2626
import { Type } from '@angular/core';
2727
import { Version } from '@angular/core';
2828

29-
// @public
30-
export interface ApplicationConfig {
31-
providers: Array<Provider | EnvironmentProviders>;
32-
}
29+
// @public @deprecated
30+
export type ApplicationConfig = ApplicationConfig_2;
3331

3432
// @public
3533
export function bootstrapApplication(rootComponent: Type<unknown>, options?: ApplicationConfig): Promise<ApplicationRef>;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
/**
3+
* @license
4+
* Copyright Google LLC All Rights Reserved.
5+
*
6+
* Use of this source code is governed by an MIT-style license that can be
7+
* found in the LICENSE file at https://angular.io/license
8+
*/
9+
10+
import {EnvironmentProviders, Provider} from './di';
11+
12+
/**
13+
* Set of config options available during the application bootstrap operation.
14+
*
15+
* @publicApi
16+
*/
17+
export interface ApplicationConfig {
18+
/**
19+
* List of providers that should be available to the root component and all its children.
20+
*/
21+
providers: Array<Provider|EnvironmentProviders>;
22+
}

packages/core/src/core.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export {Sanitizer} from './sanitization/sanitizer';
4040
export {createNgModule, createNgModuleRef, createEnvironmentInjector} from './render3/ng_module_ref';
4141
export {createComponent, reflectComponentType, ComponentMirror} from './render3/component';
4242
export {isStandalone} from './render3/definition';
43+
export {ApplicationConfig} from './application_config';
4344

4445
import {global} from './util/global';
4546
if (typeof ngDevMode !== 'undefined' && ngDevMode) {

packages/platform-browser/src/browser.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import {CommonModule, DOCUMENT, XhrFactory, ɵPLATFORM_BROWSER_ID as PLATFORM_BROWSER_ID} from '@angular/common';
10-
import {APP_ID, ApplicationModule, ApplicationRef, createPlatformFactory, EnvironmentProviders, ErrorHandler, Inject, InjectionToken, ModuleWithProviders, NgModule, NgZone, Optional, PLATFORM_ID, PLATFORM_INITIALIZER, platformCore, PlatformRef, Provider, RendererFactory2, SkipSelf, StaticProvider, Testability, TestabilityRegistry, Type, ɵINJECTOR_SCOPE as INJECTOR_SCOPE, ɵinternalCreateApplication as internalCreateApplication, ɵsetDocument, ɵTESTABILITY as TESTABILITY, ɵTESTABILITY_GETTER as TESTABILITY_GETTER} from '@angular/core';
10+
import {APP_ID, ApplicationConfig as ApplicationConfigFromCore, ApplicationModule, ApplicationRef, createPlatformFactory, ErrorHandler, Inject, InjectionToken, ModuleWithProviders, NgModule, NgZone, Optional, PLATFORM_ID, PLATFORM_INITIALIZER, platformCore, PlatformRef, Provider, RendererFactory2, SkipSelf, StaticProvider, Testability, TestabilityRegistry, Type, ɵINJECTOR_SCOPE as INJECTOR_SCOPE, ɵinternalCreateApplication as internalCreateApplication, ɵsetDocument, ɵTESTABILITY as TESTABILITY, ɵTESTABILITY_GETTER as TESTABILITY_GETTER} from '@angular/core';
1111

1212
import {BrowserDomAdapter} from './browser/browser_adapter';
1313
import {SERVER_TRANSITION_PROVIDERS, TRANSITION_ID} from './browser/server-transition';
@@ -25,13 +25,13 @@ const NG_DEV_MODE = typeof ngDevMode === 'undefined' || !!ngDevMode;
2525
* Set of config options available during the application bootstrap operation.
2626
*
2727
* @publicApi
28+
*
29+
* @deprecated
30+
* `ApplicationConfig` has moved, please import `ApplicationConfig` from `@angular/core` instead.
2831
*/
29-
export interface ApplicationConfig {
30-
/**
31-
* List of providers that should be available to the root component and all its children.
32-
*/
33-
providers: Array<Provider|EnvironmentProviders>;
34-
}
32+
// The below is a workaround to add a deprecated message.
33+
type ApplicationConfig = ApplicationConfigFromCore;
34+
export {ApplicationConfig};
3535

3636
/**
3737
* Bootstraps an instance of an Angular application and renders a standalone component as the
@@ -136,7 +136,8 @@ function createProvidersConfig(options?: ApplicationConfig) {
136136
*/
137137
export function provideProtractorTestingSupport(): Provider[] {
138138
// Return a copy to prevent changes to the original array in case any in-place
139-
// alterations are performed to the `provideProtractorTestingSupport` call results in app code.
139+
// alterations are performed to the `provideProtractorTestingSupport` call results in app
140+
// code.
140141
return [...TESTABILITY_PROVIDERS];
141142
}
142143

0 commit comments

Comments
 (0)