feat(di): Add the `@Injectable` annotation to `Compiler`
Mark `Compiler` and its dependencies as available to the `Injector`.
This commit is contained in:
parent
b656f63430
commit
57723e1354
|
@ -1,3 +1,4 @@
|
||||||
|
import {Injectable} from 'angular2/di';
|
||||||
import {List, ListWrapper, SetWrapper} from "angular2/src/facade/collection";
|
import {List, ListWrapper, SetWrapper} from "angular2/src/facade/collection";
|
||||||
import {int, NumberWrapper, StringJoiner, StringWrapper} from "angular2/src/facade/lang";
|
import {int, NumberWrapper, StringJoiner, StringWrapper} from "angular2/src/facade/lang";
|
||||||
|
|
||||||
|
@ -8,6 +9,7 @@ export const TOKEN_TYPE_STRING = 4;
|
||||||
export const TOKEN_TYPE_OPERATOR = 5;
|
export const TOKEN_TYPE_OPERATOR = 5;
|
||||||
export const TOKEN_TYPE_NUMBER = 6;
|
export const TOKEN_TYPE_NUMBER = 6;
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
export class Lexer {
|
export class Lexer {
|
||||||
text:string;
|
text:string;
|
||||||
tokenize(text:string):List {
|
tokenize(text:string):List {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import {Injectable} from 'angular2/di';
|
||||||
import {int, isBlank, isPresent, BaseException, StringWrapper, RegExpWrapper} from 'angular2/src/facade/lang';
|
import {int, isBlank, isPresent, BaseException, StringWrapper, RegExpWrapper} from 'angular2/src/facade/lang';
|
||||||
import {ListWrapper, List} from 'angular2/src/facade/collection';
|
import {ListWrapper, List} from 'angular2/src/facade/collection';
|
||||||
import {Lexer, EOF, Token, $PERIOD, $COLON, $SEMICOLON, $LBRACKET, $RBRACKET,
|
import {Lexer, EOF, Token, $PERIOD, $COLON, $SEMICOLON, $LBRACKET, $RBRACKET,
|
||||||
|
@ -32,6 +33,7 @@ var _implicitReceiver = new ImplicitReceiver();
|
||||||
var INTERPOLATION_REGEXP = RegExpWrapper.create('\\{\\{(.*?)\\}\\}');
|
var INTERPOLATION_REGEXP = RegExpWrapper.create('\\{\\{(.*?)\\}\\}');
|
||||||
var QUOTE_REGEXP = RegExpWrapper.create("'");
|
var QUOTE_REGEXP = RegExpWrapper.create("'");
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
export class Parser {
|
export class Parser {
|
||||||
_lexer:Lexer;
|
_lexer:Lexer;
|
||||||
_reflector:Reflector;
|
_reflector:Reflector;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import {ABSTRACT, CONST, normalizeBlank, isPresent} from 'angular2/src/facade/lang';
|
import {ABSTRACT, CONST, normalizeBlank, isPresent} from 'angular2/src/facade/lang';
|
||||||
import {ListWrapper, List} from 'angular2/src/facade/collection';
|
import {ListWrapper, List} from 'angular2/src/facade/collection';
|
||||||
|
import {Injectable} from 'angular2/di';
|
||||||
|
|
||||||
// type StringMap = {[idx: string]: string};
|
// type StringMap = {[idx: string]: string};
|
||||||
|
|
||||||
|
@ -10,7 +11,7 @@ import {ListWrapper, List} from 'angular2/src/facade/collection';
|
||||||
* @publicModule angular2/angular2
|
* @publicModule angular2/angular2
|
||||||
*/
|
*/
|
||||||
@ABSTRACT()
|
@ABSTRACT()
|
||||||
export class Directive {
|
export class Directive extends Injectable {
|
||||||
/**
|
/**
|
||||||
* The CSS selector that triggers the instantiation of a directive.
|
* The CSS selector that triggers the instantiation of a directive.
|
||||||
*
|
*
|
||||||
|
@ -189,6 +190,7 @@ export class Directive {
|
||||||
lifecycle:List
|
lifecycle:List
|
||||||
}={})
|
}={})
|
||||||
{
|
{
|
||||||
|
super();
|
||||||
this.selector = selector;
|
this.selector = selector;
|
||||||
this.bind = bind;
|
this.bind = bind;
|
||||||
this.events = events;
|
this.events = events;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import {Injectable} from 'angular2/di';
|
||||||
import {Type, isBlank, isPresent, BaseException, normalizeBlank, stringify} from 'angular2/src/facade/lang';
|
import {Type, isBlank, isPresent, BaseException, normalizeBlank, stringify} from 'angular2/src/facade/lang';
|
||||||
import {Promise, PromiseWrapper} from 'angular2/src/facade/async';
|
import {Promise, PromiseWrapper} from 'angular2/src/facade/async';
|
||||||
import {List, ListWrapper, Map, MapWrapper} from 'angular2/src/facade/collection';
|
import {List, ListWrapper, Map, MapWrapper} from 'angular2/src/facade/collection';
|
||||||
|
@ -23,6 +24,7 @@ import {CssProcessor} from './css_processor';
|
||||||
* Used to prevent duplicate work and resolve cyclic dependencies.
|
* Used to prevent duplicate work and resolve cyclic dependencies.
|
||||||
* @publicModule angular2/angular2
|
* @publicModule angular2/angular2
|
||||||
*/
|
*/
|
||||||
|
@Injectable()
|
||||||
export class CompilerCache {
|
export class CompilerCache {
|
||||||
_cache:Map;
|
_cache:Map;
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -49,6 +51,7 @@ export class CompilerCache {
|
||||||
* the CompilePipeline and the CompileSteps.
|
* the CompilePipeline and the CompileSteps.
|
||||||
* @publicModule angular2/angular2
|
* @publicModule angular2/angular2
|
||||||
*/
|
*/
|
||||||
|
@Injectable()
|
||||||
export class Compiler {
|
export class Compiler {
|
||||||
_reader: DirectiveMetadataReader;
|
_reader: DirectiveMetadataReader;
|
||||||
_parser:Parser;
|
_parser:Parser;
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
import {Injectable} from 'angular2/di';
|
||||||
import {Type, isPresent} from 'angular2/src/facade/lang';
|
import {Type, isPresent} from 'angular2/src/facade/lang';
|
||||||
import {Map, MapWrapper} from 'angular2/src/facade/collection';
|
import {Map, MapWrapper} from 'angular2/src/facade/collection';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
export class ComponentUrlMapper {
|
export class ComponentUrlMapper {
|
||||||
// Returns the base URL to the component source file.
|
// Returns the base URL to the component source file.
|
||||||
// The returned URL could be:
|
// The returned URL could be:
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import {Injectable} from 'angular2/di';
|
||||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||||
|
|
||||||
import {isPresent} from 'angular2/src/facade/lang';
|
import {isPresent} from 'angular2/src/facade/lang';
|
||||||
|
@ -15,6 +16,7 @@ import {DirectiveMetadata} from './directive_metadata';
|
||||||
* - Apply any given transformers,
|
* - Apply any given transformers,
|
||||||
* - Apply the shadow DOM strategy style step.
|
* - Apply the shadow DOM strategy style step.
|
||||||
*/
|
*/
|
||||||
|
@Injectable()
|
||||||
export class CssProcessor {
|
export class CssProcessor {
|
||||||
_transformers: List<CssTransformer>;
|
_transformers: List<CssTransformer>;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
|
import {Injectable} from 'angular2/di';
|
||||||
import {Type, isPresent, BaseException, stringify} from 'angular2/src/facade/lang';
|
import {Type, isPresent, BaseException, stringify} from 'angular2/src/facade/lang';
|
||||||
import {Directive} from '../annotations/annotations';
|
import {Directive} from '../annotations/annotations';
|
||||||
import {DirectiveMetadata} from './directive_metadata';
|
import {DirectiveMetadata} from './directive_metadata';
|
||||||
import {reflector} from 'angular2/src/reflection/reflection';
|
import {reflector} from 'angular2/src/reflection/reflection';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
export class DirectiveMetadataReader {
|
export class DirectiveMetadataReader {
|
||||||
read(type:Type):DirectiveMetadata {
|
read(type:Type):DirectiveMetadata {
|
||||||
var annotations = reflector.annotations(type);
|
var annotations = reflector.annotations(type);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import * as ldModule from './light_dom';
|
import * as ldModule from './light_dom';
|
||||||
|
import {Inject, Injectable} from 'angular2/di';
|
||||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||||
import {isPresent} from 'angular2/src/facade/lang';
|
import {isPresent} from 'angular2/src/facade/lang';
|
||||||
import {List, ListWrapper} from 'angular2/src/facade/collection';
|
import {List, ListWrapper} from 'angular2/src/facade/collection';
|
||||||
|
@ -13,6 +14,7 @@ class ContentStrategy {
|
||||||
* It is used when the content tag is not a direct child of another component,
|
* It is used when the content tag is not a direct child of another component,
|
||||||
* and thus does not affect redistribution.
|
* and thus does not affect redistribution.
|
||||||
*/
|
*/
|
||||||
|
@Injectable()
|
||||||
class RenderedContent extends ContentStrategy {
|
class RenderedContent extends ContentStrategy {
|
||||||
beginScript;
|
beginScript;
|
||||||
endScript;
|
endScript;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import {Injectable} from 'angular2/di';
|
||||||
import {Type, isBlank, isPresent, int, StringWrapper, assertionsEnabled} from 'angular2/src/facade/lang';
|
import {Type, isBlank, isPresent, int, StringWrapper, assertionsEnabled} from 'angular2/src/facade/lang';
|
||||||
import {List, ListWrapper, MapWrapper, Map} from 'angular2/src/facade/collection';
|
import {List, ListWrapper, MapWrapper, Map} from 'angular2/src/facade/collection';
|
||||||
import {PromiseWrapper} from 'angular2/src/facade/async';
|
import {PromiseWrapper} from 'angular2/src/facade/async';
|
||||||
|
@ -77,6 +78,7 @@ export class ShadowDomStrategy {
|
||||||
* - styles are **not** scoped to their component and will apply to the whole document,
|
* - styles are **not** scoped to their component and will apply to the whole document,
|
||||||
* - you can **not** use shadow DOM specific selectors in the styles
|
* - you can **not** use shadow DOM specific selectors in the styles
|
||||||
*/
|
*/
|
||||||
|
@Injectable()
|
||||||
export class EmulatedUnscopedShadowDomStrategy extends ShadowDomStrategy {
|
export class EmulatedUnscopedShadowDomStrategy extends ShadowDomStrategy {
|
||||||
_styleUrlResolver: StyleUrlResolver;
|
_styleUrlResolver: StyleUrlResolver;
|
||||||
_styleHost;
|
_styleHost;
|
||||||
|
@ -118,6 +120,7 @@ export class EmulatedUnscopedShadowDomStrategy extends ShadowDomStrategy {
|
||||||
* - a common subset of shadow DOM selectors are supported,
|
* - a common subset of shadow DOM selectors are supported,
|
||||||
* - see `ShadowCss` for more information and limitations.
|
* - see `ShadowCss` for more information and limitations.
|
||||||
*/
|
*/
|
||||||
|
@Injectable()
|
||||||
export class EmulatedScopedShadowDomStrategy extends EmulatedUnscopedShadowDomStrategy {
|
export class EmulatedScopedShadowDomStrategy extends EmulatedUnscopedShadowDomStrategy {
|
||||||
_styleInliner: StyleInliner;
|
_styleInliner: StyleInliner;
|
||||||
|
|
||||||
|
@ -148,6 +151,7 @@ export class EmulatedScopedShadowDomStrategy extends EmulatedUnscopedShadowDomSt
|
||||||
* The templates for the component are inserted in a Shadow Root created on the component element.
|
* The templates for the component are inserted in a Shadow Root created on the component element.
|
||||||
* Hence they are strictly isolated.
|
* Hence they are strictly isolated.
|
||||||
*/
|
*/
|
||||||
|
@Injectable()
|
||||||
export class NativeShadowDomStrategy extends ShadowDomStrategy {
|
export class NativeShadowDomStrategy extends ShadowDomStrategy {
|
||||||
_styleUrlResolver: StyleUrlResolver;
|
_styleUrlResolver: StyleUrlResolver;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import {Injectable} from 'angular2/di';
|
||||||
import {XHR} from 'angular2/src/core/compiler/xhr/xhr';
|
import {XHR} from 'angular2/src/core/compiler/xhr/xhr';
|
||||||
import {StyleUrlResolver} from 'angular2/src/core/compiler/style_url_resolver';
|
import {StyleUrlResolver} from 'angular2/src/core/compiler/style_url_resolver';
|
||||||
import {UrlResolver} from 'angular2/src/core/compiler/url_resolver';
|
import {UrlResolver} from 'angular2/src/core/compiler/url_resolver';
|
||||||
|
@ -21,6 +22,7 @@ import {
|
||||||
*
|
*
|
||||||
* When an @import rules is inlined, it's url are rewritten.
|
* When an @import rules is inlined, it's url are rewritten.
|
||||||
*/
|
*/
|
||||||
|
@Injectable()
|
||||||
export class StyleInliner {
|
export class StyleInliner {
|
||||||
_xhr: XHR;
|
_xhr: XHR;
|
||||||
_urlResolver: UrlResolver;
|
_urlResolver: UrlResolver;
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
// Some of the code comes from WebComponents.JS
|
// Some of the code comes from WebComponents.JS
|
||||||
// https://github.com/webcomponents/webcomponentsjs/blob/master/src/HTMLImports/path.js
|
// https://github.com/webcomponents/webcomponentsjs/blob/master/src/HTMLImports/path.js
|
||||||
|
|
||||||
|
import {Injectable} from 'angular2/di';
|
||||||
import {RegExp, RegExpWrapper, StringWrapper} from 'angular2/src/facade/lang';
|
import {RegExp, RegExpWrapper, StringWrapper} from 'angular2/src/facade/lang';
|
||||||
import {UrlResolver} from './url_resolver';
|
import {UrlResolver} from './url_resolver';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rewrites URLs by resolving '@import' and 'url()' URLs from the given base URL.
|
* Rewrites URLs by resolving '@import' and 'url()' URLs from the given base URL.
|
||||||
*/
|
*/
|
||||||
|
@Injectable()
|
||||||
export class StyleUrlResolver {
|
export class StyleUrlResolver {
|
||||||
_resolver: UrlResolver;
|
_resolver: UrlResolver;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import {Injectable} from 'angular2/di';
|
||||||
import {isBlank, isPresent, BaseException, stringify} from 'angular2/src/facade/lang';
|
import {isBlank, isPresent, BaseException, stringify} from 'angular2/src/facade/lang';
|
||||||
import {Map, MapWrapper, StringMapWrapper, StringMap} from 'angular2/src/facade/collection';
|
import {Map, MapWrapper, StringMapWrapper, StringMap} from 'angular2/src/facade/collection';
|
||||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||||
|
@ -12,6 +13,7 @@ import {UrlResolver} from './url_resolver';
|
||||||
* Strategy to load component templates.
|
* Strategy to load component templates.
|
||||||
* @publicModule angular2/angular2
|
* @publicModule angular2/angular2
|
||||||
*/
|
*/
|
||||||
|
@Injectable()
|
||||||
export class TemplateLoader {
|
export class TemplateLoader {
|
||||||
_xhr: XHR;
|
_xhr: XHR;
|
||||||
_htmlCache: StringMap;
|
_htmlCache: StringMap;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import {Injectable} from 'angular2/di';
|
||||||
import {Template} from 'angular2/src/core/annotations/template';
|
import {Template} from 'angular2/src/core/annotations/template';
|
||||||
|
|
||||||
import {Type, stringify, isBlank, BaseException} from 'angular2/src/facade/lang';
|
import {Type, stringify, isBlank, BaseException} from 'angular2/src/facade/lang';
|
||||||
|
@ -6,6 +7,7 @@ import {Map, MapWrapper, List, ListWrapper} from 'angular2/src/facade/collection
|
||||||
import {reflector} from 'angular2/src/reflection/reflection';
|
import {reflector} from 'angular2/src/reflection/reflection';
|
||||||
|
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
export class TemplateResolver {
|
export class TemplateResolver {
|
||||||
_cache: Map;
|
_cache: Map;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
import {Injectable} from 'angular2/di';
|
||||||
import {isPresent, isBlank, RegExpWrapper, BaseException} from 'angular2/src/facade/lang';
|
import {isPresent, isBlank, RegExpWrapper, BaseException} from 'angular2/src/facade/lang';
|
||||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
export class UrlResolver {
|
export class UrlResolver {
|
||||||
static a;
|
static a;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:html';
|
import 'dart:html';
|
||||||
|
import 'package:angular2/di.dart';
|
||||||
import './xhr.dart' show XHR;
|
import './xhr.dart' show XHR;
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
class XHRImpl extends XHR {
|
class XHRImpl extends XHR {
|
||||||
Future<String> get(String url) {
|
Future<String> get(String url) {
|
||||||
return HttpRequest.request(url).then(
|
return HttpRequest.request(url).then(
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
import {Injectable} from 'angular2/di';
|
||||||
import {Promise, PromiseWrapper} from 'angular2/src/facade/async';
|
import {Promise, PromiseWrapper} from 'angular2/src/facade/async';
|
||||||
import {XHR} from './xhr';
|
import {XHR} from './xhr';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
export class XHRImpl extends XHR {
|
export class XHRImpl extends XHR {
|
||||||
get(url: string): Promise<string> {
|
get(url: string): Promise<string> {
|
||||||
var completer = PromiseWrapper.completer();
|
var completer = PromiseWrapper.completer();
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
import {Injectable} from 'angular2/di';
|
||||||
import {isPresent, print} from 'angular2/src/facade/lang';
|
import {isPresent, print} from 'angular2/src/facade/lang';
|
||||||
import {ListWrapper, isListLikeIterable} from 'angular2/src/facade/collection';
|
import {ListWrapper, isListLikeIterable} from 'angular2/src/facade/collection';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
export class ExceptionHandler {
|
export class ExceptionHandler {
|
||||||
call(error, stackTrace = null, reason = null) {
|
call(error, stackTrace = null, reason = null) {
|
||||||
var longStackTrace = isListLikeIterable(stackTrace) ? ListWrapper.join(stackTrace, "\n\n") : stackTrace;
|
var longStackTrace = isListLikeIterable(stackTrace) ? ListWrapper.join(stackTrace, "\n\n") : stackTrace;
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
|
import {Injectable} from 'angular2/di';
|
||||||
import {ChangeDetector} from 'angular2/change_detection';
|
import {ChangeDetector} from 'angular2/change_detection';
|
||||||
import {VmTurnZone} from 'angular2/src/core/zone/vm_turn_zone';
|
import {VmTurnZone} from 'angular2/src/core/zone/vm_turn_zone';
|
||||||
import {ExceptionHandler} from 'angular2/src/core/exception_handler';
|
import {ExceptionHandler} from 'angular2/src/core/exception_handler';
|
||||||
import {isPresent} from 'angular2/src/facade/lang';
|
import {isPresent} from 'angular2/src/facade/lang';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
export class LifeCycle {
|
export class LifeCycle {
|
||||||
_errorHandler;
|
_errorHandler;
|
||||||
_changeDetector:ChangeDetector;
|
_changeDetector:ChangeDetector;
|
||||||
|
|
Loading…
Reference in New Issue