Revert "fix: cleanup public api of platform-server"
This reverts commit ac84468f1c
.
This commit is contained in:
parent
80deac5cde
commit
d44d0852e5
|
@ -1,8 +1,9 @@
|
||||||
import {__core_private__ as r, __core_private_types__ as t} from '@angular/core';
|
import {__core_private__ as r, __core_private_types__ as t} from '@angular/core';
|
||||||
|
|
||||||
export var reflector: typeof t.reflector = r.reflector;
|
export type NoOpAnimationPlayer = t.NoOpAnimationPlayer;
|
||||||
export var ReflectionCapabilities: typeof t.ReflectionCapabilities = r.ReflectionCapabilities;
|
export var NoOpAnimationPlayer: typeof t.NoOpAnimationPlayer = r.NoOpAnimationPlayer;
|
||||||
export var wtfInit: typeof t.wtfInit = r.wtfInit;
|
export type AnimationPlayer = t.AnimationPlayer;
|
||||||
|
export var AnimationPlayer: typeof t.AnimationPlayer = r.AnimationPlayer;
|
||||||
export type NoOpAnimationDriver = t.NoOpAnimationDriver;
|
export type NoOpAnimationDriver = t.NoOpAnimationDriver;
|
||||||
export var NoOpAnimationDriver: typeof t.NoOpAnimationDriver = r.NoOpAnimationDriver;
|
export var NoOpAnimationDriver: typeof t.NoOpAnimationDriver = r.NoOpAnimationDriver;
|
||||||
export type AnimationDriver = t.AnimationDriver;
|
export type AnimationDriver = t.AnimationDriver;
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
// TODO: vsavkin add SERVER_PROVIDERS and SERVER_APPLICATION_PROVIDERS
|
// TODO: vsavkin add SERVER_PROVIDERS and SERVER_APP_PROVIDERS
|
||||||
export 'package:angular2/src/platform/server/html_adapter.dart';
|
export 'package:angular2/src/platform/server/html_adapter.dart';
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
export {SERVER_APPLICATION_PROVIDERS, SERVER_PLATFORM_PROVIDERS, serverBootstrap} from './src/server';
|
// TODO: vsavkin add SERVER_PROVIDERS and SERVER_APP_PROVIDERS
|
||||||
|
export {Parse5DomAdapter} from './src/parse5_adapter';
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
import {PlatformLocation} from '@angular/common';
|
|
||||||
import {ComponentRef, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, Type, assertPlatform, coreLoadAndBootstrap, createPlatform, getPlatform} from '@angular/core';
|
|
||||||
import {BROWSER_APP_PROVIDERS, BrowserPlatformLocation} from '@angular/platform-browser';
|
|
||||||
import {BROWSER_APP_COMPILER_PROVIDERS} from '@angular/platform-browser-dynamic';
|
|
||||||
|
|
||||||
import {ReflectionCapabilities, reflector, wtfInit} from '../core_private';
|
|
||||||
|
|
||||||
import {Parse5DomAdapter} from './parse5_adapter';
|
|
||||||
|
|
||||||
const SERVER_PLATFORM_MARKER = new OpaqueToken('ServerPlatformMarker');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A set of providers to initialize the Angular platform in a server.
|
|
||||||
*
|
|
||||||
* Used automatically by `serverBootstrap`, or can be passed to {@link platform}.
|
|
||||||
*/
|
|
||||||
export const SERVER_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [
|
|
||||||
{provide: SERVER_PLATFORM_MARKER, useValue: true}, PLATFORM_COMMON_PROVIDERS,
|
|
||||||
{provide: PLATFORM_INITIALIZER, useValue: initParse5Adapter, multi: true},
|
|
||||||
{provide: PlatformLocation, useClass: BrowserPlatformLocation}
|
|
||||||
];
|
|
||||||
|
|
||||||
export const SERVER_APPLICATION_PROVIDERS: Array<any> =
|
|
||||||
[BROWSER_APP_PROVIDERS, BROWSER_APP_COMPILER_PROVIDERS];
|
|
||||||
|
|
||||||
function initParse5Adapter() {
|
|
||||||
Parse5DomAdapter.makeCurrent();
|
|
||||||
wtfInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export function serverPlatform(): PlatformRef {
|
|
||||||
if (!getPlatform()) {
|
|
||||||
createPlatform(ReflectiveInjector.resolveAndCreate(SERVER_PLATFORM_PROVIDERS));
|
|
||||||
}
|
|
||||||
return assertPlatform(SERVER_PLATFORM_MARKER);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export function serverBootstrap(
|
|
||||||
appComponentType: Type,
|
|
||||||
customProviders?: Array<any /*Type | Provider | any[]*/>): Promise<ComponentRef<any>> {
|
|
||||||
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
|
||||||
let providers = [SERVER_APPLICATION_PROVIDERS, customProviders || []];
|
|
||||||
var appInjector = ReflectiveInjector.resolveAndCreate(providers, serverPlatform().injector);
|
|
||||||
return coreLoadAndBootstrap(appComponentType, appInjector);
|
|
||||||
}
|
|
|
@ -1,34 +0,0 @@
|
||||||
import {Component, disposePlatform} from '@angular/core';
|
|
||||||
import {afterEach, async, beforeEach, ddescribe, describe, expect, iit, inject, it, xdescribe, xit} from '@angular/core/testing';
|
|
||||||
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
|
|
||||||
import {serverBootstrap} from '@angular/platform-server';
|
|
||||||
|
|
||||||
import {Parse5DomAdapter} from '../src/parse5_adapter';
|
|
||||||
|
|
||||||
function writeBody(html: string): any {
|
|
||||||
var dom = getDOM();
|
|
||||||
var doc = dom.defaultDoc();
|
|
||||||
var body = dom.querySelector(doc, 'body');
|
|
||||||
dom.setInnerHTML(body, html);
|
|
||||||
return body;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function main() {
|
|
||||||
if (getDOM().supportsDOMEvents()) return; // NODE only
|
|
||||||
|
|
||||||
describe('platform-server integration', () => {
|
|
||||||
|
|
||||||
afterEach(() => disposePlatform());
|
|
||||||
|
|
||||||
it('should bootstrap', async(() => {
|
|
||||||
var body = writeBody('<app></app>');
|
|
||||||
serverBootstrap(MyServerApp).then(() => {
|
|
||||||
expect(getDOM().getText(body)).toEqual('Works!');
|
|
||||||
});
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Component({selector: 'app', template: `Works!`})
|
|
||||||
class MyServerApp {
|
|
||||||
}
|
|
|
@ -1664,9 +1664,129 @@ const PLATFORM_BROWSER_DYNAMIC_TESTING = [
|
||||||
|
|
||||||
|
|
||||||
const PLATFORM_SERVER = [
|
const PLATFORM_SERVER = [
|
||||||
'const SERVER_APPLICATION_PROVIDERS:Array<any>',
|
'Parse5DomAdapter',
|
||||||
'const SERVER_PLATFORM_PROVIDERS:Array<any>',
|
'Parse5DomAdapter.addClass(element:any, className:string):any',
|
||||||
'serverBootstrap(appComponentType:Type, customProviders?:Array<any>):Promise<ComponentRef<any>>',
|
'Parse5DomAdapter.adoptNode(node:any):any',
|
||||||
|
'Parse5DomAdapter.animate(element:any, keyframes:any[], options:any):any',
|
||||||
|
'Parse5DomAdapter.appendChild(el:any, node:any):any',
|
||||||
|
'Parse5DomAdapter.attributeMap(element:any):Map<string, string>',
|
||||||
|
'Parse5DomAdapter.attrToPropMap:any',
|
||||||
|
'Parse5DomAdapter.cancelAnimationFrame(id:number):any',
|
||||||
|
'Parse5DomAdapter.childNodes(el:any):Node[]',
|
||||||
|
'Parse5DomAdapter.childNodesAsList(el:any):any[]',
|
||||||
|
'Parse5DomAdapter.classList(element:any):string[]',
|
||||||
|
'Parse5DomAdapter.clearNodes(el:any):any',
|
||||||
|
'Parse5DomAdapter.clone(node:Node):Node',
|
||||||
|
'Parse5DomAdapter.content(node:any):string',
|
||||||
|
'Parse5DomAdapter.createComment(text:string):Comment',
|
||||||
|
'Parse5DomAdapter.createElement(tagName:any):HTMLElement',
|
||||||
|
'Parse5DomAdapter.createElementNS(ns:any, tagName:any):HTMLElement',
|
||||||
|
'Parse5DomAdapter.createEvent(eventType:string):Event',
|
||||||
|
'Parse5DomAdapter.createHtmlDocument():Document',
|
||||||
|
'Parse5DomAdapter.createMouseEvent(eventType:any):Event',
|
||||||
|
'Parse5DomAdapter.createScriptTag(attrName:string, attrValue:string):HTMLElement',
|
||||||
|
'Parse5DomAdapter.createShadowRoot(el:any):HTMLElement',
|
||||||
|
'Parse5DomAdapter.createStyleElement(css:string):HTMLStyleElement',
|
||||||
|
'Parse5DomAdapter.createTemplate(html:any):HTMLElement',
|
||||||
|
'Parse5DomAdapter.createTextNode(text:string):Text',
|
||||||
|
'Parse5DomAdapter.defaultDoc():Document',
|
||||||
|
'Parse5DomAdapter.dispatchEvent(el:any, evt:any):any',
|
||||||
|
'Parse5DomAdapter.elementMatches(node:any, selector:string, matcher:any=null):boolean',
|
||||||
|
'Parse5DomAdapter.firstChild(el:any):Node',
|
||||||
|
'Parse5DomAdapter.getAnimationPrefix():string',
|
||||||
|
'Parse5DomAdapter.getAttribute(element:any, attribute:string):string',
|
||||||
|
'Parse5DomAdapter.getAttributeNS(element:any, ns:string, attribute:string):string',
|
||||||
|
'Parse5DomAdapter.getBaseHref():string',
|
||||||
|
'Parse5DomAdapter.getBoundingClientRect(el:any):any',
|
||||||
|
'Parse5DomAdapter.getChecked(el:any):boolean',
|
||||||
|
'Parse5DomAdapter.getComputedStyle(el:any):any',
|
||||||
|
'Parse5DomAdapter.getCookie(name:string):string',
|
||||||
|
'Parse5DomAdapter.getData(el:any, name:string):string',
|
||||||
|
'Parse5DomAdapter.getDistributedNodes(el:any):Node[]',
|
||||||
|
'Parse5DomAdapter.getElementsByClassName(element:any, name:string):HTMLElement[]',
|
||||||
|
'Parse5DomAdapter.getElementsByTagName(element:any, name:string):HTMLElement[]',
|
||||||
|
'Parse5DomAdapter.getEventKey(event:any):string',
|
||||||
|
'Parse5DomAdapter.getGlobalEventTarget(target:string):any',
|
||||||
|
'Parse5DomAdapter.getHistory():History',
|
||||||
|
'Parse5DomAdapter.getHost(el:any):string',
|
||||||
|
'Parse5DomAdapter.getHref(el:any):string',
|
||||||
|
'Parse5DomAdapter.getInnerHTML(el:any):string',
|
||||||
|
'Parse5DomAdapter.getLocation():Location',
|
||||||
|
'Parse5DomAdapter.getOuterHTML(el:any):string',
|
||||||
|
'Parse5DomAdapter.getProperty(el:any, name:string):any',
|
||||||
|
'Parse5DomAdapter.getShadowRoot(el:any):Element',
|
||||||
|
'Parse5DomAdapter.getStyle(element:any, styleName:string):string',
|
||||||
|
'Parse5DomAdapter.getTemplateContent(el:any):Node',
|
||||||
|
'Parse5DomAdapter.getText(el:any, isRecursive?:boolean):string',
|
||||||
|
'Parse5DomAdapter.getTitle():string',
|
||||||
|
'Parse5DomAdapter.getTransitionEnd():string',
|
||||||
|
'Parse5DomAdapter.getUserAgent():string',
|
||||||
|
'Parse5DomAdapter.getValue(el:any):string',
|
||||||
|
'Parse5DomAdapter.getXHR():Type',
|
||||||
|
'Parse5DomAdapter.hasAttribute(element:any, attribute:string):boolean',
|
||||||
|
'Parse5DomAdapter.hasAttributeNS(element:any, ns:string, attribute:string):boolean',
|
||||||
|
'Parse5DomAdapter.hasClass(element:any, className:string):boolean',
|
||||||
|
'Parse5DomAdapter.hasProperty(element:any, name:string):boolean',
|
||||||
|
'Parse5DomAdapter.hasShadowRoot(node:any):boolean',
|
||||||
|
'Parse5DomAdapter.hasStyle(element:any, styleName:string, styleValue:string=null):boolean',
|
||||||
|
'Parse5DomAdapter.importIntoDoc(node:any):any',
|
||||||
|
'Parse5DomAdapter.insertAfter(el:any, node:any):any',
|
||||||
|
'Parse5DomAdapter.insertAllBefore(el:any, nodes:any):any',
|
||||||
|
'Parse5DomAdapter.insertBefore(el:any, node:any):any',
|
||||||
|
'Parse5DomAdapter.invoke(el:Element, methodName:string, args:any[]):any',
|
||||||
|
'Parse5DomAdapter.isCommentNode(node:any):boolean',
|
||||||
|
'Parse5DomAdapter.isElementNode(node:any):boolean',
|
||||||
|
'Parse5DomAdapter.isPrevented(evt:any):boolean',
|
||||||
|
'Parse5DomAdapter.isShadowRoot(node:any):boolean',
|
||||||
|
'Parse5DomAdapter.isTemplateElement(el:any):boolean',
|
||||||
|
'Parse5DomAdapter.isTextNode(node:any):boolean',
|
||||||
|
'Parse5DomAdapter.log(error:any):any',
|
||||||
|
'Parse5DomAdapter.logError(error:any):any',
|
||||||
|
'Parse5DomAdapter.logGroup(error:any):any',
|
||||||
|
'Parse5DomAdapter.logGroupEnd():any',
|
||||||
|
'Parse5DomAdapter.makeCurrent():any',
|
||||||
|
'Parse5DomAdapter.nextSibling(el:any):Node',
|
||||||
|
'Parse5DomAdapter.nodeName(node:any):string',
|
||||||
|
'Parse5DomAdapter.nodeValue(node:any):string',
|
||||||
|
'Parse5DomAdapter.on(el:any, evt:any, listener:any):any',
|
||||||
|
'Parse5DomAdapter.onAndCancel(el:any, evt:any, listener:any):Function',
|
||||||
|
'Parse5DomAdapter.parentElement(el:any):Node',
|
||||||
|
'Parse5DomAdapter.parse(templateHtml:string):any',
|
||||||
|
'Parse5DomAdapter.performanceNow():number',
|
||||||
|
'Parse5DomAdapter.preventDefault(evt:any):any',
|
||||||
|
'Parse5DomAdapter.query(selector:any):any',
|
||||||
|
'Parse5DomAdapter.querySelector(el:any, selector:string):any',
|
||||||
|
'Parse5DomAdapter.querySelectorAll(el:any, selector:string):any[]',
|
||||||
|
'Parse5DomAdapter.remove(el:any):HTMLElement',
|
||||||
|
'Parse5DomAdapter.removeAttribute(element:any, attribute:string):any',
|
||||||
|
'Parse5DomAdapter.removeAttributeNS(element:any, ns:string, name:string):any',
|
||||||
|
'Parse5DomAdapter.removeChild(el:any, node:any):any',
|
||||||
|
'Parse5DomAdapter.removeClass(element:any, className:string):any',
|
||||||
|
'Parse5DomAdapter.removeStyle(element:any, styleName:string):any',
|
||||||
|
'Parse5DomAdapter.replaceChild(el:any, newNode:any, oldNode:any):any',
|
||||||
|
'Parse5DomAdapter.requestAnimationFrame(callback:any):number',
|
||||||
|
'Parse5DomAdapter.resetBaseElement():void',
|
||||||
|
'Parse5DomAdapter.resolveAndSetHref(el:any, baseUrl:string, href:string):any',
|
||||||
|
'Parse5DomAdapter.setAttribute(element:any, attribute:string, value:string):any',
|
||||||
|
'Parse5DomAdapter.setAttributeNS(element:any, ns:string, attribute:string, value:string):any',
|
||||||
|
'Parse5DomAdapter.setChecked(el:any, value:boolean):any',
|
||||||
|
'Parse5DomAdapter.setCookie(name:string, value:string):any',
|
||||||
|
'Parse5DomAdapter.setData(el:any, name:string, value:string):any',
|
||||||
|
'Parse5DomAdapter.setGlobalVar(path:string, value:any):any',
|
||||||
|
'Parse5DomAdapter.setInnerHTML(el:any, value:any):any',
|
||||||
|
'Parse5DomAdapter.setProperty(el:any, name:string, value:any):any',
|
||||||
|
'Parse5DomAdapter.setStyle(element:any, styleName:string, styleValue:string):any',
|
||||||
|
'Parse5DomAdapter.setText(el:any, value:string):any',
|
||||||
|
'Parse5DomAdapter.setTitle(newTitle:string):any',
|
||||||
|
'Parse5DomAdapter.setValue(el:any, value:string):any',
|
||||||
|
'Parse5DomAdapter.supportsAnimation():boolean',
|
||||||
|
'Parse5DomAdapter.supportsCookies():boolean',
|
||||||
|
'Parse5DomAdapter.supportsDOMEvents():boolean',
|
||||||
|
'Parse5DomAdapter.supportsNativeShadowDOM():boolean',
|
||||||
|
'Parse5DomAdapter.supportsWebAnimation():boolean',
|
||||||
|
'Parse5DomAdapter.tagName(element:any):string',
|
||||||
|
'Parse5DomAdapter.templateAwareRoot(el:any):any',
|
||||||
|
'Parse5DomAdapter.type(node:any):string',
|
||||||
];
|
];
|
||||||
|
|
||||||
const PLATFORM_SERVER_TESTING = [
|
const PLATFORM_SERVER_TESTING = [
|
||||||
|
|
Loading…
Reference in New Issue