feat(platform-server): support document reference in render functions (#47032)

This commit updates the `renderModule` and `renderApplication` functions to also accept a document reference (in addition to the serialized document contents as a string). This should provide the necessary flexibility to NgUniversal (and other API consumers) to structure the logic to avoid serializing and parsing document multiple times during the SSR request.

PR Close #47032
This commit is contained in:
Andrew Kushnir
2022-08-03 14:19:40 -07:00
committed by Dylan Hunn
parent de1e28006b
commit 2b4d7f6733
4 changed files with 51 additions and 11 deletions
+2 -2
View File
@@ -51,7 +51,7 @@ export class PlatformState {
// @public
export function renderApplication<T>(rootComponent: Type<T>, options: {
appId: string;
document?: string;
document?: string | Document;
url?: string;
providers?: Array<Provider | ImportedNgModuleProviders>;
platformProviders?: Provider[];
@@ -59,7 +59,7 @@ export function renderApplication<T>(rootComponent: Type<T>, options: {
// @public
export function renderModule<T>(module: Type<T>, options: {
document?: string;
document?: string | Document;
url?: string;
extraProviders?: StaticProvider[];
}): Promise<string>;