diff --git a/packages/compiler-cli/ngcc/src/main.ts b/packages/compiler-cli/ngcc/src/main.ts index b359b9af5b..3e9d6cec11 100644 --- a/packages/compiler-cli/ngcc/src/main.ts +++ b/packages/compiler-cli/ngcc/src/main.ts @@ -65,7 +65,7 @@ const SUPPORTED_FORMATS: EntryPointFormat[] = ['esm5', 'esm2015']; export function mainNgcc( {basePath, targetEntryPointPath, propertiesToConsider = SUPPORTED_FORMAT_PROPERTIES, compileAllFormats = true, createNewEntryPointFormats = false}: NgccOptions): void { - const transformer = new Transformer(basePath, basePath); + const transformer = new Transformer(basePath); const host = new DependencyHost(); const resolver = new DependencyResolver(host); const finder = new EntryPointFinder(resolver); diff --git a/packages/compiler-cli/ngcc/src/packages/transformer.ts b/packages/compiler-cli/ngcc/src/packages/transformer.ts index 1cf50fa860..f46312d3e9 100644 --- a/packages/compiler-cli/ngcc/src/packages/transformer.ts +++ b/packages/compiler-cli/ngcc/src/packages/transformer.ts @@ -45,7 +45,7 @@ import {EntryPointBundle} from './entry_point_bundle'; * - Some formats may contain multiple "modules" in a single file. */ export class Transformer { - constructor(private sourcePath: string, private targetPath: string) {} + constructor(private sourcePath: string) {} /** * Transform the source (and typings) files of a bundle. @@ -84,9 +84,9 @@ export class Transformer { getRenderer(host: NgccReflectionHost, isCore: boolean, bundle: EntryPointBundle): Renderer { switch (bundle.format) { case 'esm2015': - return new EsmRenderer(host, isCore, bundle, this.sourcePath, this.targetPath); + return new EsmRenderer(host, isCore, bundle, this.sourcePath); case 'esm5': - return new Esm5Renderer(host, isCore, bundle, this.sourcePath, this.targetPath); + return new Esm5Renderer(host, isCore, bundle, this.sourcePath); default: throw new Error(`Renderer for "${bundle.format}" not yet implemented.`); } diff --git a/packages/compiler-cli/ngcc/src/rendering/esm5_renderer.ts b/packages/compiler-cli/ngcc/src/rendering/esm5_renderer.ts index 8c68a68704..382b1ff1c8 100644 --- a/packages/compiler-cli/ngcc/src/rendering/esm5_renderer.ts +++ b/packages/compiler-cli/ngcc/src/rendering/esm5_renderer.ts @@ -15,9 +15,8 @@ import {EntryPointBundle} from '../packages/entry_point_bundle'; export class Esm5Renderer extends EsmRenderer { constructor( - host: NgccReflectionHost, isCore: boolean, bundle: EntryPointBundle, sourcePath: string, - targetPath: string) { - super(host, isCore, bundle, sourcePath, targetPath); + host: NgccReflectionHost, isCore: boolean, bundle: EntryPointBundle, sourcePath: string) { + super(host, isCore, bundle, sourcePath); } /** diff --git a/packages/compiler-cli/ngcc/src/rendering/esm_renderer.ts b/packages/compiler-cli/ngcc/src/rendering/esm_renderer.ts index fd38bb8333..45cf8da203 100644 --- a/packages/compiler-cli/ngcc/src/rendering/esm_renderer.ts +++ b/packages/compiler-cli/ngcc/src/rendering/esm_renderer.ts @@ -17,9 +17,8 @@ import {isDtsPath} from '../../../src/ngtsc/util/src/typescript'; export class EsmRenderer extends Renderer { constructor( - host: NgccReflectionHost, isCore: boolean, bundle: EntryPointBundle, sourcePath: string, - targetPath: string) { - super(host, isCore, bundle, sourcePath, targetPath); + host: NgccReflectionHost, isCore: boolean, bundle: EntryPointBundle, sourcePath: string) { + super(host, isCore, bundle, sourcePath); } /** diff --git a/packages/compiler-cli/ngcc/src/rendering/renderer.ts b/packages/compiler-cli/ngcc/src/rendering/renderer.ts index 2345588b56..964c27ec47 100644 --- a/packages/compiler-cli/ngcc/src/rendering/renderer.ts +++ b/packages/compiler-cli/ngcc/src/rendering/renderer.ts @@ -81,8 +81,7 @@ export const RedundantDecoratorMap = Map; export abstract class Renderer { constructor( protected host: NgccReflectionHost, protected isCore: boolean, - protected bundle: EntryPointBundle, protected sourcePath: string, - protected targetPath: string) {} + protected bundle: EntryPointBundle, protected sourcePath: string) {} renderProgram( decorationAnalyses: DecorationAnalyses, switchMarkerAnalyses: SwitchMarkerAnalyses, @@ -333,7 +332,7 @@ export abstract class Renderer { const outputPath = resolve(this.targetPath, relative(this.sourcePath, sourceFile.fileName)); const outputMapPath = `${outputPath}.map`; const outputMap = output.generateMap({ - source: sourceFile.fileName, + source: outputPath, includeContent: true, // hires: true // TODO: This results in accurate but huge sourcemaps. Instead we should fix // the merge algorithm. diff --git a/packages/compiler-cli/ngcc/test/rendering/esm2015_renderer_spec.ts b/packages/compiler-cli/ngcc/test/rendering/esm2015_renderer_spec.ts index 9176141ae1..21763076b1 100644 --- a/packages/compiler-cli/ngcc/test/rendering/esm2015_renderer_spec.ts +++ b/packages/compiler-cli/ngcc/test/rendering/esm2015_renderer_spec.ts @@ -28,7 +28,7 @@ function setup(file: {name: string, contents: string}) { referencesRegistry, [AbsoluteFsPath.fromUnchecked('/')], false) .analyzeProgram(); const switchMarkerAnalyses = new SwitchMarkerAnalyzer(host).analyzeProgram(bundle.src.program); - const renderer = new EsmRenderer(host, false, bundle, dir, dir); + const renderer = new EsmRenderer(host, false, bundle, dir); return { host, program: bundle.src.program, diff --git a/packages/compiler-cli/ngcc/test/rendering/esm5_renderer_spec.ts b/packages/compiler-cli/ngcc/test/rendering/esm5_renderer_spec.ts index 2c025e7b7a..8fd45339aa 100644 --- a/packages/compiler-cli/ngcc/test/rendering/esm5_renderer_spec.ts +++ b/packages/compiler-cli/ngcc/test/rendering/esm5_renderer_spec.ts @@ -28,7 +28,7 @@ function setup(file: {name: string, contents: string}) { referencesRegistry, [AbsoluteFsPath.fromUnchecked('/')], false) .analyzeProgram(); const switchMarkerAnalyses = new SwitchMarkerAnalyzer(host).analyzeProgram(bundle.src.program); - const renderer = new Esm5Renderer(host, false, bundle, dir, dir); + const renderer = new Esm5Renderer(host, false, bundle, dir); return { host, program: bundle.src.program, diff --git a/packages/compiler-cli/ngcc/test/rendering/renderer_spec.ts b/packages/compiler-cli/ngcc/test/rendering/renderer_spec.ts index b945d60351..c933a04894 100644 --- a/packages/compiler-cli/ngcc/test/rendering/renderer_spec.ts +++ b/packages/compiler-cli/ngcc/test/rendering/renderer_spec.ts @@ -21,7 +21,7 @@ import {makeTestEntryPointBundle} from '../helpers/utils'; class TestRenderer extends Renderer { constructor(host: Esm2015ReflectionHost, isCore: boolean, bundle: EntryPointBundle) { - super(host, isCore, bundle, '/src', '/dist'); + super(host, isCore, bundle, '/src'); } addImports(output: MagicString, imports: {specifier: string, qualifier: string}[]) { output.prepend('\n// ADD IMPORTS\n');