Socket
Socket
Sign inDemoInstall

@angular/compiler

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 - npm Package Compare versions

Comparing version 0.0.0-3 to 0.0.0-4

2

core_private.d.ts

@@ -36,2 +36,4 @@ import { __core_private_types__ as t } from '@angular/core';

export declare var isProviderLiteral: typeof t.isProviderLiteral;
export declare var EMPTY_ARRAY: typeof t.EMPTY_ARRAY;
export declare var EMPTY_MAP: typeof t.EMPTY_MAP;
export declare var pureProxy1: typeof t.pureProxy1;

@@ -38,0 +40,0 @@ export declare var pureProxy2: typeof t.pureProxy2;

@@ -30,2 +30,4 @@ "use strict";

exports.isProviderLiteral = core_1.__core_private__.isProviderLiteral;
exports.EMPTY_ARRAY = core_1.__core_private__.EMPTY_ARRAY;
exports.EMPTY_MAP = core_1.__core_private__.EMPTY_MAP;
exports.pureProxy1 = core_1.__core_private__.pureProxy1;

@@ -32,0 +34,0 @@ exports.pureProxy2 = core_1.__core_private__.pureProxy2;

@@ -36,2 +36,4 @@ import { __core_private_types__ as t } from '@angular/core';

export declare var isProviderLiteral: typeof t.isProviderLiteral;
export declare var EMPTY_ARRAY: typeof t.EMPTY_ARRAY;
export declare var EMPTY_MAP: typeof t.EMPTY_MAP;
export declare var pureProxy1: typeof t.pureProxy1;

@@ -38,0 +40,0 @@ export declare var pureProxy2: typeof t.pureProxy2;

@@ -29,2 +29,4 @@ import { __core_private__ as r } from '@angular/core';

export var isProviderLiteral = r.isProviderLiteral;
export var EMPTY_ARRAY = r.EMPTY_ARRAY;
export var EMPTY_MAP = r.EMPTY_MAP;
export var pureProxy1 = r.pureProxy1;

@@ -31,0 +33,0 @@ export var pureProxy2 = r.pureProxy2;

6

esm/private_export.d.ts
import * as selector from './src/selector';
import * as staticReflector from './src/static_reflector';
export declare namespace __compiler_private__ {

@@ -8,7 +7,2 @@ type SelectorMatcher = selector.SelectorMatcher;

var CssSelector: typeof selector.CssSelector;
type StaticReflector = staticReflector.StaticReflector;
var StaticReflector: typeof staticReflector.StaticReflector;
type StaticReflectorHost = staticReflector.StaticReflectorHost;
type StaticSymbol = staticReflector.StaticSymbol;
var StaticSymbol: typeof staticReflector.StaticSymbol;
}
import * as selector from './src/selector';
import * as staticReflector from './src/static_reflector';
export var __compiler_private__;

@@ -7,5 +6,3 @@ (function (__compiler_private__) {

__compiler_private__.CssSelector = selector.CssSelector;
__compiler_private__.StaticReflector = staticReflector.StaticReflector;
__compiler_private__.StaticSymbol = staticReflector.StaticSymbol;
})(__compiler_private__ || (__compiler_private__ = {}));
//# sourceMappingURL=private_export.js.map

@@ -63,2 +63,3 @@ export interface BrowserNodeGlobal {

export declare function isStringMap(obj: any): boolean;
export declare function isStrictStringMap(obj: any): boolean;
export declare function isPromise(obj: any): boolean;

@@ -65,0 +66,0 @@ export declare function isArray(obj: any): boolean;

@@ -84,2 +84,6 @@ var globalScope;

}
const STRING_MAP_PROTO = Object.getPrototypeOf({});
export function isStrictStringMap(obj) {
return isStringMap(obj) && Object.getPrototypeOf(obj) === STRING_MAP_PROTO;
}
export function isPromise(obj) {

@@ -86,0 +90,0 @@ return obj instanceof _global.Promise;

@@ -30,4 +30,6 @@ import { CompileIdentifierMetadata, CompileTokenMetadata } from './compile_metadata';

static castByValue: CompileIdentifierMetadata;
static EMPTY_ARRAY: CompileIdentifierMetadata;
static EMPTY_MAP: CompileIdentifierMetadata;
static pureProxies: CompileIdentifierMetadata[];
}
export declare function identifierToken(identifier: CompileIdentifierMetadata): CompileTokenMetadata;
import { SimpleChange, ChangeDetectorRef, ChangeDetectionStrategy, ElementRef, ViewContainerRef, Renderer, RenderComponentType, Injector, QueryList, ViewEncapsulation, TemplateRef } from '@angular/core';
import { AppElement, AppView, DebugAppView, ChangeDetectorState, checkBinding, DebugContext, devModeEqual, flattenNestedViewRenderNodes, interpolate, StaticNodeDebugInfo, TemplateRef_, uninitialized, ValueUnwrapper, ViewType, ViewUtils, castByValue, pureProxy1, pureProxy2, pureProxy3, pureProxy4, pureProxy5, pureProxy6, pureProxy7, pureProxy8, pureProxy9, pureProxy10 } from '../core_private';
import { AppElement, AppView, DebugAppView, ChangeDetectorState, checkBinding, DebugContext, devModeEqual, flattenNestedViewRenderNodes, interpolate, StaticNodeDebugInfo, TemplateRef_, uninitialized, ValueUnwrapper, ViewType, ViewUtils, castByValue, EMPTY_ARRAY, EMPTY_MAP, pureProxy1, pureProxy2, pureProxy3, pureProxy4, pureProxy5, pureProxy6, pureProxy7, pureProxy8, pureProxy9, pureProxy10 } from '../core_private';
import { CompileIdentifierMetadata, CompileTokenMetadata } from './compile_metadata';

@@ -38,2 +38,4 @@ import { assetUrl } from './util';

var impCastByValue = castByValue;
var impEMPTY_ARRAY = EMPTY_ARRAY;
var impEMPTY_MAP = EMPTY_MAP;
export class Identifiers {

@@ -136,2 +138,4 @@ }

Identifiers.castByValue = new CompileIdentifierMetadata({ name: 'castByValue', moduleUrl: VIEW_UTILS_MODULE_URL, runtime: impCastByValue });
Identifiers.EMPTY_ARRAY = new CompileIdentifierMetadata({ name: 'EMPTY_ARRAY', moduleUrl: VIEW_UTILS_MODULE_URL, runtime: impEMPTY_ARRAY });
Identifiers.EMPTY_MAP = new CompileIdentifierMetadata({ name: 'EMPTY_MAP', moduleUrl: VIEW_UTILS_MODULE_URL, runtime: impEMPTY_MAP });
Identifiers.pureProxies = [

@@ -138,0 +142,0 @@ null,

@@ -23,3 +23,3 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

import { hasLifecycleHook } from './directive_lifecycle_reflector';
import { MODULE_SUFFIX, sanitizeIdentifier } from './util';
import { MODULE_SUFFIX, sanitizeIdentifier, ValueTransformer, visitValue } from './util';
import { assertArrayOfStrings } from './assertions';

@@ -296,5 +296,3 @@ import { getUrlScheme } from './url_resolver';

null,
useValue: isPresent(provider.useValue) ?
new cpl.CompileIdentifierMetadata({ runtime: provider.useValue }) :
null,
useValue: convertToCompileValue(provider.useValue),
useFactory: isPresent(provider.useFactory) ?

@@ -395,2 +393,16 @@ this.getFactoryMetadata(provider.useFactory, staticTypeModuleUrl(provider.useFactory)) :

}
// Only fill CompileIdentifierMetadata.runtime if needed...
function convertToCompileValue(value) {
return visitValue(value, new _CompileValueConverter(), null);
}
class _CompileValueConverter extends ValueTransformer {
visitOther(value, context) {
if (isStaticType(value)) {
return new cpl.CompileIdentifierMetadata({ name: value['name'], moduleUrl: staticTypeModuleUrl(value) });
}
else {
return new cpl.CompileIdentifierMetadata({ runtime: value });
}
}
}
//# sourceMappingURL=metadata_resolver.js.map

@@ -52,3 +52,3 @@ import { ComponentFactory } from '@angular/core';

statements.push(o.variable(compFactoryVar)
.set(o.importExpr(_COMPONENT_FACTORY_IDENTIFIER)
.set(o.importExpr(_COMPONENT_FACTORY_IDENTIFIER, [o.importType(compMeta.type)])
.instantiate([

@@ -58,3 +58,3 @@ o.literal(compMeta.selector),

o.importExpr(compMeta.type)
], o.importType(_COMPONENT_FACTORY_IDENTIFIER, null, [o.TypeModifier.Const])))
], o.importType(_COMPONENT_FACTORY_IDENTIFIER, [o.importType(compMeta.type)], [o.TypeModifier.Const])))
.toDeclStmt(null, [o.StmtModifier.Final]));

@@ -61,0 +61,0 @@ exportedVars.push(compFactoryVar);

@@ -330,2 +330,5 @@ import { isPresent, isBlank, isArray } from '../../src/facade/lang';

_visitIdentifier(value, typeParams, ctx) {
if (isBlank(value.name)) {
throw new BaseException(`Internal error: unknown identifier ${value}`);
}
if (isPresent(value.moduleUrl) && value.moduleUrl != this._moduleUrl) {

@@ -332,0 +335,0 @@ var prefix = this.importsWithPrefixes.get(value.moduleUrl);

@@ -300,2 +300,5 @@ import * as o from './output_ast';

_visitIdentifier(value, typeParams, ctx) {
if (isBlank(value.name)) {
throw new BaseException(`Internal error: unknown identifier ${value}`);
}
if (isPresent(value.moduleUrl) && value.moduleUrl != this._moduleUrl) {

@@ -302,0 +305,0 @@ var prefix = this.importsWithPrefixes.get(value.moduleUrl);

@@ -28,3 +28,3 @@ import { ComponentFactory, ComponentResolver } from '@angular/core';

constructor(_metadataResolver: CompileMetadataResolver, _templateNormalizer: DirectiveNormalizer, _templateParser: TemplateParser, _styleCompiler: StyleCompiler, _viewCompiler: ViewCompiler, _xhr: XHR, _genConfig: CompilerConfig);
resolveComponent(componentType: Type): Promise<ComponentFactory>;
resolveComponent(componentType: Type): Promise<ComponentFactory<any>>;
clearCache(): void;

@@ -31,0 +31,0 @@ private _loadAndCompileComponent(cacheKey, compMeta, viewDirectives, pipes, compilingComponentsPath);

@@ -108,6 +108,2 @@ import { AST } from './expression_parser/ast';

visit(visitor: TemplateAstVisitor, context: any): any;
/**
* Get the component associated with this element, if any.
*/
getComponent(): CompileDirectiveMetadata;
}

@@ -114,0 +110,0 @@ /**

@@ -120,14 +120,2 @@ import { isPresent } from '../src/facade/lang';

}
/**
* Get the component associated with this element, if any.
*/
getComponent() {
for (var i = 0; i < this.directives.length; i++) {
var dirAst = this.directives[i];
if (dirAst.directive.isComponent) {
return dirAst.directive;
}
}
return null;
}
}

@@ -134,0 +122,0 @@ /**

@@ -674,4 +674,5 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

var wildcardNgContentIndex = null;
if (directives.length > 0 && directives[0].directive.isComponent) {
var ngContentSelectors = directives[0].directive.template.ngContentSelectors;
var component = directives.find(directive => directive.directive.isComponent);
if (isPresent(component)) {
var ngContentSelectors = component.directive.template.ngContentSelectors;
for (var i = 0; i < ngContentSelectors.length; i++) {

@@ -678,0 +679,0 @@ var selector = ngContentSelectors[i];

@@ -6,2 +6,19 @@ export declare var MODULE_SUFFIX: string;

export declare function sanitizeIdentifier(name: string): string;
export declare function visitValue(value: any, visitor: ValueVisitor, context: any): any;
export interface ValueVisitor {
visitArray(arr: any[], context: any): any;
visitStringMap(map: {
[key: string]: any;
}, context: any): any;
visitPrimitive(value: any, context: any): any;
visitOther(value: any, context: any): any;
}
export declare class ValueTransformer implements ValueVisitor {
visitArray(arr: any[], context: any): any;
visitStringMap(map: {
[key: string]: any;
}, context: any): any;
visitPrimitive(value: any, context: any): any;
visitOther(value: any, context: any): any;
}
export declare function assetUrl(pkg: string, path?: string, type?: string): string;

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

import { IS_DART, StringWrapper } from '../src/facade/lang';
import { IS_DART, StringWrapper, isBlank, isArray, isStrictStringMap, isPrimitive } from './facade/lang';
import { StringMapWrapper } from './facade/collection';
export var MODULE_SUFFIX = IS_DART ? '.dart' : '';

@@ -23,2 +24,28 @@ var CAMEL_CASE_REGEXP = /([A-Z])/g;

}
export function visitValue(value, visitor, context) {
if (isArray(value)) {
return visitor.visitArray(value, context);
}
else if (isStrictStringMap(value)) {
return visitor.visitStringMap(value, context);
}
else if (isBlank(value) || isPrimitive(value)) {
return visitor.visitPrimitive(value, context);
}
else {
return visitor.visitOther(value, context);
}
}
export class ValueTransformer {
visitArray(arr, context) {
return arr.map(value => visitValue(value, this, context));
}
visitStringMap(map, context) {
var result = {};
StringMapWrapper.forEach(map, (value, key) => { result[key] = visitValue(value, this, context); });
return result;
}
visitPrimitive(value, context) { return value; }
visitOther(value, context) { return value; }
}
export function assetUrl(pkg, path = null, type = 'src') {

@@ -25,0 +52,0 @@ if (IS_DART) {

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

import { BaseException } from '@angular/core';
import { isPresent, isBlank } from '../../src/facade/lang';

@@ -11,2 +12,3 @@ import { ListWrapper, StringMapWrapper } from '../../src/facade/collection';

import { CompileMethod } from './compile_method';
import { ValueTransformer, visitValue } from '../util';
export class CompileNode {

@@ -54,2 +56,3 @@ constructor(parent, view, nodeIndex, renderNode, sourceAst) {

var parentNodeIndex = this.isRootElement() ? null : this.parent.nodeIndex;
// private is fine here as no child view will reference an AppElement
this.view.fields.push(new o.ClassField(fieldName, o.importType(Identifiers.AppElement), [o.StmtModifier.Private]));

@@ -112,11 +115,3 @@ var statement = o.THIS_EXPR.prop(fieldName)

else {
if (provider.useValue instanceof CompileIdentifierMetadata) {
return o.importExpr(provider.useValue);
}
else if (provider.useValue instanceof o.Expression) {
return provider.useValue;
}
else {
return o.literal(provider.useValue);
}
return _convertValueToOutputAst(provider.useValue);
}

@@ -254,3 +249,3 @@ });

else {
return o.THIS_EXPR.prop('ref');
return getPropertyInView(o.THIS_EXPR.prop('ref'), this.view, this.view.componentView);
}

@@ -317,3 +312,3 @@ }

if (isEager) {
view.fields.push(new o.ClassField(propName, type, [o.StmtModifier.Private]));
view.fields.push(new o.ClassField(propName, type));
view.createMethod.addStmt(o.THIS_EXPR.prop(propName).set(resolvedProviderValueExpr).toStmt());

@@ -323,3 +318,3 @@ }

var internalField = `_${propName}`;
view.fields.push(new o.ClassField(internalField, type, [o.StmtModifier.Private]));
view.fields.push(new o.ClassField(internalField, type));
var getter = new CompileMethod(view);

@@ -340,2 +335,27 @@ getter.resetDebugInfo(compileElement.nodeIndex, compileElement.sourceAst);

}
function _convertValueToOutputAst(value) {
return visitValue(value, new _ValueOutputAstTransformer(), null);
}
class _ValueOutputAstTransformer extends ValueTransformer {
visitArray(arr, context) {
return o.literalArr(arr.map(value => visitValue(value, this, context)));
}
visitStringMap(map, context) {
var entries = [];
StringMapWrapper.forEach(map, (value, key) => { entries.push([key, visitValue(value, this, context)]); });
return o.literalMap(entries);
}
visitPrimitive(value, context) { return o.literal(value); }
visitOther(value, context) {
if (value instanceof CompileIdentifierMetadata) {
return o.importExpr(value);
}
else if (value instanceof o.Expression) {
return value;
}
else {
throw new BaseException(`Illegal state: Don't now how to compile value ${value}`);
}
}
}
//# sourceMappingURL=compile_element.js.map

@@ -23,7 +23,7 @@ import { isBlank } from '../facade/lang';

if (diDep.token.equalsTo(identifierToken(Identifiers.ChangeDetectorRef))) {
return o.THIS_EXPR.prop('ref');
return getPropertyInView(o.THIS_EXPR.prop('ref'), this.view, this.view.componentView);
}
return injectFromViewParentInjector(diDep.token, false);
});
this.view.fields.push(new o.ClassField(this.instance.name, o.importType(this.meta.type), [o.StmtModifier.Private]));
this.view.fields.push(new o.ClassField(this.instance.name, o.importType(this.meta.type)));
this.view.createMethod.resetDebugInfo(null, null);

@@ -30,0 +30,0 @@ this.view.createMethod.addStmt(o.THIS_EXPR.prop(this.instance.name)

@@ -79,3 +79,3 @@ import { isPresent, isBlank } from '../../src/facade/lang';

export function createQueryList(query, directiveInstance, propertyName, compileView) {
compileView.fields.push(new o.ClassField(propertyName, o.importType(Identifiers.QueryList), [o.StmtModifier.Private]));
compileView.fields.push(new o.ClassField(propertyName, o.importType(Identifiers.QueryList)));
var expr = o.THIS_EXPR.prop(propertyName);

@@ -82,0 +82,0 @@ compileView.createMethod.addStmt(o.THIS_EXPR.prop(propertyName)

@@ -11,2 +11,3 @@ import { ViewType } from '../../core_private';

import { getViewFactoryName, getPropertyInView, createPureProxy } from './util';
import { Identifiers } from '../identifiers';
export class CompileView {

@@ -115,2 +116,5 @@ constructor(component, genConfig, pipeMetas, styles, viewIndex, declarationElement, templateVariableBindings) {

createLiteralArray(values) {
if (values.length === 0) {
return o.importExpr(Identifiers.EMPTY_ARRAY);
}
var proxyExpr = o.THIS_EXPR.prop(`_arr_${this.literalArrayCount++}`);

@@ -128,2 +132,5 @@ var proxyParams = [];

createLiteralMap(entries) {
if (entries.length === 0) {
return o.importExpr(Identifiers.EMPTY_MAP);
}
var proxyExpr = o.THIS_EXPR.prop(`_map_${this.literalMapCount++}`);

@@ -130,0 +137,0 @@ var proxyParams = [];

@@ -63,2 +63,3 @@ import { isBlank, isPresent, StringWrapper } from '../../src/facade/lang';

.concat([new o.ReturnStatement(resultExpr)]);
// private is fine here as no child view will reference the event handler...
this.compileElement.view.eventHandlerMethods.push(new o.ClassMethod(this._methodName, [this._eventParam], stmts, o.BOOL_TYPE, [o.StmtModifier.Private]));

@@ -68,7 +69,3 @@ }

var listenExpr;
var eventListener = o.THIS_EXPR.callMethod('eventHandler', [
o.fn([this._eventParam], [
new o.ReturnStatement(o.THIS_EXPR.callMethod(this._methodName, [EventHandlerVars.event]))
], o.BOOL_TYPE)
]);
var eventListener = o.THIS_EXPR.callMethod('eventHandler', [o.THIS_EXPR.prop(this._methodName).callMethod(o.BuiltinMethod.bind, [o.THIS_EXPR])]);
if (isPresent(this.eventTarget)) {

@@ -82,2 +79,3 @@ listenExpr = ViewProperties.renderer.callMethod('listenGlobal', [o.literal(this.eventTarget), o.literal(this.eventName), eventListener]);

this.compileElement.view.disposables.push(disposable);
// private is fine here as no child view will reference the event handler...
this.compileElement.view.createMethod.addStmt(disposable.set(listenExpr).toDeclStmt(o.FUNCTION_TYPE, [o.StmtModifier.Private]));

@@ -88,5 +86,3 @@ }

this.compileElement.view.subscriptions.push(subscription);
var eventListener = o.THIS_EXPR.callMethod('eventHandler', [
o.fn([this._eventParam], [o.THIS_EXPR.callMethod(this._methodName, [EventHandlerVars.event]).toStmt()])
]);
var eventListener = o.THIS_EXPR.callMethod('eventHandler', [o.THIS_EXPR.prop(this._methodName).callMethod(o.BuiltinMethod.bind, [o.THIS_EXPR])]);
this.compileElement.view.createMethod.addStmt(subscription.set(directiveInstance.prop(observablePropName)

@@ -93,0 +89,0 @@ .callMethod(o.BuiltinMethod.SubscribeObservable, [eventListener]))

@@ -22,2 +22,3 @@ import { LifecycleHooks, isDefaultChangeDetectionStrategy } from '../../core_private';

}
// private is fine here as no child view will reference the cached value...
view.fields.push(new o.ClassField(fieldExpr.name, null, [o.StmtModifier.Private]));

@@ -24,0 +25,0 @@ view.createMethod.addStmt(o.THIS_EXPR.prop(fieldExpr.name).set(o.importExpr(Identifiers.uninitialized)).toStmt());

@@ -76,3 +76,3 @@ import { isPresent, isBlank } from '../../src/facade/lang';

export function createPureProxy(fn, argCount, pureProxyProp, view) {
view.fields.push(new o.ClassField(pureProxyProp.name, null, [o.StmtModifier.Private]));
view.fields.push(new o.ClassField(pureProxyProp.name, null));
var pureProxyId = argCount < Identifiers.pureProxies.length ? Identifiers.pureProxies[argCount] : null;

@@ -79,0 +79,0 @@ if (isBlank(pureProxyId)) {

@@ -84,3 +84,3 @@ import { ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core';

var fieldName = `_text_${this.view.nodes.length}`;
this.view.fields.push(new o.ClassField(fieldName, o.importType(this.view.genConfig.renderTypes.renderText), [o.StmtModifier.Private]));
this.view.fields.push(new o.ClassField(fieldName, o.importType(this.view.genConfig.renderTypes.renderText)));
var renderNode = o.THIS_EXPR.prop(fieldName);

@@ -138,7 +138,7 @@ var compileNode = new CompileNode(parent, this.view, this.view.nodes.length, renderNode, ast);

var fieldName = `_el_${nodeIndex}`;
this.view.fields.push(new o.ClassField(fieldName, o.importType(this.view.genConfig.renderTypes.renderElement), [o.StmtModifier.Private]));
this.view.fields.push(new o.ClassField(fieldName, o.importType(this.view.genConfig.renderTypes.renderElement)));
this.view.createMethod.addStmt(o.THIS_EXPR.prop(fieldName).set(createRenderNodeExpr).toStmt());
var renderNode = o.THIS_EXPR.prop(fieldName);
var component = ast.getComponent();
var directives = ast.directives.map(directiveAst => directiveAst.directive);
var component = directives.find(directive => directive.isComponent);
var htmlAttrs = _readHtmlAttrs(ast.attrs);

@@ -188,3 +188,3 @@ var attrNameAndValues = _mergeHtmlAndDirectiveAttrs(htmlAttrs, directives);

var fieldName = `_anchor_${nodeIndex}`;
this.view.fields.push(new o.ClassField(fieldName, o.importType(this.view.genConfig.renderTypes.renderComment), [o.StmtModifier.Private]));
this.view.fields.push(new o.ClassField(fieldName, o.importType(this.view.genConfig.renderTypes.renderComment)));
this.view.createMethod.addStmt(o.THIS_EXPR.prop(fieldName)

@@ -191,0 +191,0 @@ .set(ViewProperties.renderer.callMethod('createTemplateAnchor', [

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

import { OpaqueToken, ComponentRef, Injector, ViewMetadata, ElementRef, ChangeDetectorRef, NgZone, DebugElement } from '@angular/core';
import { OpaqueToken, ComponentRef, ComponentFactory, Injector, ViewMetadata, ElementRef, ChangeDetectorRef, NgZone, DebugElement } from '@angular/core';
import { Type } from '../src/facade/lang';

@@ -14,3 +14,3 @@ /**

*/
export declare class ComponentFixture {
export declare class ComponentFixture<T> {
/**

@@ -35,3 +35,3 @@ * The DebugElement associated with the root element of this component.

*/
componentRef: ComponentRef;
componentRef: ComponentRef<T>;
/**

@@ -52,3 +52,3 @@ * The ChangeDetectorRef for the component

private _onErrorSubscription;
constructor(componentRef: ComponentRef, ngZone: NgZone, autoDetect: boolean);
constructor(componentRef: ComponentRef<T>, ngZone: NgZone, autoDetect: boolean);
private _tick(checkNoChanges);

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

overrideViewBindings(type: Type, providers: any[]): TestComponentBuilder;
private _create<C>(ngZone, componentFactory);
/**

@@ -179,4 +180,5 @@ * Builds and returns a ComponentFixture.

*/
createAsync(rootComponentType: Type): Promise<ComponentFixture>;
createFakeAsync(rootComponentType: Type): ComponentFixture;
createAsync(rootComponentType: Type): Promise<ComponentFixture<any>>;
createFakeAsync(rootComponentType: Type): ComponentFixture<any>;
createSync<C>(componentFactory: ComponentFactory<C>): ComponentFixture<C>;
}

@@ -10,3 +10,3 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

};
import { OpaqueToken, DynamicComponentLoader, Injector, Injectable, NgZone, getDebugNode } from '@angular/core';
import { OpaqueToken, ComponentResolver, Injector, Injectable, NgZone, getDebugNode } from '@angular/core';
import { DirectiveResolver, ViewResolver } from '../index';

@@ -272,2 +272,10 @@ import { BaseException } from '../src/facade/exceptions';

}
_create(ngZone, componentFactory) {
let rootElId = `root${_nextRootElementId++}`;
var testComponentRenderer = this._injector.get(TestComponentRenderer);
testComponentRenderer.insertRootElement(rootElId);
var componentRef = componentFactory.create(this._injector, [], `#${rootElId}`);
let autoDetect = this._injector.get(ComponentFixtureAutoDetect, false);
return new ComponentFixture(componentRef, ngZone, autoDetect);
}
/**

@@ -281,3 +289,2 @@ * Builds and returns a ComponentFixture.

let ngZone = noNgZone ? null : this._injector.get(NgZone, null);
let autoDetect = this._injector.get(ComponentFixtureAutoDetect, false);
let initComponent = () => {

@@ -293,8 +300,4 @@ let mockDirectiveResolver = this._injector.get(DirectiveResolver);

this._viewBindingsOverrides.forEach((bindings, type) => mockDirectiveResolver.setViewBindingsOverride(type, bindings));
var testComponentRenderer = this._injector.get(TestComponentRenderer);
var rootElId = `root${_nextRootElementId++}`;
testComponentRenderer.insertRootElement(rootElId);
let promise = this._injector.get(DynamicComponentLoader)
.loadAsRoot(rootComponentType, `#${rootElId}`, this._injector);
return promise.then((componentRef) => { return new ComponentFixture(componentRef, ngZone, autoDetect); });
let promise = this._injector.get(ComponentResolver).resolveComponent(rootComponentType);
return promise.then(componentFactory => this._create(ngZone, componentFactory));
};

@@ -313,2 +316,8 @@ return ngZone == null ? initComponent() : ngZone.run(initComponent);

}
createSync(componentFactory) {
let noNgZone = IS_DART || this._injector.get(ComponentFixtureNoNgZone, false);
let ngZone = noNgZone ? null : this._injector.get(NgZone, null);
let initComponent = () => this._create(ngZone, componentFactory);
return ngZone == null ? initComponent() : ngZone.run(initComponent);
}
};

@@ -315,0 +324,0 @@ TestComponentBuilder = TestComponentBuilder_1 = __decorate([

{
"name": "@angular/compiler",
"version": "0.0.0-3",
"version": "0.0.0-4",
"description": "",

@@ -11,4 +11,4 @@ "main": "index.js",

"peerDependencies": {
"@angular/core": "0.0.0-3"
"@angular/core": "0.0.0-4"
}
}
import * as selector from './src/selector';
import * as staticReflector from './src/static_reflector';
export declare namespace __compiler_private__ {

@@ -8,7 +7,2 @@ type SelectorMatcher = selector.SelectorMatcher;

var CssSelector: typeof selector.CssSelector;
type StaticReflector = staticReflector.StaticReflector;
var StaticReflector: typeof staticReflector.StaticReflector;
type StaticReflectorHost = staticReflector.StaticReflectorHost;
type StaticSymbol = staticReflector.StaticSymbol;
var StaticSymbol: typeof staticReflector.StaticSymbol;
}
"use strict";
var selector = require('./src/selector');
var staticReflector = require('./src/static_reflector');
var __compiler_private__;

@@ -8,5 +7,3 @@ (function (__compiler_private__) {

__compiler_private__.CssSelector = selector.CssSelector;
__compiler_private__.StaticReflector = staticReflector.StaticReflector;
__compiler_private__.StaticSymbol = staticReflector.StaticSymbol;
})(__compiler_private__ = exports.__compiler_private__ || (exports.__compiler_private__ = {}));
//# sourceMappingURL=private_export.js.map

@@ -63,2 +63,3 @@ export interface BrowserNodeGlobal {

export declare function isStringMap(obj: any): boolean;
export declare function isStrictStringMap(obj: any): boolean;
export declare function isPromise(obj: any): boolean;

@@ -65,0 +66,0 @@ export declare function isArray(obj: any): boolean;

@@ -103,2 +103,7 @@ "use strict";

exports.isStringMap = isStringMap;
var STRING_MAP_PROTO = Object.getPrototypeOf({});
function isStrictStringMap(obj) {
return isStringMap(obj) && Object.getPrototypeOf(obj) === STRING_MAP_PROTO;
}
exports.isStrictStringMap = isStrictStringMap;
function isPromise(obj) {

@@ -105,0 +110,0 @@ return obj instanceof _global.Promise;

@@ -30,4 +30,6 @@ import { CompileIdentifierMetadata, CompileTokenMetadata } from './compile_metadata';

static castByValue: CompileIdentifierMetadata;
static EMPTY_ARRAY: CompileIdentifierMetadata;
static EMPTY_MAP: CompileIdentifierMetadata;
static pureProxies: CompileIdentifierMetadata[];
}
export declare function identifierToken(identifier: CompileIdentifierMetadata): CompileTokenMetadata;

@@ -39,2 +39,4 @@ "use strict";

var impCastByValue = core_private_1.castByValue;
var impEMPTY_ARRAY = core_private_1.EMPTY_ARRAY;
var impEMPTY_MAP = core_private_1.EMPTY_MAP;
var Identifiers = (function () {

@@ -138,2 +140,4 @@ function Identifiers() {

Identifiers.castByValue = new compile_metadata_1.CompileIdentifierMetadata({ name: 'castByValue', moduleUrl: VIEW_UTILS_MODULE_URL, runtime: impCastByValue });
Identifiers.EMPTY_ARRAY = new compile_metadata_1.CompileIdentifierMetadata({ name: 'EMPTY_ARRAY', moduleUrl: VIEW_UTILS_MODULE_URL, runtime: impEMPTY_ARRAY });
Identifiers.EMPTY_MAP = new compile_metadata_1.CompileIdentifierMetadata({ name: 'EMPTY_MAP', moduleUrl: VIEW_UTILS_MODULE_URL, runtime: impEMPTY_MAP });
Identifiers.pureProxies = [

@@ -140,0 +144,0 @@ null,

"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

@@ -300,5 +305,3 @@ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;

null,
useValue: lang_1.isPresent(provider.useValue) ?
new cpl.CompileIdentifierMetadata({ runtime: provider.useValue }) :
null,
useValue: convertToCompileValue(provider.useValue),
useFactory: lang_1.isPresent(provider.useFactory) ?

@@ -403,2 +406,21 @@ this.getFactoryMetadata(provider.useFactory, staticTypeModuleUrl(provider.useFactory)) :

}
// Only fill CompileIdentifierMetadata.runtime if needed...
function convertToCompileValue(value) {
return util_1.visitValue(value, new _CompileValueConverter(), null);
}
var _CompileValueConverter = (function (_super) {
__extends(_CompileValueConverter, _super);
function _CompileValueConverter() {
_super.apply(this, arguments);
}
_CompileValueConverter.prototype.visitOther = function (value, context) {
if (isStaticType(value)) {
return new cpl.CompileIdentifierMetadata({ name: value['name'], moduleUrl: staticTypeModuleUrl(value) });
}
else {
return new cpl.CompileIdentifierMetadata({ runtime: value });
}
};
return _CompileValueConverter;
}(util_1.ValueTransformer));
//# sourceMappingURL=metadata_resolver.js.map

@@ -58,3 +58,3 @@ "use strict";

statements.push(o.variable(compFactoryVar)
.set(o.importExpr(_COMPONENT_FACTORY_IDENTIFIER)
.set(o.importExpr(_COMPONENT_FACTORY_IDENTIFIER, [o.importType(compMeta.type)])
.instantiate([

@@ -64,3 +64,3 @@ o.literal(compMeta.selector),

o.importExpr(compMeta.type)
], o.importType(_COMPONENT_FACTORY_IDENTIFIER, null, [o.TypeModifier.Const])))
], o.importType(_COMPONENT_FACTORY_IDENTIFIER, [o.importType(compMeta.type)], [o.TypeModifier.Const])))
.toDeclStmt(null, [o.StmtModifier.Final]));

@@ -67,0 +67,0 @@ exportedVars.push(compFactoryVar);

@@ -343,2 +343,5 @@ "use strict";

var _this = this;
if (lang_1.isBlank(value.name)) {
throw new exceptions_1.BaseException("Internal error: unknown identifier " + value);
}
if (lang_1.isPresent(value.moduleUrl) && value.moduleUrl != this._moduleUrl) {

@@ -345,0 +348,0 @@ var prefix = this.importsWithPrefixes.get(value.moduleUrl);

@@ -313,2 +313,5 @@ "use strict";

var _this = this;
if (lang_1.isBlank(value.name)) {
throw new exceptions_1.BaseException("Internal error: unknown identifier " + value);
}
if (lang_1.isPresent(value.moduleUrl) && value.moduleUrl != this._moduleUrl) {

@@ -315,0 +318,0 @@ var prefix = this.importsWithPrefixes.get(value.moduleUrl);

@@ -28,3 +28,3 @@ import { ComponentFactory, ComponentResolver } from '@angular/core';

constructor(_metadataResolver: CompileMetadataResolver, _templateNormalizer: DirectiveNormalizer, _templateParser: TemplateParser, _styleCompiler: StyleCompiler, _viewCompiler: ViewCompiler, _xhr: XHR, _genConfig: CompilerConfig);
resolveComponent(componentType: Type): Promise<ComponentFactory>;
resolveComponent(componentType: Type): Promise<ComponentFactory<any>>;
clearCache(): void;

@@ -31,0 +31,0 @@ private _loadAndCompileComponent(cacheKey, compMeta, viewDirectives, pipes, compilingComponentsPath);

@@ -108,6 +108,2 @@ import { AST } from './expression_parser/ast';

visit(visitor: TemplateAstVisitor, context: any): any;
/**
* Get the component associated with this element, if any.
*/
getComponent(): CompileDirectiveMetadata;
}

@@ -114,0 +110,0 @@ /**

@@ -139,14 +139,2 @@ "use strict";

};
/**
* Get the component associated with this element, if any.
*/
ElementAst.prototype.getComponent = function () {
for (var i = 0; i < this.directives.length; i++) {
var dirAst = this.directives[i];
if (dirAst.directive.isComponent) {
return dirAst.directive;
}
}
return null;
};
return ElementAst;

@@ -153,0 +141,0 @@ }());

@@ -706,4 +706,5 @@ "use strict";

var wildcardNgContentIndex = null;
if (directives.length > 0 && directives[0].directive.isComponent) {
var ngContentSelectors = directives[0].directive.template.ngContentSelectors;
var component = directives.find(function (directive) { return directive.directive.isComponent; });
if (lang_1.isPresent(component)) {
var ngContentSelectors = component.directive.template.ngContentSelectors;
for (var i = 0; i < ngContentSelectors.length; i++) {

@@ -710,0 +711,0 @@ var selector = ngContentSelectors[i];

@@ -6,2 +6,19 @@ export declare var MODULE_SUFFIX: string;

export declare function sanitizeIdentifier(name: string): string;
export declare function visitValue(value: any, visitor: ValueVisitor, context: any): any;
export interface ValueVisitor {
visitArray(arr: any[], context: any): any;
visitStringMap(map: {
[key: string]: any;
}, context: any): any;
visitPrimitive(value: any, context: any): any;
visitOther(value: any, context: any): any;
}
export declare class ValueTransformer implements ValueVisitor {
visitArray(arr: any[], context: any): any;
visitStringMap(map: {
[key: string]: any;
}, context: any): any;
visitPrimitive(value: any, context: any): any;
visitOther(value: any, context: any): any;
}
export declare function assetUrl(pkg: string, path?: string, type?: string): string;
"use strict";
var lang_1 = require('../src/facade/lang');
var lang_1 = require('./facade/lang');
var collection_1 = require('./facade/collection');
exports.MODULE_SUFFIX = lang_1.IS_DART ? '.dart' : '';

@@ -28,2 +29,35 @@ var CAMEL_CASE_REGEXP = /([A-Z])/g;

exports.sanitizeIdentifier = sanitizeIdentifier;
function visitValue(value, visitor, context) {
if (lang_1.isArray(value)) {
return visitor.visitArray(value, context);
}
else if (lang_1.isStrictStringMap(value)) {
return visitor.visitStringMap(value, context);
}
else if (lang_1.isBlank(value) || lang_1.isPrimitive(value)) {
return visitor.visitPrimitive(value, context);
}
else {
return visitor.visitOther(value, context);
}
}
exports.visitValue = visitValue;
var ValueTransformer = (function () {
function ValueTransformer() {
}
ValueTransformer.prototype.visitArray = function (arr, context) {
var _this = this;
return arr.map(function (value) { return visitValue(value, _this, context); });
};
ValueTransformer.prototype.visitStringMap = function (map, context) {
var _this = this;
var result = {};
collection_1.StringMapWrapper.forEach(map, function (value, key) { result[key] = visitValue(value, _this, context); });
return result;
};
ValueTransformer.prototype.visitPrimitive = function (value, context) { return value; };
ValueTransformer.prototype.visitOther = function (value, context) { return value; };
return ValueTransformer;
}());
exports.ValueTransformer = ValueTransformer;
function assetUrl(pkg, path, type) {

@@ -30,0 +64,0 @@ if (path === void 0) { path = null; }

@@ -7,2 +7,3 @@ "use strict";

};
var core_1 = require('@angular/core');
var lang_1 = require('../../src/facade/lang');

@@ -18,2 +19,3 @@ var collection_1 = require('../../src/facade/collection');

var compile_method_1 = require('./compile_method');
var util_2 = require('../util');
var CompileNode = (function () {

@@ -65,2 +67,3 @@ function CompileNode(parent, view, nodeIndex, renderNode, sourceAst) {

var parentNodeIndex = this.isRootElement() ? null : this.parent.nodeIndex;
// private is fine here as no child view will reference an AppElement
this.view.fields.push(new o.ClassField(fieldName, o.importType(identifiers_1.Identifiers.AppElement), [o.StmtModifier.Private]));

@@ -126,11 +129,3 @@ var statement = o.THIS_EXPR.prop(fieldName)

else {
if (provider.useValue instanceof compile_metadata_1.CompileIdentifierMetadata) {
return o.importExpr(provider.useValue);
}
else if (provider.useValue instanceof o.Expression) {
return provider.useValue;
}
else {
return o.literal(provider.useValue);
}
return _convertValueToOutputAst(provider.useValue);
}

@@ -271,3 +266,3 @@ });

else {
return o.THIS_EXPR.prop('ref');
return util_1.getPropertyInView(o.THIS_EXPR.prop('ref'), this.view, this.view.componentView);
}

@@ -336,3 +331,3 @@ }

if (isEager) {
view.fields.push(new o.ClassField(propName, type, [o.StmtModifier.Private]));
view.fields.push(new o.ClassField(propName, type));
view.createMethod.addStmt(o.THIS_EXPR.prop(propName).set(resolvedProviderValueExpr).toStmt());

@@ -342,3 +337,3 @@ }

var internalField = "_" + propName;
view.fields.push(new o.ClassField(internalField, type, [o.StmtModifier.Private]));
view.fields.push(new o.ClassField(internalField, type));
var getter = new compile_method_1.CompileMethod(view);

@@ -360,2 +355,34 @@ getter.resetDebugInfo(compileElement.nodeIndex, compileElement.sourceAst);

}());
function _convertValueToOutputAst(value) {
return util_2.visitValue(value, new _ValueOutputAstTransformer(), null);
}
var _ValueOutputAstTransformer = (function (_super) {
__extends(_ValueOutputAstTransformer, _super);
function _ValueOutputAstTransformer() {
_super.apply(this, arguments);
}
_ValueOutputAstTransformer.prototype.visitArray = function (arr, context) {
var _this = this;
return o.literalArr(arr.map(function (value) { return util_2.visitValue(value, _this, context); }));
};
_ValueOutputAstTransformer.prototype.visitStringMap = function (map, context) {
var _this = this;
var entries = [];
collection_1.StringMapWrapper.forEach(map, function (value, key) { entries.push([key, util_2.visitValue(value, _this, context)]); });
return o.literalMap(entries);
};
_ValueOutputAstTransformer.prototype.visitPrimitive = function (value, context) { return o.literal(value); };
_ValueOutputAstTransformer.prototype.visitOther = function (value, context) {
if (value instanceof compile_metadata_1.CompileIdentifierMetadata) {
return o.importExpr(value);
}
else if (value instanceof o.Expression) {
return value;
}
else {
throw new core_1.BaseException("Illegal state: Don't now how to compile value " + value);
}
};
return _ValueOutputAstTransformer;
}(util_2.ValueTransformer));
//# sourceMappingURL=compile_element.js.map

@@ -30,7 +30,7 @@ "use strict";

if (diDep.token.equalsTo(identifiers_1.identifierToken(identifiers_1.Identifiers.ChangeDetectorRef))) {
return o.THIS_EXPR.prop('ref');
return util_1.getPropertyInView(o.THIS_EXPR.prop('ref'), _this.view, _this.view.componentView);
}
return util_1.injectFromViewParentInjector(diDep.token, false);
});
this.view.fields.push(new o.ClassField(this.instance.name, o.importType(this.meta.type), [o.StmtModifier.Private]));
this.view.fields.push(new o.ClassField(this.instance.name, o.importType(this.meta.type)));
this.view.createMethod.resetDebugInfo(null, null);

@@ -37,0 +37,0 @@ this.view.createMethod.addStmt(o.THIS_EXPR.prop(this.instance.name)

@@ -83,3 +83,3 @@ "use strict";

function createQueryList(query, directiveInstance, propertyName, compileView) {
compileView.fields.push(new o.ClassField(propertyName, o.importType(identifiers_1.Identifiers.QueryList), [o.StmtModifier.Private]));
compileView.fields.push(new o.ClassField(propertyName, o.importType(identifiers_1.Identifiers.QueryList)));
var expr = o.THIS_EXPR.prop(propertyName);

@@ -86,0 +86,0 @@ compileView.createMethod.addStmt(o.THIS_EXPR.prop(propertyName)

@@ -12,2 +12,3 @@ "use strict";

var util_1 = require('./util');
var identifiers_1 = require('../identifiers');
var CompileView = (function () {

@@ -117,2 +118,5 @@ function CompileView(component, genConfig, pipeMetas, styles, viewIndex, declarationElement, templateVariableBindings) {

CompileView.prototype.createLiteralArray = function (values) {
if (values.length === 0) {
return o.importExpr(identifiers_1.Identifiers.EMPTY_ARRAY);
}
var proxyExpr = o.THIS_EXPR.prop("_arr_" + this.literalArrayCount++);

@@ -130,2 +134,5 @@ var proxyParams = [];

CompileView.prototype.createLiteralMap = function (entries) {
if (entries.length === 0) {
return o.importExpr(identifiers_1.Identifiers.EMPTY_MAP);
}
var proxyExpr = o.THIS_EXPR.prop("_map_" + this.literalMapCount++);

@@ -132,0 +139,0 @@ var proxyParams = [];

@@ -64,2 +64,3 @@ "use strict";

.concat([new o.ReturnStatement(resultExpr)]);
// private is fine here as no child view will reference the event handler...
this.compileElement.view.eventHandlerMethods.push(new o.ClassMethod(this._methodName, [this._eventParam], stmts, o.BOOL_TYPE, [o.StmtModifier.Private]));

@@ -69,7 +70,3 @@ };

var listenExpr;
var eventListener = o.THIS_EXPR.callMethod('eventHandler', [
o.fn([this._eventParam], [
new o.ReturnStatement(o.THIS_EXPR.callMethod(this._methodName, [constants_1.EventHandlerVars.event]))
], o.BOOL_TYPE)
]);
var eventListener = o.THIS_EXPR.callMethod('eventHandler', [o.THIS_EXPR.prop(this._methodName).callMethod(o.BuiltinMethod.bind, [o.THIS_EXPR])]);
if (lang_1.isPresent(this.eventTarget)) {

@@ -83,2 +80,3 @@ listenExpr = constants_1.ViewProperties.renderer.callMethod('listenGlobal', [o.literal(this.eventTarget), o.literal(this.eventName), eventListener]);

this.compileElement.view.disposables.push(disposable);
// private is fine here as no child view will reference the event handler...
this.compileElement.view.createMethod.addStmt(disposable.set(listenExpr).toDeclStmt(o.FUNCTION_TYPE, [o.StmtModifier.Private]));

@@ -89,5 +87,3 @@ };

this.compileElement.view.subscriptions.push(subscription);
var eventListener = o.THIS_EXPR.callMethod('eventHandler', [
o.fn([this._eventParam], [o.THIS_EXPR.callMethod(this._methodName, [constants_1.EventHandlerVars.event]).toStmt()])
]);
var eventListener = o.THIS_EXPR.callMethod('eventHandler', [o.THIS_EXPR.prop(this._methodName).callMethod(o.BuiltinMethod.bind, [o.THIS_EXPR])]);
this.compileElement.view.createMethod.addStmt(subscription.set(directiveInstance.prop(observablePropName)

@@ -94,0 +90,0 @@ .callMethod(o.BuiltinMethod.SubscribeObservable, [eventListener]))

@@ -23,2 +23,3 @@ "use strict";

}
// private is fine here as no child view will reference the cached value...
view.fields.push(new o.ClassField(fieldExpr.name, null, [o.StmtModifier.Private]));

@@ -25,0 +26,0 @@ view.createMethod.addStmt(o.THIS_EXPR.prop(fieldExpr.name).set(o.importExpr(identifiers_1.Identifiers.uninitialized)).toStmt());

@@ -82,3 +82,3 @@ "use strict";

function createPureProxy(fn, argCount, pureProxyProp, view) {
view.fields.push(new o.ClassField(pureProxyProp.name, null, [o.StmtModifier.Private]));
view.fields.push(new o.ClassField(pureProxyProp.name, null));
var pureProxyId = argCount < identifiers_1.Identifiers.pureProxies.length ? identifiers_1.Identifiers.pureProxies[argCount] : null;

@@ -85,0 +85,0 @@ if (lang_1.isBlank(pureProxyId)) {

@@ -89,3 +89,3 @@ "use strict";

var fieldName = "_text_" + this.view.nodes.length;
this.view.fields.push(new o.ClassField(fieldName, o.importType(this.view.genConfig.renderTypes.renderText), [o.StmtModifier.Private]));
this.view.fields.push(new o.ClassField(fieldName, o.importType(this.view.genConfig.renderTypes.renderText)));
var renderNode = o.THIS_EXPR.prop(fieldName);

@@ -143,7 +143,7 @@ var compileNode = new compile_element_1.CompileNode(parent, this.view, this.view.nodes.length, renderNode, ast);

var fieldName = "_el_" + nodeIndex;
this.view.fields.push(new o.ClassField(fieldName, o.importType(this.view.genConfig.renderTypes.renderElement), [o.StmtModifier.Private]));
this.view.fields.push(new o.ClassField(fieldName, o.importType(this.view.genConfig.renderTypes.renderElement)));
this.view.createMethod.addStmt(o.THIS_EXPR.prop(fieldName).set(createRenderNodeExpr).toStmt());
var renderNode = o.THIS_EXPR.prop(fieldName);
var component = ast.getComponent();
var directives = ast.directives.map(function (directiveAst) { return directiveAst.directive; });
var component = directives.find(function (directive) { return directive.isComponent; });
var htmlAttrs = _readHtmlAttrs(ast.attrs);

@@ -193,3 +193,3 @@ var attrNameAndValues = _mergeHtmlAndDirectiveAttrs(htmlAttrs, directives);

var fieldName = "_anchor_" + nodeIndex;
this.view.fields.push(new o.ClassField(fieldName, o.importType(this.view.genConfig.renderTypes.renderComment), [o.StmtModifier.Private]));
this.view.fields.push(new o.ClassField(fieldName, o.importType(this.view.genConfig.renderTypes.renderComment)));
this.view.createMethod.addStmt(o.THIS_EXPR.prop(fieldName)

@@ -196,0 +196,0 @@ .set(constants_1.ViewProperties.renderer.callMethod('createTemplateAnchor', [

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

import { OpaqueToken, ComponentRef, Injector, ViewMetadata, ElementRef, ChangeDetectorRef, NgZone, DebugElement } from '@angular/core';
import { OpaqueToken, ComponentRef, ComponentFactory, Injector, ViewMetadata, ElementRef, ChangeDetectorRef, NgZone, DebugElement } from '@angular/core';
import { Type } from '../src/facade/lang';

@@ -14,3 +14,3 @@ /**

*/
export declare class ComponentFixture {
export declare class ComponentFixture<T> {
/**

@@ -35,3 +35,3 @@ * The DebugElement associated with the root element of this component.

*/
componentRef: ComponentRef;
componentRef: ComponentRef<T>;
/**

@@ -52,3 +52,3 @@ * The ChangeDetectorRef for the component

private _onErrorSubscription;
constructor(componentRef: ComponentRef, ngZone: NgZone, autoDetect: boolean);
constructor(componentRef: ComponentRef<T>, ngZone: NgZone, autoDetect: boolean);
private _tick(checkNoChanges);

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

overrideViewBindings(type: Type, providers: any[]): TestComponentBuilder;
private _create<C>(ngZone, componentFactory);
/**

@@ -179,4 +180,5 @@ * Builds and returns a ComponentFixture.

*/
createAsync(rootComponentType: Type): Promise<ComponentFixture>;
createFakeAsync(rootComponentType: Type): ComponentFixture;
createAsync(rootComponentType: Type): Promise<ComponentFixture<any>>;
createFakeAsync(rootComponentType: Type): ComponentFixture<any>;
createSync<C>(componentFactory: ComponentFactory<C>): ComponentFixture<C>;
}

@@ -281,2 +281,10 @@ "use strict";

};
TestComponentBuilder.prototype._create = function (ngZone, componentFactory) {
var rootElId = "root" + _nextRootElementId++;
var testComponentRenderer = this._injector.get(TestComponentRenderer);
testComponentRenderer.insertRootElement(rootElId);
var componentRef = componentFactory.create(this._injector, [], "#" + rootElId);
var autoDetect = this._injector.get(exports.ComponentFixtureAutoDetect, false);
return new ComponentFixture(componentRef, ngZone, autoDetect);
};
/**

@@ -291,3 +299,2 @@ * Builds and returns a ComponentFixture.

var ngZone = noNgZone ? null : this._injector.get(core_1.NgZone, null);
var autoDetect = this._injector.get(exports.ComponentFixtureAutoDetect, false);
var initComponent = function () {

@@ -305,8 +312,4 @@ var mockDirectiveResolver = _this._injector.get(index_1.DirectiveResolver);

_this._viewBindingsOverrides.forEach(function (bindings, type) { return mockDirectiveResolver.setViewBindingsOverride(type, bindings); });
var testComponentRenderer = _this._injector.get(TestComponentRenderer);
var rootElId = "root" + _nextRootElementId++;
testComponentRenderer.insertRootElement(rootElId);
var promise = _this._injector.get(core_1.DynamicComponentLoader)
.loadAsRoot(rootComponentType, "#" + rootElId, _this._injector);
return promise.then(function (componentRef) { return new ComponentFixture(componentRef, ngZone, autoDetect); });
var promise = _this._injector.get(core_1.ComponentResolver).resolveComponent(rootComponentType);
return promise.then(function (componentFactory) { return _this._create(ngZone, componentFactory); });
};

@@ -325,2 +328,9 @@ return ngZone == null ? initComponent() : ngZone.run(initComponent);

};
TestComponentBuilder.prototype.createSync = function (componentFactory) {
var _this = this;
var noNgZone = lang_1.IS_DART || this._injector.get(exports.ComponentFixtureNoNgZone, false);
var ngZone = noNgZone ? null : this._injector.get(core_1.NgZone, null);
var initComponent = function () { return _this._create(ngZone, componentFactory); };
return ngZone == null ? initComponent() : ngZone.run(initComponent);
};
TestComponentBuilder = __decorate([

@@ -327,0 +337,0 @@ core_1.Injectable(),

Sorry, the diff of this file is too big to display

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

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

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

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

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

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

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