Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@angular/compiler-cli

Package Overview
Dependencies
Maintainers
1
Versions
843
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@angular/compiler-cli - npm Package Compare versions

Comparing version 2.2.2 to 2.2.3

src/path_mapped_reflector_host.d.ts

4

index.d.ts

@@ -8,6 +8,6 @@ /**

*/
export { AotCompilerHost, AotCompilerHost as StaticReflectorHost, StaticReflector, StaticSymbol } from '@angular/compiler';
export { CodeGenerator } from './src/codegen';
export { CompilerHost, CompilerHostContext, NodeCompilerHostContext } from './src/compiler_host';
export { Extractor } from './src/extractor';
export { NodeReflectorHostContext, ReflectorHost, ReflectorHostContext } from './src/reflector_host';
export { StaticReflector, StaticReflectorHost, StaticSymbol } from './src/static_reflector';
export * from '@angular/tsc-wrapped';

@@ -12,13 +12,13 @@ /**

}
var compiler_1 = require('@angular/compiler');
exports.StaticReflector = compiler_1.StaticReflector;
exports.StaticSymbol = compiler_1.StaticSymbol;
var codegen_1 = require('./src/codegen');
exports.CodeGenerator = codegen_1.CodeGenerator;
var compiler_host_1 = require('./src/compiler_host');
exports.CompilerHost = compiler_host_1.CompilerHost;
exports.NodeCompilerHostContext = compiler_host_1.NodeCompilerHostContext;
var extractor_1 = require('./src/extractor');
exports.Extractor = extractor_1.Extractor;
var reflector_host_1 = require('./src/reflector_host');
exports.NodeReflectorHostContext = reflector_host_1.NodeReflectorHostContext;
exports.ReflectorHost = reflector_host_1.ReflectorHost;
var static_reflector_1 = require('./src/static_reflector');
exports.StaticReflector = static_reflector_1.StaticReflector;
exports.StaticSymbol = static_reflector_1.StaticSymbol;
__export(require('@angular/tsc-wrapped'));
//# sourceMappingURL=index.js.map

@@ -1,1 +0,1 @@

{"__symbolic":"module","version":2,"metadata":{},"exports":[{"from":"@angular/compiler","export":["AotCompilerHost",{"name":"AotCompilerHost","as":"StaticReflectorHost"},"StaticReflector","StaticSymbol"]},{"from":"./src/codegen","export":["CodeGenerator"]},{"from":"./src/compiler_host","export":["CompilerHost","CompilerHostContext","NodeCompilerHostContext"]},{"from":"./src/extractor","export":["Extractor"]},{"from":"@angular/tsc-wrapped"}]}
{"__symbolic":"module","version":1,"metadata":{},"exports":[{"from":"./src/codegen","export":["CodeGenerator"]},{"from":"./src/extractor","export":["Extractor"]},{"from":"./src/reflector_host","export":["NodeReflectorHostContext","ReflectorHost","ReflectorHostContext"]},{"from":"./src/static_reflector","export":["StaticReflector","StaticReflectorHost","StaticSymbol"]},{"from":"@angular/tsc-wrapped"}]}
{
"name": "@angular/compiler-cli",
"version": "2.2.2",
"version": "2.2.3",
"description": "Angular - the compiler CLI for Node.js",

@@ -12,3 +12,3 @@ "main": "index.js",

"dependencies": {
"@angular/tsc-wrapped": "^0.4.0",
"@angular/tsc-wrapped": "^0.3.0",
"reflect-metadata": "^0.1.2",

@@ -19,4 +19,4 @@ "minimist": "^1.2.0"

"typescript": "^2.0.2",
"@angular/compiler": "2.2.2",
"@angular/core": "2.2.2"
"@angular/compiler": "2.2.3",
"@angular/core": "2.2.3"
},

@@ -23,0 +23,0 @@ "repository": {

@@ -15,3 +15,4 @@ /**

import * as ts from 'typescript';
import { CompilerHost, CompilerHostContext } from './compiler_host';
import { ReflectorHost, ReflectorHostContext } from './reflector_host';
import { StaticReflector, StaticReflectorHost, StaticSymbol } from './static_reflector';
export declare class CodeGenerator {

@@ -21,9 +22,12 @@ private options;

host: ts.CompilerHost;
private staticReflector;
private compiler;
private ngCompilerHost;
constructor(options: AngularCompilerOptions, program: ts.Program, host: ts.CompilerHost, compiler: compiler.AotCompiler, ngCompilerHost: CompilerHost);
private reflectorHost;
constructor(options: AngularCompilerOptions, program: ts.Program, host: ts.CompilerHost, staticReflector: StaticReflector, compiler: compiler.OfflineCompiler, reflectorHost: StaticReflectorHost);
private calculateEmitPath(filePath);
codegen(): Promise<any>;
static create(options: AngularCompilerOptions, cliOptions: NgcCliOptions, program: ts.Program, tsCompilerHost: ts.CompilerHost, compilerHostContext?: CompilerHostContext, ngCompilerHost?: CompilerHost): CodeGenerator;
codegen(options: {
transitiveModules: boolean;
}): Promise<any>;
static create(options: AngularCompilerOptions, cliOptions: NgcCliOptions, program: ts.Program, compilerHost: ts.CompilerHost, reflectorHostContext?: ReflectorHostContext, resourceLoader?: compiler.ResourceLoader, reflectorHost?: ReflectorHost): CodeGenerator;
}
export declare function excludeFilePattern(options: AngularCompilerOptions): RegExp;
export declare function extractProgramSymbols(program: ts.Program, staticReflector: StaticReflector, reflectorHost: StaticReflectorHost, options: AngularCompilerOptions): StaticSymbol[];

@@ -14,6 +14,10 @@ /**

var compiler = require('@angular/compiler');
var core_1 = require('@angular/core');
var fs_1 = require('fs');
var path = require('path');
var compiler_host_1 = require('./compiler_host');
var path_mapped_compiler_host_1 = require('./path_mapped_compiler_host');
var path_mapped_reflector_host_1 = require('./path_mapped_reflector_host');
var private_import_core_1 = require('./private_import_core');
var reflector_host_1 = require('./reflector_host');
var static_reflection_capabilities_1 = require('./static_reflection_capabilities');
var static_reflector_1 = require('./static_reflector');
var GENERATED_FILES = /\.ngfactory\.ts$|\.css\.ts$|\.css\.shim\.ts$/;

@@ -23,8 +27,9 @@ var GENERATED_OR_DTS_FILES = /\.d\.ts$|\.ngfactory\.ts$|\.css\.ts$|\.css\.shim\.ts$/;

var CodeGenerator = (function () {
function CodeGenerator(options, program, host, compiler, ngCompilerHost) {
function CodeGenerator(options, program, host, staticReflector, compiler, reflectorHost) {
this.options = options;
this.program = program;
this.host = host;
this.staticReflector = staticReflector;
this.compiler = compiler;
this.ngCompilerHost = ngCompilerHost;
this.reflectorHost = reflectorHost;
}

@@ -52,7 +57,6 @@ // Write codegen in a directory structure matching the sources.

};
CodeGenerator.prototype.codegen = function () {
CodeGenerator.prototype.codegen = function (options) {
var _this = this;
return this.compiler
.compileAll(this.program.getSourceFiles().map(function (sf) { return _this.ngCompilerHost.getCanonicalFileName(sf.fileName); }))
.then(function (generatedModules) {
var staticSymbols = extractProgramSymbols(this.program, this.staticReflector, this.reflectorHost, this.options);
return this.compiler.compileModules(staticSymbols, options).then(function (generatedModules) {
generatedModules.forEach(function (generatedModule) {

@@ -65,9 +69,12 @@ var sourceFile = _this.program.getSourceFile(generatedModule.fileUrl);

};
CodeGenerator.create = function (options, cliOptions, program, tsCompilerHost, compilerHostContext, ngCompilerHost) {
if (!ngCompilerHost) {
var usePathMapping = !!options.rootDirs && options.rootDirs.length > 0;
ngCompilerHost = usePathMapping ?
new path_mapped_compiler_host_1.PathMappedCompilerHost(program, tsCompilerHost, options, compilerHostContext) :
new compiler_host_1.CompilerHost(program, tsCompilerHost, options, compilerHostContext);
}
CodeGenerator.create = function (options, cliOptions, program, compilerHost, reflectorHostContext, resourceLoader, reflectorHost) {
resourceLoader = resourceLoader || {
get: function (s) {
if (!compilerHost.fileExists(s)) {
// TODO: We should really have a test for error cases like this!
throw new Error("Compilation failed. Resource file not found: " + s);
}
return Promise.resolve(compilerHost.readFile(s));
}
};
var transFile = cliOptions.i18nFile;

@@ -82,11 +89,27 @@ var locale = cliOptions.locale;

}
var aotCompiler = compiler.createAotCompiler(ngCompilerHost, {
debug: options.debug === true,
translations: transContent,
i18nFormat: cliOptions.i18nFormat,
locale: cliOptions.locale,
excludeFilePattern: options.generateCodeForLibraries === false ? GENERATED_OR_DTS_FILES :
GENERATED_FILES
}).compiler;
return new CodeGenerator(options, program, tsCompilerHost, aotCompiler, ngCompilerHost);
var urlResolver = compiler.createOfflineCompileUrlResolver();
if (!reflectorHost) {
var usePathMapping = !!options.rootDirs && options.rootDirs.length > 0;
reflectorHost = usePathMapping ?
new path_mapped_reflector_host_1.PathMappedReflectorHost(program, compilerHost, options, reflectorHostContext) :
new reflector_host_1.ReflectorHost(program, compilerHost, options, reflectorHostContext);
}
var staticReflector = new static_reflector_1.StaticReflector(reflectorHost);
static_reflection_capabilities_1.StaticAndDynamicReflectionCapabilities.install(staticReflector);
var htmlParser = new compiler.I18NHtmlParser(new compiler.HtmlParser(), transContent, cliOptions.i18nFormat);
var config = new compiler.CompilerConfig({
genDebugInfo: options.debug === true,
defaultEncapsulation: core_1.ViewEncapsulation.Emulated,
logBindingUpdate: false,
useJit: false
});
var normalizer = new compiler.DirectiveNormalizer(resourceLoader, urlResolver, htmlParser, config);
var expressionParser = new compiler.Parser(new compiler.Lexer());
var elementSchemaRegistry = new compiler.DomElementSchemaRegistry();
var console = new private_import_core_1.Console();
var tmplParser = new compiler.TemplateParser(expressionParser, elementSchemaRegistry, htmlParser, console, []);
var resolver = new compiler.CompileMetadataResolver(new compiler.NgModuleResolver(staticReflector), new compiler.DirectiveResolver(staticReflector), new compiler.PipeResolver(staticReflector), elementSchemaRegistry, normalizer, staticReflector);
// TODO(vicb): do not pass cliOptions.i18nFormat here
var offlineCompiler = new compiler.OfflineCompiler(resolver, tmplParser, new compiler.StyleCompiler(urlResolver), new compiler.ViewCompiler(config, elementSchemaRegistry), new compiler.DirectiveWrapperCompiler(config, expressionParser, elementSchemaRegistry, console), new compiler.NgModuleCompiler(), new compiler.TypeScriptEmitter(reflectorHost), cliOptions.locale, cliOptions.i18nFormat, new compiler.AnimationParser(elementSchemaRegistry));
return new CodeGenerator(options, program, compilerHost, staticReflector, offlineCompiler, reflectorHost);
};

@@ -96,6 +119,31 @@ return CodeGenerator;

exports.CodeGenerator = CodeGenerator;
function excludeFilePattern(options) {
return options.generateCodeForLibraries === false ? GENERATED_OR_DTS_FILES : GENERATED_FILES;
function extractProgramSymbols(program, staticReflector, reflectorHost, options) {
// Compare with false since the default should be true
var skipFileNames = options.generateCodeForLibraries === false ? GENERATED_OR_DTS_FILES : GENERATED_FILES;
var staticSymbols = [];
program.getSourceFiles()
.filter(function (sourceFile) { return !skipFileNames.test(sourceFile.fileName); })
.forEach(function (sourceFile) {
var absSrcPath = reflectorHost.getCanonicalFileName(sourceFile.fileName);
var moduleMetadata = staticReflector.getModuleMetadata(absSrcPath);
if (!moduleMetadata) {
console.log("WARNING: no metadata found for " + absSrcPath);
return;
}
var metadata = moduleMetadata['metadata'];
if (!metadata) {
return;
}
for (var _i = 0, _a = Object.keys(metadata); _i < _a.length; _i++) {
var symbol = _a[_i];
if (metadata[symbol] && metadata[symbol].__symbolic == 'error') {
// Ignore symbols that are only included to record error information.
continue;
}
staticSymbols.push(reflectorHost.findDeclaration(absSrcPath, symbol, absSrcPath));
}
});
return staticSymbols;
}
exports.excludeFilePattern = excludeFilePattern;
exports.extractProgramSymbols = extractProgramSymbols;
//# sourceMappingURL=codegen.js.map

@@ -9,3 +9,12 @@ #!/usr/bin/env node

function extract(ngOptions, cliOptions, program, host) {
var extractor = extractor_1.Extractor.create(ngOptions, cliOptions.i18nFormat, program, host);
var resourceLoader = {
get: function (s) {
if (!host.fileExists(s)) {
// TODO: We should really have a test for error cases like this!
throw new Error("Compilation failed. Resource file not found: " + s);
}
return Promise.resolve(host.readFile(s));
}
};
var extractor = extractor_1.Extractor.create(ngOptions, cliOptions.i18nFormat, program, host, resourceLoader);
var bundlePromise = extractor.extract();

@@ -12,0 +21,0 @@ return (bundlePromise).then(function (messageBundle) {

@@ -15,10 +15,15 @@ /**

import * as ts from 'typescript';
import { CompilerHost } from './compiler_host';
import { ReflectorHost } from './reflector_host';
import { StaticReflector } from './static_reflector';
export declare class Extractor {
private ngExtractor;
private ngCompilerHost;
private options;
private program;
constructor(ngExtractor: compiler.Extractor, ngCompilerHost: CompilerHost, program: ts.Program);
host: ts.CompilerHost;
private staticReflector;
private messageBundle;
private reflectorHost;
private metadataResolver;
constructor(options: tsc.AngularCompilerOptions, program: ts.Program, host: ts.CompilerHost, staticReflector: StaticReflector, messageBundle: compiler.MessageBundle, reflectorHost: ReflectorHost, metadataResolver: compiler.CompileMetadataResolver);
extract(): Promise<compiler.MessageBundle>;
static create(options: tsc.AngularCompilerOptions, translationsFormat: string, program: ts.Program, tsCompilerHost: ts.CompilerHost, ngCompilerHost?: CompilerHost): Extractor;
static create(options: tsc.AngularCompilerOptions, translationsFormat: string, program: ts.Program, compilerHost: ts.CompilerHost, resourceLoader: compiler.ResourceLoader, reflectorHost?: ReflectorHost): Extractor;
}

@@ -15,19 +15,62 @@ /**

var compiler = require('@angular/compiler');
var core_1 = require('@angular/core');
var codegen_1 = require('./codegen');
var compiler_host_1 = require('./compiler_host');
var reflector_host_1 = require('./reflector_host');
var static_reflection_capabilities_1 = require('./static_reflection_capabilities');
var static_reflector_1 = require('./static_reflector');
var Extractor = (function () {
function Extractor(ngExtractor, ngCompilerHost, program) {
this.ngExtractor = ngExtractor;
this.ngCompilerHost = ngCompilerHost;
function Extractor(options, program, host, staticReflector, messageBundle, reflectorHost, metadataResolver) {
this.options = options;
this.program = program;
this.host = host;
this.staticReflector = staticReflector;
this.messageBundle = messageBundle;
this.reflectorHost = reflectorHost;
this.metadataResolver = metadataResolver;
}
Extractor.prototype.extract = function () {
var _this = this;
return this.ngExtractor.extract(this.program.getSourceFiles().map(function (sf) { return _this.ngCompilerHost.getCanonicalFileName(sf.fileName); }));
var programSymbols = codegen_1.extractProgramSymbols(this.program, this.staticReflector, this.reflectorHost, this.options);
var _a = compiler.analyzeAndValidateNgModules(programSymbols, { transitiveModules: true }, this.metadataResolver), ngModules = _a.ngModules, files = _a.files;
return compiler.loadNgModuleDirectives(ngModules).then(function () {
var errors = [];
files.forEach(function (file) {
var compMetas = [];
file.directives.forEach(function (directiveType) {
var dirMeta = _this.metadataResolver.getDirectiveMetadata(directiveType);
if (dirMeta && dirMeta.isComponent) {
compMetas.push(dirMeta);
}
});
compMetas.forEach(function (compMeta) {
var html = compMeta.template.template;
var interpolationConfig = compiler.InterpolationConfig.fromArray(compMeta.template.interpolation);
errors.push.apply(errors, _this.messageBundle.updateFromTemplate(html, file.srcUrl, interpolationConfig));
});
});
if (errors.length) {
throw new Error(errors.map(function (e) { return e.toString(); }).join('\n'));
}
return _this.messageBundle;
});
};
Extractor.create = function (options, translationsFormat, program, tsCompilerHost, ngCompilerHost) {
if (!ngCompilerHost)
ngCompilerHost = new compiler_host_1.CompilerHost(program, tsCompilerHost, options);
var ngExtractor = compiler.Extractor.create(ngCompilerHost, { excludeFilePattern: codegen_1.excludeFilePattern(options) }).extractor;
return new Extractor(ngExtractor, ngCompilerHost, program);
Extractor.create = function (options, translationsFormat, program, compilerHost, resourceLoader, reflectorHost) {
var htmlParser = new compiler.I18NHtmlParser(new compiler.HtmlParser());
var urlResolver = compiler.createOfflineCompileUrlResolver();
if (!reflectorHost)
reflectorHost = new reflector_host_1.ReflectorHost(program, compilerHost, options);
var staticReflector = new static_reflector_1.StaticReflector(reflectorHost);
static_reflection_capabilities_1.StaticAndDynamicReflectionCapabilities.install(staticReflector);
var config = new compiler.CompilerConfig({
genDebugInfo: options.debug === true,
defaultEncapsulation: core_1.ViewEncapsulation.Emulated,
logBindingUpdate: false,
useJit: false
});
var normalizer = new compiler.DirectiveNormalizer(resourceLoader, urlResolver, htmlParser, config);
var elementSchemaRegistry = new compiler.DomElementSchemaRegistry();
var resolver = new compiler.CompileMetadataResolver(new compiler.NgModuleResolver(staticReflector), new compiler.DirectiveResolver(staticReflector), new compiler.PipeResolver(staticReflector), elementSchemaRegistry, normalizer, staticReflector);
// TODO(vicb): implicit tags & attributes
var messageBundle = new compiler.MessageBundle(htmlParser, [], {});
return new Extractor(options, program, compilerHost, staticReflector, messageBundle, reflectorHost, resolver);
};

@@ -34,0 +77,0 @@ return Extractor;

@@ -7,3 +7,5 @@ #!/usr/bin/env node

function codegen(ngOptions, cliOptions, program, host) {
return codegen_1.CodeGenerator.create(ngOptions, cliOptions, program, host).codegen();
return codegen_1.CodeGenerator.create(ngOptions, cliOptions, program, host).codegen({
transitiveModules: true
});
}

@@ -10,0 +12,0 @@ // CLI entry point

@@ -15,1 +15,5 @@ /**

export declare var Console: typeof r.Console;
export declare var reflector: typeof r.reflector;
export declare type SetterFn = typeof r._SetterFn;
export declare type GetterFn = typeof r._GetterFn;
export declare type MethodFn = typeof r._MethodFn;

@@ -13,2 +13,3 @@ /**

exports.Console = core_1.__core_private__.Console;
exports.reflector = core_1.__core_private__.reflector;
//# sourceMappingURL=private_import_core.js.map

@@ -1,1 +0,1 @@

{"__symbolic":"module","version":2,"metadata":{"ReflectorReader":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"___core_private__"},"member":"ReflectorReader"},"ReflectionCapabilities":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"___core_private__"},"member":"ReflectionCapabilities"},"Console":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"___core_private__"},"member":"Console"}}}
{"__symbolic":"module","version":1,"metadata":{"ReflectorReader":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"___core_private__"},"member":"ReflectorReader"},"ReflectionCapabilities":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"___core_private__"},"member":"ReflectionCapabilities"},"Console":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"___core_private__"},"member":"Console"},"reflector":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"___core_private__"},"member":"reflector"}}}

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc