fix(compiler): make sourcemaps work in AOT mode
Inlcuded fixes: - include preamble in generated source map - always add a mapping for line/col 0 so that the generated sourcemap is not sparse - use a uniue sourceUrl for inline templates even in the AOT case
This commit is contained in:

committed by
Chuck Jazdzewski

parent
c0e05e6f03
commit
492153a986
@ -33,7 +33,8 @@ export class AotCompiler {
|
||||
private _styleCompiler: StyleCompiler, private _viewCompiler: ViewCompiler,
|
||||
private _ngModuleCompiler: NgModuleCompiler, private _outputEmitter: OutputEmitter,
|
||||
private _summaryResolver: SummaryResolver<StaticSymbol>, private _localeId: string,
|
||||
private _translationFormat: string, private _symbolResolver: StaticSymbolResolver) {}
|
||||
private _translationFormat: string, private _genFilePreamble: string,
|
||||
private _symbolResolver: StaticSymbolResolver) {}
|
||||
|
||||
clearCache() { this._metadataResolver.clearCache(); }
|
||||
|
||||
@ -215,7 +216,8 @@ export class AotCompiler {
|
||||
exportedVars: string[]): GeneratedFile {
|
||||
return new GeneratedFile(
|
||||
srcFileUrl, genFileUrl,
|
||||
this._outputEmitter.emitStatements(genFileUrl, statements, exportedVars));
|
||||
this._outputEmitter.emitStatements(
|
||||
srcFileUrl, genFileUrl, statements, exportedVars, this._genFilePreamble));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,6 +79,6 @@ export function createAotCompiler(compilerHost: AotCompilerHost, options: AotCom
|
||||
const compiler = new AotCompiler(
|
||||
config, compilerHost, resolver, tmplParser, new StyleCompiler(urlResolver), viewCompiler,
|
||||
new NgModuleCompiler(), new TypeScriptEmitter(importResolver), summaryResolver,
|
||||
options.locale, options.i18nFormat, symbolResolver);
|
||||
options.locale, options.i18nFormat, options.genFilePreamble, symbolResolver);
|
||||
return {compiler, reflector: staticReflector};
|
||||
}
|
||||
|
@ -11,4 +11,6 @@ export interface AotCompilerOptions {
|
||||
i18nFormat?: string;
|
||||
translations?: string;
|
||||
enableLegacyTemplate?: boolean;
|
||||
/** preamble for all generated source files */
|
||||
genFilePreamble?: string;
|
||||
}
|
||||
|
Reference in New Issue
Block a user