2016-08-30 14:15:25 -04:00
|
|
|
/**
|
|
|
|
* @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
|
|
|
|
*/
|
|
|
|
|
2017-02-22 19:49:46 -05:00
|
|
|
import {ɵPLATFORM_WORKER_UI_ID as PLATFORM_WORKER_UI_ID} from '@angular/common';
|
2016-08-30 14:15:25 -04:00
|
|
|
import {ResourceLoader, platformCoreDynamic} from '@angular/compiler';
|
perf: switch angular to use StaticInjector instead of ReflectiveInjector
This change allows ReflectiveInjector to be tree shaken resulting
in not needed Reflect polyfil and smaller bundles.
Code savings for HelloWorld using Closure:
Reflective: bundle.js: 105,864(34,190 gzip)
Static: bundle.js: 154,889(33,555 gzip)
645( 2%)
BREAKING CHANGE:
`platformXXXX()` no longer accepts providers which depend on reflection.
Specifically the method signature when from `Provider[]` to
`StaticProvider[]`.
Example:
Before:
```
[
MyClass,
{provide: ClassA, useClass: SubClassA}
]
```
After:
```
[
{provide: MyClass, deps: [Dep1,...]},
{provide: ClassA, useClass: SubClassA, deps: [Dep1,...]}
]
```
NOTE: This only applies to platform creation and providers for the JIT
compiler. It does not apply to `@Compotent` or `@NgModule` provides
declarations.
Benchpress note: Previously Benchpress also supported reflective
provides, which now require static providers.
DEPRECATION:
- `ReflectiveInjector` is now deprecated as it will be remove. Use
`Injector.create` as a replacement.
closes #18496
2017-08-03 15:33:29 -04:00
|
|
|
import {COMPILER_OPTIONS, PLATFORM_ID, PlatformRef, StaticProvider, createPlatformFactory} from '@angular/core';
|
2017-02-17 15:55:55 -05:00
|
|
|
import {ɵResourceLoaderImpl as ResourceLoaderImpl} from '@angular/platform-browser-dynamic';
|
2016-12-06 19:21:07 -05:00
|
|
|
export {VERSION} from './version';
|
2016-08-30 14:15:25 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @experimental API related to bootstrapping are still under review.
|
|
|
|
*/
|
2017-02-22 19:49:46 -05:00
|
|
|
export const platformWorkerAppDynamic =
|
|
|
|
createPlatformFactory(platformCoreDynamic, 'workerAppDynamic', [
|
|
|
|
{
|
|
|
|
provide: COMPILER_OPTIONS,
|
2017-07-27 16:49:33 -04:00
|
|
|
useValue: {providers: [{provide: ResourceLoader, useClass: ResourceLoaderImpl, deps: []}]},
|
2017-02-22 19:49:46 -05:00
|
|
|
multi: true
|
|
|
|
},
|
|
|
|
{provide: PLATFORM_ID, useValue: PLATFORM_WORKER_UI_ID}
|
|
|
|
]);
|