UNPKG

6.14 kBTypeScriptView Raw
1/**
2 * @license Angular v13.1.3
3 * (c) 2010-2022 Google LLC. https://angular.io/
4 * License: MIT
5 */
6
7import { EventManager } from '@angular/platform-browser';
8import * as i0 from '@angular/core';
9import * as i1 from '@angular/common/http';
10import * as i2 from '@angular/platform-browser/animations';
11import * as i3 from '@angular/platform-browser';
12import { InjectionToken } from '@angular/core';
13import { NgModuleFactory } from '@angular/core';
14import { NgZone } from '@angular/core';
15import { PlatformRef } from '@angular/core';
16import { Provider } from '@angular/core';
17import { Renderer2 } from '@angular/core';
18import { RendererFactory2 } from '@angular/core';
19import { RendererType2 } from '@angular/core';
20import { StaticProvider } from '@angular/core';
21import { Type } from '@angular/core';
22import { Version } from '@angular/core';
23import { ɵSharedStylesHost } from '@angular/platform-browser';
24
25/**
26 * A function that will be executed when calling `renderModuleFactory` or `renderModule` just
27 * before current platform state is rendered to string.
28 *
29 * @publicApi
30 */
31export declare const BEFORE_APP_SERIALIZED: InjectionToken<(() => void | Promise<void>)[]>;
32
33/**
34 * The DI token for setting the initial config for the platform.
35 *
36 * @publicApi
37 */
38export declare const INITIAL_CONFIG: InjectionToken<PlatformConfig>;
39
40/**
41 * Config object passed to initialize the platform.
42 *
43 * @publicApi
44 */
45export declare interface PlatformConfig {
46 /**
47 * The initial DOM to use to bootstrap the server application.
48 * @default create a new DOM using Domino
49 */
50 document?: string;
51 /**
52 * The URL for the current application state. This is used for initializing
53 * the platform's location. `protocol`, `hostname`, and `port` will be
54 * overridden if `baseUrl` is set.
55 * @default none
56 */
57 url?: string;
58 /**
59 * Whether to append the absolute URL to any relative HTTP requests. If set to
60 * true, this logic executes prior to any HTTP interceptors that may run later
61 * on in the request. `baseUrl` must be supplied if this flag is enabled.
62 * @default false
63 */
64 useAbsoluteUrl?: boolean;
65 /**
66 * The base URL for resolving absolute URL for HTTP requests. It must be set
67 * if `useAbsoluteUrl` is true, and must consist of protocol, hostname,
68 * and optional port. This option has no effect if `useAbsoluteUrl` is not
69 * enabled.
70 */
71 baseUrl?: string;
72}
73
74/**
75 * The server platform that supports the runtime compiler.
76 *
77 * @publicApi
78 */
79export declare const platformDynamicServer: (extraProviders?: StaticProvider[] | undefined) => PlatformRef;
80
81/**
82 * @publicApi
83 */
84export declare const platformServer: (extraProviders?: StaticProvider[] | undefined) => PlatformRef;
85
86/**
87 * Representation of the current platform state.
88 *
89 * @publicApi
90 */
91export declare class PlatformState {
92 private _doc;
93 constructor(_doc: any);
94 /**
95 * Renders the current state of the platform to string.
96 */
97 renderToString(): string;
98 /**
99 * Returns the current DOM state.
100 */
101 getDocument(): any;
102 static ɵfac: i0.ɵɵFactoryDeclaration<PlatformState, never>;
103 static ɵprov: i0.ɵɵInjectableDeclaration<PlatformState>;
104}
105
106/**
107 * Renders a Module to string.
108 *
109 * `document` is the full document HTML of the page to render, as a string.
110 * `url` is the URL for the current render request.
111 * `extraProviders` are the platform level providers for the current render request.
112 *
113 * @publicApi
114 */
115export declare function renderModule<T>(module: Type<T>, options: {
116 document?: string;
117 url?: string;
118 extraProviders?: StaticProvider[];
119}): Promise<string>;
120
121/**
122 * Renders a {@link NgModuleFactory} to string.
123 *
124 * `document` is the full document HTML of the page to render, as a string.
125 * `url` is the URL for the current render request.
126 * `extraProviders` are the platform level providers for the current render request.
127 *
128 * @publicApi
129 *
130 * @deprecated
131 * This symbol is no longer necessary as of Angular v13.
132 * Use {@link renderModule} API instead.
133 */
134export declare function renderModuleFactory<T>(moduleFactory: NgModuleFactory<T>, options: {
135 document?: string;
136 url?: string;
137 extraProviders?: StaticProvider[];
138}): Promise<string>;
139
140/**
141 * The ng module for the server.
142 *
143 * @publicApi
144 */
145export declare class ServerModule {
146 static ɵfac: i0.ɵɵFactoryDeclaration<ServerModule, never>;
147 static ɵmod: i0.ɵɵNgModuleDeclaration<ServerModule, never, [typeof i1.HttpClientModule, typeof i2.NoopAnimationsModule], [typeof i3.BrowserModule]>;
148 static ɵinj: i0.ɵɵInjectorDeclaration<ServerModule>;
149}
150
151/**
152 * NgModule to install on the server side while using the `TransferState` to transfer state from
153 * server to client.
154 *
155 * @publicApi
156 */
157export declare class ServerTransferStateModule {
158 static ɵfac: i0.ɵɵFactoryDeclaration<ServerTransferStateModule, never>;
159 static ɵmod: i0.ɵɵNgModuleDeclaration<ServerTransferStateModule, never, never, never>;
160 static ɵinj: i0.ɵɵInjectorDeclaration<ServerTransferStateModule>;
161}
162
163/**
164 * @publicApi
165 */
166export declare const VERSION: Version;
167
168export declare const ɵINTERNAL_SERVER_PLATFORM_PROVIDERS: StaticProvider[];
169
170export declare const ɵSERVER_RENDER_PROVIDERS: Provider[];
171
172export declare class ɵServerRendererFactory2 implements RendererFactory2 {
173 private eventManager;
174 private ngZone;
175 private document;
176 private sharedStylesHost;
177 private rendererByCompId;
178 private defaultRenderer;
179 private schema;
180 constructor(eventManager: EventManager, ngZone: NgZone, document: any, sharedStylesHost: ɵSharedStylesHost);
181 createRenderer(element: any, type: RendererType2 | null): Renderer2;
182 begin(): void;
183 end(): void;
184 static ɵfac: i0.ɵɵFactoryDeclaration<ɵServerRendererFactory2, never>;
185 static ɵprov: i0.ɵɵInjectableDeclaration<ɵServerRendererFactory2>;
186}
187
188export { }