cleanup(platform): removed webworker and server deprecated apis (#10745)
This commit is contained in:
parent
73c0a9daaf
commit
60b10134df
|
@ -50,9 +50,9 @@ bootstrap.ts
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
import {MainModuleNgFactory} from './main_module.ngfactory';
|
import {MainModuleNgFactory} from './main_module.ngfactory';
|
||||||
import {browserPlatform} from '@angular/platform-browser';
|
import {platformBrowser} from '@angular/platform-browser';
|
||||||
|
|
||||||
browserPlatform().bootstrapModuleFactory(MainModuleNgFactory);
|
platformBrowser().bootstrapModuleFactory(MainModuleNgFactory);
|
||||||
```
|
```
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {browserPlatform} from '@angular/platform-browser';
|
import {platformBrowser} from '@angular/platform-browser';
|
||||||
import {BasicComp} from './basic';
|
import {BasicComp} from './basic';
|
||||||
import {MainModuleNgFactory} from './module.ngfactory';
|
import {MainModuleNgFactory} from './module.ngfactory';
|
||||||
|
|
||||||
|
|
|
@ -8,14 +8,14 @@
|
||||||
|
|
||||||
import {NgModuleFactory, NgModuleRef} from '@angular/core';
|
import {NgModuleFactory, NgModuleRef} from '@angular/core';
|
||||||
import {ComponentFixture} from '@angular/core/testing';
|
import {ComponentFixture} from '@angular/core/testing';
|
||||||
import {serverPlatform} from '@angular/platform-server';
|
import {platformServer} from '@angular/platform-server';
|
||||||
|
|
||||||
import {MainModule} from '../src/module';
|
import {MainModule} from '../src/module';
|
||||||
import {MainModuleNgFactory} from '../src/module.ngfactory';
|
import {MainModuleNgFactory} from '../src/module.ngfactory';
|
||||||
|
|
||||||
let mainModuleRef: NgModuleRef<MainModule> = null;
|
let mainModuleRef: NgModuleRef<MainModule> = null;
|
||||||
beforeEach((done) => {
|
beforeEach((done) => {
|
||||||
serverPlatform().bootstrapModuleFactory(MainModuleNgFactory).then((moduleRef) => {
|
platformServer().bootstrapModuleFactory(MainModuleNgFactory).then((moduleRef: any) => {
|
||||||
mainModuleRef = moduleRef;
|
mainModuleRef = moduleRef;
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {COMPILER_OPTIONS, Compiler, CompilerFactory, CompilerOptions, Component, Inject, Injectable, OptionalMetadata, PLATFORM_DIRECTIVES, PLATFORM_INITIALIZER, PLATFORM_PIPES, PlatformRef, Provider, ReflectiveInjector, TRANSLATIONS, Type, ViewEncapsulation, createPlatformFactory, isDevMode, platformCore} from '@angular/core';
|
import {COMPILER_OPTIONS, Compiler, CompilerFactory, CompilerOptions, Component, Inject, Injectable, OptionalMetadata, PLATFORM_INITIALIZER, PlatformRef, Provider, ReflectiveInjector, TRANSLATIONS, Type, ViewEncapsulation, createPlatformFactory, isDevMode, platformCore} from '@angular/core';
|
||||||
|
|
||||||
export * from './template_parser/template_ast';
|
export * from './template_parser/template_ast';
|
||||||
export {TEMPLATE_TRANSFORMS} from './template_parser/template_parser';
|
export {TEMPLATE_TRANSFORMS} from './template_parser/template_parser';
|
||||||
|
@ -90,9 +90,6 @@ export function analyzeAppProvidersForDeprecatedConfiguration(appProviders: any[
|
||||||
moduleDeclarations: Type<any>[],
|
moduleDeclarations: Type<any>[],
|
||||||
deprecationMessages: string[]
|
deprecationMessages: string[]
|
||||||
} {
|
} {
|
||||||
let platformDirectives: any[] = [];
|
|
||||||
let platformPipes: any[] = [];
|
|
||||||
|
|
||||||
let compilerProviders: any[] = [];
|
let compilerProviders: any[] = [];
|
||||||
let useDebug: boolean;
|
let useDebug: boolean;
|
||||||
let useJit: boolean;
|
let useJit: boolean;
|
||||||
|
@ -105,38 +102,18 @@ export function analyzeAppProvidersForDeprecatedConfiguration(appProviders: any[
|
||||||
const tempInj = ReflectiveInjector.resolveAndCreate(appProviders);
|
const tempInj = ReflectiveInjector.resolveAndCreate(appProviders);
|
||||||
const compilerConfig: CompilerConfig = tempInj.get(CompilerConfig, null);
|
const compilerConfig: CompilerConfig = tempInj.get(CompilerConfig, null);
|
||||||
if (compilerConfig) {
|
if (compilerConfig) {
|
||||||
platformDirectives = compilerConfig.platformDirectives;
|
|
||||||
platformPipes = compilerConfig.platformPipes;
|
|
||||||
useJit = compilerConfig.useJit;
|
useJit = compilerConfig.useJit;
|
||||||
useDebug = compilerConfig.genDebugInfo;
|
useDebug = compilerConfig.genDebugInfo;
|
||||||
defaultEncapsulation = compilerConfig.defaultEncapsulation;
|
defaultEncapsulation = compilerConfig.defaultEncapsulation;
|
||||||
deprecationMessages.push(
|
deprecationMessages.push(
|
||||||
`Passing CompilerConfig as a regular provider is deprecated. Use the "compilerOptions" parameter of "bootstrap()" or use a custom "CompilerFactory" platform provider instead.`);
|
`Passing CompilerConfig as a regular provider is deprecated. Use the "compilerOptions" parameter of "bootstrap()" or use a custom "CompilerFactory" platform provider instead.`);
|
||||||
} else {
|
|
||||||
// If nobody provided a CompilerConfig, use the
|
|
||||||
// PLATFORM_DIRECTIVES / PLATFORM_PIPES values directly if existing
|
|
||||||
platformDirectives = tempInj.get(PLATFORM_DIRECTIVES, []);
|
|
||||||
platformPipes = tempInj.get(PLATFORM_PIPES, []);
|
|
||||||
}
|
}
|
||||||
platformDirectives = ListWrapper.flatten(platformDirectives);
|
|
||||||
platformPipes = ListWrapper.flatten(platformPipes);
|
|
||||||
const xhr = tempInj.get(XHR, null);
|
const xhr = tempInj.get(XHR, null);
|
||||||
if (xhr) {
|
if (xhr) {
|
||||||
compilerProviders.push([{provide: XHR, useValue: xhr}]);
|
compilerProviders.push([{provide: XHR, useValue: xhr}]);
|
||||||
deprecationMessages.push(
|
deprecationMessages.push(
|
||||||
`Passing XHR as regular provider is deprecated. Pass the provider via "compilerOptions" instead.`);
|
`Passing XHR as regular provider is deprecated. Pass the provider via "compilerOptions" instead.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (platformDirectives.length > 0) {
|
|
||||||
deprecationMessages.push(
|
|
||||||
`The PLATFORM_DIRECTIVES provider and CompilerConfig.platformDirectives is deprecated. Add the directives to an NgModule instead! ` +
|
|
||||||
`(Directives: ${platformDirectives.map(type => stringify(type))})`);
|
|
||||||
}
|
|
||||||
if (platformPipes.length > 0) {
|
|
||||||
deprecationMessages.push(
|
|
||||||
`The PLATFORM_PIPES provider and CompilerConfig.platformPipes is deprecated. Add the pipes to an NgModule instead! ` +
|
|
||||||
`(Pipes: ${platformPipes.map(type => stringify(type))})`);
|
|
||||||
}
|
|
||||||
const compilerOptions: CompilerOptions = {
|
const compilerOptions: CompilerOptions = {
|
||||||
useJit: useJit,
|
useJit: useJit,
|
||||||
useDebug: useDebug,
|
useDebug: useDebug,
|
||||||
|
@ -144,18 +121,7 @@ export function analyzeAppProvidersForDeprecatedConfiguration(appProviders: any[
|
||||||
providers: compilerProviders
|
providers: compilerProviders
|
||||||
};
|
};
|
||||||
|
|
||||||
// Declare a component that uses @Component.directives / pipes as these
|
return {compilerOptions, moduleDeclarations: [], deprecationMessages: deprecationMessages};
|
||||||
// will be added to the module declarations only if they are not already
|
|
||||||
// imported by other modules.
|
|
||||||
@Component({directives: platformDirectives, pipes: platformPipes, template: ''})
|
|
||||||
class DynamicComponent {
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
compilerOptions,
|
|
||||||
moduleDeclarations: [DynamicComponent],
|
|
||||||
deprecationMessages: deprecationMessages
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
|
|
@ -21,36 +21,21 @@ export class CompilerConfig {
|
||||||
private _genDebugInfo: boolean;
|
private _genDebugInfo: boolean;
|
||||||
private _logBindingUpdate: boolean;
|
private _logBindingUpdate: boolean;
|
||||||
public useJit: boolean;
|
public useJit: boolean;
|
||||||
/**
|
|
||||||
* @deprecated Providing platform directives via the {@link CompilerConfig} is deprecated. Provide
|
|
||||||
* platform directives via an {@link NgModule} instead.
|
|
||||||
*/
|
|
||||||
public platformDirectives: any[];
|
|
||||||
/**
|
|
||||||
* @deprecated Providing platform pipes via the {@link CompilerConfig} is deprecated. Provide
|
|
||||||
* platform pipes via an {@link NgModule} instead.
|
|
||||||
*/
|
|
||||||
public platformPipes: any[];
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
{renderTypes = new DefaultRenderTypes(), defaultEncapsulation = ViewEncapsulation.Emulated,
|
{renderTypes = new DefaultRenderTypes(), defaultEncapsulation = ViewEncapsulation.Emulated,
|
||||||
genDebugInfo, logBindingUpdate, useJit = true, deprecatedPlatformDirectives = [],
|
genDebugInfo, logBindingUpdate, useJit = true}: {
|
||||||
deprecatedPlatformPipes = []}: {
|
|
||||||
renderTypes?: RenderTypes,
|
renderTypes?: RenderTypes,
|
||||||
defaultEncapsulation?: ViewEncapsulation,
|
defaultEncapsulation?: ViewEncapsulation,
|
||||||
genDebugInfo?: boolean,
|
genDebugInfo?: boolean,
|
||||||
logBindingUpdate?: boolean,
|
logBindingUpdate?: boolean,
|
||||||
useJit?: boolean,
|
useJit?: boolean
|
||||||
deprecatedPlatformDirectives?: any[],
|
|
||||||
deprecatedPlatformPipes?: any[]
|
|
||||||
} = {}) {
|
} = {}) {
|
||||||
this.renderTypes = renderTypes;
|
this.renderTypes = renderTypes;
|
||||||
this.defaultEncapsulation = defaultEncapsulation;
|
this.defaultEncapsulation = defaultEncapsulation;
|
||||||
this._genDebugInfo = genDebugInfo;
|
this._genDebugInfo = genDebugInfo;
|
||||||
this._logBindingUpdate = logBindingUpdate;
|
this._logBindingUpdate = logBindingUpdate;
|
||||||
this.useJit = useJit;
|
this.useJit = useJit;
|
||||||
this.platformDirectives = deprecatedPlatformDirectives;
|
|
||||||
this.platformPipes = deprecatedPlatformPipes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get genDebugInfo(): boolean {
|
get genDebugInfo(): boolean {
|
||||||
|
|
|
@ -23,7 +23,6 @@ export * from './src/linker';
|
||||||
export {DebugElement, DebugNode, asNativeElements, getDebugNode} from './src/debug/debug_node';
|
export {DebugElement, DebugNode, asNativeElements, getDebugNode} from './src/debug/debug_node';
|
||||||
export * from './src/testability/testability';
|
export * from './src/testability/testability';
|
||||||
export * from './src/change_detection';
|
export * from './src/change_detection';
|
||||||
export * from './src/platform_directives_and_pipes';
|
|
||||||
export * from './src/platform_core_providers';
|
export * from './src/platform_core_providers';
|
||||||
export {TRANSLATIONS, TRANSLATIONS_FORMAT, LOCALE_ID} from './src/i18n/tokens';
|
export {TRANSLATIONS, TRANSLATIONS_FORMAT, LOCALE_ID} from './src/i18n/tokens';
|
||||||
export {APPLICATION_COMMON_PROVIDERS, ApplicationModule} from './src/application_module';
|
export {APPLICATION_COMMON_PROVIDERS, ApplicationModule} from './src/application_module';
|
||||||
|
|
|
@ -170,9 +170,9 @@ export abstract class PlatformRef {
|
||||||
*
|
*
|
||||||
* main.ts:
|
* main.ts:
|
||||||
* import {MyModuleNgFactory} from './my_module.ngfactory';
|
* import {MyModuleNgFactory} from './my_module.ngfactory';
|
||||||
* import {browserPlatform} from '@angular/platform-browser';
|
* import {platformBrowser} from '@angular/platform-browser';
|
||||||
*
|
*
|
||||||
* let moduleRef = browserPlatform().bootstrapModuleFactory(MyModuleNgFactory);
|
* let moduleRef = platformBrowser().bootstrapModuleFactory(MyModuleNgFactory);
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @experimental APIs related to application bootstrap are currently under review.
|
* @experimental APIs related to application bootstrap are currently under review.
|
||||||
|
@ -192,7 +192,7 @@ export abstract class PlatformRef {
|
||||||
* })
|
* })
|
||||||
* class MyModule {}
|
* class MyModule {}
|
||||||
*
|
*
|
||||||
* let moduleRef = browserPlatform().bootstrapModule(MyModule);
|
* let moduleRef = platformBrowser().bootstrapModule(MyModule);
|
||||||
* ```
|
* ```
|
||||||
* @stable
|
* @stable
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -30,10 +30,3 @@ const _CORE_PLATFORM_PROVIDERS: Array<any|Type<any>|Provider|any[]> = [
|
||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
export const platformCore = createPlatformFactory(null, 'core', _CORE_PLATFORM_PROVIDERS);
|
export const platformCore = createPlatformFactory(null, 'core', _CORE_PLATFORM_PROVIDERS);
|
||||||
|
|
||||||
/**
|
|
||||||
* A default set of providers which should be included in any Angular platform.
|
|
||||||
*
|
|
||||||
* @deprecated Create platforms via `createPlatformFactory(corePlatform, ...) instead!
|
|
||||||
*/
|
|
||||||
export const PLATFORM_COMMON_PROVIDERS = _CORE_PLATFORM_PROVIDERS;
|
|
||||||
|
|
|
@ -1,67 +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 {OpaqueToken} from './di';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A token that can be provided when bootstrapping an application to make an array of directives
|
|
||||||
* available in every component of the application.
|
|
||||||
*
|
|
||||||
* ### Example
|
|
||||||
*
|
|
||||||
* ```typescript
|
|
||||||
* import {PLATFORM_DIRECTIVES} from '@angular/core';
|
|
||||||
* import {OtherDirective} from './myDirectives';
|
|
||||||
*
|
|
||||||
* @Component({
|
|
||||||
* selector: 'my-component',
|
|
||||||
* template: `
|
|
||||||
* <!-- can use other directive even though the component does not list it in `directives` -->
|
|
||||||
* <other-directive></other-directive>
|
|
||||||
* `
|
|
||||||
* })
|
|
||||||
* export class MyComponent {
|
|
||||||
* ...
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* bootstrap(MyComponent, [{provide: PLATFORM_DIRECTIVES, useValue: [OtherDirective],
|
|
||||||
multi:true}]);
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @deprecated Providing platform directives via a provider is deprecated. Provide platform
|
|
||||||
* directives via an {@link NgModule} instead.
|
|
||||||
*/
|
|
||||||
export const PLATFORM_DIRECTIVES: OpaqueToken = new OpaqueToken('Platform Directives');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A token that can be provided when bootstraping an application to make an array of pipes
|
|
||||||
* available in every component of the application.
|
|
||||||
*
|
|
||||||
* ### Example
|
|
||||||
*
|
|
||||||
* ```typescript
|
|
||||||
* import {PLATFORM_PIPES} from '@angular/core';
|
|
||||||
* import {OtherPipe} from './myPipe';
|
|
||||||
*
|
|
||||||
* @Component({
|
|
||||||
* selector: 'my-component',
|
|
||||||
* template: `
|
|
||||||
* {{123 | other-pipe}}
|
|
||||||
* `
|
|
||||||
* })
|
|
||||||
* export class MyComponent {
|
|
||||||
* ...
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* bootstrap(MyComponent, [{provide: PLATFORM_PIPES, useValue: [OtherPipe], multi:true}]);
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @deprecated Providing platform pipes via a provider is deprecated. Provide platform pipes via an
|
|
||||||
* {@link NgModule} instead.
|
|
||||||
*/
|
|
||||||
export const PLATFORM_PIPES: OpaqueToken = new OpaqueToken('Platform Pipes');
|
|
|
@ -48,4 +48,4 @@ export class FormsModule {
|
||||||
exports: [InternalFormsSharedModule, REACTIVE_DRIVEN_DIRECTIVES]
|
exports: [InternalFormsSharedModule, REACTIVE_DRIVEN_DIRECTIVES]
|
||||||
})
|
})
|
||||||
export class ReactiveFormsModule {
|
export class ReactiveFormsModule {
|
||||||
}
|
}
|
|
@ -15,14 +15,6 @@ import {INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS} from './src/platform_provid
|
||||||
import {CachedXHR} from './src/xhr/xhr_cache';
|
import {CachedXHR} from './src/xhr/xhr_cache';
|
||||||
import {XHRImpl} from './src/xhr/xhr_impl';
|
import {XHRImpl} from './src/xhr/xhr_impl';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated The compiler providers are already included in the {@link CompilerFactory} that is
|
|
||||||
* contained the {@link browserDynamicPlatform}()`.
|
|
||||||
*/
|
|
||||||
export const BROWSER_APP_COMPILER_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
|
@ -35,11 +27,6 @@ export const CACHED_TEMPLATE_PROVIDER: Array<any /*Type | Provider | any[]*/> =
|
||||||
export const platformBrowserDynamic = createPlatformFactory(
|
export const platformBrowserDynamic = createPlatformFactory(
|
||||||
platformCoreDynamic, 'browserDynamic', INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS);
|
platformCoreDynamic, 'browserDynamic', INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS);
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link platformBrowserDynamic} instead
|
|
||||||
*/
|
|
||||||
export const browserDynamicPlatform = platformBrowserDynamic;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bootstrapping for Angular applications.
|
* Bootstrapping for Angular applications.
|
||||||
*
|
*
|
||||||
|
@ -177,44 +164,6 @@ export const platformWorkerAppDynamic =
|
||||||
multi: true
|
multi: true
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link platformWorkerAppDynamic} instead
|
|
||||||
*/
|
|
||||||
export const workerAppDynamicPlatform = platformWorkerAppDynamic;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Create an {@link NgModule} that includes the {@link WorkerAppModule} and use {@link
|
|
||||||
* bootstrapModule}
|
|
||||||
* with the {@link workerAppDynamicPlatform}() instead.
|
|
||||||
*/
|
|
||||||
export function bootstrapWorkerApp<T>(
|
|
||||||
appComponentType: Type<T>,
|
|
||||||
customProviders?: Array<any /*Type | Provider | any[]*/>): Promise<ComponentRef<T>> {
|
|
||||||
console.warn(
|
|
||||||
'bootstrapWorkerApp is deprecated. Create an @NgModule that includes the `WorkerAppModule` and use `bootstrapModule` with the `workerAppDynamicPlatform()` instead.');
|
|
||||||
|
|
||||||
const deprecatedConfiguration = analyzeAppProvidersForDeprecatedConfiguration(customProviders);
|
|
||||||
const declarations = [deprecatedConfiguration.moduleDeclarations.concat([appComponentType])];
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
providers: customProviders,
|
|
||||||
declarations: declarations,
|
|
||||||
imports: [WorkerAppModule],
|
|
||||||
bootstrap: [appComponentType]
|
|
||||||
})
|
|
||||||
class DynamicModule {
|
|
||||||
}
|
|
||||||
|
|
||||||
return platformWorkerAppDynamic()
|
|
||||||
.bootstrapModule(DynamicModule, deprecatedConfiguration.compilerOptions)
|
|
||||||
.then((moduleRef) => {
|
|
||||||
const console = moduleRef.injector.get(Console);
|
|
||||||
deprecatedConfiguration.deprecationMessages.forEach((msg) => console.warn(msg));
|
|
||||||
const appRef: ApplicationRef = moduleRef.injector.get(ApplicationRef);
|
|
||||||
return appRef.components[0];
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function normalizeArray(arr: any[]): any[] {
|
function normalizeArray(arr: any[]): any[] {
|
||||||
return arr ? arr : [];
|
return arr ? arr : [];
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export {BROWSER_APP_PROVIDERS, BROWSER_PLATFORM_PROVIDERS, BROWSER_SANITIZATION_PROVIDERS, BrowserModule, browserPlatform, platformBrowser} from './src/browser';
|
export {BROWSER_SANITIZATION_PROVIDERS, BrowserModule, platformBrowser} from './src/browser';
|
||||||
export {BrowserPlatformLocation} from './src/browser/location/browser_platform_location';
|
export {BrowserPlatformLocation} from './src/browser/location/browser_platform_location';
|
||||||
export {Title} from './src/browser/title';
|
export {Title} from './src/browser/title';
|
||||||
export {disableDebugTools, enableDebugTools} from './src/browser/tools/tools';
|
export {disableDebugTools, enableDebugTools} from './src/browser/tools/tools';
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {CommonModule, PlatformLocation} from '@angular/common';
|
import {CommonModule, PlatformLocation} from '@angular/common';
|
||||||
import {ApplicationModule, ExceptionHandler, NgModule, NgModuleFactory, NgModuleRef, NgZone, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, RootRenderer, SanitizationService, Testability, assertPlatform, createPlatform, createPlatformFactory, getPlatform, isDevMode, platformCore} from '@angular/core';
|
import {ApplicationModule, ExceptionHandler, NgModule, NgModuleFactory, NgModuleRef, NgZone, OpaqueToken, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, RootRenderer, SanitizationService, Testability, assertPlatform, createPlatform, createPlatformFactory, getPlatform, isDevMode, platformCore} from '@angular/core';
|
||||||
|
|
||||||
import {wtfInit} from '../core_private';
|
import {wtfInit} from '../core_private';
|
||||||
import {AnimationDriver} from '../src/dom/animation_driver';
|
import {AnimationDriver} from '../src/dom/animation_driver';
|
||||||
|
@ -33,17 +33,6 @@ export const INTERNAL_BROWSER_PLATFORM_PROVIDERS: Array<any /*Type | Provider |
|
||||||
{provide: PlatformLocation, useClass: BrowserPlatformLocation}
|
{provide: PlatformLocation, useClass: BrowserPlatformLocation}
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* A set of providers to initialize the Angular platform in a web browser.
|
|
||||||
*
|
|
||||||
* Used automatically by `bootstrap`, or can be passed to `platform`.
|
|
||||||
*
|
|
||||||
* @deprecated Use `platformBrowser()` or create a custom platform factory via
|
|
||||||
* `createPlatformFactory(platformBrowser, ...)`
|
|
||||||
*/
|
|
||||||
export const BROWSER_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
|
|
||||||
[PLATFORM_COMMON_PROVIDERS, INTERNAL_BROWSER_PLATFORM_PROVIDERS];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @security Replacing built-in sanitization providers exposes the application to XSS risks.
|
* @security Replacing built-in sanitization providers exposes the application to XSS risks.
|
||||||
* Attacker-controlled data introduced by an unsanitized provider could expose your
|
* Attacker-controlled data introduced by an unsanitized provider could expose your
|
||||||
|
@ -55,30 +44,12 @@ export const BROWSER_SANITIZATION_PROVIDERS: Array<any> = [
|
||||||
{provide: DomSanitizationService, useClass: DomSanitizationServiceImpl},
|
{provide: DomSanitizationService, useClass: DomSanitizationServiceImpl},
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* A set of providers to initialize an Angular application in a web browser.
|
|
||||||
*
|
|
||||||
* Used automatically by `bootstrap`, or can be passed to {@link PlatformRef
|
|
||||||
* PlatformRef.application}.
|
|
||||||
*
|
|
||||||
* @deprecated Create a module that includes `BrowserModule` instead. This is empty for backwards
|
|
||||||
* compatibility,
|
|
||||||
* as all of our bootstrap methods add a module implicitly, i.e. keeping this filled would add the
|
|
||||||
* providers 2x.
|
|
||||||
*/
|
|
||||||
export const BROWSER_APP_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @experimental API related to bootstrapping are still under review.
|
* @experimental API related to bootstrapping are still under review.
|
||||||
*/
|
*/
|
||||||
export const platformBrowser =
|
export const platformBrowser =
|
||||||
createPlatformFactory(platformCore, 'browser', INTERNAL_BROWSER_PLATFORM_PROVIDERS);
|
createPlatformFactory(platformCore, 'browser', INTERNAL_BROWSER_PLATFORM_PROVIDERS);
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link platformBrowser} instead
|
|
||||||
*/
|
|
||||||
export const browserPlatform = platformBrowser;
|
|
||||||
|
|
||||||
export function initDomAdapter() {
|
export function initDomAdapter() {
|
||||||
BrowserDomAdapter.makeCurrent();
|
BrowserDomAdapter.makeCurrent();
|
||||||
wtfInit();
|
wtfInit();
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {CommonModule} from '@angular/common';
|
import {CommonModule} from '@angular/common';
|
||||||
import {APP_INITIALIZER, ApplicationModule, ExceptionHandler, NgModule, NgZone, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PlatformRef, ReflectiveInjector, RootRenderer, assertPlatform, createPlatform, createPlatformFactory, getPlatform, platformCore} from '@angular/core';
|
import {APP_INITIALIZER, ApplicationModule, ExceptionHandler, NgModule, NgZone, OpaqueToken, PlatformRef, ReflectiveInjector, RootRenderer, assertPlatform, createPlatform, createPlatformFactory, getPlatform, platformCore} from '@angular/core';
|
||||||
|
|
||||||
import {BROWSER_SANITIZATION_PROVIDERS} from './browser';
|
import {BROWSER_SANITIZATION_PROVIDERS} from './browser';
|
||||||
import {isBlank, print} from './facade/lang';
|
import {isBlank, print} from './facade/lang';
|
||||||
|
@ -28,31 +28,11 @@ class PrintLogger {
|
||||||
logGroupEnd() {}
|
logGroupEnd() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `platformWorkerApp()` or create a custom platform factory via
|
|
||||||
* `createPlatformFactory(platformWorkerApp, ...)`
|
|
||||||
*/
|
|
||||||
export const WORKER_APP_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
|
|
||||||
PLATFORM_COMMON_PROVIDERS;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Create a module that includes `WorkerAppModule` instead. This is empty for backwards
|
|
||||||
* compatibility,
|
|
||||||
* as all of our bootstrap methods add a module implicitly, i.e. keeping this filled would add the
|
|
||||||
* providers 2x.
|
|
||||||
*/
|
|
||||||
export const WORKER_APP_APPLICATION_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
export const platformWorkerApp = createPlatformFactory(platformCore, 'workerApp');
|
export const platformWorkerApp = createPlatformFactory(platformCore, 'workerApp');
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link platformWorkerApp} instead
|
|
||||||
*/
|
|
||||||
export const workerAppPlatform = platformWorkerApp;
|
|
||||||
|
|
||||||
function _exceptionHandler(): ExceptionHandler {
|
function _exceptionHandler(): ExceptionHandler {
|
||||||
return new ExceptionHandler(new PrintLogger());
|
return new ExceptionHandler(new PrintLogger());
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {BaseException, ExceptionHandler, Injectable, Injector, NgZone, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, RootRenderer, Testability, assertPlatform, createPlatform, createPlatformFactory, getPlatform, isDevMode, platformCore} from '@angular/core';
|
import {BaseException, ExceptionHandler, Injectable, Injector, NgZone, OpaqueToken, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, RootRenderer, Testability, assertPlatform, createPlatform, createPlatformFactory, getPlatform, isDevMode, platformCore} from '@angular/core';
|
||||||
|
|
||||||
import {wtfInit} from '../core_private';
|
import {wtfInit} from '../core_private';
|
||||||
|
|
||||||
|
@ -105,18 +105,6 @@ export const _WORKER_UI_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*
|
||||||
{provide: MessageBus, useFactory: messageBusFactory, deps: [WebWorkerInstance]}
|
{provide: MessageBus, useFactory: messageBusFactory, deps: [WebWorkerInstance]}
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* * @deprecated Use `platformWorkerUi()` or create a custom platform factory via
|
|
||||||
* `createPlatformFactory(platformWorkerUi, ...)`
|
|
||||||
*/
|
|
||||||
export const WORKER_UI_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
|
|
||||||
[PLATFORM_COMMON_PROVIDERS, _WORKER_UI_PLATFORM_PROVIDERS];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Worker UI only has a platform but no application
|
|
||||||
*/
|
|
||||||
export const WORKER_UI_APPLICATION_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [];
|
|
||||||
|
|
||||||
function initializeGenericWorkerRenderer(injector: Injector) {
|
function initializeGenericWorkerRenderer(injector: Injector) {
|
||||||
var bus = injector.get(MessageBus);
|
var bus = injector.get(MessageBus);
|
||||||
let zone = injector.get(NgZone);
|
let zone = injector.get(NgZone);
|
||||||
|
@ -157,12 +145,6 @@ function initWebWorkerRenderPlatform(injector: Injector): () => void {
|
||||||
export const platformWorkerUi =
|
export const platformWorkerUi =
|
||||||
createPlatformFactory(platformCore, 'workerUi', _WORKER_UI_PLATFORM_PROVIDERS);
|
createPlatformFactory(platformCore, 'workerUi', _WORKER_UI_PLATFORM_PROVIDERS);
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link platformWorkerUi} instead
|
|
||||||
*/
|
|
||||||
export const workerUiPlatform = platformWorkerUi;
|
|
||||||
|
|
||||||
|
|
||||||
function _exceptionHandler(): ExceptionHandler {
|
function _exceptionHandler(): ExceptionHandler {
|
||||||
return new ExceptionHandler(getDOM());
|
return new ExceptionHandler(getDOM());
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {XHR} from '@angular/compiler';
|
import {XHR} from '@angular/compiler';
|
||||||
import {APP_INITIALIZER, CUSTOM_ELEMENTS_SCHEMA, Component, Directive, ExceptionHandler, Inject, Input, NgModule, OnDestroy, PLATFORM_DIRECTIVES, PLATFORM_INITIALIZER, PLATFORM_PIPES, Pipe, ReflectiveInjector, createPlatform, createPlatformFactory, provide} from '@angular/core';
|
import {APP_INITIALIZER, CUSTOM_ELEMENTS_SCHEMA, Component, Directive, ExceptionHandler, Inject, Input, NgModule, OnDestroy, PLATFORM_INITIALIZER, Pipe, ReflectiveInjector, createPlatform, createPlatformFactory, provide} from '@angular/core';
|
||||||
import {ApplicationRef, destroyPlatform} from '@angular/core/src/application_ref';
|
import {ApplicationRef, destroyPlatform} from '@angular/core/src/application_ref';
|
||||||
import {Console} from '@angular/core/src/console';
|
import {Console} from '@angular/core/src/console';
|
||||||
import {ComponentRef} from '@angular/core/src/linker/component_factory';
|
import {ComponentRef} from '@angular/core/src/linker/component_factory';
|
||||||
|
@ -311,27 +311,6 @@ export function main() {
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Note: This will soon be deprecated as bootstrap creates a separate injector for the compiler,
|
|
||||||
// i.e. such providers needs to go into that injecotr (when calling `browserCompiler`);
|
|
||||||
it('should still allow to provide platform directives/pipes via the regular providers',
|
|
||||||
inject([Console, AsyncTestCompleter], (console: DummyConsole, async: AsyncTestCompleter) => {
|
|
||||||
bootstrap(HelloCmpUsingPlatformDirectiveAndPipe, testProviders.concat([
|
|
||||||
{provide: PLATFORM_DIRECTIVES, useValue: [SomeDirective]},
|
|
||||||
{provide: PLATFORM_PIPES, useValue: [SomePipe]}
|
|
||||||
])).then((compRef) => {
|
|
||||||
let compFixture = new ComponentFixture(compRef, null, null);
|
|
||||||
compFixture.detectChanges();
|
|
||||||
expect(compFixture.debugElement.children[0].properties['title'])
|
|
||||||
.toBe('transformed someValue');
|
|
||||||
|
|
||||||
expect(compilerConsole.warnings).toEqual([
|
|
||||||
`The PLATFORM_DIRECTIVES provider and CompilerConfig.platformDirectives is deprecated. Add the directives to an NgModule instead! (Directives: ${stringify(SomeDirective)})`,
|
|
||||||
`The PLATFORM_PIPES provider and CompilerConfig.platformPipes is deprecated. Add the pipes to an NgModule instead! (Pipes: ${stringify(SomePipe)})`
|
|
||||||
]);
|
|
||||||
async.done();
|
|
||||||
});
|
|
||||||
}));
|
|
||||||
|
|
||||||
it('should allow to pass schemas', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
it('should allow to pass schemas', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||||
bootstrap(HelloCmpUsingCustomElement, testProviders).then((compRef) => {
|
bootstrap(HelloCmpUsingCustomElement, testProviders).then((compRef) => {
|
||||||
expect(el).toHaveText('hello world!');
|
expect(el).toHaveText('hello world!');
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {LocationStrategy} from '@angular/common';
|
import {LocationStrategy} from '@angular/common';
|
||||||
import {APP_ID, NgModule, NgZone, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, assertPlatform, createPlatform, createPlatformFactory, getPlatform, platformCore} from '@angular/core';
|
import {APP_ID, NgModule, NgZone, OpaqueToken, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, assertPlatform, createPlatform, createPlatformFactory, getPlatform, platformCore} from '@angular/core';
|
||||||
|
|
||||||
import {BrowserModule} from '../src/browser';
|
import {BrowserModule} from '../src/browser';
|
||||||
import {BrowserDomAdapter} from '../src/browser/browser_adapter';
|
import {BrowserDomAdapter} from '../src/browser/browser_adapter';
|
||||||
|
|
|
@ -6,4 +6,4 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export {SERVER_PLATFORM_PROVIDERS, platformDynamicServer, platformServer, serverBootstrap, serverDynamicPlatform, serverPlatform} from './src/server';
|
export {ServerModule, platformDynamicServer, platformServer} from './src/server';
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
import {PlatformLocation} from '@angular/common';
|
import {PlatformLocation} from '@angular/common';
|
||||||
import {analyzeAppProvidersForDeprecatedConfiguration, platformCoreDynamic} from '@angular/compiler';
|
import {analyzeAppProvidersForDeprecatedConfiguration, platformCoreDynamic} from '@angular/compiler';
|
||||||
import {ApplicationRef, ComponentRef, NgModule, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, PlatformRef, Type, createPlatformFactory, platformCore} from '@angular/core';
|
import {ApplicationRef, ComponentRef, NgModule, PLATFORM_INITIALIZER, PlatformRef, Type, createPlatformFactory, platformCore} from '@angular/core';
|
||||||
import {BrowserModule} from '@angular/platform-browser';
|
import {BrowserModule} from '@angular/platform-browser';
|
||||||
|
|
||||||
import {Console, ReflectionCapabilities, reflector, wtfInit} from '../core_private';
|
import {Console, ReflectionCapabilities, reflector, wtfInit} from '../core_private';
|
||||||
|
@ -37,89 +37,30 @@ export const INTERNAL_SERVER_PLATFORM_PROVIDERS: Array<any /*Type | Provider | a
|
||||||
{provide: PlatformLocation, useClass: ServerPlatformLocation},
|
{provide: PlatformLocation, useClass: ServerPlatformLocation},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A set of providers to initialize the Angular platform in a server.
|
|
||||||
*
|
|
||||||
* Used automatically by `serverBootstrap`, or can be passed to `platform`.
|
|
||||||
* @deprecated Use `platformServer()` or create a custom platform factory via
|
|
||||||
* `createPlatformFactory(platformServer, ...)`
|
|
||||||
*/
|
|
||||||
export const SERVER_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
|
|
||||||
[PLATFORM_COMMON_PROVIDERS, INTERNAL_SERVER_PLATFORM_PROVIDERS];
|
|
||||||
|
|
||||||
function initParse5Adapter() {
|
function initParse5Adapter() {
|
||||||
Parse5DomAdapter.makeCurrent();
|
Parse5DomAdapter.makeCurrent();
|
||||||
wtfInit();
|
wtfInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ng module for the server.
|
||||||
|
*
|
||||||
|
* @experimental
|
||||||
|
*/
|
||||||
|
@NgModule({imports: [BrowserModule]})
|
||||||
|
export class ServerModule {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
export const platformServer =
|
export const platformServer =
|
||||||
createPlatformFactory(platformCore, 'server', INTERNAL_SERVER_PLATFORM_PROVIDERS);
|
createPlatformFactory(platformCore, 'server', INTERNAL_SERVER_PLATFORM_PROVIDERS);
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link platformServer} instead
|
|
||||||
*/
|
|
||||||
export const serverPlatform = platformServer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The server platform that supports the runtime compiler.
|
* The server platform that supports the runtime compiler.
|
||||||
*
|
*
|
||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
export const platformDynamicServer =
|
export const platformDynamicServer =
|
||||||
createPlatformFactory(platformCoreDynamic, 'serverDynamic', INTERNAL_SERVER_PLATFORM_PROVIDERS);
|
createPlatformFactory(platformCoreDynamic, 'serverDynamic', INTERNAL_SERVER_PLATFORM_PROVIDERS);
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link platformDynamicServer} instead
|
|
||||||
*/
|
|
||||||
export const serverDynamicPlatform = platformDynamicServer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to bootstrap Angular in server environment (such as node).
|
|
||||||
*
|
|
||||||
* This version of bootstrap only creates platform injector and does not define anything for
|
|
||||||
* application injector. It is expected that application providers are imported from other
|
|
||||||
* packages such as `@angular/platform-browser` or `@angular/platform-browser-dynamic`.
|
|
||||||
*
|
|
||||||
* ```
|
|
||||||
* import {BROWSER_APP_PROVIDERS} from '@angular/platform-browser';
|
|
||||||
* import {BROWSER_APP_COMPILER_PROVIDERS} from '@angular/platform-browser-dynamic';
|
|
||||||
*
|
|
||||||
* serverBootstrap(..., [BROWSER_APP_PROVIDERS, BROWSER_APP_COMPILER_PROVIDERS])
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @deprecated create an {@link NgModule} and use {@link bootstrapModule} with the {@link
|
|
||||||
* serverDynamicPlatform}()
|
|
||||||
* instead.
|
|
||||||
*/
|
|
||||||
export function serverBootstrap<T>(
|
|
||||||
appComponentType: Type<T>,
|
|
||||||
customProviders: Array<any /*Type | Provider | any[]*/>): Promise<ComponentRef<T>> {
|
|
||||||
console.warn(
|
|
||||||
'serverBootstrap is deprecated. Create an @NgModule and use `bootstrapModule` with the `serverDynamicPlatform()` instead.');
|
|
||||||
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
|
||||||
|
|
||||||
const deprecatedConfiguration = analyzeAppProvidersForDeprecatedConfiguration(customProviders);
|
|
||||||
const declarations = [deprecatedConfiguration.moduleDeclarations.concat([appComponentType])];
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
providers: customProviders,
|
|
||||||
declarations: declarations,
|
|
||||||
imports: [BrowserModule],
|
|
||||||
bootstrap: [appComponentType]
|
|
||||||
})
|
|
||||||
class DynamicModule {
|
|
||||||
}
|
|
||||||
|
|
||||||
return platformDynamicServer()
|
|
||||||
.bootstrapModule(DynamicModule, deprecatedConfiguration.compilerOptions)
|
|
||||||
.then((moduleRef) => {
|
|
||||||
const console = moduleRef.injector.get(Console);
|
|
||||||
deprecatedConfiguration.deprecationMessages.forEach((msg) => console.warn(msg));
|
|
||||||
const appRef: ApplicationRef = moduleRef.injector.get(ApplicationRef);
|
|
||||||
return appRef.components[0];
|
|
||||||
});
|
|
||||||
}
|
|
|
@ -6,12 +6,10 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Component, destroyPlatform} from '@angular/core';
|
import {Component, NgModule, destroyPlatform} from '@angular/core';
|
||||||
import {async} from '@angular/core/testing';
|
import {async} from '@angular/core/testing';
|
||||||
import {BROWSER_APP_PROVIDERS} from '@angular/platform-browser';
|
|
||||||
import {BROWSER_APP_COMPILER_PROVIDERS} from '@angular/platform-browser-dynamic';
|
|
||||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
||||||
import {serverBootstrap} from '@angular/platform-server';
|
import {ServerModule, platformDynamicServer} from '@angular/platform-server';
|
||||||
|
|
||||||
function writeBody(html: string): any {
|
function writeBody(html: string): any {
|
||||||
var dom = getDOM();
|
var dom = getDOM();
|
||||||
|
@ -21,6 +19,15 @@ function writeBody(html: string): any {
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Component({selector: 'app', template: `Works!`})
|
||||||
|
class MyServerApp {
|
||||||
|
}
|
||||||
|
|
||||||
|
@NgModule({imports: [ServerModule], bootstrap: [MyServerApp]})
|
||||||
|
class ExampleModule {
|
||||||
|
}
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
if (getDOM().supportsDOMEvents()) return; // NODE only
|
if (getDOM().supportsDOMEvents()) return; // NODE only
|
||||||
|
|
||||||
|
@ -31,13 +38,9 @@ export function main() {
|
||||||
|
|
||||||
it('should bootstrap', async(() => {
|
it('should bootstrap', async(() => {
|
||||||
var body = writeBody('<app></app>');
|
var body = writeBody('<app></app>');
|
||||||
serverBootstrap(MyServerApp, [
|
platformDynamicServer().bootstrapModule(ExampleModule).then(() => {
|
||||||
BROWSER_APP_PROVIDERS, BROWSER_APP_COMPILER_PROVIDERS
|
expect(getDOM().getText(body)).toEqual('Works!');
|
||||||
]).then(() => { expect(getDOM().getText(body)).toEqual('Works!'); });
|
});
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component({selector: 'app', template: `Works!`})
|
|
||||||
class MyServerApp {
|
|
||||||
}
|
|
||||||
|
|
|
@ -6,10 +6,16 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {bootstrapWorkerApp} from '@angular/platform-browser-dynamic';
|
import {NgModule} from '@angular/core';
|
||||||
|
import {WorkerAppModule} from '@angular/platform-browser';
|
||||||
|
import {platformWorkerAppDynamic} from '@angular/platform-browser-dynamic';
|
||||||
|
|
||||||
import {ImageDemo} from './index_common';
|
import {ImageDemo} from './index_common';
|
||||||
|
|
||||||
export function main() {
|
@NgModule({imports: [WorkerAppModule], bootstrap: [ImageDemo]})
|
||||||
bootstrapWorkerApp(ImageDemo);
|
class ExampleModule {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function main() {
|
||||||
|
platformWorkerAppDynamic().bootstrapModule(ExampleModule);
|
||||||
|
}
|
|
@ -6,10 +6,16 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {bootstrapWorkerApp} from '@angular/platform-browser-dynamic';
|
import {NgModule} from '@angular/core';
|
||||||
|
import {WorkerAppModule} from '@angular/platform-browser';
|
||||||
|
import {platformWorkerAppDynamic} from '@angular/platform-browser-dynamic';
|
||||||
|
|
||||||
import {InputCmp} from './index_common';
|
import {InputCmp} from './index_common';
|
||||||
|
|
||||||
export function main() {
|
@NgModule({imports: [WorkerAppModule], bootstrap: [InputCmp]})
|
||||||
bootstrapWorkerApp(InputCmp);
|
class ExampleModule {
|
||||||
|
}
|
||||||
|
|
||||||
|
export function main() {
|
||||||
|
platformWorkerAppDynamic().bootstrapModule(ExampleModule);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,10 +6,16 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {bootstrapWorkerApp} from '@angular/platform-browser-dynamic';
|
import {NgModule} from '@angular/core';
|
||||||
|
import {WorkerAppModule} from '@angular/platform-browser';
|
||||||
|
import {platformWorkerAppDynamic} from '@angular/platform-browser-dynamic';
|
||||||
|
|
||||||
import {HelloCmp} from './index_common';
|
import {HelloCmp} from './index_common';
|
||||||
|
|
||||||
export function main() {
|
@NgModule({imports: [WorkerAppModule], bootstrap: [HelloCmp]})
|
||||||
bootstrapWorkerApp(HelloCmp);
|
class ExampleModule {
|
||||||
|
}
|
||||||
|
|
||||||
|
export function main() {
|
||||||
|
platformWorkerAppDynamic().bootstrapModule(ExampleModule);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,16 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {bootstrapWorkerApp} from '@angular/platform-browser-dynamic';
|
import {NgModule} from '@angular/core';
|
||||||
|
import {WorkerAppModule} from '@angular/platform-browser';
|
||||||
|
import {platformWorkerAppDynamic} from '@angular/platform-browser-dynamic';
|
||||||
|
|
||||||
import {App} from './index_common';
|
import {App} from './index_common';
|
||||||
|
|
||||||
export function main() {
|
@NgModule({imports: [WorkerAppModule], bootstrap: [App]})
|
||||||
bootstrapWorkerApp(App);
|
class ExampleModule {
|
||||||
|
}
|
||||||
|
|
||||||
|
export function main() {
|
||||||
|
platformWorkerAppDynamic().bootstrapModule(ExampleModule);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,10 +6,16 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {bootstrapWorkerApp} from '@angular/platform-browser-dynamic';
|
import {NgModule} from '@angular/core';
|
||||||
|
import {WorkerAppModule} from '@angular/platform-browser';
|
||||||
|
import {platformWorkerAppDynamic} from '@angular/platform-browser-dynamic';
|
||||||
|
|
||||||
import {TodoApp} from './index_common';
|
import {TodoApp} from './index_common';
|
||||||
|
|
||||||
export function main() {
|
@NgModule({imports: [WorkerAppModule], bootstrap: [TodoApp]})
|
||||||
bootstrapWorkerApp(TodoApp);
|
class ExampleModule {
|
||||||
|
}
|
||||||
|
|
||||||
|
export function main() {
|
||||||
|
platformWorkerAppDynamic().bootstrapModule(ExampleModule);
|
||||||
}
|
}
|
||||||
|
|
|
@ -964,18 +964,9 @@ export interface PipeTransform {
|
||||||
transform(value: any, ...args: any[]): any;
|
transform(value: any, ...args: any[]): any;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated */
|
|
||||||
export declare const PLATFORM_COMMON_PROVIDERS: any[];
|
|
||||||
|
|
||||||
/** @deprecated */
|
|
||||||
export declare const PLATFORM_DIRECTIVES: OpaqueToken;
|
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare const PLATFORM_INITIALIZER: any;
|
export declare const PLATFORM_INITIALIZER: any;
|
||||||
|
|
||||||
/** @deprecated */
|
|
||||||
export declare const PLATFORM_PIPES: OpaqueToken;
|
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare const platformCore: (extraProviders?: any[]) => PlatformRef;
|
export declare const platformCore: (extraProviders?: any[]) => PlatformRef;
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,9 @@
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
export declare function bootstrap<C>(appComponentType: Type<C>, customProviders?: Array<any>): Promise<ComponentRef<C>>;
|
export declare function bootstrap<C>(appComponentType: Type<C>, customProviders?: Array<any>): Promise<ComponentRef<C>>;
|
||||||
|
|
||||||
/** @deprecated */
|
|
||||||
export declare function bootstrapWorkerApp<T>(appComponentType: Type<T>, customProviders?: Array<any>): Promise<ComponentRef<T>>;
|
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare function bootstrapWorkerUi(workerScriptUri: string, customProviders?: Array<any>): Promise<PlatformRef>;
|
export declare function bootstrapWorkerUi(workerScriptUri: string, customProviders?: Array<any>): Promise<PlatformRef>;
|
||||||
|
|
||||||
/** @deprecated */
|
|
||||||
export declare const BROWSER_APP_COMPILER_PROVIDERS: Array<any>;
|
|
||||||
|
|
||||||
/** @deprecated */
|
|
||||||
export declare const browserDynamicPlatform: (extraProviders?: any[]) => PlatformRef;
|
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare const CACHED_TEMPLATE_PROVIDER: Array<any>;
|
export declare const CACHED_TEMPLATE_PROVIDER: Array<any>;
|
||||||
|
|
||||||
|
@ -21,6 +12,3 @@ export declare const platformBrowserDynamic: (extraProviders?: any[]) => Platfor
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare const platformWorkerAppDynamic: (extraProviders?: any[]) => PlatformRef;
|
export declare const platformWorkerAppDynamic: (extraProviders?: any[]) => PlatformRef;
|
||||||
|
|
||||||
/** @deprecated */
|
|
||||||
export declare const workerAppDynamicPlatform: (extraProviders?: any[]) => PlatformRef;
|
|
||||||
|
|
|
@ -7,12 +7,6 @@ export declare abstract class AnimationDriver {
|
||||||
static NOOP: AnimationDriver;
|
static NOOP: AnimationDriver;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated */
|
|
||||||
export declare const BROWSER_APP_PROVIDERS: Array<any>;
|
|
||||||
|
|
||||||
/** @deprecated */
|
|
||||||
export declare const BROWSER_PLATFORM_PROVIDERS: Array<any>;
|
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare const BROWSER_SANITIZATION_PROVIDERS: Array<any>;
|
export declare const BROWSER_SANITIZATION_PROVIDERS: Array<any>;
|
||||||
|
|
||||||
|
@ -20,9 +14,6 @@ export declare const BROWSER_SANITIZATION_PROVIDERS: Array<any>;
|
||||||
export declare class BrowserModule {
|
export declare class BrowserModule {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated */
|
|
||||||
export declare const browserPlatform: (extraProviders?: any[]) => PlatformRef;
|
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export declare class BrowserPlatformLocation extends PlatformLocation {
|
export declare class BrowserPlatformLocation extends PlatformLocation {
|
||||||
hash: string;
|
hash: string;
|
||||||
|
@ -203,9 +194,6 @@ export declare class WebWorkerInstance {
|
||||||
worker: Worker;
|
worker: Worker;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated */
|
|
||||||
export declare const WORKER_APP_APPLICATION_PROVIDERS: Array<any>;
|
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare const WORKER_APP_LOCATION_PROVIDERS: ({
|
export declare const WORKER_APP_LOCATION_PROVIDERS: ({
|
||||||
provide: typeof PlatformLocation;
|
provide: typeof PlatformLocation;
|
||||||
|
@ -217,15 +205,9 @@ export declare const WORKER_APP_LOCATION_PROVIDERS: ({
|
||||||
deps: (typeof PlatformLocation | typeof NgZone)[];
|
deps: (typeof PlatformLocation | typeof NgZone)[];
|
||||||
})[];
|
})[];
|
||||||
|
|
||||||
/** @deprecated */
|
|
||||||
export declare const WORKER_APP_PLATFORM_PROVIDERS: Array<any>;
|
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare const WORKER_SCRIPT: OpaqueToken;
|
export declare const WORKER_SCRIPT: OpaqueToken;
|
||||||
|
|
||||||
/** @deprecated */
|
|
||||||
export declare const WORKER_UI_APPLICATION_PROVIDERS: Array<any>;
|
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare const WORKER_UI_LOCATION_PROVIDERS: (typeof MessageBasedPlatformLocation | typeof BrowserPlatformLocation | {
|
export declare const WORKER_UI_LOCATION_PROVIDERS: (typeof MessageBasedPlatformLocation | typeof BrowserPlatformLocation | {
|
||||||
provide: any;
|
provide: any;
|
||||||
|
@ -234,18 +216,9 @@ export declare const WORKER_UI_LOCATION_PROVIDERS: (typeof MessageBasedPlatformL
|
||||||
deps: typeof Injector[];
|
deps: typeof Injector[];
|
||||||
})[];
|
})[];
|
||||||
|
|
||||||
/** @deprecated */
|
|
||||||
export declare const WORKER_UI_PLATFORM_PROVIDERS: Array<any>;
|
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare const WORKER_UI_STARTABLE_MESSAGING_SERVICE: OpaqueToken;
|
export declare const WORKER_UI_STARTABLE_MESSAGING_SERVICE: OpaqueToken;
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare class WorkerAppModule {
|
export declare class WorkerAppModule {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated */
|
|
||||||
export declare const workerAppPlatform: (extraProviders?: any[]) => PlatformRef;
|
|
||||||
|
|
||||||
/** @deprecated */
|
|
||||||
export declare const workerUiPlatform: (extraProviders?: any[]) => PlatformRef;
|
|
||||||
|
|
|
@ -4,14 +4,6 @@ export declare const platformDynamicServer: (extraProviders?: any[]) => Platform
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare const platformServer: (extraProviders?: any[]) => PlatformRef;
|
export declare const platformServer: (extraProviders?: any[]) => PlatformRef;
|
||||||
|
|
||||||
/** @deprecated */
|
/** @experimental */
|
||||||
export declare const SERVER_PLATFORM_PROVIDERS: Array<any>;
|
export declare class ServerModule {
|
||||||
|
}
|
||||||
/** @deprecated */
|
|
||||||
export declare function serverBootstrap<T>(appComponentType: Type<T>, customProviders: Array<any>): Promise<ComponentRef<T>>;
|
|
||||||
|
|
||||||
/** @deprecated */
|
|
||||||
export declare const serverDynamicPlatform: (extraProviders?: any[]) => PlatformRef;
|
|
||||||
|
|
||||||
/** @deprecated */
|
|
||||||
export declare const serverPlatform: (extraProviders?: any[]) => PlatformRef;
|
|
||||||
|
|
Loading…
Reference in New Issue