Permalink
Browse files

perf(compiler): only use tsickle if needed (#19275)

PR Close #19275
  • Loading branch information...
tbosch authored and IgorMinar committed Sep 16, 2017
1 parent edd5f5a commit 8f95b751e0ab2c42c2cefbfd40ff3255e0a2fcba
Showing with 10 additions and 5 deletions.
  1. +10 −5 packages/compiler-cli/src/main.ts
@@ -16,6 +16,7 @@ import * as path from 'path';
import * as tsickle from 'tsickle';
import * as api from './transformers/api';
import * as ngc from './transformers/entry_points';
import {GENERATED_FILES} from './transformers/util';
import {exitCodeFromResult, performCompilation, readConfiguration, formatDiagnostics, Diagnostics, ParsedConfiguration, PerformCompilationResult} from './perform_compile';
import {performWatchCompilationcreatePerformWatchHost} from './perform_watch';
@@ -38,17 +39,21 @@ export function main(
return reportErrorsAndExit(options, compileDiags, consoleError);
}
function createEmitCallback(options: api.CompilerOptions): api.TsEmitCallback {
function createEmitCallback(options: api.CompilerOptions): api.TsEmitCallback|undefined {
const transformDecorators = options.annotationsAs !== 'decorators';
const transformTypesToClosure = options.annotateForClosureCompiler;
if (!transformDecorators && !transformTypesToClosure) {
return undefined;
}
const tsickleHost: tsickle.TsickleHost = {
shouldSkipTsickleProcessing: (fileName) => /\.d\.ts$/.test(fileName),
shouldSkipTsickleProcessing: (fileName) =>
/\.d\.ts$/.test(fileName) || GENERATED_FILES.test(fileName),
pathToModuleName: (context, importPath) => '',
shouldIgnoreWarningsForPath: (filePath) => false,
fileNameToModuleId: (fileName) => fileName,
googmodule: false,
untyped: true,
convertIndexImportShorthand: true,
transformDecorators: options.annotationsAs !== 'decorators',
transformTypesToClosure: options.annotateForClosureCompiler,
convertIndexImportShorthand: true, transformDecorators, transformTypesToClosure,
};
return ({

0 comments on commit 8f95b75

Please sign in to comment.