refactor(router): Remove deprecated loadChildren file (#49504)

This file was used while migrations were happening internally. All code is now updated to the callback

PR Close #49504
This commit is contained in:
Andrew Scott
2023-03-20 15:47:24 -07:00
committed by Andrew Scott
parent 0af891f391
commit 69a6e09e7e
2 changed files with 2 additions and 29 deletions
@@ -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.io/license
*/
import {Injector, NgModuleFactory} from '@angular/core';
import {Observable} from 'rxjs';
// This file exists to support the legacy `loadChildren: string` behavior being patched back into
// Angular.
export function deprecatedLoadChildrenString(
injector: Injector, loadChildren: unknown): Observable<NgModuleFactory<any>>|null {
return null;
}
+2 -11
View File
@@ -6,11 +6,10 @@
* found in the LICENSE file at https://angular.io/license
*/
import {Compiler, EnvironmentInjector, Injectable, InjectFlags, InjectionToken, Injector, NgModuleFactory, Type} from '@angular/core';
import {Compiler, EnvironmentInjector, inject, Injectable, InjectFlags, InjectionToken, Injector, NgModuleFactory, Type} from '@angular/core';
import {ConnectableObservable, from, Observable, of, Subject} from 'rxjs';
import {finalize, map, mergeMap, refCount, tap} from 'rxjs/operators';
import {deprecatedLoadChildrenString} from './deprecated_load_children';
import {DefaultExport, LoadChildren, LoadChildrenCallback, LoadedRouterConfig, Route, Routes} from './models';
import {wrapIntoObservable} from './utils/collection';
import {assertStandalone, standardizeConfig, validateConfig} from './utils/config';
@@ -38,11 +37,7 @@ export class RouterConfigLoader {
private childrenLoaders = new WeakMap<Route, Observable<LoadedRouterConfig>>();
onLoadStartListener?: (r: Route) => void;
onLoadEndListener?: (r: Route) => void;
constructor(
private injector: Injector,
private compiler: Compiler,
) {}
private readonly compiler = inject(Compiler);
loadComponent(route: Route): Observable<Type<unknown>> {
if (this.componentLoaders.get(route)) {
@@ -124,10 +119,6 @@ export class RouterConfigLoader {
private loadModuleFactoryOrRoutes(loadChildren: LoadChildren):
Observable<NgModuleFactory<any>|Routes> {
const deprecatedResult = deprecatedLoadChildrenString(this.injector, loadChildren);
if (deprecatedResult) {
return deprecatedResult;
}
return wrapIntoObservable((loadChildren as LoadChildrenCallback)())
.pipe(
map(maybeUnwrapDefaultExport),