From 67588ec606024b52e2523fe471b1ec1aced6c99c Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Mon, 16 Jul 2018 08:43:24 +0100 Subject: [PATCH] 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 --- packages/compiler-cli/src/ngtsc/transform/src/translator.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/compiler-cli/src/ngtsc/transform/src/translator.ts b/packages/compiler-cli/src/ngtsc/transform/src/translator.ts index f54aaef524..095e30683e 100644 --- a/packages/compiler-cli/src/ngtsc/transform/src/translator.ts +++ b/packages/compiler-cli/src/ngtsc/transform/src/translator.ts @@ -52,11 +52,11 @@ export class ImportManager { private moduleToIndex = new Map(); 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`);