feat(build): record angular version in the dom (#13164)

This commit is contained in:
Victor Savkin
2016-11-30 13:52:08 -08:00
committed by Alex Rickabaugh
parent 3e73bea3e7
commit e628b66cca
30 changed files with 152 additions and 10 deletions

View File

@ -14,6 +14,10 @@
export * from './src/location';
export {NgLocalization} from './src/localization';
export {CommonModule} from './src/common_module';
export {NgClass, NgFor, NgIf, NgPlural, NgPluralCase, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgTemplateOutlet} from './src/directives/index';
export {AsyncPipe, DatePipe, I18nPluralPipe, I18nSelectPipe, JsonPipe, LowerCasePipe, CurrencyPipe, DecimalPipe, PercentPipe, SlicePipe, UpperCasePipe} from './src/pipes/index';
export {AsyncPipe, DatePipe, I18nPluralPipe, I18nSelectPipe, JsonPipe, LowerCasePipe, CurrencyPipe, DecimalPipe, PercentPipe, SlicePipe, UpperCasePipe} from './src/pipes/index';
import {Version} from '@angular/core';
/**
* @stable
*/
export const VERSION = new Version('0.0.0-PLACEHOLDER');

View File

@ -5,10 +5,14 @@
* 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
*/
export {AotCompilerHost, AotCompilerHost as StaticReflectorHost, StaticReflector, StaticSymbol} from '@angular/compiler';
export {CodeGenerator} from './src/codegen';
export {CompilerHost, CompilerHostContext, NodeCompilerHostContext} from './src/compiler_host';
export {Extractor} from './src/extractor';
export * from '@angular/tsc-wrapped';
import {Version} from '@angular/core';
/**
* @stable
*/
export const VERSION = new Version('0.0.0-PLACEHOLDER');

View File

@ -21,6 +21,11 @@
* </p>
* </div>
*/
import {Version} from '@angular/core';
/**
* @stable
*/
export const VERSION = new Version('0.0.0-PLACEHOLDER');
export * from './src/template_parser/template_ast';
export {TEMPLATE_TRANSFORMS} from './src/template_parser/template_parser';
export {CompilerConfig, RenderTypes} from './src/config';
@ -58,5 +63,4 @@ export * from './src/style_compiler';
export * from './src/template_parser/template_parser';
export {ViewCompiler} from './src/view_compiler/view_compiler';
export {AnimationParser} from './src/animation/animation_parser';
// This file only reexports content of the `src` folder. Keep it that way.

View File

@ -12,5 +12,10 @@
* Entry point for all public APIs of the core package.
*/
export * from './src/core';
import {Version} from './src/core';
/**
* @stable
*/
export const VERSION = new Version('0.0.0-PLACEHOLDER');
// This file only reexports content of the `src` folder. Keep it that way.

View File

@ -12,6 +12,7 @@
* Entry point from which you should import all public core APIs.
*/
export * from './metadata';
export * from './version';
export * from './util';
export * from './di';
export {createPlatform, assertPlatform, destroyPlatform, getPlatform, PlatformRef, ApplicationRef, enableProdMode, isDevMode, createPlatformFactory, NgProbeToken} from './application_ref';
@ -34,4 +35,4 @@ export * from './core_private_export';
export * from './animation/metadata';
export {AnimationTransitionEvent} from './animation/animation_transition_event';
export {AnimationPlayer} from './animation/animation_player';
export {Sanitizer, SecurityContext} from './security';
export {Sanitizer, SecurityContext} from './security';

View File

@ -0,0 +1,22 @@
/**
* @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
*/
/**
* @whatItDoes Represents the version of Angular
*
* @stable
*/
export class Version {
constructor(public full: string) {}
get major(): string { return this.full.split('.')[0]; }
get minor(): string { return this.full.split('.')[1]; }
get patch(): string { return this.full.split('.')[2]; }
}

View File

@ -11,6 +11,11 @@
* @description
* Entry point for all public APIs of the forms package.
*/
import {Version} from '@angular/core';
/**
* @stable
*/
export const VERSION = new Version('0.0.0-PLACEHOLDER');
export * from './src/forms';
// This file only reexports content of the `src` folder. Keep it that way.

View File

@ -11,6 +11,11 @@
* @description
* Entry point for all public APIs of the http package.
*/
import {Version} from '@angular/core';
/**
* @stable
*/
export const VERSION = new Version('0.0.0-PLACEHOLDER');
export * from './src/index';
// This file only reexports content of the `src` folder. Keep it that way.

View File

@ -11,10 +11,15 @@
* @description
* Entry point for all public APIs of the language service package.
*/
import {Version} from '@angular/core';
import * as ts from 'typescript';
import {LanguageServicePlugin} from './src/ts_plugin';
/**
* @stable
*/
export const VERSION = new Version('0.0.0-PLACEHOLDER');
export {createLanguageService} from './src/language_service';
export {Completion, Completions, Declaration, Declarations, Definition, Diagnostic, Diagnostics, Hover, HoverTextSection, LanguageService, LanguageServiceHost, Location, Span, TemplateSource, TemplateSources} from './src/types';
export {TypeScriptServiceHost, createLanguageServiceFromTypescript} from './src/typescript_host';

View File

@ -11,6 +11,11 @@
* @description
* Entry point for all public APIs of the platform-browser-dynamic package.
*/
import {Version} from '@angular/core';
/**
* @stable
*/
export const VERSION = new Version('0.0.0-PLACEHOLDER');
export * from './src/platform-browser-dynamic';
// This file only reexports content of the `src` folder. Keep it that way.

View File

@ -11,6 +11,10 @@
* @description
* Entry point for all public APIs of the platform-browser package.
*/
import {Version} from '@angular/core';
/**
* @stable
*/
export const VERSION = new Version('0.0.0-PLACEHOLDER');
export * from './src/platform-browser';
// This file only reexports content of the `src` folder. Keep it that way.

View File

@ -7,7 +7,7 @@
*/
import {CommonModule, PlatformLocation} from '@angular/common';
import {ApplicationModule, ErrorHandler, NgModule, Optional, PLATFORM_INITIALIZER, PlatformRef, Provider, RootRenderer, Sanitizer, SkipSelf, Testability, createPlatformFactory, platformCore} from '@angular/core';
import {ApplicationModule, ErrorHandler, NgModule, Optional, PLATFORM_INITIALIZER, PlatformRef, Provider, RootRenderer, Sanitizer, SkipSelf, Testability, VERSION, createPlatformFactory, platformCore} from '@angular/core';
import {AnimationDriver} from '../src/dom/animation_driver';
import {WebAnimationsDriver} from '../src/dom/web_animations_driver';
@ -29,6 +29,7 @@ import {DomSanitizer, DomSanitizerImpl} from './security/dom_sanitization_servic
export const INTERNAL_BROWSER_PLATFORM_PROVIDERS: Provider[] = [
{provide: PLATFORM_INITIALIZER, useValue: initDomAdapter, multi: true},
{provide: PLATFORM_INITIALIZER, useValue: recordAngularVersion, multi: true},
{provide: PlatformLocation, useClass: BrowserPlatformLocation}
];
@ -54,6 +55,14 @@ export function initDomAdapter() {
BrowserGetTestability.init();
}
export function recordAngularVersion(): void {
const domAdapter = getDOM();
const body = domAdapter.getElementsByTagName(domAdapter.defaultDoc(), 'body');
if (body.length > 0) {
domAdapter.setAttribute(body[0], 'ng-version', VERSION.full);
}
}
export function errorHandler(): ErrorHandler {
return new ErrorHandler();
}

View File

@ -16,5 +16,4 @@ export {DOCUMENT} from './dom/dom_tokens';
export {EVENT_MANAGER_PLUGINS, EventManager} from './dom/events/event_manager';
export {HAMMER_GESTURE_CONFIG, HammerGestureConfig} from './dom/events/hammer_gestures';
export {DomSanitizer, SafeHtml, SafeResourceUrl, SafeScript, SafeStyle, SafeUrl} from './security/dom_sanitization_service';
export * from './private_export';
export * from './private_export';

View File

@ -11,6 +11,12 @@
* @description
* Entry point for all public APIs of the platform-server package.
*/
import {Version} from '@angular/core';
/**
* @stable
*/
export const VERSION = new Version('0.0.0-PLACEHOLDER');
export * from './src/platform-server';
// This file only reexports content of the `src` folder. Keep it that way.

View File

@ -11,6 +11,11 @@
* @description
* Entry point for all public APIs of the platform-browser-dynamic package.
*/
import {Version} from '@angular/core';
/**
* @stable
*/
export const VERSION = new Version('0.0.0-PLACEHOLDER');
export * from './src/platform-webworker-dynamic';
// This file only reexports content of the `src` folder. Keep it that way.

View File

@ -11,6 +11,11 @@
* @description
* Entry point for all public APIs of the platform-webworker package.
*/
import {Version} from '@angular/core';
/**
* @stable
*/
export const VERSION = new Version('0.0.0-PLACEHOLDER');
export * from './src/platform-webworker';
// This file only reexports content of the `src` folder. Keep it that way.

View File

@ -11,6 +11,11 @@
* @description
* Entry point for all public APIs of the router package.
*/
import {Version} from '@angular/core';
/**
* @stable
*/
export const VERSION = new Version('0.0.0-ROUTERPLACEHOLDER');
export * from './src/index';
// This file only reexports content of the `src` folder. Keep it that way.

View File

@ -11,5 +11,10 @@
* @description
* Entry point for all public APIs of the upgrade package.
*/
import {Version} from '@angular/core';
/**
* @stable
*/
export const VERSION = new Version('0.0.0-PLACEHOLDER');
export * from './src/upgrade';
// This file only reexports content of the `src` folder. Keep it that way.