Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var programForJsEmit = programWithCodegen;
if (ngOptions_1.annotationsAs !== 'decorators') {
if (diagnostics_1)
console.time('NG downlevel');
tsickleCompilerHost_1.reconfigureForRun(programForJsEmit, tsickle.Pass.DECORATOR_DOWNLEVEL);
// A program can be re-used only once; save the programWithCodegen to be reused by
// metadataWriter
programForJsEmit = createProgram_1(tsickleCompilerHost_1);
tsc_1.check(tsickleCompilerHost_1.diagnostics);
if (diagnostics_1)
console.timeEnd('NG downlevel');
}
if (ngOptions_1.annotateForClosureCompiler) {
if (diagnostics_1)
console.time('NG JSDoc');
tsickleCompilerHost_1.reconfigureForRun(programForJsEmit, tsickle.Pass.CLOSURIZE);
programForJsEmit = createProgram_1(tsickleCompilerHost_1);
tsc_1.check(tsickleCompilerHost_1.diagnostics);
if (diagnostics_1)
console.timeEnd('NG JSDoc');
}
// Emit *.js and *.js.map
tsc_1.tsc.emit(programForJsEmit);
// Emit *.d.ts and maybe *.metadata.json
// Not in the same emit pass with above, because tsickle erases
// decorators which we want to read or document.
// Do this emit second since TypeScript will create missing directories for us
// in the standard emit.
tsc_1.tsc.emit(programWithCodegen);
if (diagnostics_1) {
ts.performance.forEachMeasure(function (name, duration) { console.error("TS " + name + ": " + duration + "ms"); });
}
var programForJsEmit = programWithCodegen;
if (ngOptions_1.annotationsAs !== 'decorators') {
if (diagnostics_1)
console.time('NG downlevel');
tsickleCompilerHost_1.reconfigureForRun(programForJsEmit, tsickle.Pass.DECORATOR_DOWNLEVEL);
// A program can be re-used only once; save the programWithCodegen to be reused by
// metadataWriter
programForJsEmit = createProgram_1(tsickleCompilerHost_1);
tsc_1.check(tsickleCompilerHost_1.diagnostics);
if (diagnostics_1)
console.timeEnd('NG downlevel');
}
if (ngOptions_1.annotateForClosureCompiler) {
if (diagnostics_1)
console.time('NG JSDoc');
tsickleCompilerHost_1.reconfigureForRun(programForJsEmit, tsickle.Pass.CLOSURIZE);
programForJsEmit = createProgram_1(tsickleCompilerHost_1);
tsc_1.check(tsickleCompilerHost_1.diagnostics);
if (diagnostics_1)
console.timeEnd('NG JSDoc');
}
// Emit *.js and *.js.map
tsc_1.tsc.emit(programForJsEmit);
// Emit *.d.ts and maybe *.metadata.json
// Not in the same emit pass with above, because tsickle erases
// decorators which we want to read or document.
// Do this emit second since TypeScript will create missing directories for us
// in the standard emit.
tsc_1.tsc.emit(programWithCodegen);
if (diagnostics_1) {
ts.performance.forEachMeasure(function (name, duration) { console.error("TS " + name + ": " + duration + "ms"); });
}
console.timeEnd('NG codegen');
var definitionsHost = tsickleCompilerHost_1;
if (!ngOptions_1.skipMetadataEmit) {
// if tsickle is not not used for emitting, but we do use the MetadataWriterHost,
// it also needs to emit the js files.
var emitJsFiles = ngOptions_1.annotationsAs === 'decorators' && !ngOptions_1.annotateForClosureCompiler;
definitionsHost = new compiler_host_1.MetadataWriterHost(tsickleCompilerHost_1, ngOptions_1, emitJsFiles);
}
// Create a new program since codegen files were created after making the old program
var programWithCodegen = createProgram_1(definitionsHost, program_1);
tsc_1.tsc.typeCheck(host_1, programWithCodegen);
var programForJsEmit = programWithCodegen;
if (ngOptions_1.annotationsAs !== 'decorators') {
if (diagnostics_1)
console.time('NG downlevel');
tsickleCompilerHost_1.reconfigureForRun(programForJsEmit, tsickle.Pass.DECORATOR_DOWNLEVEL);
// A program can be re-used only once; save the programWithCodegen to be reused by
// metadataWriter
programForJsEmit = createProgram_1(tsickleCompilerHost_1);
tsc_1.check(tsickleCompilerHost_1.diagnostics);
if (diagnostics_1)
console.timeEnd('NG downlevel');
}
if (ngOptions_1.annotateForClosureCompiler) {
if (diagnostics_1)
console.time('NG JSDoc');
tsickleCompilerHost_1.reconfigureForRun(programForJsEmit, tsickle.Pass.CLOSURIZE);
programForJsEmit = createProgram_1(tsickleCompilerHost_1);
tsc_1.check(tsickleCompilerHost_1.diagnostics);
if (diagnostics_1)
console.timeEnd('NG JSDoc');
}
}
var definitionsHost = tsickleCompilerHost_1;
if (!ngOptions_1.skipMetadataEmit) {
// if tsickle is not not used for emitting, but we do use the MetadataWriterHost,
// it also needs to emit the js files.
var emitJsFiles = ngOptions_1.annotationsAs === 'decorators' && !ngOptions_1.annotateForClosureCompiler;
definitionsHost = new compiler_host_1.MetadataWriterHost(tsickleCompilerHost_1, ngOptions_1, emitJsFiles);
}
// Create a new program since codegen files were created after making the old program
var programWithCodegen = createProgram_1(definitionsHost, program_1);
tsc_1.tsc.typeCheck(host_1, programWithCodegen);
var programForJsEmit = programWithCodegen;
if (ngOptions_1.annotationsAs !== 'decorators') {
if (diagnostics_1)
console.time('NG downlevel');
tsickleCompilerHost_1.reconfigureForRun(programForJsEmit, tsickle.Pass.DECORATOR_DOWNLEVEL);
// A program can be re-used only once; save the programWithCodegen to be reused by
// metadataWriter
programForJsEmit = createProgram_1(tsickleCompilerHost_1);
tsc_1.check(tsickleCompilerHost_1.diagnostics);
if (diagnostics_1)
console.timeEnd('NG downlevel');
}
if (ngOptions_1.annotateForClosureCompiler) {
if (diagnostics_1)
console.time('NG JSDoc');
tsickleCompilerHost_1.reconfigureForRun(programForJsEmit, tsickle.Pass.CLOSURIZE);
programForJsEmit = createProgram_1(tsickleCompilerHost_1);
tsc_1.check(tsickleCompilerHost_1.diagnostics);
if (diagnostics_1)
console.timeEnd('NG JSDoc');
}