diff --git a/goldens/public-api/platform-browser-dynamic/index.api.md b/goldens/public-api/platform-browser-dynamic/index.api.md index 4e8ac3a179d8..cc5f45d1fad5 100644 --- a/goldens/public-api/platform-browser-dynamic/index.api.md +++ b/goldens/public-api/platform-browser-dynamic/index.api.md @@ -4,10 +4,11 @@ ```ts -import * as _angular_core from '@angular/core'; import { Compiler } from '@angular/core'; import { CompilerFactory } from '@angular/core'; import { CompilerOptions } from '@angular/core'; +import * as i0 from '@angular/core'; +import { StaticProvider } from '@angular/core'; import { Version } from '@angular/core'; // @public @deprecated (undocumented) @@ -17,7 +18,7 @@ export class JitCompilerFactory implements CompilerFactory { } // @public (undocumented) -export const platformBrowserDynamic: (extraProviders?: _angular_core.StaticProvider[]) => _angular_core.PlatformRef; +export const platformBrowserDynamic: (extraProviders?: StaticProvider[]) => i0.PlatformRef; // @public (undocumented) export const VERSION: Version; diff --git a/goldens/public-api/platform-browser-dynamic/testing/index.api.md b/goldens/public-api/platform-browser-dynamic/testing/index.api.md index 6ec165a64d38..fbc1ef4f5d05 100644 --- a/goldens/public-api/platform-browser-dynamic/testing/index.api.md +++ b/goldens/public-api/platform-browser-dynamic/testing/index.api.md @@ -4,7 +4,7 @@ ```ts -import * as _angular_core from '@angular/core'; +import * as i0 from '@angular/core'; import * as i1 from '@angular/platform-browser/testing'; import { PlatformRef } from '@angular/core'; import { StaticProvider } from '@angular/core'; @@ -12,11 +12,11 @@ import { StaticProvider } from '@angular/core'; // @public export class BrowserDynamicTestingModule { // (undocumented) - static ɵfac: _angular_core.ɵɵFactoryDeclaration; + static ɵfac: i0.ɵɵFactoryDeclaration; // (undocumented) - static ɵinj: _angular_core.ɵɵInjectorDeclaration; + static ɵinj: i0.ɵɵInjectorDeclaration; // (undocumented) - static ɵmod: _angular_core.ɵɵNgModuleDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; } // @public (undocumented) diff --git a/goldens/public-api/platform-server/testing/index.api.md b/goldens/public-api/platform-server/testing/index.api.md index 74a84c321515..8d2d87e65053 100644 --- a/goldens/public-api/platform-server/testing/index.api.md +++ b/goldens/public-api/platform-server/testing/index.api.md @@ -6,9 +6,10 @@ import * as i0 from '@angular/core'; import * as i1 from '@angular/platform-browser-dynamic/testing'; +import { StaticProvider } from '@angular/core'; // @public -export const platformServerTesting: (extraProviders?: i0.StaticProvider[]) => i0.PlatformRef; +export const platformServerTesting: (extraProviders?: StaticProvider[]) => i0.PlatformRef; // @public export class ServerTestingModule { diff --git a/packages/platform-browser-dynamic/src/platform-browser-dynamic.ts b/packages/platform-browser-dynamic/src/platform-browser-dynamic.ts index 988c5142d65b..9d40b04947ec 100644 --- a/packages/platform-browser-dynamic/src/platform-browser-dynamic.ts +++ b/packages/platform-browser-dynamic/src/platform-browser-dynamic.ts @@ -6,20 +6,8 @@ * found in the LICENSE file at https://angular.dev/license */ -import {createPlatformFactory} from '@angular/core'; - -import {platformCoreDynamic} from './platform_core_dynamic'; -import {INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS} from './platform_providers'; - -export * from './private_export'; export {VERSION} from './version'; export {JitCompilerFactory} from './compiler_factory'; +export {platformBrowserDynamic} from './platform_providers'; -/** - * @publicApi - */ -export const platformBrowserDynamic = createPlatformFactory( - platformCoreDynamic, - 'browserDynamic', - INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS, -); +export * from './private_export'; diff --git a/packages/platform-browser-dynamic/src/platform_core_dynamic.ts b/packages/platform-browser-dynamic/src/platform_core_dynamic.ts deleted file mode 100644 index bf7777123093..000000000000 --- a/packages/platform-browser-dynamic/src/platform_core_dynamic.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.dev/license - */ - -import { - COMPILER_OPTIONS, - CompilerFactory, - createPlatformFactory, - platformCore, -} from '@angular/core'; - -import {JitCompilerFactory} from './compiler_factory'; - -/** - * A platform that included corePlatform and the compiler. - * - * @publicApi - */ -export const platformCoreDynamic = createPlatformFactory(platformCore, 'coreDynamic', [ - {provide: COMPILER_OPTIONS, useValue: {}, multi: true}, - {provide: CompilerFactory, useClass: JitCompilerFactory, deps: [COMPILER_OPTIONS]}, -]); diff --git a/packages/platform-browser-dynamic/src/platform_providers.ts b/packages/platform-browser-dynamic/src/platform_providers.ts index 9b2b9f2369ba..8eee1ce7b224 100644 --- a/packages/platform-browser-dynamic/src/platform_providers.ts +++ b/packages/platform-browser-dynamic/src/platform_providers.ts @@ -6,22 +6,31 @@ * found in the LICENSE file at https://angular.dev/license */ -import {ɵPLATFORM_BROWSER_ID as PLATFORM_BROWSER_ID} from '@angular/common'; +import { + COMPILER_OPTIONS, + CompilerFactory, + createPlatformFactory, + StaticProvider, +} from '@angular/core'; +import {platformBrowser} from '@angular/platform-browser'; import {ResourceLoader} from '@angular/compiler'; -import {COMPILER_OPTIONS, PLATFORM_ID, StaticProvider} from '@angular/core'; -import {ɵINTERNAL_BROWSER_PLATFORM_PROVIDERS as INTERNAL_BROWSER_PLATFORM_PROVIDERS} from '@angular/platform-browser'; - import {ResourceLoaderImpl} from './resource_loader/resource_loader_impl'; +import {JitCompilerFactory} from './compiler_factory'; -/** - * @publicApi - */ export const INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS: StaticProvider[] = [ - INTERNAL_BROWSER_PLATFORM_PROVIDERS, { provide: COMPILER_OPTIONS, useValue: {providers: [{provide: ResourceLoader, useClass: ResourceLoaderImpl, deps: []}]}, multi: true, }, - {provide: PLATFORM_ID, useValue: PLATFORM_BROWSER_ID}, + {provide: CompilerFactory, useClass: JitCompilerFactory, deps: [COMPILER_OPTIONS]}, ]; + +/** + * @publicApi + */ +export const platformBrowserDynamic = createPlatformFactory( + platformBrowser, + 'browserDynamic', + INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS, +); diff --git a/packages/platform-browser-dynamic/src/private_export.ts b/packages/platform-browser-dynamic/src/private_export.ts index 0e8e4ad0eb1f..a51836db85a7 100644 --- a/packages/platform-browser-dynamic/src/private_export.ts +++ b/packages/platform-browser-dynamic/src/private_export.ts @@ -6,5 +6,4 @@ * found in the LICENSE file at https://angular.dev/license */ -export {platformCoreDynamic as ɵplatformCoreDynamic} from './platform_core_dynamic'; export {INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS as ɵINTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS} from './platform_providers'; diff --git a/packages/platform-browser-dynamic/testing/src/platform_core_dynamic_testing.ts b/packages/platform-browser-dynamic/testing/src/platform_core_dynamic_testing.ts deleted file mode 100644 index dd143ae7de0e..000000000000 --- a/packages/platform-browser-dynamic/testing/src/platform_core_dynamic_testing.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.dev/license - */ - -import {createPlatformFactory, PlatformRef} from '@angular/core'; -import {ɵplatformCoreDynamic as platformCoreDynamic} from '@angular/platform-browser-dynamic'; - -/** - * Platform for dynamic tests - * - * @publicApi - */ -export const platformCoreDynamicTesting: (extraProviders?: any[]) => PlatformRef = - createPlatformFactory(platformCoreDynamic, 'coreDynamicTesting', []); diff --git a/packages/platform-browser-dynamic/testing/src/private_export_testing.ts b/packages/platform-browser-dynamic/testing/src/private_export_testing.ts deleted file mode 100644 index ef9a808981da..000000000000 --- a/packages/platform-browser-dynamic/testing/src/private_export_testing.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.dev/license - */ - -export {platformCoreDynamicTesting as ɵplatformCoreDynamicTesting} from './platform_core_dynamic_testing'; -export {ɵDOMTestComponentRenderer} from '@angular/platform-browser/testing'; diff --git a/packages/platform-browser-dynamic/testing/src/testing.ts b/packages/platform-browser-dynamic/testing/src/testing.ts index 254bc86e905d..85ceee513d4a 100644 --- a/packages/platform-browser-dynamic/testing/src/testing.ts +++ b/packages/platform-browser-dynamic/testing/src/testing.ts @@ -7,20 +7,15 @@ */ import {createPlatformFactory, NgModule, PlatformRef, StaticProvider} from '@angular/core'; -import {ɵINTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS as INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS} from '@angular/platform-browser-dynamic'; +import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; import {BrowserTestingModule} from '@angular/platform-browser/testing'; -import {platformCoreDynamicTesting} from './platform_core_dynamic_testing'; - -export * from './private_export_testing'; - /** * @publicApi */ export const platformBrowserDynamicTesting = createPlatformFactory( - platformCoreDynamicTesting, + platformBrowserDynamic, 'browserDynamicTesting', - INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS, ); /** diff --git a/packages/platform-browser/src/browser.ts b/packages/platform-browser/src/browser.ts index 7e663ecb6bc5..12d8fc90dc65 100644 --- a/packages/platform-browser/src/browser.ts +++ b/packages/platform-browser/src/browser.ts @@ -183,7 +183,7 @@ export function _document(): any { return document; } -export const INTERNAL_BROWSER_PLATFORM_PROVIDERS: StaticProvider[] = [ +const INTERNAL_BROWSER_PLATFORM_PROVIDERS: StaticProvider[] = [ {provide: PLATFORM_ID, useValue: PLATFORM_BROWSER_ID}, {provide: PLATFORM_INITIALIZER, useValue: initDomAdapter, multi: true}, {provide: DOCUMENT, useFactory: _document, deps: []}, diff --git a/packages/platform-browser/src/private_export.ts b/packages/platform-browser/src/private_export.ts index 486be163e2fc..7aae7820c764 100644 --- a/packages/platform-browser/src/private_export.ts +++ b/packages/platform-browser/src/private_export.ts @@ -7,10 +7,6 @@ */ export {ɵgetDOM} from '@angular/common'; -export { - initDomAdapter as ɵinitDomAdapter, - INTERNAL_BROWSER_PLATFORM_PROVIDERS as ɵINTERNAL_BROWSER_PLATFORM_PROVIDERS, -} from './browser'; export {BrowserDomAdapter as ɵBrowserDomAdapter} from './browser/browser_adapter'; export {BrowserGetTestability as ɵBrowserGetTestability} from './browser/testability'; export {DomRendererFactory2 as ɵDomRendererFactory2} from './dom/dom_renderer'; diff --git a/packages/platform-browser/testing/src/browser.ts b/packages/platform-browser/testing/src/browser.ts index fd69a5f658ad..657ae43aeac8 100644 --- a/packages/platform-browser/testing/src/browser.ts +++ b/packages/platform-browser/testing/src/browser.ts @@ -11,35 +11,21 @@ import { APP_ID, createPlatformFactory, NgModule, - PLATFORM_INITIALIZER, - platformCore, StaticProvider, ɵinternalProvideZoneChangeDetection as internalProvideZoneChangeDetection, ɵChangeDetectionScheduler as ChangeDetectionScheduler, ɵChangeDetectionSchedulerImpl as ChangeDetectionSchedulerImpl, } from '@angular/core'; import {TestComponentRenderer} from '@angular/core/testing'; -import {BrowserModule, ɵBrowserDomAdapter as BrowserDomAdapter} from '@angular/platform-browser'; +import {BrowserModule, platformBrowser} from '@angular/platform-browser'; import {DOMTestComponentRenderer} from './dom_test_component_renderer'; -function initBrowserTests() { - BrowserDomAdapter.makeCurrent(); -} - -const _TEST_BROWSER_PLATFORM_PROVIDERS: StaticProvider[] = [ - {provide: PLATFORM_INITIALIZER, useValue: initBrowserTests, multi: true}, -]; - /** * Platform for testing * * @publicApi */ -export const platformBrowserTesting = createPlatformFactory( - platformCore, - 'browserTesting', - _TEST_BROWSER_PLATFORM_PROVIDERS, -); +export const platformBrowserTesting = createPlatformFactory(platformBrowser, 'browserTesting'); /** * NgModule for testing. diff --git a/packages/platform-browser/testing/src/private_export_testing.ts b/packages/platform-browser/testing/src/private_export_testing.ts deleted file mode 100644 index 690770bf8f76..000000000000 --- a/packages/platform-browser/testing/src/private_export_testing.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.dev/license - */ - -export {DOMTestComponentRenderer as ɵDOMTestComponentRenderer} from './dom_test_component_renderer'; diff --git a/packages/platform-browser/testing/src/testing.ts b/packages/platform-browser/testing/src/testing.ts index cc8c478c49ef..0249250c0e2f 100644 --- a/packages/platform-browser/testing/src/testing.ts +++ b/packages/platform-browser/testing/src/testing.ts @@ -12,4 +12,3 @@ * Entry point for all public APIs of the platform-browser/testing package. */ export * from './browser'; -export * from './private_export_testing'; diff --git a/packages/platform-server/testing/BUILD.bazel b/packages/platform-server/testing/BUILD.bazel index 39dff822fbf1..e6b878fc310c 100644 --- a/packages/platform-server/testing/BUILD.bazel +++ b/packages/platform-server/testing/BUILD.bazel @@ -9,6 +9,7 @@ ng_module( srcs = glob(["**/*.ts"]), deps = [ "//packages/core", + "//packages/platform-browser-dynamic", "//packages/platform-browser-dynamic/testing", "//packages/platform-server", ], diff --git a/packages/platform-server/testing/src/server.ts b/packages/platform-server/testing/src/server.ts index 6d899ace6543..ac0f995af72d 100644 --- a/packages/platform-server/testing/src/server.ts +++ b/packages/platform-server/testing/src/server.ts @@ -6,25 +6,28 @@ * found in the LICENSE file at https://angular.dev/license */ -import {createPlatformFactory, NgModule} from '@angular/core'; -import { - BrowserDynamicTestingModule, - ɵplatformCoreDynamicTesting as platformCoreDynamicTesting, -} from '@angular/platform-browser-dynamic/testing'; +import {createPlatformFactory, NgModule, platformCore, StaticProvider} from '@angular/core'; +import {ɵINTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS as INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS} from '@angular/platform-browser-dynamic'; +import {BrowserDynamicTestingModule} from '@angular/platform-browser-dynamic/testing'; import { ɵINTERNAL_SERVER_PLATFORM_PROVIDERS as INTERNAL_SERVER_PLATFORM_PROVIDERS, ɵSERVER_RENDER_PROVIDERS as SERVER_RENDER_PROVIDERS, } from '@angular/platform-server'; +const INTERNAL_SERVER_DYNAMIC_PLATFORM_TESTING_PROVIDERS: StaticProvider[] = [ + ...INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS, + ...INTERNAL_SERVER_PLATFORM_PROVIDERS, +]; + /** * Platform for testing * * @publicApi */ export const platformServerTesting = createPlatformFactory( - platformCoreDynamicTesting, + platformCore, 'serverTesting', - INTERNAL_SERVER_PLATFORM_PROVIDERS, + INTERNAL_SERVER_DYNAMIC_PLATFORM_TESTING_PROVIDERS, ); /**