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';
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';

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';

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.

View File

@ -17,6 +17,8 @@ fi
echo "====== RENAMING 0.0.0-PLACEHOLDER to 2.0.0-rc.${VERSION} ======"
find ./dist/packages-dist/ -type f -name package.json -print0 | xargs -0 sed -i '' "s/0\\.0\\.0-PLACEHOLDER/2.0.0-rc.${VERSION}/g"
find ./dist/packages-dist/ -type f -name "*umd.js" -print0 | xargs -0 sed -i '' "s/0\\.0\\.0-PLACEHOLDER/2.0.0-rc.${VERSION}/g"
find ./dist/packages-dist/ -type f -name index.js -print0 | xargs -0 sed -i '' "s/0\\.0\\.0-PLACEHOLDER/2.0.0-rc.${VERSION}/g"
for PACKAGE in \
core \

View File

@ -227,3 +227,6 @@ export declare class SlicePipe implements PipeTransform {
export declare class UpperCasePipe implements PipeTransform {
transform(value: string): string;
}
/** @stable */
export declare const VERSION: Version;

View File

@ -949,6 +949,18 @@ export interface ValueProvider {
useValue: any;
}
/** @stable */
export declare class Version {
full: string;
major: string;
minor: string;
patch: string;
constructor(full: string);
}
/** @stable */
export declare const VERSION: Version;
/** @stable */
export declare const ViewChild: ViewChildDecorator;

View File

@ -532,3 +532,6 @@ export declare class Validators {
[key: string]: boolean;
};
}
/** @stable */
export declare const VERSION: Version;

View File

@ -227,6 +227,9 @@ export declare class URLSearchParams {
toString(): string;
}
/** @stable */
export declare const VERSION: Version;
/** @experimental */
export declare class XHRBackend implements ConnectionBackend {
constructor(_browserXHR: BrowserXhr, _baseResponseOptions: ResponseOptions, _xsrfStrategy: XSRFStrategy);

View File

@ -3,3 +3,6 @@ export declare const platformBrowserDynamic: (extraProviders?: Provider[]) => Pl
/** @experimental */
export declare const RESOURCE_CACHE_PROVIDER: Provider[];
/** @stable */
export declare const VERSION: Version;

View File

@ -93,3 +93,6 @@ export declare class Title {
getTitle(): string;
setTitle(newTitle: string): void;
}
/** @stable */
export declare const VERSION: Version;

View File

@ -7,3 +7,6 @@ export declare const platformServer: (extraProviders?: Provider[]) => PlatformRe
/** @experimental */
export declare class ServerModule {
}
/** @stable */
export declare const VERSION: Version;

View File

@ -1,2 +1,5 @@
/** @experimental */
export declare const platformWorkerAppDynamic: (extraProviders?: Provider[]) => PlatformRef;
/** @stable */
export declare const VERSION: Version;

View File

@ -77,6 +77,9 @@ export declare class UiArguments {
constructor(method: string, args?: FnArg[]);
}
/** @stable */
export declare const VERSION: Version;
/** @experimental */
export declare const WORKER_APP_LOCATION_PROVIDERS: ({
provide: typeof PlatformLocation;

View File

@ -413,3 +413,6 @@ export declare class UrlTree {
root: UrlSegmentGroup;
toString(): string;
}
/** @stable */
export declare const VERSION: Version;

View File

@ -19,3 +19,6 @@ export declare class UpgradeAdapterRef {
dispose(): void;
ready(fn: (upgradeAdapterRef?: UpgradeAdapterRef) => void): void;
}
/** @stable */
export declare const VERSION: Version;