2016-06-23 09:47:54 -07:00
|
|
|
/**
|
|
|
|
* @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
|
|
|
|
*/
|
|
|
|
|
2017-08-16 16:29:39 -07:00
|
|
|
import {CompileTokenMetadata} from './compile_metadata';
|
2017-05-18 13:46:51 -07:00
|
|
|
import {CompileReflector} from './compile_reflector';
|
2017-05-16 16:30:37 -07:00
|
|
|
import * as o from './output/output_ast';
|
2016-01-06 14:13:44 -08:00
|
|
|
|
2017-05-18 13:46:51 -07:00
|
|
|
const CORE = '@angular/core';
|
2016-01-06 14:13:44 -08:00
|
|
|
|
|
|
|
export class Identifiers {
|
2017-05-16 16:30:37 -07:00
|
|
|
static ANALYZE_FOR_ENTRY_COMPONENTS: o.ExternalReference = {
|
2016-07-25 00:36:30 -07:00
|
|
|
name: 'ANALYZE_FOR_ENTRY_COMPONENTS',
|
2017-05-16 16:30:37 -07:00
|
|
|
moduleName: CORE,
|
2017-08-16 09:00:03 -07:00
|
|
|
|
2016-08-24 17:39:49 -07:00
|
|
|
};
|
2017-08-16 09:00:03 -07:00
|
|
|
static ElementRef: o.ExternalReference = {name: 'ElementRef', moduleName: CORE};
|
|
|
|
static NgModuleRef: o.ExternalReference = {name: 'NgModuleRef', moduleName: CORE};
|
|
|
|
static ViewContainerRef: o.ExternalReference = {name: 'ViewContainerRef', moduleName: CORE};
|
2017-05-16 16:30:37 -07:00
|
|
|
static ChangeDetectorRef: o.ExternalReference = {
|
|
|
|
name: 'ChangeDetectorRef',
|
|
|
|
moduleName: CORE,
|
2017-08-16 09:00:03 -07:00
|
|
|
|
2017-05-16 16:30:37 -07:00
|
|
|
};
|
2017-08-16 09:00:03 -07:00
|
|
|
static QueryList: o.ExternalReference = {name: 'QueryList', moduleName: CORE};
|
|
|
|
static TemplateRef: o.ExternalReference = {name: 'TemplateRef', moduleName: CORE};
|
2018-08-16 17:43:29 +02:00
|
|
|
static Renderer2: o.ExternalReference = {name: 'Renderer2', moduleName: CORE};
|
2017-05-16 16:30:37 -07:00
|
|
|
static CodegenComponentFactoryResolver: o.ExternalReference = {
|
2017-02-14 13:33:06 -08:00
|
|
|
name: 'ɵCodegenComponentFactoryResolver',
|
2017-05-16 16:30:37 -07:00
|
|
|
moduleName: CORE,
|
2017-08-16 09:00:03 -07:00
|
|
|
|
2016-08-24 17:39:49 -07:00
|
|
|
};
|
2017-05-16 16:30:37 -07:00
|
|
|
static ComponentFactoryResolver: o.ExternalReference = {
|
2016-06-22 14:06:23 -07:00
|
|
|
name: 'ComponentFactoryResolver',
|
2017-05-16 16:30:37 -07:00
|
|
|
moduleName: CORE,
|
2017-08-16 09:00:03 -07:00
|
|
|
|
2016-08-24 17:39:49 -07:00
|
|
|
};
|
2017-08-16 09:00:03 -07:00
|
|
|
static ComponentFactory: o.ExternalReference = {name: 'ComponentFactory', moduleName: CORE};
|
|
|
|
static ComponentRef: o.ExternalReference = {name: 'ComponentRef', moduleName: CORE};
|
|
|
|
static NgModuleFactory: o.ExternalReference = {name: 'NgModuleFactory', moduleName: CORE};
|
2017-05-16 16:30:37 -07:00
|
|
|
static createModuleFactory: o.ExternalReference = {
|
2017-05-11 10:26:02 -07:00
|
|
|
name: 'ɵcmf',
|
2017-05-16 16:30:37 -07:00
|
|
|
moduleName: CORE,
|
2017-08-16 09:00:03 -07:00
|
|
|
|
2017-05-11 10:26:02 -07:00
|
|
|
};
|
2017-05-16 16:30:37 -07:00
|
|
|
static moduleDef: o.ExternalReference = {
|
2017-05-11 10:26:02 -07:00
|
|
|
name: 'ɵmod',
|
2017-05-16 16:30:37 -07:00
|
|
|
moduleName: CORE,
|
2017-08-16 09:00:03 -07:00
|
|
|
|
2017-05-11 10:26:02 -07:00
|
|
|
};
|
2017-05-16 16:30:37 -07:00
|
|
|
static moduleProviderDef: o.ExternalReference = {
|
2017-05-11 10:26:02 -07:00
|
|
|
name: 'ɵmpd',
|
2017-05-16 16:30:37 -07:00
|
|
|
moduleName: CORE,
|
2017-08-16 09:00:03 -07:00
|
|
|
|
2016-08-24 17:39:49 -07:00
|
|
|
};
|
2017-05-16 16:30:37 -07:00
|
|
|
static RegisterModuleFactoryFn: o.ExternalReference = {
|
2017-02-14 13:33:06 -08:00
|
|
|
name: 'ɵregisterModuleFactory',
|
2017-05-16 16:30:37 -07:00
|
|
|
moduleName: CORE,
|
2017-08-16 09:00:03 -07:00
|
|
|
|
2016-09-01 13:46:08 -07:00
|
|
|
};
|
2019-05-09 11:47:25 -07:00
|
|
|
static inject: o.ExternalReference = {name: 'Δinject', moduleName: CORE};
|
2018-02-16 08:45:21 -08:00
|
|
|
static INJECTOR: o.ExternalReference = {name: 'INJECTOR', moduleName: CORE};
|
2017-08-16 09:00:03 -07:00
|
|
|
static Injector: o.ExternalReference = {name: 'Injector', moduleName: CORE};
|
2019-05-09 11:47:25 -07:00
|
|
|
static ΔdefineInjectable: o.ExternalReference = {name: 'ΔdefineInjectable', moduleName: CORE};
|
|
|
|
static InjectableDef: o.ExternalReference = {name: 'ΔInjectableDef', moduleName: CORE};
|
2017-05-16 16:30:37 -07:00
|
|
|
static ViewEncapsulation: o.ExternalReference = {
|
|
|
|
name: 'ViewEncapsulation',
|
|
|
|
moduleName: CORE,
|
2017-08-16 09:00:03 -07:00
|
|
|
|
2017-05-16 16:30:37 -07:00
|
|
|
};
|
|
|
|
static ChangeDetectionStrategy: o.ExternalReference = {
|
2016-01-06 14:13:44 -08:00
|
|
|
name: 'ChangeDetectionStrategy',
|
2017-05-16 16:30:37 -07:00
|
|
|
moduleName: CORE,
|
2017-08-16 09:00:03 -07:00
|
|
|
|
2016-08-24 17:39:49 -07:00
|
|
|
};
|
2017-05-16 16:30:37 -07:00
|
|
|
static SecurityContext: o.ExternalReference = {
|
feat: security implementation in Angular 2.
Summary:
This adds basic security hooks to Angular 2.
* `SecurityContext` is a private API between core, compiler, and
platform-browser. `SecurityContext` communicates what context a value is used
in across template parser, compiler, and sanitization at runtime.
* `SanitizationService` is the bare bones interface to sanitize values for a
particular context.
* `SchemaElementRegistry.securityContext(tagName, attributeOrPropertyName)`
determines the security context for an attribute or property (it turns out
attributes and properties match for the purposes of sanitization).
Based on these hooks:
* `DomSchemaElementRegistry` decides what sanitization applies in a particular
context.
* `DomSanitizationService` implements `SanitizationService` and adds *Safe
Value*s, i.e. the ability to mark a value as safe and not requiring further
sanitization.
* `url_sanitizer` and `style_sanitizer` sanitize URLs and Styles, respectively
(surprise!).
`DomSanitizationService` is the default implementation bound for browser
applications, in the three contexts (browser rendering, web worker rendering,
server side rendering).
BREAKING CHANGES:
*** SECURITY WARNING ***
Angular 2 Release Candidates do not implement proper contextual escaping yet.
Make sure to correctly escape all values that go into the DOM.
*** SECURITY WARNING ***
Reviewers: IgorMinar
Differential Revision: https://reviews.angular.io/D103
2016-04-29 16:04:08 -07:00
|
|
|
name: 'SecurityContext',
|
2017-05-16 16:30:37 -07:00
|
|
|
moduleName: CORE,
|
2017-08-16 09:00:03 -07:00
|
|
|
|
2016-08-24 17:39:49 -07:00
|
|
|
};
|
2017-08-16 09:00:03 -07:00
|
|
|
static LOCALE_ID: o.ExternalReference = {name: 'LOCALE_ID', moduleName: CORE};
|
2017-05-16 16:30:37 -07:00
|
|
|
static TRANSLATIONS_FORMAT: o.ExternalReference = {
|
|
|
|
name: 'TRANSLATIONS_FORMAT',
|
|
|
|
moduleName: CORE,
|
2017-08-16 09:00:03 -07:00
|
|
|
|
2017-05-16 16:30:37 -07:00
|
|
|
};
|
|
|
|
static inlineInterpolate: o.ExternalReference = {
|
|
|
|
name: 'ɵinlineInterpolate',
|
|
|
|
moduleName: CORE,
|
|
|
|
};
|
2019-05-02 09:06:50 -07:00
|
|
|
static interpolate: o.ExternalReference = {name: 'ɵinterpolate', moduleName: CORE};
|
2017-08-16 09:00:03 -07:00
|
|
|
static EMPTY_ARRAY: o.ExternalReference = {name: 'ɵEMPTY_ARRAY', moduleName: CORE};
|
|
|
|
static EMPTY_MAP: o.ExternalReference = {name: 'ɵEMPTY_MAP', moduleName: CORE};
|
|
|
|
static Renderer: o.ExternalReference = {name: 'Renderer', moduleName: CORE};
|
|
|
|
static viewDef: o.ExternalReference = {name: 'ɵvid', moduleName: CORE};
|
|
|
|
static elementDef: o.ExternalReference = {name: 'ɵeld', moduleName: CORE};
|
|
|
|
static anchorDef: o.ExternalReference = {name: 'ɵand', moduleName: CORE};
|
|
|
|
static textDef: o.ExternalReference = {name: 'ɵted', moduleName: CORE};
|
|
|
|
static directiveDef: o.ExternalReference = {name: 'ɵdid', moduleName: CORE};
|
|
|
|
static providerDef: o.ExternalReference = {name: 'ɵprd', moduleName: CORE};
|
|
|
|
static queryDef: o.ExternalReference = {name: 'ɵqud', moduleName: CORE};
|
|
|
|
static pureArrayDef: o.ExternalReference = {name: 'ɵpad', moduleName: CORE};
|
|
|
|
static pureObjectDef: o.ExternalReference = {name: 'ɵpod', moduleName: CORE};
|
|
|
|
static purePipeDef: o.ExternalReference = {name: 'ɵppd', moduleName: CORE};
|
|
|
|
static pipeDef: o.ExternalReference = {name: 'ɵpid', moduleName: CORE};
|
|
|
|
static nodeValue: o.ExternalReference = {name: 'ɵnov', moduleName: CORE};
|
|
|
|
static ngContentDef: o.ExternalReference = {name: 'ɵncd', moduleName: CORE};
|
|
|
|
static unwrapValue: o.ExternalReference = {name: 'ɵunv', moduleName: CORE};
|
|
|
|
static createRendererType2: o.ExternalReference = {name: 'ɵcrt', moduleName: CORE};
|
|
|
|
// type only
|
2017-05-16 16:30:37 -07:00
|
|
|
static RendererType2: o.ExternalReference = {
|
2017-03-07 16:36:12 -08:00
|
|
|
name: 'RendererType2',
|
2017-05-16 16:30:37 -07:00
|
|
|
moduleName: CORE,
|
2017-08-16 09:00:03 -07:00
|
|
|
|
2017-02-17 08:56:49 -08:00
|
|
|
};
|
2017-08-16 09:00:03 -07:00
|
|
|
// type only
|
2017-05-16 16:30:37 -07:00
|
|
|
static ViewDefinition: o.ExternalReference = {
|
2017-02-18 21:28:27 -08:00
|
|
|
name: 'ɵViewDefinition',
|
2017-05-16 16:30:37 -07:00
|
|
|
moduleName: CORE,
|
2017-02-17 08:56:49 -08:00
|
|
|
};
|
2017-08-16 09:00:03 -07:00
|
|
|
static createComponentFactory: o.ExternalReference = {name: 'ɵccf', moduleName: CORE};
|
2018-10-30 10:16:52 -07:00
|
|
|
static setClassMetadata: o.ExternalReference = {name: 'ɵsetClassMetadata', moduleName: CORE};
|
2016-10-19 09:17:36 -07:00
|
|
|
}
|
|
|
|
|
2017-05-18 13:46:51 -07:00
|
|
|
export function createTokenForReference(reference: any): CompileTokenMetadata {
|
|
|
|
return {identifier: {reference: reference}};
|
2016-08-24 17:39:49 -07:00
|
|
|
}
|
|
|
|
|
2017-05-18 13:46:51 -07:00
|
|
|
export function createTokenForExternalReference(
|
|
|
|
reflector: CompileReflector, reference: o.ExternalReference): CompileTokenMetadata {
|
|
|
|
return createTokenForReference(reflector.resolveExternalReference(reference));
|
2016-08-30 18:07:40 -07:00
|
|
|
}
|