@angular/tsc-wrapped
Advanced tools
Comparing version 4.3.0-beta.0 to 4.3.0-beta.1
@@ -9,3 +9,3 @@ /** | ||
export { MetadataWriterHost } from './src/compiler_host'; | ||
export { CodegenExtension, UserError, main } from './src/main'; | ||
export { CodegenExtension, UserError, createBundleIndexHost, main } from './src/main'; | ||
export { default as AngularCompilerOptions } from './src/options'; | ||
@@ -12,0 +12,0 @@ export * from './src/bundler'; |
@@ -17,2 +17,3 @@ "use strict"; | ||
exports.UserError = main_1.UserError; | ||
exports.createBundleIndexHost = main_1.createBundleIndexHost; | ||
exports.main = main_1.main; | ||
@@ -19,0 +20,0 @@ __export(require("./src/bundler")); |
{ | ||
"name": "@angular/tsc-wrapped", | ||
"version": "4.3.0-beta.0", | ||
"version": "4.3.0-beta.1", | ||
"description": "Wraps the tsc CLI, allowing extensions.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/angular/angular/blob/master/tools/@angular/tsc-wrapped", |
@@ -12,2 +12,7 @@ import * as ts from 'typescript'; | ||
} | ||
export declare function createBundleIndexHost(ngOptions: NgOptions, rootFiles: string[], host: ts.CompilerHost): { | ||
host: ts.CompilerHost; | ||
indexName?: string; | ||
errors?: ts.Diagnostic[]; | ||
}; | ||
export declare function main(project: string | VinylFile, cliOptions: CliOptions, codegen?: CodegenExtension, options?: ts.CompilerOptions): Promise<any>; |
@@ -25,2 +25,29 @@ "use strict"; | ||
var TS_EXT = /\.ts$/; | ||
function createBundleIndexHost(ngOptions, rootFiles, host) { | ||
var files = rootFiles.filter(function (f) { return !DTS.test(f); }); | ||
if (files.length != 1) { | ||
return { | ||
host: host, | ||
errors: [{ | ||
file: null, | ||
start: null, | ||
length: null, | ||
messageText: 'Angular compiler option "flatModuleIndex" requires one and only one .ts file in the "files" field.', | ||
category: ts.DiagnosticCategory.Error, | ||
code: 0 | ||
}] | ||
}; | ||
} | ||
var file = files[0]; | ||
var indexModule = file.replace(/\.ts$/, ''); | ||
var bundler = new bundler_1.MetadataBundler(indexModule, ngOptions.flatModuleId, new bundler_1.CompilerHostAdapter(host)); | ||
var metadataBundle = bundler.getMetadataBundle(); | ||
var metadata = JSON.stringify(metadataBundle.metadata); | ||
var name = path.join(path.dirname(indexModule), ngOptions.flatModuleOutFile.replace(JS_EXT, '.ts')); | ||
var libraryIndex = "./" + path.basename(indexModule); | ||
var content = index_writer_1.privateEntriesToIndex(libraryIndex, metadataBundle.privates); | ||
host = new compiler_host_1.SyntheticIndexHost(host, { name: name, content: content, metadata: metadata }); | ||
return { host: host, indexName: name }; | ||
} | ||
exports.createBundleIndexHost = createBundleIndexHost; | ||
function main(project, cliOptions, codegen, options) { | ||
@@ -57,27 +84,8 @@ try { | ||
if (ngOptions_1.flatModuleOutFile && !ngOptions_1.skipMetadataEmit) { | ||
var files = parsed_1.fileNames.filter(function (f) { return !DTS.test(f); }); | ||
if (files.length != 1) { | ||
tsc_1.check([{ | ||
file: null, | ||
start: null, | ||
length: null, | ||
messageText: 'Angular compiler option "flatModuleIndex" requires one and only one .ts file in the "files" field.', | ||
category: ts.DiagnosticCategory.Error, | ||
code: 0 | ||
}]); | ||
} | ||
var file = files[0]; | ||
var indexModule = file.replace(/\.ts$/, ''); | ||
var bundler = new bundler_1.MetadataBundler(indexModule, ngOptions_1.flatModuleId, new bundler_1.CompilerHostAdapter(host_1)); | ||
if (diagnostics_1) | ||
console.time('NG flat module index'); | ||
var metadataBundle = bundler.getMetadataBundle(); | ||
if (diagnostics_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 _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; | ||
} | ||
@@ -84,0 +92,0 @@ var tsickleCompilerHostOptions = { googmodule: false, untyped: true, convertIndexImportShorthand: true }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
648116
5139