perf: delete pre-view-engine core, compiler, platform-browser, etc code (#14788)
After the introduction of the view engine, we can drop a lot of code that is not used any more. This should reduce the size of the app bundles because a lot of this code was not being properly tree-shaken by today's tools even though it was dead code.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import {APP_ID, NgModule, NgZone, PLATFORM_INITIALIZER, PlatformRef, Provider, createPlatformFactory, platformCore} from '@angular/core';
|
||||
import {AnimationDriver, BrowserModule, ɵBrowserDomAdapter as BrowserDomAdapter, ɵELEMENT_PROBE_PROVIDERS as ELEMENT_PROBE_PROVIDERS} from '@angular/platform-browser';
|
||||
import {BrowserModule, ɵBrowserDomAdapter as BrowserDomAdapter, ɵELEMENT_PROBE_PROVIDERS as ELEMENT_PROBE_PROVIDERS} from '@angular/platform-browser';
|
||||
import {BrowserDetection, createNgZone} from './browser_util';
|
||||
|
||||
function initBrowserTests() {
|
||||
@@ -33,9 +33,9 @@ export const platformBrowserTesting =
|
||||
@NgModule({
|
||||
exports: [BrowserModule],
|
||||
providers: [
|
||||
{provide: APP_ID, useValue: 'a'}, ELEMENT_PROBE_PROVIDERS,
|
||||
{provide: APP_ID, useValue: 'a'},
|
||||
ELEMENT_PROBE_PROVIDERS,
|
||||
{provide: NgZone, useFactory: createNgZone},
|
||||
{provide: AnimationDriver, useValue: AnimationDriver.NOOP}
|
||||
]
|
||||
})
|
||||
export class BrowserTestingModule {
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
|
||||
import {AnimationPlayer, ɵAnimationKeyframe as AnimationKeyframe, ɵAnimationStyles as AnimationStyles} from '@angular/core';
|
||||
import {MockAnimationPlayer} from '@angular/core/testing/testing_internal';
|
||||
import {AnimationDriver} from '@angular/platform-browser';
|
||||
import {ListWrapper} from './facade/collection';
|
||||
|
||||
export class MockAnimationDriver extends AnimationDriver {
|
||||
public log: {[key: string]: any}[] = [];
|
||||
animate(
|
||||
element: any, startingStyles: AnimationStyles, keyframes: AnimationKeyframe[],
|
||||
duration: number, delay: number, easing: string,
|
||||
previousPlayers: AnimationPlayer[] = []): AnimationPlayer {
|
||||
const mockPlayers = <MockAnimationPlayer[]>previousPlayers.filter(
|
||||
player => player instanceof MockAnimationPlayer);
|
||||
const normalizedStartingStyles = _serializeStyles(startingStyles);
|
||||
const normalizedKeyframes = _serializeKeyframes(keyframes);
|
||||
const player =
|
||||
new MockAnimationPlayer(normalizedStartingStyles, normalizedKeyframes, previousPlayers);
|
||||
|
||||
this.log.push({
|
||||
'element': element,
|
||||
'startingStyles': normalizedStartingStyles,
|
||||
'previousStyles': player.previousStyles,
|
||||
'keyframes': keyframes,
|
||||
'keyframeLookup': normalizedKeyframes,
|
||||
'duration': duration,
|
||||
'delay': delay,
|
||||
'easing': easing,
|
||||
'player': player
|
||||
});
|
||||
return player;
|
||||
}
|
||||
}
|
||||
|
||||
function _serializeKeyframes(keyframes: AnimationKeyframe[]): any[] {
|
||||
return keyframes.map(keyframe => [keyframe.offset, _serializeStyles(keyframe.styles)]);
|
||||
}
|
||||
|
||||
function _serializeStyles(styles: AnimationStyles): {[key: string]: any} {
|
||||
const flatStyles: {[key: string]: any} = {};
|
||||
styles.styles.forEach((entry: {[key: string]: string | number;}) => {
|
||||
Object.keys(entry).forEach(prop => { flatStyles[prop] = entry[prop]; });
|
||||
});
|
||||
return flatStyles;
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
|
||||
import {DomAnimatePlayer} from '../src/dom/dom_animate_player';
|
||||
import {isPresent} from '../src/facade/lang';
|
||||
|
||||
export class MockDomAnimatePlayer implements DomAnimatePlayer {
|
||||
public captures: {[key: string]: any[]} = {};
|
||||
private _position: number = 0;
|
||||
private _onfinish: Function = () => {};
|
||||
public currentTime: number;
|
||||
|
||||
/** @internal */
|
||||
_capture(method: string, data: any): void {
|
||||
if (!isPresent(this.captures[method])) {
|
||||
this.captures[method] = [];
|
||||
}
|
||||
this.captures[method].push(data);
|
||||
}
|
||||
|
||||
cancel(): void { this._capture('cancel', null); }
|
||||
play(): void { this._capture('play', null); }
|
||||
pause(): void { this._capture('pause', null); }
|
||||
finish(): void {
|
||||
this._capture('finish', null);
|
||||
this._onfinish();
|
||||
}
|
||||
set onfinish(fn: Function) {
|
||||
this._capture('onfinish', fn);
|
||||
this._onfinish = fn;
|
||||
}
|
||||
get onfinish(): Function { return this._onfinish; }
|
||||
set position(val: number) {
|
||||
this._capture('position', val);
|
||||
this._position = val;
|
||||
}
|
||||
get position(): number { return this._position; }
|
||||
addEventListener(eventName: string, handler: (event: any) => any): any {
|
||||
if (eventName == 'finish') {
|
||||
this.onfinish = handler;
|
||||
}
|
||||
}
|
||||
dispatchEvent(eventName: string): any {}
|
||||
}
|
||||
Reference in New Issue
Block a user