-
Notifications
You must be signed in to change notification settings - Fork 13
/
index.d.ts
executable file
·170 lines (152 loc) · 5.27 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/**
* @license Angular v19.1.0-next.4+sha-8c5db3c
* (c) 2010-2024 Google LLC. https://angular.io/
* License: MIT
*/
import { ApplicationRef } from '@angular/core';
import { EnvironmentProviders } from '@angular/core';
import * as i0 from '@angular/core';
import * as i1 from '@angular/platform-browser/animations';
import * as i2 from '@angular/platform-browser';
import { InjectionToken } from '@angular/core';
import { PlatformRef } from '@angular/core';
import { Provider } from '@angular/core';
import { StaticProvider } from '@angular/core';
import { Type } from '@angular/core';
import { Version } from '@angular/core';
/**
* A function that will be executed when calling `renderApplication` or
* `renderModule` just before current platform state is rendered to string.
*
* @publicApi
*/
export declare const BEFORE_APP_SERIALIZED: InjectionToken<readonly (() => void | Promise<void>)[]>;
/**
* The DI token for setting the initial config for the platform.
*
* @publicApi
*/
export declare const INITIAL_CONFIG: InjectionToken<PlatformConfig>;
/**
* Config object passed to initialize the platform.
*
* @publicApi
*/
export declare interface PlatformConfig {
/**
* The initial DOM to use to bootstrap the server application.
* @default create a new DOM using Domino
*/
document?: string;
/**
* The URL for the current application state. This is used for initializing
* the platform's location. `protocol`, `hostname`, and `port` will be
* overridden if `baseUrl` is set.
* @default none
*/
url?: string;
}
/**
* @publicApi
*/
export declare function platformServer(extraProviders?: StaticProvider[] | undefined): PlatformRef;
/**
* Representation of the current platform state.
*
* @publicApi
*/
export declare class PlatformState {
private _doc;
constructor(_doc: any);
/**
* Renders the current state of the platform to string.
*/
renderToString(): string;
/**
* Returns the current DOM state.
*/
getDocument(): any;
static ɵfac: i0.ɵɵFactoryDeclaration<PlatformState, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<PlatformState>;
}
/**
* Sets up providers necessary to enable server rendering functionality for the application.
*
* @usageNotes
*
* Basic example of how you can add server support to your application:
* ```ts
* bootstrapApplication(AppComponent, {
* providers: [provideServerRendering()]
* });
* ```
*
* @publicApi
* @returns A set of providers to setup the server.
*/
export declare function provideServerRendering(): EnvironmentProviders;
/**
* Bootstraps an instance of an Angular application and renders it to a string.
* ```ts
* const bootstrap = () => bootstrapApplication(RootComponent, appConfig);
* const output: string = await renderApplication(bootstrap);
* ```
*
* @param bootstrap A method that when invoked returns a promise that returns an `ApplicationRef`
* instance once resolved.
* @param options Additional configuration for the render operation:
* - `document` - the document of the page to render, either as an HTML string or
* as a reference to the `document` instance.
* - `url` - the URL for the current render request.
* - `platformProviders` - the platform level providers for the current render request.
*
* @returns A Promise, that returns serialized (to a string) rendered page, once resolved.
*
* @publicApi
*/
export declare function renderApplication<T>(bootstrap: () => Promise<ApplicationRef>, options: {
document?: string | Document;
url?: string;
platformProviders?: Provider[];
}): Promise<string>;
/**
* Bootstraps an application using provided NgModule and serializes the page content to string.
*
* @param moduleType A reference to an NgModule that should be used for bootstrap.
* @param options Additional configuration for the render operation:
* - `document` - the document of the page to render, either as an HTML string or
* as a reference to the `document` instance.
* - `url` - the URL for the current render request.
* - `extraProviders` - set of platform level providers for the current render request.
*
* @publicApi
*/
export declare function renderModule<T>(moduleType: Type<T>, options: {
document?: string | Document;
url?: string;
extraProviders?: StaticProvider[];
}): Promise<string>;
/**
* The ng module for the server.
*
* @publicApi
*/
export declare class ServerModule {
static ɵfac: i0.ɵɵFactoryDeclaration<ServerModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<ServerModule, never, [typeof i1.NoopAnimationsModule], [typeof i2.BrowserModule]>;
static ɵinj: i0.ɵɵInjectorDeclaration<ServerModule>;
}
/**
* @publicApi
*/
export declare const VERSION: Version;
export declare const ɵENABLE_DOM_EMULATION: InjectionToken<boolean>;
export declare const ɵINTERNAL_SERVER_PLATFORM_PROVIDERS: StaticProvider[];
/**
* An internal token that allows providing extra information about the server context
* (e.g. whether SSR or SSG was used). The value is a string and characters other
* than [a-zA-Z0-9\-] are removed. See the default value in `DEFAULT_SERVER_CONTEXT` const.
*/
export declare const ɵSERVER_CONTEXT: InjectionToken<string>;
export declare const ɵSERVER_RENDER_PROVIDERS: Provider[];
export { }