@angular/platform-server 14.0.0-next.9 → 14.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/init/src/shims.mjs +3 -3
- package/esm2020/src/http.mjs +3 -3
- package/esm2020/src/location.mjs +3 -3
- package/esm2020/src/platform-server.mjs +2 -2
- package/esm2020/src/platform_state.mjs +3 -3
- package/esm2020/src/private_export.mjs +2 -1
- package/esm2020/src/server.mjs +9 -10
- package/esm2020/src/server_events.mjs +3 -3
- package/esm2020/src/server_renderer.mjs +3 -3
- package/esm2020/src/styles_host.mjs +3 -3
- package/esm2020/src/tokens.mjs +3 -3
- package/esm2020/src/transfer_state.mjs +4 -4
- package/esm2020/src/utils.mjs +56 -12
- package/esm2020/src/version.mjs +1 -1
- package/esm2020/testing/src/server.mjs +5 -5
- package/fesm2015/init.mjs +3 -93
- package/fesm2015/init.mjs.map +1 -1
- package/fesm2015/platform-server.mjs +89 -44
- package/fesm2015/platform-server.mjs.map +1 -1
- package/fesm2015/testing.mjs +5 -5
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2020/init.mjs +3 -92
- package/fesm2020/init.mjs.map +1 -1
- package/fesm2020/platform-server.mjs +87 -44
- package/fesm2020/platform-server.mjs.map +1 -1
- package/fesm2020/testing.mjs +5 -5
- package/fesm2020/testing.mjs.map +1 -1
- package/{platform-server.d.ts → index.d.ts} +224 -183
- package/init/{init.d.ts → index.d.ts} +3 -2
- package/package.json +12 -12
- package/testing/{testing.d.ts → index.d.ts} +27 -26
- package/init/package.json +0 -10
- package/testing/package.json +0 -9
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v14.0.0-
|
|
2
|
+
* @license Angular v14.0.0-rc.0
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { ɵsetRootDomAdapter, DOCUMENT, XhrFactory, PlatformLocation, ɵgetDOM, ɵPLATFORM_SERVER_ID, ViewportScroller, ɵNullViewportScroller } from '@angular/common';
|
|
8
8
|
import * as i0 from '@angular/core';
|
|
9
|
-
import { Injectable, Inject, InjectionToken, Injector, Optional, ViewEncapsulation, RendererStyleFlags2, PLATFORM_ID, PLATFORM_INITIALIZER, ɵALLOW_MULTIPLE_PLATFORMS, RendererFactory2, NgZone, Testability, NgModule, ɵsetDocument, createPlatformFactory, platformCore, APP_ID, ApplicationRef, ɵisPromise, Version } from '@angular/core';
|
|
9
|
+
import { Injectable, Inject, InjectionToken, Injector, Optional, ViewEncapsulation, RendererStyleFlags2, PLATFORM_ID, PLATFORM_INITIALIZER, ɵALLOW_MULTIPLE_PLATFORMS, RendererFactory2, NgZone, Testability, ɵTESTABILITY, NgModule, ɵsetDocument, createPlatformFactory, platformCore, APP_ID, ApplicationRef, ɵisPromise, importProvidersFrom, ɵinternalBootstrapApplication, Version } from '@angular/core';
|
|
10
10
|
import * as i1 from '@angular/platform-browser';
|
|
11
11
|
import { ɵBrowserDomAdapter, ɵflattenStyles, ɵNAMESPACE_URIS, ɵshimContentAttribute, ɵshimHostAttribute, ɵSharedStylesHost, ɵTRANSITION_ID, EVENT_MANAGER_PLUGINS, BrowserModule, ɵescapeHtml, TransferState } from '@angular/platform-browser';
|
|
12
12
|
import * as domino from 'domino';
|
|
@@ -136,9 +136,9 @@ class PlatformState {
|
|
|
136
136
|
return this._doc;
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
PlatformState.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-
|
|
140
|
-
PlatformState.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-
|
|
141
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-
|
|
139
|
+
PlatformState.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: PlatformState, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
140
|
+
PlatformState.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: PlatformState });
|
|
141
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: PlatformState, decorators: [{
|
|
142
142
|
type: Injectable
|
|
143
143
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
144
144
|
type: Inject,
|
|
@@ -159,8 +159,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.9",
|
|
|
159
159
|
*/
|
|
160
160
|
const INITIAL_CONFIG = new InjectionToken('Server.INITIAL_CONFIG');
|
|
161
161
|
/**
|
|
162
|
-
* A function that will be executed when calling `renderModuleFactory` or
|
|
163
|
-
* before current platform state is rendered to string.
|
|
162
|
+
* A function that will be executed when calling `renderApplication`, `renderModuleFactory` or
|
|
163
|
+
* `renderModule` just before current platform state is rendered to string.
|
|
164
164
|
*
|
|
165
165
|
* @publicApi
|
|
166
166
|
*/
|
|
@@ -180,9 +180,9 @@ class ServerXhr {
|
|
|
180
180
|
return new xhr2.XMLHttpRequest();
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
-
ServerXhr.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-
|
|
184
|
-
ServerXhr.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-
|
|
185
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-
|
|
183
|
+
ServerXhr.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerXhr, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
184
|
+
ServerXhr.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerXhr });
|
|
185
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerXhr, decorators: [{
|
|
186
186
|
type: Injectable
|
|
187
187
|
}] });
|
|
188
188
|
class ZoneMacroTaskWrapper {
|
|
@@ -386,9 +386,9 @@ class ServerPlatformLocation {
|
|
|
386
386
|
return undefined;
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
|
-
ServerPlatformLocation.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-
|
|
390
|
-
ServerPlatformLocation.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-
|
|
391
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-
|
|
389
|
+
ServerPlatformLocation.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerPlatformLocation, deps: [{ token: DOCUMENT }, { token: INITIAL_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
390
|
+
ServerPlatformLocation.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerPlatformLocation });
|
|
391
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerPlatformLocation, decorators: [{
|
|
392
392
|
type: Injectable
|
|
393
393
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
394
394
|
type: Inject,
|
|
@@ -430,9 +430,9 @@ class ServerEventManagerPlugin /* extends EventManagerPlugin which is private */
|
|
|
430
430
|
return this.addEventListener(target, eventName, handler);
|
|
431
431
|
}
|
|
432
432
|
}
|
|
433
|
-
ServerEventManagerPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-
|
|
434
|
-
ServerEventManagerPlugin.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-
|
|
435
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-
|
|
433
|
+
ServerEventManagerPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerEventManagerPlugin /* extends EventManagerPlugin which is private */, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
434
|
+
ServerEventManagerPlugin.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerEventManagerPlugin /* extends EventManagerPlugin which is private */ });
|
|
435
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerEventManagerPlugin /* extends EventManagerPlugin which is private */, decorators: [{
|
|
436
436
|
type: Injectable
|
|
437
437
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
438
438
|
type: Inject,
|
|
@@ -485,9 +485,9 @@ class ServerRendererFactory2 {
|
|
|
485
485
|
begin() { }
|
|
486
486
|
end() { }
|
|
487
487
|
}
|
|
488
|
-
ServerRendererFactory2.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-
|
|
489
|
-
ServerRendererFactory2.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-
|
|
490
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-
|
|
488
|
+
ServerRendererFactory2.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerRendererFactory2, deps: [{ token: i1.EventManager }, { token: i0.NgZone }, { token: DOCUMENT }, { token: i1.ɵSharedStylesHost }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
489
|
+
ServerRendererFactory2.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerRendererFactory2 });
|
|
490
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerRendererFactory2, decorators: [{
|
|
491
491
|
type: Injectable
|
|
492
492
|
}], ctorParameters: function () { return [{ type: i1.EventManager }, { type: i0.NgZone }, { type: undefined, decorators: [{
|
|
493
493
|
type: Inject,
|
|
@@ -738,9 +738,9 @@ class ServerStylesHost extends ɵSharedStylesHost {
|
|
|
738
738
|
this._styleNodes.forEach(styleNode => styleNode.remove());
|
|
739
739
|
}
|
|
740
740
|
}
|
|
741
|
-
ServerStylesHost.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-
|
|
742
|
-
ServerStylesHost.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-
|
|
743
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-
|
|
741
|
+
ServerStylesHost.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerStylesHost, deps: [{ token: DOCUMENT }, { token: ɵTRANSITION_ID, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
742
|
+
ServerStylesHost.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerStylesHost });
|
|
743
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerStylesHost, decorators: [{
|
|
744
744
|
type: Injectable
|
|
745
745
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
746
746
|
type: Inject,
|
|
@@ -759,9 +759,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.9",
|
|
|
759
759
|
* Use of this source code is governed by an MIT-style license that can be
|
|
760
760
|
* found in the LICENSE file at https://angular.io/license
|
|
761
761
|
*/
|
|
762
|
-
function notSupported(feature) {
|
|
763
|
-
throw new Error(`platform-server does not support '${feature}'.`);
|
|
764
|
-
}
|
|
765
762
|
const INTERNAL_SERVER_PLATFORM_PROVIDERS = [
|
|
766
763
|
{ provide: DOCUMENT, useFactory: _document, deps: [Injector] },
|
|
767
764
|
{ provide: PLATFORM_ID, useValue: ɵPLATFORM_SERVER_ID },
|
|
@@ -800,15 +797,16 @@ const SERVER_RENDER_PROVIDERS = [
|
|
|
800
797
|
*/
|
|
801
798
|
class ServerModule {
|
|
802
799
|
}
|
|
803
|
-
ServerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-
|
|
804
|
-
ServerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "
|
|
805
|
-
ServerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.0-
|
|
800
|
+
ServerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
801
|
+
ServerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerModule, imports: [HttpClientModule, NoopAnimationsModule], exports: [BrowserModule] });
|
|
802
|
+
ServerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerModule, providers: [
|
|
806
803
|
SERVER_RENDER_PROVIDERS,
|
|
807
804
|
SERVER_HTTP_PROVIDERS,
|
|
808
805
|
{ provide: Testability, useValue: null },
|
|
806
|
+
{ provide: ɵTESTABILITY, useValue: null },
|
|
809
807
|
{ provide: ViewportScroller, useClass: ɵNullViewportScroller },
|
|
810
|
-
], imports: [
|
|
811
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-
|
|
808
|
+
], imports: [HttpClientModule, NoopAnimationsModule, BrowserModule] });
|
|
809
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerModule, decorators: [{
|
|
812
810
|
type: NgModule,
|
|
813
811
|
args: [{
|
|
814
812
|
exports: [BrowserModule],
|
|
@@ -817,6 +815,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.9",
|
|
|
817
815
|
SERVER_RENDER_PROVIDERS,
|
|
818
816
|
SERVER_HTTP_PROVIDERS,
|
|
819
817
|
{ provide: Testability, useValue: null },
|
|
818
|
+
{ provide: ɵTESTABILITY, useValue: null },
|
|
820
819
|
{ provide: ViewportScroller, useClass: ɵNullViewportScroller },
|
|
821
820
|
],
|
|
822
821
|
}]
|
|
@@ -864,9 +863,9 @@ function serializeTransferStateFactory(doc, appId, transferStore) {
|
|
|
864
863
|
*/
|
|
865
864
|
class ServerTransferStateModule {
|
|
866
865
|
}
|
|
867
|
-
ServerTransferStateModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-
|
|
868
|
-
ServerTransferStateModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "
|
|
869
|
-
ServerTransferStateModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.0-
|
|
866
|
+
ServerTransferStateModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerTransferStateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
867
|
+
ServerTransferStateModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerTransferStateModule });
|
|
868
|
+
ServerTransferStateModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerTransferStateModule, providers: [
|
|
870
869
|
TransferState, {
|
|
871
870
|
provide: BEFORE_APP_SERIALIZED,
|
|
872
871
|
useFactory: serializeTransferStateFactory,
|
|
@@ -874,7 +873,7 @@ ServerTransferStateModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0
|
|
|
874
873
|
multi: true,
|
|
875
874
|
}
|
|
876
875
|
] });
|
|
877
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-
|
|
876
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerTransferStateModule, decorators: [{
|
|
878
877
|
type: NgModule,
|
|
879
878
|
args: [{
|
|
880
879
|
providers: [
|
|
@@ -896,27 +895,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.9",
|
|
|
896
895
|
* found in the LICENSE file at https://angular.io/license
|
|
897
896
|
*/
|
|
898
897
|
function _getPlatform(platformFactory, options) {
|
|
899
|
-
const extraProviders = options.
|
|
898
|
+
const extraProviders = options.platformProviders ?? [];
|
|
900
899
|
return platformFactory([
|
|
901
900
|
{ provide: INITIAL_CONFIG, useValue: { document: options.document, url: options.url } },
|
|
902
901
|
extraProviders
|
|
903
902
|
]);
|
|
904
903
|
}
|
|
905
|
-
function _render(platform,
|
|
906
|
-
return
|
|
907
|
-
const
|
|
904
|
+
function _render(platform, bootstrapPromise) {
|
|
905
|
+
return bootstrapPromise.then((moduleOrApplicationRef) => {
|
|
906
|
+
const environmentInjector = moduleOrApplicationRef.injector;
|
|
907
|
+
const transitionId = environmentInjector.get(ɵTRANSITION_ID, null);
|
|
908
908
|
if (!transitionId) {
|
|
909
909
|
throw new Error(`renderModule[Factory]() requires the use of BrowserModule.withServerTransition() to ensure
|
|
910
910
|
the server-rendered app can be properly bootstrapped into a client app.`);
|
|
911
911
|
}
|
|
912
|
-
const applicationRef =
|
|
912
|
+
const applicationRef = moduleOrApplicationRef instanceof ApplicationRef ?
|
|
913
|
+
moduleOrApplicationRef :
|
|
914
|
+
environmentInjector.get(ApplicationRef);
|
|
913
915
|
return applicationRef.isStable.pipe((first((isStable) => isStable)))
|
|
914
916
|
.toPromise()
|
|
915
917
|
.then(() => {
|
|
916
918
|
const platformState = platform.injector.get(PlatformState);
|
|
917
919
|
const asyncPromises = [];
|
|
918
920
|
// Run any BEFORE_APP_SERIALIZED callbacks just before rendering to string.
|
|
919
|
-
const callbacks =
|
|
921
|
+
const callbacks = environmentInjector.get(BEFORE_APP_SERIALIZED, null);
|
|
920
922
|
if (callbacks) {
|
|
921
923
|
for (const callback of callbacks) {
|
|
922
924
|
try {
|
|
@@ -960,9 +962,49 @@ the server-rendered app can be properly bootstrapped into a client app.`);
|
|
|
960
962
|
* @publicApi
|
|
961
963
|
*/
|
|
962
964
|
function renderModule(module, options) {
|
|
963
|
-
const
|
|
965
|
+
const { document, url, extraProviders: platformProviders } = options;
|
|
966
|
+
const platform = _getPlatform(platformDynamicServer, { document, url, platformProviders });
|
|
964
967
|
return _render(platform, platform.bootstrapModule(module));
|
|
965
968
|
}
|
|
969
|
+
/**
|
|
970
|
+
* Bootstraps an instance of an Angular application and renders it to a string.
|
|
971
|
+
*
|
|
972
|
+
* Note: the root component passed into this function *must* be a standalone one (should have the
|
|
973
|
+
* `standalone: true` flag in the `@Component` decorator config).
|
|
974
|
+
*
|
|
975
|
+
* ```typescript
|
|
976
|
+
* @Component({
|
|
977
|
+
* standalone: true,
|
|
978
|
+
* template: 'Hello world!'
|
|
979
|
+
* })
|
|
980
|
+
* class RootComponent {}
|
|
981
|
+
*
|
|
982
|
+
* const output: string = await renderApplication(RootComponent, {appId: 'server-app'});
|
|
983
|
+
* ```
|
|
984
|
+
*
|
|
985
|
+
* @param rootComponent A reference to a Standalone Component that should be rendered.
|
|
986
|
+
* @param options Additional configuration for the render operation:
|
|
987
|
+
* - `appId` - a string identifier of this application. The appId is used to prefix all
|
|
988
|
+
* server-generated stylings and state keys of the application in TransferState
|
|
989
|
+
* use-cases.
|
|
990
|
+
* - `document` - the full document HTML of the page to render, as a string.
|
|
991
|
+
* - `url` - the URL for the current render request.
|
|
992
|
+
* - `providers` - set of application level providers for the current render request.
|
|
993
|
+
* - `platformProviders` - the platform level providers for the current render request.
|
|
994
|
+
* @returns A Promise, that returns serialized (to a string) rendered page, once resolved.
|
|
995
|
+
*
|
|
996
|
+
* @publicApi
|
|
997
|
+
*/
|
|
998
|
+
function renderApplication(rootComponent, options) {
|
|
999
|
+
const { document, url, platformProviders, appId } = options;
|
|
1000
|
+
const platform = _getPlatform(platformDynamicServer, { document, url, platformProviders });
|
|
1001
|
+
const appProviders = [
|
|
1002
|
+
importProvidersFrom(BrowserModule.withServerTransition({ appId })),
|
|
1003
|
+
importProvidersFrom(ServerModule),
|
|
1004
|
+
...(options.providers ?? []),
|
|
1005
|
+
];
|
|
1006
|
+
return _render(platform, ɵinternalBootstrapApplication({ rootComponent, appProviders }));
|
|
1007
|
+
}
|
|
966
1008
|
/**
|
|
967
1009
|
* Renders a {@link NgModuleFactory} to string.
|
|
968
1010
|
*
|
|
@@ -977,7 +1019,8 @@ function renderModule(module, options) {
|
|
|
977
1019
|
* Use {@link renderModule} API instead.
|
|
978
1020
|
*/
|
|
979
1021
|
function renderModuleFactory(moduleFactory, options) {
|
|
980
|
-
const
|
|
1022
|
+
const { document, url, extraProviders: platformProviders } = options;
|
|
1023
|
+
const platform = _getPlatform(platformServer, { document, url, platformProviders });
|
|
981
1024
|
return _render(platform, platform.bootstrapModuleFactory(moduleFactory));
|
|
982
1025
|
}
|
|
983
1026
|
|
|
@@ -999,7 +1042,7 @@ function renderModuleFactory(moduleFactory, options) {
|
|
|
999
1042
|
/**
|
|
1000
1043
|
* @publicApi
|
|
1001
1044
|
*/
|
|
1002
|
-
const VERSION = new Version('14.0.0-
|
|
1045
|
+
const VERSION = new Version('14.0.0-rc.0');
|
|
1003
1046
|
|
|
1004
1047
|
/**
|
|
1005
1048
|
* @license
|
|
@@ -1030,5 +1073,5 @@ const VERSION = new Version('14.0.0-next.9');
|
|
|
1030
1073
|
* Generated bundle index. Do not edit.
|
|
1031
1074
|
*/
|
|
1032
1075
|
|
|
1033
|
-
export { BEFORE_APP_SERIALIZED, INITIAL_CONFIG, PlatformState, ServerModule, ServerTransferStateModule, VERSION, platformDynamicServer, platformServer, renderModule, renderModuleFactory, INTERNAL_SERVER_PLATFORM_PROVIDERS as ɵINTERNAL_SERVER_PLATFORM_PROVIDERS, SERVER_RENDER_PROVIDERS as ɵSERVER_RENDER_PROVIDERS, ServerRendererFactory2 as ɵServerRendererFactory2 };
|
|
1076
|
+
export { BEFORE_APP_SERIALIZED, INITIAL_CONFIG, PlatformState, ServerModule, ServerTransferStateModule, VERSION, platformDynamicServer, platformServer, renderApplication, renderModule, renderModuleFactory, INTERNAL_SERVER_PLATFORM_PROVIDERS as ɵINTERNAL_SERVER_PLATFORM_PROVIDERS, SERVER_RENDER_PROVIDERS as ɵSERVER_RENDER_PROVIDERS, ServerRendererFactory2 as ɵServerRendererFactory2, setDomTypes as ɵsetDomTypes };
|
|
1034
1077
|
//# sourceMappingURL=platform-server.mjs.map
|