@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
package/fesm2015/init.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.mjs","sources":["../../../../../../packages/platform-server/
|
|
1
|
+
{"version":3,"file":"init.mjs","sources":["../../../../../../packages/platform-server/init/src/shims.ts","../../../../../../packages/platform-server/init/src/init.ts","../../../../../../packages/platform-server/init/public_api.ts","../../../../../../packages/platform-server/init/index.ts","../../../../../../packages/platform-server/init/init.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport {ɵsetDomTypes} from '@angular/platform-server';\n\n/**\n * Apply the necessary shims to make DOM globals (such as `Element`, `HTMLElement`, etc.) available\n * on the environment.\n */\nexport function applyShims(): void {\n ɵsetDomTypes();\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * @module\n * @description\n * Entry point for all initialization APIs of the platform-server package.\n */\n\nimport {applyShims} from './shims';\n\napplyShims();\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of this package.\n */\nexport * from './src/init';\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n// This file is not used to build this module. It is only used during editing\n// by the TypeScript language service and during build for verifcation. `ngc`\n// replaces this file with production index.ts when it rewrites private symbol\n// names.\n\nexport * from './public_api';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAAA;;;;;;AAMG;AAGH;;;AAGG;SACa,UAAU,GAAA;AACxB,IAAA,YAAY,EAAE,CAAC;AACjB;;ACfA;;;;;;AAMG;AAUH,UAAU,EAAE;;AChBZ;;;;;;AAMG;;ACNH;;;;;;AAMG;;ACNH;;AAEG"}
|
|
@@ -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';
|
|
@@ -137,9 +137,9 @@ class PlatformState {
|
|
|
137
137
|
return this._doc;
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
-
PlatformState.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-
|
|
141
|
-
PlatformState.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-
|
|
142
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-
|
|
140
|
+
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 });
|
|
141
|
+
PlatformState.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: PlatformState });
|
|
142
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: PlatformState, decorators: [{
|
|
143
143
|
type: Injectable
|
|
144
144
|
}], ctorParameters: function () {
|
|
145
145
|
return [{ type: undefined, decorators: [{
|
|
@@ -162,8 +162,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.9",
|
|
|
162
162
|
*/
|
|
163
163
|
const INITIAL_CONFIG = new InjectionToken('Server.INITIAL_CONFIG');
|
|
164
164
|
/**
|
|
165
|
-
* A function that will be executed when calling `renderModuleFactory` or
|
|
166
|
-
* before current platform state is rendered to string.
|
|
165
|
+
* A function that will be executed when calling `renderApplication`, `renderModuleFactory` or
|
|
166
|
+
* `renderModule` just before current platform state is rendered to string.
|
|
167
167
|
*
|
|
168
168
|
* @publicApi
|
|
169
169
|
*/
|
|
@@ -183,9 +183,9 @@ class ServerXhr {
|
|
|
183
183
|
return new xhr2.XMLHttpRequest();
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
ServerXhr.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-
|
|
187
|
-
ServerXhr.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-
|
|
188
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-
|
|
186
|
+
ServerXhr.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerXhr, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
187
|
+
ServerXhr.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerXhr });
|
|
188
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerXhr, decorators: [{
|
|
189
189
|
type: Injectable
|
|
190
190
|
}] });
|
|
191
191
|
class ZoneMacroTaskWrapper {
|
|
@@ -389,9 +389,9 @@ class ServerPlatformLocation {
|
|
|
389
389
|
return undefined;
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
|
-
ServerPlatformLocation.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-
|
|
393
|
-
ServerPlatformLocation.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-
|
|
394
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-
|
|
392
|
+
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 });
|
|
393
|
+
ServerPlatformLocation.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerPlatformLocation });
|
|
394
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerPlatformLocation, decorators: [{
|
|
395
395
|
type: Injectable
|
|
396
396
|
}], ctorParameters: function () {
|
|
397
397
|
return [{ type: undefined, decorators: [{
|
|
@@ -435,9 +435,9 @@ class ServerEventManagerPlugin /* extends EventManagerPlugin which is private */
|
|
|
435
435
|
return this.addEventListener(target, eventName, handler);
|
|
436
436
|
}
|
|
437
437
|
}
|
|
438
|
-
ServerEventManagerPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-
|
|
439
|
-
ServerEventManagerPlugin.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-
|
|
440
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-
|
|
438
|
+
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 });
|
|
439
|
+
ServerEventManagerPlugin.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerEventManagerPlugin /* extends EventManagerPlugin which is private */ });
|
|
440
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerEventManagerPlugin /* extends EventManagerPlugin which is private */, decorators: [{
|
|
441
441
|
type: Injectable
|
|
442
442
|
}], ctorParameters: function () {
|
|
443
443
|
return [{ type: undefined, decorators: [{
|
|
@@ -492,9 +492,9 @@ class ServerRendererFactory2 {
|
|
|
492
492
|
begin() { }
|
|
493
493
|
end() { }
|
|
494
494
|
}
|
|
495
|
-
ServerRendererFactory2.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-
|
|
496
|
-
ServerRendererFactory2.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-
|
|
497
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-
|
|
495
|
+
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 });
|
|
496
|
+
ServerRendererFactory2.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerRendererFactory2 });
|
|
497
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerRendererFactory2, decorators: [{
|
|
498
498
|
type: Injectable
|
|
499
499
|
}], ctorParameters: function () {
|
|
500
500
|
return [{ type: i1.EventManager }, { type: i0.NgZone }, { type: undefined, decorators: [{
|
|
@@ -747,9 +747,9 @@ class ServerStylesHost extends ɵSharedStylesHost {
|
|
|
747
747
|
this._styleNodes.forEach(styleNode => styleNode.remove());
|
|
748
748
|
}
|
|
749
749
|
}
|
|
750
|
-
ServerStylesHost.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-
|
|
751
|
-
ServerStylesHost.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-
|
|
752
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-
|
|
750
|
+
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 });
|
|
751
|
+
ServerStylesHost.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerStylesHost });
|
|
752
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerStylesHost, decorators: [{
|
|
753
753
|
type: Injectable
|
|
754
754
|
}], ctorParameters: function () {
|
|
755
755
|
return [{ type: undefined, decorators: [{
|
|
@@ -770,9 +770,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.9",
|
|
|
770
770
|
* Use of this source code is governed by an MIT-style license that can be
|
|
771
771
|
* found in the LICENSE file at https://angular.io/license
|
|
772
772
|
*/
|
|
773
|
-
function notSupported(feature) {
|
|
774
|
-
throw new Error(`platform-server does not support '${feature}'.`);
|
|
775
|
-
}
|
|
776
773
|
const INTERNAL_SERVER_PLATFORM_PROVIDERS = [
|
|
777
774
|
{ provide: DOCUMENT, useFactory: _document, deps: [Injector] },
|
|
778
775
|
{ provide: PLATFORM_ID, useValue: ɵPLATFORM_SERVER_ID },
|
|
@@ -811,15 +808,16 @@ const SERVER_RENDER_PROVIDERS = [
|
|
|
811
808
|
*/
|
|
812
809
|
class ServerModule {
|
|
813
810
|
}
|
|
814
|
-
ServerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-
|
|
815
|
-
ServerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "
|
|
816
|
-
ServerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.0-
|
|
811
|
+
ServerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
812
|
+
ServerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerModule, imports: [HttpClientModule, NoopAnimationsModule], exports: [BrowserModule] });
|
|
813
|
+
ServerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerModule, providers: [
|
|
817
814
|
SERVER_RENDER_PROVIDERS,
|
|
818
815
|
SERVER_HTTP_PROVIDERS,
|
|
819
816
|
{ provide: Testability, useValue: null },
|
|
817
|
+
{ provide: ɵTESTABILITY, useValue: null },
|
|
820
818
|
{ provide: ViewportScroller, useClass: ɵNullViewportScroller },
|
|
821
|
-
], imports: [
|
|
822
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-
|
|
819
|
+
], imports: [HttpClientModule, NoopAnimationsModule, BrowserModule] });
|
|
820
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerModule, decorators: [{
|
|
823
821
|
type: NgModule,
|
|
824
822
|
args: [{
|
|
825
823
|
exports: [BrowserModule],
|
|
@@ -828,6 +826,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.9",
|
|
|
828
826
|
SERVER_RENDER_PROVIDERS,
|
|
829
827
|
SERVER_HTTP_PROVIDERS,
|
|
830
828
|
{ provide: Testability, useValue: null },
|
|
829
|
+
{ provide: ɵTESTABILITY, useValue: null },
|
|
831
830
|
{ provide: ViewportScroller, useClass: ɵNullViewportScroller },
|
|
832
831
|
],
|
|
833
832
|
}]
|
|
@@ -875,9 +874,9 @@ function serializeTransferStateFactory(doc, appId, transferStore) {
|
|
|
875
874
|
*/
|
|
876
875
|
class ServerTransferStateModule {
|
|
877
876
|
}
|
|
878
|
-
ServerTransferStateModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-
|
|
879
|
-
ServerTransferStateModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "
|
|
880
|
-
ServerTransferStateModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.0-
|
|
877
|
+
ServerTransferStateModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerTransferStateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
878
|
+
ServerTransferStateModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerTransferStateModule });
|
|
879
|
+
ServerTransferStateModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerTransferStateModule, providers: [
|
|
881
880
|
TransferState, {
|
|
882
881
|
provide: BEFORE_APP_SERIALIZED,
|
|
883
882
|
useFactory: serializeTransferStateFactory,
|
|
@@ -885,7 +884,7 @@ ServerTransferStateModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0
|
|
|
885
884
|
multi: true,
|
|
886
885
|
}
|
|
887
886
|
] });
|
|
888
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-
|
|
887
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-rc.0", ngImport: i0, type: ServerTransferStateModule, decorators: [{
|
|
889
888
|
type: NgModule,
|
|
890
889
|
args: [{
|
|
891
890
|
providers: [
|
|
@@ -907,27 +906,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.0-next.9",
|
|
|
907
906
|
* found in the LICENSE file at https://angular.io/license
|
|
908
907
|
*/
|
|
909
908
|
function _getPlatform(platformFactory, options) {
|
|
910
|
-
|
|
909
|
+
var _a;
|
|
910
|
+
const extraProviders = (_a = options.platformProviders) !== null && _a !== void 0 ? _a : [];
|
|
911
911
|
return platformFactory([
|
|
912
912
|
{ provide: INITIAL_CONFIG, useValue: { document: options.document, url: options.url } },
|
|
913
913
|
extraProviders
|
|
914
914
|
]);
|
|
915
915
|
}
|
|
916
|
-
function _render(platform,
|
|
917
|
-
return
|
|
918
|
-
const
|
|
916
|
+
function _render(platform, bootstrapPromise) {
|
|
917
|
+
return bootstrapPromise.then((moduleOrApplicationRef) => {
|
|
918
|
+
const environmentInjector = moduleOrApplicationRef.injector;
|
|
919
|
+
const transitionId = environmentInjector.get(ɵTRANSITION_ID, null);
|
|
919
920
|
if (!transitionId) {
|
|
920
921
|
throw new Error(`renderModule[Factory]() requires the use of BrowserModule.withServerTransition() to ensure
|
|
921
922
|
the server-rendered app can be properly bootstrapped into a client app.`);
|
|
922
923
|
}
|
|
923
|
-
const applicationRef =
|
|
924
|
+
const applicationRef = moduleOrApplicationRef instanceof ApplicationRef ?
|
|
925
|
+
moduleOrApplicationRef :
|
|
926
|
+
environmentInjector.get(ApplicationRef);
|
|
924
927
|
return applicationRef.isStable.pipe((first((isStable) => isStable)))
|
|
925
928
|
.toPromise()
|
|
926
929
|
.then(() => {
|
|
927
930
|
const platformState = platform.injector.get(PlatformState);
|
|
928
931
|
const asyncPromises = [];
|
|
929
932
|
// Run any BEFORE_APP_SERIALIZED callbacks just before rendering to string.
|
|
930
|
-
const callbacks =
|
|
933
|
+
const callbacks = environmentInjector.get(BEFORE_APP_SERIALIZED, null);
|
|
931
934
|
if (callbacks) {
|
|
932
935
|
for (const callback of callbacks) {
|
|
933
936
|
try {
|
|
@@ -971,9 +974,50 @@ the server-rendered app can be properly bootstrapped into a client app.`);
|
|
|
971
974
|
* @publicApi
|
|
972
975
|
*/
|
|
973
976
|
function renderModule(module, options) {
|
|
974
|
-
const
|
|
977
|
+
const { document, url, extraProviders: platformProviders } = options;
|
|
978
|
+
const platform = _getPlatform(platformDynamicServer, { document, url, platformProviders });
|
|
975
979
|
return _render(platform, platform.bootstrapModule(module));
|
|
976
980
|
}
|
|
981
|
+
/**
|
|
982
|
+
* Bootstraps an instance of an Angular application and renders it to a string.
|
|
983
|
+
*
|
|
984
|
+
* Note: the root component passed into this function *must* be a standalone one (should have the
|
|
985
|
+
* `standalone: true` flag in the `@Component` decorator config).
|
|
986
|
+
*
|
|
987
|
+
* ```typescript
|
|
988
|
+
* @Component({
|
|
989
|
+
* standalone: true,
|
|
990
|
+
* template: 'Hello world!'
|
|
991
|
+
* })
|
|
992
|
+
* class RootComponent {}
|
|
993
|
+
*
|
|
994
|
+
* const output: string = await renderApplication(RootComponent, {appId: 'server-app'});
|
|
995
|
+
* ```
|
|
996
|
+
*
|
|
997
|
+
* @param rootComponent A reference to a Standalone Component that should be rendered.
|
|
998
|
+
* @param options Additional configuration for the render operation:
|
|
999
|
+
* - `appId` - a string identifier of this application. The appId is used to prefix all
|
|
1000
|
+
* server-generated stylings and state keys of the application in TransferState
|
|
1001
|
+
* use-cases.
|
|
1002
|
+
* - `document` - the full document HTML of the page to render, as a string.
|
|
1003
|
+
* - `url` - the URL for the current render request.
|
|
1004
|
+
* - `providers` - set of application level providers for the current render request.
|
|
1005
|
+
* - `platformProviders` - the platform level providers for the current render request.
|
|
1006
|
+
* @returns A Promise, that returns serialized (to a string) rendered page, once resolved.
|
|
1007
|
+
*
|
|
1008
|
+
* @publicApi
|
|
1009
|
+
*/
|
|
1010
|
+
function renderApplication(rootComponent, options) {
|
|
1011
|
+
var _a;
|
|
1012
|
+
const { document, url, platformProviders, appId } = options;
|
|
1013
|
+
const platform = _getPlatform(platformDynamicServer, { document, url, platformProviders });
|
|
1014
|
+
const appProviders = [
|
|
1015
|
+
importProvidersFrom(BrowserModule.withServerTransition({ appId })),
|
|
1016
|
+
importProvidersFrom(ServerModule),
|
|
1017
|
+
...((_a = options.providers) !== null && _a !== void 0 ? _a : []),
|
|
1018
|
+
];
|
|
1019
|
+
return _render(platform, ɵinternalBootstrapApplication({ rootComponent, appProviders }));
|
|
1020
|
+
}
|
|
977
1021
|
/**
|
|
978
1022
|
* Renders a {@link NgModuleFactory} to string.
|
|
979
1023
|
*
|
|
@@ -988,7 +1032,8 @@ function renderModule(module, options) {
|
|
|
988
1032
|
* Use {@link renderModule} API instead.
|
|
989
1033
|
*/
|
|
990
1034
|
function renderModuleFactory(moduleFactory, options) {
|
|
991
|
-
const
|
|
1035
|
+
const { document, url, extraProviders: platformProviders } = options;
|
|
1036
|
+
const platform = _getPlatform(platformServer, { document, url, platformProviders });
|
|
992
1037
|
return _render(platform, platform.bootstrapModuleFactory(moduleFactory));
|
|
993
1038
|
}
|
|
994
1039
|
|
|
@@ -1010,7 +1055,7 @@ function renderModuleFactory(moduleFactory, options) {
|
|
|
1010
1055
|
/**
|
|
1011
1056
|
* @publicApi
|
|
1012
1057
|
*/
|
|
1013
|
-
const VERSION = new Version('14.0.0-
|
|
1058
|
+
const VERSION = new Version('14.0.0-rc.0');
|
|
1014
1059
|
|
|
1015
1060
|
/**
|
|
1016
1061
|
* @license
|
|
@@ -1041,5 +1086,5 @@ const VERSION = new Version('14.0.0-next.9');
|
|
|
1041
1086
|
* Generated bundle index. Do not edit.
|
|
1042
1087
|
*/
|
|
1043
1088
|
|
|
1044
|
-
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 };
|
|
1089
|
+
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 };
|
|
1045
1090
|
//# sourceMappingURL=platform-server.mjs.map
|