UNPKG

8.01 kBTypeScriptView Raw
1/**
2 * @license Angular v12.2.4
3 * (c) 2010-2021 Google LLC. https://angular.io/
4 * License: MIT
5 */
6
7import { EventManager } from '@angular/platform-browser';
8import { HttpBackend } from '@angular/common/http';
9import { HttpEvent } from '@angular/common/http';
10import { HttpRequest } from '@angular/common/http';
11import { InjectionToken } from '@angular/core';
12import { Injector } from '@angular/core';
13import { NgModuleFactory } from '@angular/core';
14import { NgZone } from '@angular/core';
15import { Observable } from 'rxjs';
16import { PlatformLocation } from '@angular/common';
17import { PlatformRef } from '@angular/core';
18import { Provider } from '@angular/core';
19import { Renderer2 } from '@angular/core';
20import { RendererFactory2 } from '@angular/core';
21import { RendererType2 } from '@angular/core';
22import { StaticProvider } from '@angular/core';
23import { TransferState } from '@angular/platform-browser';
24import { Type } from '@angular/core';
25import { Version } from '@angular/core';
26import { XhrFactory } from '@angular/common';
27import { ɵAnimationEngine } from '@angular/animations/browser';
28import { ɵAnimationRendererFactory } from '@angular/platform-browser/animations';
29import { ɵSharedStylesHost } from '@angular/platform-browser';
30
31/**
32 * A function that will be executed when calling `renderModuleFactory` or `renderModule` just
33 * before current platform state is rendered to string.
34 *
35 * @publicApi
36 */
37export declare const BEFORE_APP_SERIALIZED: InjectionToken<(() => void | Promise<void>)[]>;
38
39/**
40 * The DI token for setting the initial config for the platform.
41 *
42 * @publicApi
43 */
44export declare const INITIAL_CONFIG: InjectionToken<PlatformConfig>;
45
46/**
47 * Config object passed to initialize the platform.
48 *
49 * @publicApi
50 */
51export declare interface PlatformConfig {
52 /**
53 * The initial DOM to use to bootstrap the server application.
54 * @default create a new DOM using Domino
55 */
56 document?: string;
57 /**
58 * The URL for the current application state. This is used for initializing
59 * the platform's location. `protocol`, `hostname`, and `port` will be
60 * overridden if `baseUrl` is set.
61 * @default none
62 */
63 url?: string;
64 /**
65 * Whether to append the absolute URL to any relative HTTP requests. If set to
66 * true, this logic executes prior to any HTTP interceptors that may run later
67 * on in the request. `baseUrl` must be supplied if this flag is enabled.
68 * @default false
69 */
70 useAbsoluteUrl?: boolean;
71 /**
72 * The base URL for resolving absolute URL for HTTP requests. It must be set
73 * if `useAbsoluteUrl` is true, and must consist of protocol, hostname,
74 * and optional port. This option has no effect if `useAbsoluteUrl` is not
75 * enabled.
76 */
77 baseUrl?: string;
78}
79
80/**
81 * The server platform that supports the runtime compiler.
82 *
83 * @publicApi
84 */
85export declare const platformDynamicServer: (extraProviders?: StaticProvider[] | undefined) => PlatformRef;
86
87/**
88 * @publicApi
89 */
90export declare const platformServer: (extraProviders?: StaticProvider[] | undefined) => PlatformRef;
91
92
93/**
94 * Representation of the current platform state.
95 *
96 * @publicApi
97 */
98export declare class PlatformState {
99 private _doc;
100 constructor(_doc: any);
101 /**
102 * Renders the current state of the platform to string.
103 */
104 renderToString(): string;
105 /**
106 * Returns the current DOM state.
107 */
108 getDocument(): any;
109}
110
111/**
112 * Renders a Module to string.
113 *
114 * `document` is the full document HTML of the page to render, as a string.
115 * `url` is the URL for the current render request.
116 * `extraProviders` are the platform level providers for the current render request.
117 *
118 * If compiling with the ViewEngine renderer, do not use this in a production server environment.
119 * Use pre-compiled {@link NgModuleFactory} with {@link renderModuleFactory} instead. If
120 * compiling with the Ivy renderer, this method is the recommended rendering method for
121 * platform-server.
122 *
123 * @publicApi
124 */
125export declare function renderModule<T>(module: Type<T>, options: {
126 document?: string;
127 url?: string;
128 extraProviders?: StaticProvider[];
129}): Promise<string>;
130
131/**
132 * Renders a {@link NgModuleFactory} to string.
133 *
134 * `document` is the full document HTML of the page to render, as a string.
135 * `url` is the URL for the current render request.
136 * `extraProviders` are the platform level providers for the current render request.
137 *
138 * @publicApi
139 */
140export declare function renderModuleFactory<T>(moduleFactory: NgModuleFactory<T>, options: {
141 document?: string;
142 url?: string;
143 extraProviders?: StaticProvider[];
144}): Promise<string>;
145
146/**
147 * The ng module for the server.
148 *
149 * @publicApi
150 */
151export declare class ServerModule {
152}
153
154/**
155 * NgModule to install on the server side while using the `TransferState` to transfer state from
156 * server to client.
157 *
158 * @publicApi
159 */
160export declare class ServerTransferStateModule {
161}
162
163/**
164 * @publicApi
165 */
166export declare const VERSION: Version;
167
168declare class ZoneClientBackend extends ZoneMacroTaskWrapper<HttpRequest<any>, HttpEvent<any>> implements HttpBackend {
169 private backend;
170 private platformLocation;
171 private config;
172 constructor(backend: HttpBackend, platformLocation: PlatformLocation, config: PlatformConfig);
173 handle(request: HttpRequest<any>): Observable<HttpEvent<any>>;
174 protected delegate(request: HttpRequest<any>): Observable<HttpEvent<any>>;
175}
176
177declare abstract class ZoneMacroTaskWrapper<S, R> {
178 wrap(request: S): Observable<R>;
179 protected abstract delegate(request: S): Observable<R>;
180}
181
182export declare function ɵangular_packages_platform_server_platform_server_a(renderer: RendererFactory2, engine: ɵAnimationEngine, zone: NgZone): ɵAnimationRendererFactory;
183
184export declare function ɵangular_packages_platform_server_platform_server_b(doc: Document, appId: string, transferStore: TransferState): () => void;
185
186export declare class ɵangular_packages_platform_server_platform_server_c extends ɵSharedStylesHost {
187 private doc;
188 private transitionId;
189 private head;
190 private _styleNodes;
191 constructor(doc: any, transitionId: string);
192 private _addStyle;
193 onStylesAdded(additions: Set<string>): void;
194 ngOnDestroy(): void;
195}
196
197
198export declare class ɵangular_packages_platform_server_platform_server_d {
199 private doc;
200 constructor(doc: any);
201 supports(eventName: string): boolean;
202 addEventListener(element: HTMLElement, eventName: string, handler: Function): Function;
203 /** @deprecated No longer being used in Ivy code. To be removed in version 14. */
204 addGlobalEventListener(element: string, eventName: string, handler: Function): Function;
205}
206
207export declare class ɵangular_packages_platform_server_platform_server_e implements XhrFactory {
208 build(): XMLHttpRequest;
209}
210
211export declare function ɵangular_packages_platform_server_platform_server_f(backend: HttpBackend, injector: Injector, platformLocation: PlatformLocation, config: PlatformConfig): ZoneClientBackend;
212
213export declare const ɵangular_packages_platform_server_platform_server_g: Provider[];
214
215export declare const ɵINTERNAL_SERVER_PLATFORM_PROVIDERS: StaticProvider[];
216
217export declare const ɵSERVER_RENDER_PROVIDERS: Provider[];
218
219export declare class ɵServerRendererFactory2 implements RendererFactory2 {
220 private eventManager;
221 private ngZone;
222 private document;
223 private sharedStylesHost;
224 private rendererByCompId;
225 private defaultRenderer;
226 private schema;
227 constructor(eventManager: EventManager, ngZone: NgZone, document: any, sharedStylesHost: ɵSharedStylesHost);
228 createRenderer(element: any, type: RendererType2 | null): Renderer2;
229 begin(): void;
230 end(): void;
231}
232
233export { }