Skip to content

Commit 16efb13

Browse files
mheveryalxhub
authored andcommitted
fix: display framework version on bootstrapped component (angular#13252)
1 parent 986abbe commit 16efb13

File tree

43 files changed

+294
-103
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+294
-103
lines changed

modules/@angular/common/index.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,6 @@
1111
* @description
1212
* Entry point for all public APIs of the common package.
1313
*/
14-
export * from './src/location/index';
15-
export {NgLocalization} from './src/localization';
16-
export {CommonModule} from './src/common_module';
17-
export {NgClass, NgFor, NgIf, NgPlural, NgPluralCase, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgTemplateOutlet} from './src/directives/index';
18-
export {AsyncPipe, DatePipe, I18nPluralPipe, I18nSelectPipe, JsonPipe, LowerCasePipe, CurrencyPipe, DecimalPipe, PercentPipe, SlicePipe, UpperCasePipe} from './src/pipes/index';
19-
import {Version} from '@angular/core';
14+
export * from './src/common';
2015

21-
/**
22-
* @stable
23-
*/
24-
export const VERSION = new Version('0.0.0-PLACEHOLDER');
16+
// This file only reexports content of the `src` folder. Keep it that way.

modules/@angular/common/src/common.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* @license
3+
* Copyright Google Inc. All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
/**
10+
* @module
11+
* @description
12+
* Entry point for all public APIs of the common package.
13+
*/
14+
export * from './location/index';
15+
export {NgLocalization} from './localization';
16+
export {CommonModule} from './common_module';
17+
export {NgClass, NgFor, NgIf, NgPlural, NgPluralCase, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgTemplateOutlet} from './directives/index';
18+
export {AsyncPipe, DatePipe, I18nPluralPipe, I18nSelectPipe, JsonPipe, LowerCasePipe, CurrencyPipe, DecimalPipe, PercentPipe, SlicePipe, UpperCasePipe} from './pipes/index';
19+
export {VERSION} from './version';
20+
export {Version} from '@angular/core';
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* @license
3+
* Copyright Google Inc. All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
/**
10+
* @module
11+
* @description
12+
* Entry point for all public APIs of the common package.
13+
*/
14+
15+
import {Version} from '@angular/core';
16+
/**
17+
* @stable
18+
*/
19+
export const VERSION = new Version('0.0.0-PLACEHOLDER');

modules/@angular/compiler-cli/index.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,4 @@ export {CodeGenerator} from './src/codegen';
1010
export {CompilerHost, CompilerHostContext, ModuleResolutionHostAdapter, NodeCompilerHostContext} from './src/compiler_host';
1111
export {Extractor} from './src/extractor';
1212
export * from '@angular/tsc-wrapped';
13-
14-
import {Version} from '@angular/core';
15-
/**
16-
* @stable
17-
*/
18-
export const VERSION = new Version('0.0.0-PLACEHOLDER');
13+
export {VERSION} from './src/version';
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* @license
3+
* Copyright Google Inc. All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
/**
10+
* @module
11+
* @description
12+
* Entry point for all public APIs of the common package.
13+
*/
14+
15+
import {Version} from '@angular/core';
16+
/**
17+
* @stable
18+
*/
19+
export const VERSION = new Version('0.0.0-PLACEHOLDER');

modules/@angular/compiler/index.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@
2121
* </p>
2222
* </div>
2323
*/
24-
import {Version} from '@angular/core';
25-
/**
26-
* @stable
27-
*/
28-
export const VERSION = new Version('0.0.0-PLACEHOLDER');
24+
export {VERSION} from './src/version';
2925
export * from './src/template_parser/template_ast';
3026
export {TEMPLATE_TRANSFORMS} from './src/template_parser/template_parser';
3127
export {CompilerConfig, RenderTypes} from './src/config';
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* @license
3+
* Copyright Google Inc. All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
/**
10+
* @module
11+
* @description
12+
* Entry point for all public APIs of the common package.
13+
*/
14+
15+
import {Version} from '@angular/core';
16+
/**
17+
* @stable
18+
*/
19+
export const VERSION = new Version('0.0.0-PLACEHOLDER');

modules/@angular/core/index.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,5 @@
1212
* Entry point for all public APIs of the core package.
1313
*/
1414
export * from './src/core';
15-
import {Version} from './src/core';
16-
/**
17-
* @stable
18-
*/
19-
export const VERSION = new Version('0.0.0-PLACEHOLDER');
2015

2116
// This file only reexports content of the `src` folder. Keep it that way.

modules/@angular/core/src/core.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ export * from './core_private_export';
3535
export * from './animation/metadata';
3636
export {AnimationTransitionEvent} from './animation/animation_transition_event';
3737
export {AnimationPlayer} from './animation/animation_player';
38-
export {Sanitizer, SecurityContext} from './security';
38+
export {Sanitizer, SecurityContext} from './security';

modules/@angular/core/src/linker/view_utils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {isPresent, looseIdentical} from '../facade/lang';
1313
import {ViewEncapsulation} from '../metadata/view';
1414
import {RenderComponentType, RenderDebugInfo, Renderer, RootRenderer} from '../render/api';
1515
import {Sanitizer} from '../security';
16+
import {VERSION} from '../version';
1617

1718
import {ExpressionChangedAfterItHasBeenCheckedError} from './errors';
1819
import {AppView} from './view';
@@ -360,6 +361,7 @@ export function selectOrCreateRenderHostElement(
360361
for (let i = 0; i < attrs.length; i += 2) {
361362
renderer.setElementAttribute(hostElement, attrs.get(i), attrs.get(i + 1));
362363
}
364+
renderer.setElementAttribute(hostElement, 'ng-version', VERSION.full);
363365
} else {
364366
hostElement = createRenderElement(renderer, null, elementName, attrs, debugInfo);
365367
}

modules/@angular/core/src/version.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,9 @@ export class Version {
1919
get minor(): string { return this.full.split('.')[1]; }
2020

2121
get patch(): string { return this.full.split('.').slice(2).join('.'); }
22-
}
22+
}
23+
24+
/**
25+
* @stable
26+
*/
27+
export const VERSION = new Version('0.0.0-PLACEHOLDER');

modules/@angular/forms/index.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@
1111
* @description
1212
* Entry point for all public APIs of the forms package.
1313
*/
14-
import {Version} from '@angular/core';
15-
/**
16-
* @stable
17-
*/
18-
export const VERSION = new Version('0.0.0-PLACEHOLDER');
1914
export * from './src/forms';
2015

2116
// This file only reexports content of the `src` folder. Keep it that way.

modules/@angular/forms/src/forms.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@ export {AsyncValidatorFn, MaxLengthValidator, MinLengthValidator, PatternValidat
4242
export {FormBuilder} from './form_builder';
4343
export {AbstractControl, FormArray, FormControl, FormGroup} from './model';
4444
export {NG_ASYNC_VALIDATORS, NG_VALIDATORS, Validators} from './validators';
45-
45+
export {VERSION} from './version';
4646
export * from './form_providers';

modules/@angular/forms/src/version.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* @license
3+
* Copyright Google Inc. All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
/**
10+
* @module
11+
* @description
12+
* Entry point for all public APIs of the common package.
13+
*/
14+
15+
import {Version} from '@angular/core';
16+
/**
17+
* @stable
18+
*/
19+
export const VERSION = new Version('0.0.0-PLACEHOLDER');

modules/@angular/http/index.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@
1111
* @description
1212
* Entry point for all public APIs of the http package.
1313
*/
14-
import {Version} from '@angular/core';
15-
/**
16-
* @stable
17-
*/
18-
export const VERSION = new Version('0.0.0-PLACEHOLDER');
1914
export * from './src/index';
2015

2116
// This file only reexports content of the `src` folder. Keep it that way.

modules/@angular/http/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ export {Connection, ConnectionBackend, RequestOptionsArgs, ResponseOptionsArgs,
1919
export {Request} from './static_request';
2020
export {Response} from './static_response';
2121
export {QueryEncoder, URLSearchParams} from './url_search_params';
22+
export {VERSION} from './version';

modules/@angular/http/src/version.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* @license
3+
* Copyright Google Inc. All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
/**
10+
* @module
11+
* @description
12+
* Entry point for all public APIs of the common package.
13+
*/
14+
15+
import {Version} from '@angular/core';
16+
/**
17+
* @stable
18+
*/
19+
export const VERSION = new Version('0.0.0-PLACEHOLDER');

modules/@angular/language-service/index.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,11 @@
1111
* @description
1212
* Entry point for all public APIs of the language service package.
1313
*/
14-
import {Version} from '@angular/core';
15-
import * as ts from 'typescript';
16-
1714
import {LanguageServicePlugin} from './src/ts_plugin';
1815

19-
/**
20-
* @stable
21-
*/
22-
export const VERSION = new Version('0.0.0-PLACEHOLDER');
2316
export {createLanguageService} from './src/language_service';
2417
export {Completion, Completions, Declaration, Declarations, Definition, Diagnostic, Diagnostics, Hover, HoverTextSection, LanguageService, LanguageServiceHost, Location, Span, TemplateSource, TemplateSources} from './src/types';
2518
export {TypeScriptServiceHost, createLanguageServiceFromTypescript} from './src/typescript_host';
19+
export {VERSION} from './src/version';
2620

2721
export default LanguageServicePlugin;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* @license
3+
* Copyright Google Inc. All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
/**
10+
* @module
11+
* @description
12+
* Entry point for all public APIs of the common package.
13+
*/
14+
15+
import {Version} from '@angular/core';
16+
/**
17+
* @stable
18+
*/
19+
export const VERSION = new Version('0.0.0-PLACEHOLDER');

modules/@angular/platform-browser-dynamic/index.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@
1111
* @description
1212
* Entry point for all public APIs of the platform-browser-dynamic package.
1313
*/
14-
import {Version} from '@angular/core';
15-
/**
16-
* @stable
17-
*/
18-
export const VERSION = new Version('0.0.0-PLACEHOLDER');
1914
export * from './src/platform-browser-dynamic';
2015

2116
// This file only reexports content of the `src` folder. Keep it that way.

modules/@angular/platform-browser-dynamic/src/platform-browser-dynamic.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS} from './platform_providers'
1313
import {CachedResourceLoader} from './resource_loader/resource_loader_cache';
1414

1515
export * from './private_export';
16-
16+
export {VERSION} from './version';
1717
/**
1818
* @experimental
1919
*/
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* @license
3+
* Copyright Google Inc. All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
/**
10+
* @module
11+
* @description
12+
* Entry point for all public APIs of the common package.
13+
*/
14+
15+
import {Version} from '@angular/core';
16+
/**
17+
* @stable
18+
*/
19+
export const VERSION = new Version('0.0.0-PLACEHOLDER');

modules/@angular/platform-browser/index.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,5 @@
1111
* @description
1212
* Entry point for all public APIs of the platform-browser package.
1313
*/
14-
import {Version} from '@angular/core';
15-
/**
16-
* @stable
17-
*/
18-
export const VERSION = new Version('0.0.0-PLACEHOLDER');
1914
export * from './src/platform-browser';
2015
// This file only reexports content of the `src` folder. Keep it that way.

modules/@angular/platform-browser/src/browser.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import {CommonModule, PlatformLocation} from '@angular/common';
10-
import {ApplicationModule, ErrorHandler, NgModule, Optional, PLATFORM_INITIALIZER, PlatformRef, Provider, RootRenderer, Sanitizer, SkipSelf, Testability, VERSION, createPlatformFactory, platformCore} from '@angular/core';
10+
import {ApplicationModule, ErrorHandler, NgModule, Optional, PLATFORM_INITIALIZER, PlatformRef, Provider, RootRenderer, Sanitizer, SkipSelf, Testability, createPlatformFactory, platformCore} from '@angular/core';
1111

1212
import {AnimationDriver} from '../src/dom/animation_driver';
1313
import {WebAnimationsDriver} from '../src/dom/web_animations_driver';
@@ -29,7 +29,6 @@ import {DomSanitizer, DomSanitizerImpl} from './security/dom_sanitization_servic
2929

3030
export const INTERNAL_BROWSER_PLATFORM_PROVIDERS: Provider[] = [
3131
{provide: PLATFORM_INITIALIZER, useValue: initDomAdapter, multi: true},
32-
{provide: PLATFORM_INITIALIZER, useValue: recordAngularVersion, multi: true},
3332
{provide: PlatformLocation, useClass: BrowserPlatformLocation}
3433
];
3534

@@ -55,14 +54,6 @@ export function initDomAdapter() {
5554
BrowserGetTestability.init();
5655
}
5756

58-
export function recordAngularVersion(): void {
59-
const domAdapter = getDOM();
60-
const body = domAdapter.getElementsByTagName(domAdapter.defaultDoc(), 'body');
61-
if (body.length > 0) {
62-
domAdapter.setAttribute(body[0], 'ng-version', VERSION.full);
63-
}
64-
}
65-
6657
export function errorHandler(): ErrorHandler {
6758
return new ErrorHandler();
6859
}

modules/@angular/platform-browser/src/platform-browser.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ export {DOCUMENT} from './dom/dom_tokens';
1616
export {EVENT_MANAGER_PLUGINS, EventManager} from './dom/events/event_manager';
1717
export {HAMMER_GESTURE_CONFIG, HammerGestureConfig} from './dom/events/hammer_gestures';
1818
export {DomSanitizer, SafeHtml, SafeResourceUrl, SafeScript, SafeStyle, SafeUrl} from './security/dom_sanitization_service';
19-
export * from './private_export';
19+
export * from './private_export';
20+
export {VERSION} from './version';
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* @license
3+
* Copyright Google Inc. All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
/**
10+
* @module
11+
* @description
12+
* Entry point for all public APIs of the common package.
13+
*/
14+
15+
import {Version} from '@angular/core';
16+
/**
17+
* @stable
18+
*/
19+
export const VERSION = new Version('0.0.0-PLACEHOLDER');

0 commit comments

Comments
 (0)