mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
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
37 lines
1.4 KiB
TypeScript
37 lines
1.4 KiB
TypeScript
/**
|
|
* @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 {PlatformRef, StaticProvider} from '@angular/core';
|
|
|
|
import {WORKER_SCRIPT, platformWorkerUi} from './worker_render';
|
|
|
|
export {VERSION} from './version';
|
|
export {ClientMessageBroker, ClientMessageBrokerFactory, FnArg, UiArguments} from './web_workers/shared/client_message_broker';
|
|
export {MessageBus, MessageBusSink, MessageBusSource} from './web_workers/shared/message_bus';
|
|
export {PRIMITIVE, SerializerTypes} from './web_workers/shared/serializer';
|
|
export {ReceivedMessage, ServiceMessageBroker, ServiceMessageBrokerFactory} from './web_workers/shared/service_message_broker';
|
|
export {WORKER_UI_LOCATION_PROVIDERS} from './web_workers/ui/location_providers';
|
|
export {WORKER_APP_LOCATION_PROVIDERS} from './web_workers/worker/location_providers';
|
|
export {WorkerAppModule, platformWorkerApp} from './worker_app';
|
|
export {platformWorkerUi} from './worker_render';
|
|
|
|
/**
|
|
* Bootstraps the worker ui.
|
|
*
|
|
* @experimental
|
|
*/
|
|
export function bootstrapWorkerUi(
|
|
workerScriptUri: string, customProviders: StaticProvider[] = []): Promise<PlatformRef> {
|
|
// For now, just creates the worker ui platform...
|
|
const platform = platformWorkerUi([
|
|
{provide: WORKER_SCRIPT, useValue: workerScriptUri},
|
|
...customProviders,
|
|
]);
|
|
|
|
return Promise.resolve(platform);
|
|
}
|