Socket
Socket
Sign inDemoInstall

@angular/compiler-cli

Package Overview
Dependencies
Maintainers
1
Versions
828
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 0.5.0 to 0.6.0

src/path_mapped_reflector_host.d.ts

12

package.json
{
"name": "@angular/compiler-cli",
"version": "0.5.0",
"version": "0.6.0",
"description": "Execute angular2 template compiler in nodejs.",

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

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

@@ -19,6 +19,6 @@ "parse5": "1.3.2",

"peerDependencies": {
"typescript": "^1.9.0-dev",
"@angular/compiler": "^2.0.0-rc.5",
"@angular/platform-server": "^2.0.0-rc.5",
"@angular/core": "^2.0.0-rc.5"
"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"
},

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

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

import * as compiler from '@angular/compiler';
import { AngularCompilerOptions } from '@angular/tsc-wrapped';
import { AngularCompilerOptions, NgcCliOptions } from '@angular/tsc-wrapped';
import * as ts from 'typescript';

@@ -29,3 +29,3 @@ import { ReflectorHost, ReflectorHostContext } from './reflector_host';

codegen(): Promise<any>;
static create(options: AngularCompilerOptions, program: ts.Program, compilerHost: ts.CompilerHost, reflectorHostContext?: ReflectorHostContext): CodeGenerator;
static create(options: AngularCompilerOptions, cliOptions: NgcCliOptions, program: ts.Program, compilerHost: ts.CompilerHost, reflectorHostContext?: ReflectorHostContext, resourceLoader?: compiler.ResourceLoader): CodeGenerator;
}

@@ -16,8 +16,11 @@ /**

var path = require('path');
var compiler_private_1 = require('./compiler_private');
var core_private_1 = require('./core_private');
var path_mapped_reflector_host_1 = require('./path_mapped_reflector_host');
var private_import_compiler_1 = require('./private_import_compiler');
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 nodeFs = require('fs');
var GENERATED_FILES = /\.ngfactory\.ts$|\.css\.ts$|\.css\.shim\.ts$/;
var GENERATED_OR_DTS_FILES = /\.d\.ts$|\.ngfactory\.ts$|\.css\.ts$|\.css\.shim\.ts$/;
var PREAMBLE = "/**\n * This file is generated by the Angular 2 template compiler.\n * Do not edit.\n */\n /* tslint:disable */\n\n";

@@ -91,3 +94,9 @@ var CodeGenerator = (function () {

var _this = this;
var filePaths = this.program.getSourceFiles().map(function (sf) { return sf.fileName; }).filter(function (f) { return !GENERATED_FILES.test(f); });
// Compare with false since the default should be true
var skipFileNames = (this.options.generateCodeForLibraries === false) ?
GENERATED_OR_DTS_FILES :
GENERATED_FILES;
var filePaths = this.program.getSourceFiles()
.filter(function (sf) { return !skipFileNames.test(sf.fileName); })
.map(function (sf) { return _this.reflectorHost.getCanonicalFileName(sf.fileName); });
var fileMetas = filePaths.map(function (filePath) { return _this.readFileMetadata(filePath); });

@@ -111,4 +120,4 @@ var ngModules = fileMetas.reduce(function (ngModules, fileMeta) {

};
CodeGenerator.create = function (options, program, compilerHost, reflectorHostContext) {
var xhr = {
CodeGenerator.create = function (options, cliOptions, program, compilerHost, reflectorHostContext, resourceLoader) {
resourceLoader = resourceLoader || {
get: function (s) {

@@ -122,7 +131,19 @@ if (!compilerHost.fileExists(s)) {

};
var transFile = cliOptions.i18nFile;
var locale = cliOptions.locale;
var transContent = '';
if (transFile) {
if (!locale) {
throw new Error("The translation file (" + transFile + ") locale must be provided. Use the --locale option.");
}
transContent = nodeFs.readFileSync(transFile, 'utf8');
}
var urlResolver = compiler.createOfflineCompileUrlResolver();
var reflectorHost = new reflector_host_1.ReflectorHost(program, compilerHost, options, reflectorHostContext);
var usePathMapping = !!options.rootDirs && options.rootDirs.length > 0;
var 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_private_1.HtmlParser();
var htmlParser = new compiler.I18NHtmlParser(new private_import_compiler_1.HtmlParser(), transContent, cliOptions.i18nFormat);
var config = new compiler.CompilerConfig({

@@ -134,9 +155,10 @@ genDebugInfo: options.debug === true,

});
var normalizer = new compiler_private_1.DirectiveNormalizer(xhr, urlResolver, htmlParser, config);
var expressionParser = new compiler_private_1.Parser(new compiler_private_1.Lexer());
var elementSchemaRegistry = new compiler_private_1.DomElementSchemaRegistry();
var console = new core_private_1.Console();
var tmplParser = new compiler_private_1.TemplateParser(expressionParser, elementSchemaRegistry, htmlParser, console, []);
var resolver = new compiler_private_1.CompileMetadataResolver(new compiler.NgModuleResolver(staticReflector), new compiler.DirectiveResolver(staticReflector), new compiler.PipeResolver(staticReflector), config, console, elementSchemaRegistry, staticReflector);
var offlineCompiler = new compiler.OfflineCompiler(resolver, normalizer, tmplParser, new compiler_private_1.StyleCompiler(urlResolver), new compiler_private_1.ViewCompiler(config), new compiler_private_1.NgModuleCompiler(), new compiler_private_1.TypeScriptEmitter(reflectorHost));
var normalizer = new private_import_compiler_1.DirectiveNormalizer(resourceLoader, urlResolver, htmlParser, config);
var expressionParser = new private_import_compiler_1.Parser(new private_import_compiler_1.Lexer());
var elementSchemaRegistry = new private_import_compiler_1.DomElementSchemaRegistry();
var console = new private_import_core_1.Console();
var tmplParser = new private_import_compiler_1.TemplateParser(expressionParser, elementSchemaRegistry, htmlParser, console, []);
var resolver = new private_import_compiler_1.CompileMetadataResolver(new compiler.NgModuleResolver(staticReflector), new compiler.DirectiveResolver(staticReflector), new compiler.PipeResolver(staticReflector), elementSchemaRegistry, staticReflector);
// TODO(vicb): do not pass cliOptions.i18nFormat here
var offlineCompiler = new compiler.OfflineCompiler(resolver, normalizer, tmplParser, new private_import_compiler_1.StyleCompiler(urlResolver), new private_import_compiler_1.ViewCompiler(config), new private_import_compiler_1.NgModuleCompiler(), new private_import_compiler_1.TypeScriptEmitter(reflectorHost), cliOptions.locale, cliOptions.i18nFormat);
return new CodeGenerator(options, program, compilerHost, staticReflector, offlineCompiler, reflectorHost);

@@ -143,0 +165,0 @@ };

@@ -5,3 +5,3 @@ import 'reflect-metadata';

import * as tsc from '@angular/tsc-wrapped';
import { CompileMetadataResolver, DirectiveNormalizer } from './compiler_private';
import { CompileMetadataResolver, DirectiveNormalizer } from './private_import_compiler';
import { ReflectorHost, ReflectorHostContext } from './reflector_host';

@@ -18,6 +18,6 @@ import { StaticReflector } from './static_reflector';

private compiler;
constructor(program: ts.Program, host: ts.CompilerHost, staticReflector: StaticReflector, messageBundle: compiler.i18n.MessageBundle, reflectorHost: ReflectorHost, metadataResolver: CompileMetadataResolver, directiveNormalizer: DirectiveNormalizer, compiler: compiler.OfflineCompiler);
constructor(program: ts.Program, host: ts.CompilerHost, staticReflector: StaticReflector, messageBundle: compiler.MessageBundle, reflectorHost: ReflectorHost, metadataResolver: CompileMetadataResolver, directiveNormalizer: DirectiveNormalizer, compiler: compiler.OfflineCompiler);
private readFileMetadata(absSourcePath);
extract(): Promise<compiler.i18n.MessageBundle>;
static create(options: tsc.AngularCompilerOptions, program: ts.Program, compilerHost: ts.CompilerHost, reflectorHostContext?: ReflectorHostContext): Extractor;
extract(): Promise<compiler.MessageBundle>;
static create(options: tsc.AngularCompilerOptions, translationsFormat: string, program: ts.Program, compilerHost: ts.CompilerHost, htmlParser: compiler.I18NHtmlParser, reflectorHostContext?: ReflectorHostContext): Extractor;
}

@@ -8,13 +8,28 @@ #!/usr/bin/env node

var tsc = require('@angular/tsc-wrapped');
var compiler_private_1 = require('./compiler_private');
var core_private_1 = require('./core_private');
var private_import_compiler_1 = require('./private_import_compiler');
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');
function extract(ngOptions, program, host) {
var extractor = Extractor.create(ngOptions, program, host);
function extract(ngOptions, cliOptions, program, host) {
var htmlParser = new compiler.I18NHtmlParser(new private_import_compiler_1.HtmlParser());
var extractor = Extractor.create(ngOptions, cliOptions.i18nFormat, program, host, htmlParser);
var bundlePromise = extractor.extract();
return (bundlePromise).then(function (messageBundle) {
var serializer = new compiler.i18n.Xmb();
var dstPath = path.join(ngOptions.genDir, 'messages.xmb');
var ext;
var serializer;
var format = (cliOptions.i18nFormat || 'xlf').toLowerCase();
switch (format) {
case 'xmb':
ext = 'xmb';
serializer = new compiler.Xmb();
break;
case 'xliff':
case 'xlf':
default:
ext = 'xlf';
serializer = new compiler.Xliff(htmlParser, compiler.DEFAULT_INTERPOLATION_CONFIG);
break;
}
var dstPath = path.join(ngOptions.genDir, "messages." + ext);
host.writeFile(dstPath, messageBundle.write(serializer), false);

@@ -108,4 +123,4 @@ });

};
Extractor.create = function (options, program, compilerHost, reflectorHostContext) {
var xhr = {
Extractor.create = function (options, translationsFormat, program, compilerHost, htmlParser, reflectorHostContext) {
var resourceLoader = {
get: function (s) {

@@ -123,3 +138,2 @@ if (!compilerHost.fileExists(s)) {

static_reflection_capabilities_1.StaticAndDynamicReflectionCapabilities.install(staticReflector);
var htmlParser = new compiler_private_1.HtmlParser();
var config = new compiler.CompilerConfig({

@@ -131,11 +145,11 @@ genDebugInfo: options.debug === true,

});
var normalizer = new compiler_private_1.DirectiveNormalizer(xhr, urlResolver, htmlParser, config);
var expressionParser = new compiler_private_1.Parser(new compiler_private_1.Lexer());
var elementSchemaRegistry = new compiler_private_1.DomElementSchemaRegistry();
var console = new core_private_1.Console();
var tmplParser = new compiler_private_1.TemplateParser(expressionParser, elementSchemaRegistry, htmlParser, console, []);
var resolver = new compiler_private_1.CompileMetadataResolver(new compiler.NgModuleResolver(staticReflector), new compiler.DirectiveResolver(staticReflector), new compiler.PipeResolver(staticReflector), config, console, elementSchemaRegistry, staticReflector);
var offlineCompiler = new compiler.OfflineCompiler(resolver, normalizer, tmplParser, new compiler_private_1.StyleCompiler(urlResolver), new compiler_private_1.ViewCompiler(config), new compiler_private_1.NgModuleCompiler(), new compiler_private_1.TypeScriptEmitter(reflectorHost));
var normalizer = new private_import_compiler_1.DirectiveNormalizer(resourceLoader, urlResolver, htmlParser, config);
var expressionParser = new private_import_compiler_1.Parser(new private_import_compiler_1.Lexer());
var elementSchemaRegistry = new private_import_compiler_1.DomElementSchemaRegistry();
var console = new private_import_core_1.Console();
var tmplParser = new private_import_compiler_1.TemplateParser(expressionParser, elementSchemaRegistry, htmlParser, console, []);
var resolver = new private_import_compiler_1.CompileMetadataResolver(new compiler.NgModuleResolver(staticReflector), new compiler.DirectiveResolver(staticReflector), new compiler.PipeResolver(staticReflector), elementSchemaRegistry, staticReflector);
var offlineCompiler = new compiler.OfflineCompiler(resolver, normalizer, tmplParser, new private_import_compiler_1.StyleCompiler(urlResolver), new private_import_compiler_1.ViewCompiler(config), new private_import_compiler_1.NgModuleCompiler(), new private_import_compiler_1.TypeScriptEmitter(reflectorHost), null, null);
// TODO(vicb): implicit tags & attributes
var messageBundle = new compiler.i18n.MessageBundle(htmlParser, [], {});
var messageBundle = new compiler.MessageBundle(htmlParser, [], {});
return new Extractor(program, compilerHost, staticReflector, messageBundle, reflectorHost, resolver, normalizer, offlineCompiler);

@@ -149,3 +163,5 @@ };

var args = require('minimist')(process.argv.slice(2));
tsc.main(args.p || args.project || '.', args.basePath, extract)
var project = args.p || args.project || '.';
var cliOptions = new tsc.I18nExtractionCliOptions(args);
tsc.main(project, cliOptions, extract)
.then(function (exitCode) { return process.exit(exitCode); })

@@ -152,0 +168,0 @@ .catch(function (e) {

@@ -6,4 +6,4 @@ #!/usr/bin/env node

var codegen_1 = require('./codegen');
function codegen(ngOptions, program, host) {
return codegen_1.CodeGenerator.create(ngOptions, program, host).codegen();
function codegen(ngOptions, cliOptions, program, host) {
return codegen_1.CodeGenerator.create(ngOptions, cliOptions, program, host).codegen();
}

@@ -13,5 +13,5 @@ // CLI entry point

var args = require('minimist')(process.argv.slice(2));
tsc.main(args.p || args.project || '.', args.basePath, codegen)
.then(function (exitCode) { return process.exit(exitCode); })
.catch(function (e) {
var project = args.p || args.project || '.';
var cliOptions = new tsc.NgcCliOptions(args);
tsc.main(project, cliOptions, codegen).then(function (exitCode) { return process.exit(exitCode); }).catch(function (e) {
console.error(e.stack);

@@ -18,0 +18,0 @@ console.error('Compilation failed');

@@ -8,5 +8,5 @@ /**

*/
import { AngularCompilerOptions, ModuleMetadata } from '@angular/tsc-wrapped';
import { AngularCompilerOptions, MetadataCollector, ModuleMetadata } from '@angular/tsc-wrapped';
import * as ts from 'typescript';
import { ImportGenerator } from './compiler_private';
import { ImportGenerator } from './private_import_compiler';
import { StaticReflectorHost, StaticSymbol } from './static_reflector';

@@ -20,9 +20,9 @@ export interface ReflectorHostContext {

export declare class ReflectorHost implements StaticReflectorHost, ImportGenerator {
private program;
private compilerHost;
private options;
private metadataCollector;
private context;
protected program: ts.Program;
protected compilerHost: ts.CompilerHost;
protected options: AngularCompilerOptions;
protected metadataCollector: MetadataCollector;
protected context: ReflectorHostContext;
private isGenDirChildOfRootDir;
private basePath;
protected basePath: string;
private genDir;

@@ -38,5 +38,6 @@ constructor(program: ts.Program, compilerHost: ts.CompilerHost, options: AngularCompilerOptions, context?: ReflectorHostContext);

};
private resolve(m, containingFile);
private normalizeAssetUrl(url);
private resolveAssetUrl(url, containingFile);
getCanonicalFileName(fileName: string): string;
protected resolve(m: string, containingFile: string): string;
protected normalizeAssetUrl(url: string): string;
protected resolveAssetUrl(url: string, containingFile: string): string;
/**

@@ -73,7 +74,7 @@ * We want a moduleId that will appear in import statements in the generated code.

*/
getStaticSymbol(declarationFile: string, name: string): StaticSymbol;
getStaticSymbol(declarationFile: string, name: string, members?: string[]): StaticSymbol;
getMetadataFor(filePath: string): ModuleMetadata;
readMetadata(filePath: string): any;
private getResolverMetadata(filePath);
private resolveExportedSymbol(filePath, symbolName);
protected resolveExportedSymbol(filePath: string, symbolName: string): StaticSymbol;
}

@@ -80,0 +81,0 @@ export declare class NodeReflectorHostContext implements ReflectorHostContext {

@@ -13,7 +13,7 @@ /**

var ts = require('typescript');
var compiler_private_1 = require('./compiler_private');
var private_import_compiler_1 = require('./private_import_compiler');
var static_reflector_1 = require('./static_reflector');
var EXT = /(\.ts|\.d\.ts|\.js|\.jsx|\.tsx)$/;
var DTS = /\.d\.ts$/;
var NODE_MODULES = path.sep + 'node_modules' + path.sep;
var NODE_MODULES = '/node_modules/';
var IS_GENERATED = /\.(ngfactory|css(\.shim)?)$/;

@@ -29,4 +29,4 @@ var ReflectorHost = (function () {

// normalize the path so that it never ends with '/'.
this.basePath = path.normalize(path.join(this.options.basePath, '.'));
this.genDir = path.normalize(path.join(this.options.genDir, '.'));
this.basePath = path.normalize(path.join(this.options.basePath, '.')).replace(/\\/g, '/');
this.genDir = path.normalize(path.join(this.options.genDir, '.')).replace(/\\/g, '/');
this.context = context || new NodeReflectorHostContext();

@@ -46,4 +46,8 @@ var genPath = path.relative(this.basePath, this.genDir);

};
// We use absolute paths on disk as canonical.
ReflectorHost.prototype.getCanonicalFileName = function (fileName) { return fileName; };
ReflectorHost.prototype.resolve = function (m, containingFile) {
var resolved = ts.resolveModuleName(m, containingFile, this.options, this.context).resolvedModule;
m = m.replace(EXT, '');
var resolved = ts.resolveModuleName(m, containingFile.replace(/\\/g, '/'), this.options, this.context)
.resolvedModule;
return resolved ? resolved.resolvedFileName : null;

@@ -53,4 +57,5 @@ };

ReflectorHost.prototype.normalizeAssetUrl = function (url) {
var assetUrl = compiler_private_1.AssetUrl.parse(url);
return assetUrl ? assetUrl.packageName + "/" + assetUrl.modulePath : null;
var assetUrl = private_import_compiler_1.AssetUrl.parse(url);
var path = assetUrl ? assetUrl.packageName + "/" + assetUrl.modulePath : null;
return this.getCanonicalFileName(path);
};

@@ -60,3 +65,3 @@ ReflectorHost.prototype.resolveAssetUrl = function (url, containingFile) {

if (assetUrl) {
return this.resolve(assetUrl, containingFile);
return this.getCanonicalFileName(this.resolve(assetUrl, containingFile));
}

@@ -124,3 +129,3 @@ return url;

ReflectorHost.prototype.dotRelative = function (from, to) {
var rPath = path.relative(from, to);
var rPath = path.relative(from, to).replace(/\\/g, '/');
return rPath.startsWith('.') ? rPath : './' + rPath;

@@ -181,3 +186,3 @@ };

var declaration = symbol.getDeclarations()[0];
var declarationFile = declaration.getSourceFile().fileName;
var declarationFile = this.getCanonicalFileName(declaration.getSourceFile().fileName);
return this.getStaticSymbol(declarationFile, symbol.getName());

@@ -197,7 +202,8 @@ }

*/
ReflectorHost.prototype.getStaticSymbol = function (declarationFile, name) {
var key = "\"" + declarationFile + "\"." + name;
ReflectorHost.prototype.getStaticSymbol = function (declarationFile, name, members) {
var memberSuffix = members ? "." + members.join('.') : '';
var key = "\"" + declarationFile + "\"." + name + memberSuffix;
var result = this.typeCache.get(key);
if (!result) {
result = new static_reflector_1.StaticSymbol(declarationFile, name);
result = new static_reflector_1.StaticSymbol(declarationFile, name, members);
this.typeCache.set(key, result);

@@ -217,3 +223,4 @@ }

if (this.context.fileExists(metadataPath)) {
return this.readMetadata(metadataPath);
var metadata = this.readMetadata(metadataPath);
return (Array.isArray(metadata) && metadata.length == 0) ? undefined : metadata;
}

@@ -249,3 +256,3 @@ }

var resolveModule = function (moduleName) {
var resolvedModulePath = _this.resolve(moduleName, filePath);
var resolvedModulePath = _this.getCanonicalFileName(_this.resolve(moduleName, filePath));
if (!resolvedModulePath) {

@@ -252,0 +259,0 @@ throw new Error("Could not resolve module '" + moduleName + "' relative to file " + filePath);

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

/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { GetterFn, MethodFn, SetterFn } from './private_import_core';
import { StaticReflector } from './static_reflector';

@@ -16,6 +24,8 @@ export declare class StaticAndDynamicReflectionCapabilities {

};
getter(name: string): (obj: any) => any;
setter(name: string): (obj: any, value: any) => void;
method(name: string): (obj: any, args: any[]) => any;
getter(name: string): GetterFn;
setter(name: string): SetterFn;
method(name: string): MethodFn;
importUri(type: any): string;
resolveIdentifier(name: string, moduleUrl: string, runtime: any): any;
resolveEnum(enumIdentifier: any, name: string): any;
}

@@ -9,10 +9,10 @@ /**

"use strict";
var core_private_1 = require('./core_private');
var private_import_core_1 = require('./private_import_core');
var StaticAndDynamicReflectionCapabilities = (function () {
function StaticAndDynamicReflectionCapabilities(staticDelegate) {
this.staticDelegate = staticDelegate;
this.dynamicDelegate = new core_private_1.ReflectionCapabilities();
this.dynamicDelegate = new private_import_core_1.ReflectionCapabilities();
}
StaticAndDynamicReflectionCapabilities.install = function (staticDelegate) {
core_private_1.reflector.updateCapabilities(new StaticAndDynamicReflectionCapabilities(staticDelegate));
private_import_core_1.reflector.updateCapabilities(new StaticAndDynamicReflectionCapabilities(staticDelegate));
};

@@ -43,2 +43,13 @@ StaticAndDynamicReflectionCapabilities.prototype.isReflectionEnabled = function () { return true; };

StaticAndDynamicReflectionCapabilities.prototype.importUri = function (type) { return this.staticDelegate.importUri(type); };
StaticAndDynamicReflectionCapabilities.prototype.resolveIdentifier = function (name, moduleUrl, runtime) {
return this.staticDelegate.resolveIdentifier(name, moduleUrl, runtime);
};
StaticAndDynamicReflectionCapabilities.prototype.resolveEnum = function (enumIdentifier, name) {
if (isStaticType(enumIdentifier)) {
return this.staticDelegate.resolveEnum(enumIdentifier, name);
}
else {
return null;
}
};
return StaticAndDynamicReflectionCapabilities;

@@ -45,0 +56,0 @@ }());

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

import { ReflectorReader } from './core_private';
import { ReflectorReader } from './private_import_core';
/**

@@ -24,3 +24,3 @@ * The host of the static resolver is expected to be able to provide module metadata in the form of

findDeclaration(modulePath: string, symbolName: string, containingFile?: string): StaticSymbol;
getStaticSymbol(declarationFile: string, name: string): StaticSymbol;
getStaticSymbol(declarationFile: string, name: string, members?: string[]): StaticSymbol;
angularImportLocations(): {

@@ -43,3 +43,4 @@ coreDecorators: string;

name: string;
constructor(filePath: string, name: string);
members: string[];
constructor(filePath: string, name: string, members?: string[]);
}

@@ -60,2 +61,4 @@ /**

importUri(typeOrFunc: StaticSymbol): string;
resolveIdentifier(name: string, moduleUrl: string, runtime: any): any;
resolveEnum(enumIdentifier: any, name: string): any;
annotations(type: StaticSymbol): any[];

@@ -62,0 +65,0 @@ propMetadata(type: StaticSymbol): {

@@ -22,5 +22,6 @@ /**

var StaticSymbol = (function () {
function StaticSymbol(filePath, name) {
function StaticSymbol(filePath, name, members) {
this.filePath = filePath;
this.name = name;
this.members = members;
}

@@ -48,2 +49,10 @@ return StaticSymbol;

};
StaticReflector.prototype.resolveIdentifier = function (name, moduleUrl, runtime) {
var result = this.host.findDeclaration(moduleUrl, name, '');
return result;
};
StaticReflector.prototype.resolveEnum = function (enumIdentifier, name) {
var staticSymbol = enumIdentifier;
return this.host.getStaticSymbol(staticSymbol.filePath, staticSymbol.name, [name]);
};
StaticReflector.prototype.annotations = function (type) {

@@ -144,3 +153,2 @@ var annotations = this.annotationCache.get(type);

this.opaqueToken = this.host.findDeclaration(diOpaqueToken, 'OpaqueToken');
this.registerDecoratorOrConstructor(this.host.findDeclaration(provider, 'Provider'), core_1.Provider);
this.registerDecoratorOrConstructor(this.host.findDeclaration(diDecorators, 'Host'), core_1.HostMetadata);

@@ -153,4 +161,2 @@ this.registerDecoratorOrConstructor(this.host.findDeclaration(diDecorators, 'Injectable'), core_1.InjectableMetadata);

this.registerDecoratorOrConstructor(this.host.findDeclaration(coreDecorators, 'Attribute'), core_1.AttributeMetadata);
this.registerDecoratorOrConstructor(this.host.findDeclaration(coreDecorators, 'Query'), core_1.QueryMetadata);
this.registerDecoratorOrConstructor(this.host.findDeclaration(coreDecorators, 'ViewQuery'), core_1.ViewQueryMetadata);
this.registerDecoratorOrConstructor(this.host.findDeclaration(coreDecorators, 'ContentChild'), core_1.ContentChildMetadata);

@@ -398,3 +404,7 @@ this.registerDecoratorOrConstructor(this.host.findDeclaration(coreDecorators, 'ContentChildren'), core_1.ContentChildrenMetadata);

else {
return null;
var member_1 = expression['member'];
var members = selectTarget.members ?
selectTarget.members.concat(member_1) :
[member_1];
return _this.host.getStaticSymbol(selectTarget.filePath, selectTarget.name, members);
}

@@ -515,9 +525,9 @@ }

if (error.context && error.context.className) {
return "Reference to a non-exported class " + error.context.className;
return "Reference to a non-exported class " + error.context.className + ". Consider exporting the class";
}
break;
case 'Variable not initialized':
return 'Only initialized variables and constants can be referenced';
return 'Only initialized variables and constants can be referenced because the value of this variable is needed by the template compiler';
case 'Destructuring not supported':
return 'Referencing an exported destructured variable or constant is not supported';
return 'Referencing an exported destructured variable or constant is not supported by the template compiler. Consider simplifying this to avoid destructuring';
case 'Could not resolve type':

@@ -524,0 +534,0 @@ if (error.context && error.context.typeName) {

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