refactor(ivy): allow `ImportManager` to have configurable prefix (#24897)
The ngcc compiler will want to specify its own prefix when rendering definitions. PR Close #24897
This commit is contained in:
parent
ee2c050521
commit
67588ec606
|
@ -52,11 +52,11 @@ export class ImportManager {
|
|||
private moduleToIndex = new Map<string, string>();
|
||||
private nextIndex = 0;
|
||||
|
||||
constructor(private isCore: boolean) {}
|
||||
constructor(private isCore: boolean, private prefix = 'i') {}
|
||||
|
||||
generateNamedImport(moduleName: string, symbol: string): string {
|
||||
if (!this.moduleToIndex.has(moduleName)) {
|
||||
this.moduleToIndex.set(moduleName, `i${this.nextIndex++}`);
|
||||
this.moduleToIndex.set(moduleName, `${this.prefix}${this.nextIndex++}`);
|
||||
}
|
||||
if (this.isCore && moduleName === '@angular/core' && !CORE_SUPPORTED_SYMBOLS.has(symbol)) {
|
||||
throw new Error(`Importing unexpected symbol ${symbol} while compiling core`);
|
||||
|
|
Loading…
Reference in New Issue