Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (ngOptions_1.flatModuleOutFile && !ngOptions_1.skipMetadataEmit) {
var _b = createBundleIndexHost(ngOptions_1, rootFileNames_1, host_1), bundleHost = _b.host, indexName = _b.indexName, errors_1 = _b.errors;
if (errors_1)
tsc_1.check(errors_1);
if (indexName)
addGeneratedFileName_1(indexName);
host_1 = bundleHost;
}
var tsickleCompilerHostOptions = { googmodule: false, untyped: true, convertIndexImportShorthand: false };
var tsickleHost = {
shouldSkipTsickleProcessing: function (fileName) { return /\.d\.ts$/.test(fileName); },
pathToModuleName: function (context, importPath) { return ''; },
shouldIgnoreWarningsForPath: function (filePath) { return false; },
fileNameToModuleId: function (fileName) { return fileName; },
};
var tsickleCompilerHost_1 = new tsickle.TsickleCompilerHost(host_1, ngOptions_1, tsickleCompilerHostOptions, tsickleHost);
var program_1 = createProgram_1(tsickleCompilerHost_1);
var errors = program_1.getOptionsDiagnostics();
tsc_1.check(errors);
if (ngOptions_1.skipTemplateCodegen || !codegen) {
codegen = function () { return Promise.resolve([]); };
}
if (diagnostics_1)
console.time('NG codegen');
return codegen(ngOptions_1, cliOptions, program_1, host_1).then(function (genFiles) {
if (diagnostics_1)
console.timeEnd('NG codegen');
// Add the generated files to the configuration so they will become part of the program.
if (ngOptions_1.alwaysCompileGeneratedCode) {
genFiles.forEach(function (genFileName) { return addGeneratedFileName_1(genFileName); });
}
var definitionsHost = tsickleCompilerHost_1;
if (ngOptions_1.flatModuleOutFile && !ngOptions_1.skipMetadataEmit) {
var _b = createBundleIndexHost(ngOptions_1, rootFileNames_1, host_1), bundleHost = _b.host, indexName = _b.indexName, errors_1 = _b.errors;
if (errors_1)
tsc_1.check(errors_1);
if (indexName)
addGeneratedFileName_1(indexName);
host_1 = bundleHost;
}
var tsickleCompilerHostOptions = { googmodule: false, untyped: true, convertIndexImportShorthand: true };
var tsickleHost = {
shouldSkipTsickleProcessing: function (fileName) { return /\.d\.ts$/.test(fileName); },
pathToModuleName: function (context, importPath) { return ''; },
shouldIgnoreWarningsForPath: function (filePath) { return false; },
fileNameToModuleId: function (fileName) { return fileName; },
};
var tsickleCompilerHost_1 = new tsickle.TsickleCompilerHost(host_1, ngOptions_1, tsickleCompilerHostOptions, tsickleHost);
var program_1 = createProgram_1(tsickleCompilerHost_1);
var errors = program_1.getOptionsDiagnostics();
tsc_1.check(errors);
if (ngOptions_1.skipTemplateCodegen || !codegen) {
codegen = function () { return Promise.resolve([]); };
}
if (diagnostics_1)
console.time('NG codegen');
return codegen(ngOptions_1, cliOptions, program_1, host_1).then(function (genFiles) {
if (diagnostics_1)
console.timeEnd('NG codegen');
// Add the generated files to the configuration so they will become part of the program.
if (ngOptions_1.alwaysCompileGeneratedCode) {
genFiles.forEach(function (genFileName) { return addGeneratedFileName_1(genFileName); });
}
var definitionsHost = tsickleCompilerHost_1;
console.timeEnd('NG flat module index');
var metadata = JSON.stringify(metadataBundle.metadata);
var name_1 = path.join(path.dirname(indexModule), ngOptions_1.flatModuleOutFile.replace(JS_EXT, '.ts'));
var libraryIndex = "./" + path.basename(indexModule);
var content = index_writer_1.privateEntriesToIndex(libraryIndex, metadataBundle.privates);
host_1 = new compiler_host_1.SyntheticIndexHost(host_1, { name: name_1, content: content, metadata: metadata });
addGeneratedFileName_1(name_1);
}
var tsickleCompilerHostOptions = { googmodule: false, untyped: true, convertIndexImportShorthand: true };
var tsickleHost = {
shouldSkipTsickleProcessing: function (fileName) { return /\.d\.ts$/.test(fileName); },
pathToModuleName: function (context, importPath) { return ''; },
shouldIgnoreWarningsForPath: function (filePath) { return false; },
fileNameToModuleId: function (fileName) { return fileName; },
};
var tsickleCompilerHost_1 = new tsickle.TsickleCompilerHost(host_1, ngOptions_1, tsickleCompilerHostOptions, tsickleHost);
var program_1 = createProgram_1(tsickleCompilerHost_1);
var errors = program_1.getOptionsDiagnostics();
tsc_1.check(errors);
if (ngOptions_1.skipTemplateCodegen || !codegen) {
codegen = function () { return Promise.resolve([]); };
}
if (diagnostics_1)
console.time('NG codegen');
return codegen(ngOptions_1, cliOptions, program_1, host_1).then(function (genFiles) {
if (diagnostics_1)
console.timeEnd('NG codegen');
// Add the generated files to the configuration so they will become part of the program.
if (ngOptions_1.alwaysCompileGeneratedCode) {
genFiles.forEach(function (genFileName) { return addGeneratedFileName_1(genFileName); });
}
var definitionsHost = tsickleCompilerHost_1;
var content = index_writer_1.privateEntriesToIndex(libraryIndex, metadataBundle.privates);
host_1 = new compiler_host_1.SyntheticIndexHost(host_1, { name: name_1, content: content, metadata: metadata });
parsed_1.fileNames.push(name_1);
}
var tsickleCompilerHostOptions = {
googmodule: false,
untyped: true,
convertIndexImportShorthand: ngOptions_1.target === ts.ScriptTarget.ES2015,
};
var tsickleHost = {
shouldSkipTsickleProcessing: function (fileName) { return /\.d\.ts$/.test(fileName); },
pathToModuleName: function (context, importPath) { return ''; },
shouldIgnoreWarningsForPath: function (filePath) { return false; },
fileNameToModuleId: function (fileName) { return fileName; },
};
var tsickleCompilerHost_1 = new tsickle.TsickleCompilerHost(host_1, ngOptions_1, tsickleCompilerHostOptions, tsickleHost);
var program_1 = createProgram_1(tsickleCompilerHost_1);
var errors = program_1.getOptionsDiagnostics();
tsc_1.check(errors);
if (ngOptions_1.skipTemplateCodegen || !codegen) {
codegen = function () { return Promise.resolve(null); };
}
if (diagnostics_1)
console.time('NG codegen');
return codegen(ngOptions_1, cliOptions, program_1, host_1).then(function () {
if (diagnostics_1)
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;