revert: fix(ivy): Only restore registered modules if user compiles modules with TestBed (#32944) (#33663)
This commit reverts 63256b5
.
PR Close #33663
This commit is contained in:

committed by
Kara Erickson

parent
4988094e7d
commit
f8e9c1e6f1
@ -14,14 +14,13 @@ import {stringify} from '../util/stringify';
|
||||
|
||||
import {NgModuleFactory} from './ng_module_factory';
|
||||
|
||||
export type ModuleRegistrationMap = Map<string, NgModuleFactory<any>|NgModuleType>;
|
||||
|
||||
/**
|
||||
* Map of module-id to the corresponding NgModule.
|
||||
* - In pre Ivy we track NgModuleFactory,
|
||||
* - In post Ivy we track the NgModuleType
|
||||
*/
|
||||
let modules: ModuleRegistrationMap = new Map();
|
||||
const modules = new Map<string, NgModuleFactory<any>|NgModuleType>();
|
||||
|
||||
/**
|
||||
* Registers a loaded module. Should only be called from generated NgModuleFactory code.
|
||||
@ -57,18 +56,10 @@ export function registerNgModuleType(ngModuleType: NgModuleType) {
|
||||
}
|
||||
}
|
||||
|
||||
export function clearRegisteredModuleState(): void {
|
||||
export function clearModuleRegistry(): void {
|
||||
modules.clear();
|
||||
}
|
||||
|
||||
export function getRegisteredModulesState(): ModuleRegistrationMap {
|
||||
return new Map(modules);
|
||||
}
|
||||
|
||||
export function restoreRegisteredModulesState(moduleMap: ModuleRegistrationMap) {
|
||||
modules = new Map(moduleMap);
|
||||
}
|
||||
|
||||
export function getRegisteredNgModuleType(id: string) {
|
||||
return modules.get(id) || autoRegisterModuleById[id];
|
||||
}
|
||||
|
Reference in New Issue
Block a user