@angular/tsc-wrapped
Advanced tools
Comparing version 5.0.0-beta.3 to 5.0.0-beta.4
{ | ||
"name": "@angular/tsc-wrapped", | ||
"version": "5.0.0-beta.3", | ||
"version": "5.0.0-beta.4", | ||
"description": "Wraps the tsc CLI, allowing extensions.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/angular/angular/blob/master/packages/tsc-wrapped", |
@@ -35,15 +35,6 @@ import * as ts from 'typescript'; | ||
} | ||
export declare class SyntheticIndexHost extends DelegatingHost { | ||
private normalSyntheticIndexName; | ||
private indexContent; | ||
private indexMetadata; | ||
constructor(delegate: ts.CompilerHost, syntheticIndex: { | ||
name: string; | ||
content: string; | ||
metadata: string; | ||
}); | ||
fileExists: (fileName: string) => boolean; | ||
readFile: (fileName: string) => string; | ||
getSourceFile: (fileName: string, languageVersion: ts.ScriptTarget, onError?: ((message: string) => void) | undefined) => ts.SourceFile; | ||
writeFile: ts.WriteFileCallback; | ||
} | ||
export declare function createSyntheticIndexHost<H extends ts.CompilerHost>(delegate: H, syntheticIndex: { | ||
name: string; | ||
content: string; | ||
metadata: string; | ||
}): H; |
@@ -127,38 +127,34 @@ "use strict"; | ||
exports.MetadataWriterHost = MetadataWriterHost; | ||
var SyntheticIndexHost = (function (_super) { | ||
__extends(SyntheticIndexHost, _super); | ||
function SyntheticIndexHost(delegate, syntheticIndex) { | ||
var _this = _super.call(this, delegate) || this; | ||
_this.fileExists = function (fileName) { | ||
return path_1.normalize(fileName) == _this.normalSyntheticIndexName || | ||
_this.delegate.fileExists(fileName); | ||
}; | ||
_this.readFile = function (fileName) { | ||
return path_1.normalize(fileName) == _this.normalSyntheticIndexName ? | ||
_this.indexContent : | ||
_this.delegate.readFile(fileName); | ||
}; | ||
_this.getSourceFile = function (fileName, languageVersion, onError) { | ||
if (path_1.normalize(fileName) == _this.normalSyntheticIndexName) { | ||
return ts.createSourceFile(fileName, _this.indexContent, languageVersion, true); | ||
function createSyntheticIndexHost(delegate, syntheticIndex) { | ||
var normalSyntheticIndexName = path_1.normalize(syntheticIndex.name); | ||
var indexContent = syntheticIndex.content; | ||
var indexMetadata = syntheticIndex.metadata; | ||
var newHost = Object.create(delegate); | ||
newHost.fileExists = function (fileName) { | ||
return path_1.normalize(fileName) == normalSyntheticIndexName || delegate.fileExists(fileName); | ||
}; | ||
newHost.readFile = function (fileName) { | ||
return path_1.normalize(fileName) == normalSyntheticIndexName ? indexContent : | ||
delegate.readFile(fileName); | ||
}; | ||
newHost.getSourceFile = | ||
function (fileName, languageVersion, onError) { | ||
if (path_1.normalize(fileName) == normalSyntheticIndexName) { | ||
return ts.createSourceFile(fileName, indexContent, languageVersion, true); | ||
} | ||
return _this.delegate.getSourceFile(fileName, languageVersion, onError); | ||
return delegate.getSourceFile(fileName, languageVersion, onError); | ||
}; | ||
_this.writeFile = function (fileName, data, writeByteOrderMark, onError, sourceFiles) { | ||
_this.delegate.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles); | ||
newHost.writeFile = | ||
function (fileName, data, writeByteOrderMark, onError, sourceFiles) { | ||
delegate.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles); | ||
if (fileName.match(DTS) && sourceFiles && sourceFiles.length == 1 && | ||
path_1.normalize(sourceFiles[0].fileName) == _this.normalSyntheticIndexName) { | ||
path_1.normalize(sourceFiles[0].fileName) == normalSyntheticIndexName) { | ||
// If we are writing the synthetic index, write the metadata along side. | ||
var metadataName = fileName.replace(DTS, '.metadata.json'); | ||
fs_1.writeFileSync(metadataName, _this.indexMetadata, { encoding: 'utf8' }); | ||
fs_1.writeFileSync(metadataName, indexMetadata, { encoding: 'utf8' }); | ||
} | ||
}; | ||
_this.normalSyntheticIndexName = path_1.normalize(syntheticIndex.name); | ||
_this.indexContent = syntheticIndex.content; | ||
_this.indexMetadata = syntheticIndex.metadata; | ||
return _this; | ||
} | ||
return SyntheticIndexHost; | ||
}(DelegatingHost)); | ||
exports.SyntheticIndexHost = SyntheticIndexHost; | ||
return newHost; | ||
} | ||
exports.createSyntheticIndexHost = createSyntheticIndexHost; | ||
//# sourceMappingURL=compiler_host.js.map |
@@ -12,4 +12,4 @@ import * as ts from 'typescript'; | ||
} | ||
export declare function createBundleIndexHost(ngOptions: NgOptions, rootFiles: string[], host: ts.CompilerHost): { | ||
host: ts.CompilerHost; | ||
export declare function createBundleIndexHost<H extends ts.CompilerHost>(ngOptions: NgOptions, rootFiles: string[], host: H): { | ||
host: H; | ||
indexName?: string; | ||
@@ -16,0 +16,0 @@ errors?: ts.Diagnostic[]; |
@@ -48,3 +48,3 @@ "use strict"; | ||
var content = index_writer_1.privateEntriesToIndex(libraryIndex, metadataBundle.privates); | ||
host = new compiler_host_1.SyntheticIndexHost(host, { name: name, content: content, metadata: metadata }); | ||
host = compiler_host_1.createSyntheticIndexHost(host, { name: name, content: content, metadata: metadata }); | ||
return { host: host, indexName: name }; | ||
@@ -51,0 +51,0 @@ } |
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
684466
5371