refactor(ngcc): share code between CommonJsReflectionHost and UmdReflectionHost (#34512)

While different, CommonJS and UMD have a lot in common regarding the
their exports are constructed. Therefore, there was some code
duplication between `CommonJsReflectionHost` and `UmdReflectionHost`.

This commit extracts some of the common bits into a separate file as
helpers to allow reusing the code in both `ReflectionHost`s.

PR Close #34512
This commit is contained in:
George Kalpakas
2019-12-20 15:38:11 +02:00
committed by Alex Rickabaugh
parent d5fd742763
commit 17d5e2bc99
7 changed files with 179 additions and 159 deletions

View File

@ -11,7 +11,7 @@ import MagicString from 'magic-string';
import {Reexport} from '../../../src/ngtsc/imports';
import {Import, ImportManager} from '../../../src/ngtsc/translator';
import {ExportInfo} from '../analysis/private_declarations_analyzer';
import {isRequireCall} from '../host/commonjs_host';
import {isRequireCall} from '../host/commonjs_umd_utils';
import {NgccReflectionHost} from '../host/ngcc_host';
import {Esm5RenderingFormatter} from './esm5_rendering_formatter';
import {stripExtension} from './utils';