feat(dart/transform): Introduce @AngularEntrypoint()

This commit is contained in:
Tim Blasi 2015-11-20 16:35:55 -08:00 committed by vsavkin
parent 3e364b0d41
commit 6b2ef25c69
7 changed files with 34 additions and 5 deletions

View File

@ -9,10 +9,11 @@ export 'package:angular2/core.dart'
hide forwardRef, resolveForwardRef, ForwardRefFn; hide forwardRef, resolveForwardRef, ForwardRefFn;
export 'package:angular2/common.dart'; export 'package:angular2/common.dart';
export 'package:angular2/instrumentation.dart'; export 'package:angular2/instrumentation.dart';
export 'package:angular2/src/core/angular_entrypoint.dart' show AngularEntrypoint;
export 'package:angular2/src/core/application_tokens.dart' export 'package:angular2/src/core/application_tokens.dart'
hide APP_COMPONENT_REF_PROMISE, APP_ID_RANDOM_PROVIDER; hide APP_COMPONENT_REF_PROMISE, APP_ID_RANDOM_PROVIDER;
export 'package:angular2/src/platform/dom/dom_tokens.dart'; export 'package:angular2/src/platform/dom/dom_tokens.dart';
export 'package:angular2/src/platform/dom/dom_adapter.dart'; export 'package:angular2/src/platform/dom/dom_adapter.dart';
export 'package:angular2/src/platform/dom/events/event_manager.dart'; export 'package:angular2/src/platform/dom/events/event_manager.dart';
export 'package:angular2/src/compiler/url_resolver.dart'; export 'package:angular2/src/compiler/url_resolver.dart';
export 'package:angular2/src/compiler/app_root_url.dart'; export 'package:angular2/src/compiler/app_root_url.dart';

View File

@ -3,3 +3,4 @@
* @deprecated * @deprecated
*/ */
export {bootstrap} from 'angular2/platform/browser'; export {bootstrap} from 'angular2/platform/browser';
export {AngularEntrypoint} from 'angular2/src/core/angular_entrypoint';

View File

@ -3,3 +3,4 @@
* @deprecated * @deprecated
*/ */
export {bootstrapStatic} from 'angular2/platform/browser_static'; export {bootstrapStatic} from 'angular2/platform/browser_static';
export {AngularEntrypoint} from 'angular2/src/core/angular_entrypoint';

View File

@ -1,3 +1,4 @@
export {AngularEntrypoint} from 'angular2/src/core/angular_entrypoint';
export { export {
BROWSER_PROVIDERS, BROWSER_PROVIDERS,
ELEMENT_PROBE_BINDINGS, ELEMENT_PROBE_BINDINGS,
@ -124,4 +125,4 @@ export function bootstrap(
let appProviders = let appProviders =
isPresent(customProviders) ? [BROWSER_APP_PROVIDERS, customProviders] : BROWSER_APP_PROVIDERS; isPresent(customProviders) ? [BROWSER_APP_PROVIDERS, customProviders] : BROWSER_APP_PROVIDERS;
return platform(BROWSER_PROVIDERS).application(appProviders).bootstrap(appComponentType); return platform(BROWSER_PROVIDERS).application(appProviders).bootstrap(appComponentType);
} }

View File

@ -1,3 +1,4 @@
export {AngularEntrypoint} from 'angular2/src/core/angular_entrypoint';
export { export {
BROWSER_PROVIDERS, BROWSER_PROVIDERS,
ELEMENT_PROBE_BINDINGS, ELEMENT_PROBE_BINDINGS,
@ -10,13 +11,13 @@ export {
disableDebugTools disableDebugTools
} from 'angular2/src/platform/browser_common'; } from 'angular2/src/platform/browser_common';
import {Type, isPresent, CONST_EXPR} from 'angular2/src/facade/lang'; import {Type, isPresent} from 'angular2/src/facade/lang';
import {Promise} from 'angular2/src/facade/promise'; import {Promise} from 'angular2/src/facade/promise';
import { import {
BROWSER_PROVIDERS, BROWSER_PROVIDERS,
BROWSER_APP_COMMON_PROVIDERS BROWSER_APP_COMMON_PROVIDERS
} from 'angular2/src/platform/browser_common'; } from 'angular2/src/platform/browser_common';
import {ComponentRef, platform, reflector} from 'angular2/core'; import {ComponentRef, platform} from 'angular2/core';
/** /**
* An array of providers that should be passed into `application()` when bootstrapping a component * An array of providers that should be passed into `application()` when bootstrapping a component
@ -39,4 +40,4 @@ export function bootstrapStatic(appComponentType: Type,
let appProviders = let appProviders =
isPresent(customProviders) ? [BROWSER_APP_PROVIDERS, customProviders] : BROWSER_APP_PROVIDERS; isPresent(customProviders) ? [BROWSER_APP_PROVIDERS, customProviders] : BROWSER_APP_PROVIDERS;
return platform(BROWSER_PROVIDERS).application(appProviders).bootstrap(appComponentType); return platform(BROWSER_PROVIDERS).application(appProviders).bootstrap(appComponentType);
} }

View File

@ -0,0 +1,22 @@
import {CONST} from 'angular2/src/facade/lang';
/**
* Marks a function or method as an Angular 2 entrypoint. Only necessary in Dart code.
*
* The optional `name` parameter will be reflected in logs when the entry point is processed.
*
* See [the wiki][] for detailed documentation.
* [the wiki]: https://github.com/angular/angular/wiki/Angular-2-Dart-Transformer#entry_points
*
* ## Example
*
* ```
* @AngularEntrypoint("name-for-debug")
* void main() {
* bootstrap(MyComponent);
* }
*/
@CONST()
export class AngularEntrypoint {
constructor(public name?: String) {}
}

View File

@ -76,6 +76,8 @@ var NG_ALL = [
'AbstractControlDirective.valid', 'AbstractControlDirective.valid',
'AbstractControlDirective.value', 'AbstractControlDirective.value',
'AbstractControlDirective.path', 'AbstractControlDirective.path',
'AngularEntrypoint',
'AngularEntrypoint.name',
'AppRootUrl', 'AppRootUrl',
'AppRootUrl.value', 'AppRootUrl.value',
'AppRootUrl.value=', 'AppRootUrl.value=',