@angular/compiler-cli
Advanced tools
Comparing version 0.6.0 to 0.6.1
{ | ||
"name": "@angular/compiler-cli", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "Execute angular2 template compiler in nodejs.", | ||
@@ -19,5 +19,5 @@ "main": "index.js", | ||
"typescript": "^2.0.2", | ||
"@angular/compiler": "^2.0.0-rc.6", | ||
"@angular/platform-server": "^2.0.0-rc.6", | ||
"@angular/core": "^2.0.0-rc.6" | ||
"@angular/compiler": "^2.0.0-rc.7", | ||
"@angular/platform-server": "^2.0.0-rc.7", | ||
"@angular/core": "^2.0.0-rc.7" | ||
}, | ||
@@ -24,0 +24,0 @@ "repository": { |
@@ -55,6 +55,6 @@ /** | ||
annotations.forEach(function (annotation) { | ||
if (annotation instanceof core_1.NgModuleMetadata) { | ||
if (annotation instanceof core_1.NgModule) { | ||
result.ngModules.push(staticType); | ||
} | ||
else if (annotation instanceof core_1.ComponentMetadata) { | ||
else if (annotation instanceof core_1.Component) { | ||
result.components.push(staticType); | ||
@@ -107,13 +107,13 @@ } | ||
var analyzedNgModules = this.compiler.analyzeModules(ngModules); | ||
return Promise | ||
.all(fileMetas.map(function (fileMeta) { return _this.compiler | ||
.compile(fileMeta.fileUrl, analyzedNgModules, fileMeta.components, fileMeta.ngModules) | ||
.then(function (generatedModules) { | ||
generatedModules.forEach(function (generatedModule) { | ||
var sourceFile = _this.program.getSourceFile(fileMeta.fileUrl); | ||
var emitPath = _this.calculateEmitPath(generatedModule.moduleUrl); | ||
_this.host.writeFile(emitPath, PREAMBLE + generatedModule.source, false, function () { }, [sourceFile]); | ||
return Promise.all(fileMetas.map(function (fileMeta) { | ||
return _this.compiler | ||
.compile(fileMeta.fileUrl, analyzedNgModules, fileMeta.components, fileMeta.ngModules) | ||
.then(function (generatedModules) { | ||
generatedModules.forEach(function (generatedModule) { | ||
var sourceFile = _this.program.getSourceFile(fileMeta.fileUrl); | ||
var emitPath = _this.calculateEmitPath(generatedModule.moduleUrl); | ||
_this.host.writeFile(emitPath, PREAMBLE + generatedModule.source, false, function () { }, [sourceFile]); | ||
}); | ||
}); | ||
}); })) | ||
.catch(function (e) { console.error(e.stack); }); | ||
})); | ||
}; | ||
@@ -120,0 +120,0 @@ CodeGenerator.create = function (options, cliOptions, program, compilerHost, reflectorHostContext, resourceLoader) { |
@@ -69,6 +69,6 @@ #!/usr/bin/env node | ||
annotations.forEach(function (annotation) { | ||
if (annotation instanceof core_1.NgModuleMetadata) { | ||
if (annotation instanceof core_1.NgModule) { | ||
result.ngModules.push(staticType); | ||
} | ||
else if (annotation instanceof core_1.ComponentMetadata) { | ||
else if (annotation instanceof core_1.Component) { | ||
result.components.push(staticType); | ||
@@ -116,4 +116,3 @@ } | ||
})) | ||
.then(function (_) { return _this.messageBundle; }) | ||
.catch(function (e) { console.error(e.stack); }); | ||
.then(function (_) { return _this.messageBundle; }); | ||
if (errors.length) { | ||
@@ -120,0 +119,0 @@ throw new Error(errors.map(function (e) { return e.toString(); }).join('\n')); |
@@ -72,3 +72,8 @@ /** | ||
if (!this.context.fileExists(importedFile)) { | ||
this.context.assumeFileExists(importedFile); | ||
if (this.options.rootDirs && this.options.rootDirs.length > 0) { | ||
this.context.assumeFileExists(path.join(this.options.rootDirs[0], importedFile)); | ||
} | ||
else { | ||
this.context.assumeFileExists(importedFile); | ||
} | ||
} | ||
@@ -75,0 +80,0 @@ var resolvable = function (candidate) { |
@@ -78,2 +78,4 @@ /** | ||
export declare class NodeReflectorHostContext implements ReflectorHostContext { | ||
private host; | ||
constructor(host: ts.CompilerHost); | ||
private assumedExists; | ||
@@ -80,0 +82,0 @@ fileExists(fileName: string): boolean; |
@@ -30,3 +30,3 @@ /** | ||
this.genDir = path.normalize(path.join(this.options.genDir, '.')).replace(/\\/g, '/'); | ||
this.context = context || new NodeReflectorHostContext(); | ||
this.context = context || new NodeReflectorHostContext(compilerHost); | ||
var genPath = path.relative(this.basePath, this.genDir); | ||
@@ -38,3 +38,3 @@ this.isGenDirChildOfRootDir = genPath === '' || !genPath.startsWith('..'); | ||
coreDecorators: '@angular/core/src/metadata', | ||
diDecorators: '@angular/core/src/di/decorators', | ||
diDecorators: '@angular/core/src/di/metadata', | ||
diMetadata: '@angular/core/src/di/metadata', | ||
@@ -302,7 +302,8 @@ diOpaqueToken: '@angular/core/src/di/opaque_token', | ||
var NodeReflectorHostContext = (function () { | ||
function NodeReflectorHostContext() { | ||
function NodeReflectorHostContext(host) { | ||
this.host = host; | ||
this.assumedExists = {}; | ||
} | ||
NodeReflectorHostContext.prototype.fileExists = function (fileName) { | ||
return this.assumedExists[fileName] || fs.existsSync(fileName); | ||
return this.assumedExists[fileName] || this.host.fileExists(fileName); | ||
}; | ||
@@ -309,0 +310,0 @@ NodeReflectorHostContext.prototype.directoryExists = function (directoryName) { |
@@ -139,7 +139,3 @@ /** | ||
StaticReflector.prototype.registerDecoratorOrConstructor = function (type, ctor) { | ||
this.conversionMap.set(type, function (context, args) { | ||
var metadata = Object.create(ctor.prototype); | ||
ctor.apply(metadata, args); | ||
return metadata; | ||
}); | ||
this.conversionMap.set(type, function (context, args) { return new (ctor.bind.apply(ctor, [void 0].concat(args)))(); }); | ||
}; | ||
@@ -152,26 +148,26 @@ StaticReflector.prototype.registerFunction = function (type, fn) { | ||
this.opaqueToken = this.host.findDeclaration(diOpaqueToken, 'OpaqueToken'); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(diDecorators, 'Host'), core_1.HostMetadata); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(diDecorators, 'Injectable'), core_1.InjectableMetadata); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(diDecorators, 'Self'), core_1.SelfMetadata); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(diDecorators, 'SkipSelf'), core_1.SkipSelfMetadata); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(diDecorators, 'Inject'), core_1.InjectMetadata); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(diDecorators, 'Optional'), core_1.OptionalMetadata); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(coreDecorators, 'Attribute'), core_1.AttributeMetadata); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(coreDecorators, 'ContentChild'), core_1.ContentChildMetadata); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(coreDecorators, 'ContentChildren'), core_1.ContentChildrenMetadata); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(coreDecorators, 'ViewChild'), core_1.ViewChildMetadata); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(coreDecorators, 'ViewChildren'), core_1.ViewChildrenMetadata); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(coreDecorators, 'Input'), core_1.InputMetadata); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(coreDecorators, 'Output'), core_1.OutputMetadata); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(coreDecorators, 'Pipe'), core_1.PipeMetadata); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(coreDecorators, 'HostBinding'), core_1.HostBindingMetadata); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(coreDecorators, 'HostListener'), core_1.HostListenerMetadata); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(coreDecorators, 'Directive'), core_1.DirectiveMetadata); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(coreDecorators, 'Component'), core_1.ComponentMetadata); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(coreDecorators, 'NgModule'), core_1.NgModuleMetadata); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(diDecorators, 'Host'), core_1.Host); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(diDecorators, 'Injectable'), core_1.Injectable); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(diDecorators, 'Self'), core_1.Self); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(diDecorators, 'SkipSelf'), core_1.SkipSelf); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(diDecorators, 'Inject'), core_1.Inject); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(diDecorators, 'Optional'), core_1.Optional); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(coreDecorators, 'Attribute'), core_1.Attribute); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(coreDecorators, 'ContentChild'), core_1.ContentChild); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(coreDecorators, 'ContentChildren'), core_1.ContentChildren); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(coreDecorators, 'ViewChild'), core_1.ViewChild); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(coreDecorators, 'ViewChildren'), core_1.ViewChildren); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(coreDecorators, 'Input'), core_1.Input); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(coreDecorators, 'Output'), core_1.Output); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(coreDecorators, 'Pipe'), core_1.Pipe); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(coreDecorators, 'HostBinding'), core_1.HostBinding); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(coreDecorators, 'HostListener'), core_1.HostListener); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(coreDecorators, 'Directive'), core_1.Directive); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(coreDecorators, 'Component'), core_1.Component); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(coreDecorators, 'NgModule'), core_1.NgModule); | ||
// Note: Some metadata classes can be used directly with Provider.deps. | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(diMetadata, 'HostMetadata'), core_1.HostMetadata); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(diMetadata, 'SelfMetadata'), core_1.SelfMetadata); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(diMetadata, 'SkipSelfMetadata'), core_1.SkipSelfMetadata); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(diMetadata, 'OptionalMetadata'), core_1.OptionalMetadata); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(diMetadata, 'Host'), core_1.Host); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(diMetadata, 'Self'), core_1.Self); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(diMetadata, 'SkipSelf'), core_1.SkipSelf); | ||
this.registerDecoratorOrConstructor(this.host.findDeclaration(diMetadata, 'Optional'), core_1.Optional); | ||
this.registerFunction(this.host.findDeclaration(animationMetadata, 'trigger'), core_1.trigger); | ||
@@ -178,0 +174,0 @@ this.registerFunction(this.host.findDeclaration(animationMetadata, 'state'), core_1.state); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
1855
156668