@angular/platform-server 16.0.0-next.1 → 16.0.0-next.3
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/src/http.mjs +3 -3
- package/esm2020/src/location.mjs +3 -3
- package/esm2020/src/platform-server.mjs +3 -2
- package/esm2020/src/platform_state.mjs +3 -3
- package/esm2020/src/provide_server.mjs +34 -0
- package/esm2020/src/server.mjs +14 -20
- package/esm2020/src/server_events.mjs +3 -3
- package/esm2020/src/server_renderer.mjs +18 -15
- package/esm2020/src/styles_host.mjs +11 -14
- package/esm2020/src/tokens.mjs +2 -2
- package/esm2020/src/transfer_state.mjs +4 -4
- package/esm2020/src/utils.mjs +16 -66
- package/esm2020/src/version.mjs +1 -1
- package/esm2020/testing/src/server.mjs +4 -4
- package/fesm2015/init.mjs +1 -1
- package/fesm2015/platform-server.mjs +96 -129
- package/fesm2015/platform-server.mjs.map +1 -1
- package/fesm2015/testing.mjs +5 -5
- package/fesm2020/init.mjs +1 -1
- package/fesm2020/platform-server.mjs +96 -129
- package/fesm2020/platform-server.mjs.map +1 -1
- package/fesm2020/testing.mjs +5 -5
- package/index.d.ts +52 -30
- package/init/index.d.ts +1 -1
- package/package.json +7 -7
- package/testing/index.d.ts +1 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v16.0.0-next.
|
|
2
|
+
* @license Angular v16.0.0-next.3
|
|
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, inject, EnvironmentInjector, Optional, ViewEncapsulation,
|
|
9
|
+
import { Injectable, Inject, InjectionToken, inject, EnvironmentInjector, Optional, ViewEncapsulation, APP_ID, RendererStyleFlags2, ɵescapeTransferStateContent, NgModule, Injector, PLATFORM_ID, PLATFORM_INITIALIZER, ɵALLOW_MULTIPLE_PLATFORMS, RendererFactory2, NgZone, Testability, ɵTESTABILITY, ɵsetDocument, createPlatformFactory, platformCore, makeEnvironmentProviders, Renderer2, ApplicationRef, ɵIS_HYDRATION_FEATURE_ENABLED, ɵannotateForHydration, ɵisPromise, importProvidersFrom, ɵinternalCreateApplication, ɵgetComponentDef, Version } from '@angular/core';
|
|
10
10
|
import * as i1 from '@angular/platform-browser';
|
|
11
|
-
import { ɵBrowserDomAdapter, ɵshimStyles, ɵNAMESPACE_URIS, ɵshimContentAttribute, ɵshimHostAttribute, ɵSharedStylesHost,
|
|
11
|
+
import { ɵBrowserDomAdapter, ɵshimStyles, ɵNAMESPACE_URIS, ɵshimContentAttribute, ɵshimHostAttribute, ɵSharedStylesHost, TransferState, EVENT_MANAGER_PLUGINS, BrowserModule } from '@angular/platform-browser';
|
|
12
|
+
import { ɵHttpInterceptorHandler, HttpBackend, HttpHandler, HttpClientModule, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
|
13
|
+
import { ɵAnimationRendererFactory, NoopAnimationsModule, provideNoopAnimations } from '@angular/platform-browser/animations';
|
|
12
14
|
import { ɵAnimationEngine } from '@angular/animations/browser';
|
|
13
|
-
import { ɵHttpInterceptorHandler, HttpBackend, HttpHandler, HttpClientModule } from '@angular/common/http';
|
|
14
15
|
import { ɵplatformCoreDynamic } from '@angular/platform-browser-dynamic';
|
|
15
|
-
import { ɵAnimationRendererFactory, NoopAnimationsModule } from '@angular/platform-browser/animations';
|
|
16
16
|
import { Observable, Subject } from 'rxjs';
|
|
17
17
|
import * as xhr2 from 'xhr2';
|
|
18
18
|
import * as url from 'url';
|
|
@@ -20286,9 +20286,9 @@ class PlatformState {
|
|
|
20286
20286
|
return this._doc;
|
|
20287
20287
|
}
|
|
20288
20288
|
}
|
|
20289
|
-
PlatformState.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20290
|
-
PlatformState.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20291
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20289
|
+
PlatformState.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: PlatformState, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
20290
|
+
PlatformState.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: PlatformState });
|
|
20291
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: PlatformState, decorators: [{
|
|
20292
20292
|
type: Injectable
|
|
20293
20293
|
}], ctorParameters: function () {
|
|
20294
20294
|
return [{ type: undefined, decorators: [{
|
|
@@ -20304,7 +20304,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.1",
|
|
|
20304
20304
|
*/
|
|
20305
20305
|
const INITIAL_CONFIG = new InjectionToken('Server.INITIAL_CONFIG');
|
|
20306
20306
|
/**
|
|
20307
|
-
* A function that will be executed when calling `renderApplication
|
|
20307
|
+
* A function that will be executed when calling `renderApplication` or
|
|
20308
20308
|
* `renderModule` just before current platform state is rendered to string.
|
|
20309
20309
|
*
|
|
20310
20310
|
* @publicApi
|
|
@@ -20318,9 +20318,9 @@ class ServerXhr {
|
|
|
20318
20318
|
return new xhr2.XMLHttpRequest();
|
|
20319
20319
|
}
|
|
20320
20320
|
}
|
|
20321
|
-
ServerXhr.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20322
|
-
ServerXhr.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20323
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20321
|
+
ServerXhr.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerXhr, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
20322
|
+
ServerXhr.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerXhr });
|
|
20323
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerXhr, decorators: [{
|
|
20324
20324
|
type: Injectable
|
|
20325
20325
|
}] });
|
|
20326
20326
|
class ZoneMacroTaskWrapper {
|
|
@@ -20516,9 +20516,9 @@ class ServerPlatformLocation {
|
|
|
20516
20516
|
return undefined;
|
|
20517
20517
|
}
|
|
20518
20518
|
}
|
|
20519
|
-
ServerPlatformLocation.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20520
|
-
ServerPlatformLocation.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20521
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20519
|
+
ServerPlatformLocation.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerPlatformLocation, deps: [{ token: DOCUMENT }, { token: INITIAL_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
20520
|
+
ServerPlatformLocation.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerPlatformLocation });
|
|
20521
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerPlatformLocation, decorators: [{
|
|
20522
20522
|
type: Injectable
|
|
20523
20523
|
}], ctorParameters: function () {
|
|
20524
20524
|
return [{ type: undefined, decorators: [{
|
|
@@ -20555,9 +20555,9 @@ class ServerEventManagerPlugin /* extends EventManagerPlugin which is private */
|
|
|
20555
20555
|
return this.addEventListener(target, eventName, handler);
|
|
20556
20556
|
}
|
|
20557
20557
|
}
|
|
20558
|
-
ServerEventManagerPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20559
|
-
ServerEventManagerPlugin.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20560
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20558
|
+
ServerEventManagerPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerEventManagerPlugin /* extends EventManagerPlugin which is private */, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
20559
|
+
ServerEventManagerPlugin.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerEventManagerPlugin /* extends EventManagerPlugin which is private */ });
|
|
20560
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerEventManagerPlugin /* extends EventManagerPlugin which is private */, decorators: [{
|
|
20561
20561
|
type: Injectable
|
|
20562
20562
|
}], ctorParameters: function () {
|
|
20563
20563
|
return [{ type: undefined, decorators: [{
|
|
@@ -20569,11 +20569,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.1",
|
|
|
20569
20569
|
const EMPTY_ARRAY = [];
|
|
20570
20570
|
const DEFAULT_SCHEMA = new DomElementSchemaRegistry();
|
|
20571
20571
|
class ServerRendererFactory2 {
|
|
20572
|
-
constructor(eventManager, ngZone, document, sharedStylesHost) {
|
|
20572
|
+
constructor(eventManager, ngZone, document, sharedStylesHost, appId) {
|
|
20573
20573
|
this.eventManager = eventManager;
|
|
20574
20574
|
this.ngZone = ngZone;
|
|
20575
20575
|
this.document = document;
|
|
20576
20576
|
this.sharedStylesHost = sharedStylesHost;
|
|
20577
|
+
this.appId = appId;
|
|
20577
20578
|
this.rendererByCompId = new Map();
|
|
20578
20579
|
this.schema = DEFAULT_SCHEMA;
|
|
20579
20580
|
this.defaultRenderer = new DefaultServerRenderer2(eventManager, document, ngZone, this.schema);
|
|
@@ -20586,7 +20587,7 @@ class ServerRendererFactory2 {
|
|
|
20586
20587
|
case ViewEncapsulation.Emulated: {
|
|
20587
20588
|
let renderer = this.rendererByCompId.get(type.id);
|
|
20588
20589
|
if (!renderer) {
|
|
20589
|
-
renderer = new EmulatedEncapsulationServerRenderer2(this.eventManager, this.document, this.ngZone, this.sharedStylesHost, this.schema, type);
|
|
20590
|
+
renderer = new EmulatedEncapsulationServerRenderer2(this.eventManager, this.document, this.ngZone, this.sharedStylesHost, this.schema, type, this.appId);
|
|
20590
20591
|
this.rendererByCompId.set(type.id, renderer);
|
|
20591
20592
|
}
|
|
20592
20593
|
renderer.applyToHost(element);
|
|
@@ -20605,15 +20606,18 @@ class ServerRendererFactory2 {
|
|
|
20605
20606
|
begin() { }
|
|
20606
20607
|
end() { }
|
|
20607
20608
|
}
|
|
20608
|
-
ServerRendererFactory2.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20609
|
-
ServerRendererFactory2.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20610
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20609
|
+
ServerRendererFactory2.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerRendererFactory2, deps: [{ token: i1.EventManager }, { token: i0.NgZone }, { token: DOCUMENT }, { token: i1.ɵSharedStylesHost }, { token: APP_ID }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
20610
|
+
ServerRendererFactory2.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerRendererFactory2 });
|
|
20611
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerRendererFactory2, decorators: [{
|
|
20611
20612
|
type: Injectable
|
|
20612
20613
|
}], ctorParameters: function () {
|
|
20613
|
-
return [{ type: i1.EventManager }, { type: i0.NgZone }, { type:
|
|
20614
|
+
return [{ type: i1.EventManager }, { type: i0.NgZone }, { type: Document, decorators: [{
|
|
20614
20615
|
type: Inject,
|
|
20615
20616
|
args: [DOCUMENT]
|
|
20616
|
-
}] }, { type: i1.ɵSharedStylesHost }
|
|
20617
|
+
}] }, { type: i1.ɵSharedStylesHost }, { type: undefined, decorators: [{
|
|
20618
|
+
type: Inject,
|
|
20619
|
+
args: [APP_ID]
|
|
20620
|
+
}] }];
|
|
20617
20621
|
} });
|
|
20618
20622
|
class DefaultServerRenderer2 {
|
|
20619
20623
|
constructor(eventManager, document, ngZone, schema) {
|
|
@@ -20776,15 +20780,14 @@ function isTemplateNode(node) {
|
|
|
20776
20780
|
return node.tagName === 'TEMPLATE' && node.content !== undefined;
|
|
20777
20781
|
}
|
|
20778
20782
|
class EmulatedEncapsulationServerRenderer2 extends DefaultServerRenderer2 {
|
|
20779
|
-
constructor(eventManager, document, ngZone, sharedStylesHost, schema, component) {
|
|
20783
|
+
constructor(eventManager, document, ngZone, sharedStylesHost, schema, component, appId) {
|
|
20780
20784
|
super(eventManager, document, ngZone, schema);
|
|
20781
20785
|
this.component = component;
|
|
20782
|
-
|
|
20783
|
-
const
|
|
20784
|
-
const styles = ɵshimStyles(componentId, component.styles);
|
|
20786
|
+
const componentShortId = appId + '-' + this.component.id;
|
|
20787
|
+
const styles = ɵshimStyles(componentShortId, this.component.styles);
|
|
20785
20788
|
sharedStylesHost.addStyles(styles);
|
|
20786
|
-
this.contentAttr = ɵshimContentAttribute(
|
|
20787
|
-
this.hostAttr = ɵshimHostAttribute(
|
|
20789
|
+
this.contentAttr = ɵshimContentAttribute(componentShortId);
|
|
20790
|
+
this.hostAttr = ɵshimHostAttribute(componentShortId);
|
|
20788
20791
|
}
|
|
20789
20792
|
applyToHost(element) {
|
|
20790
20793
|
super.setAttribute(element, this.hostAttr, '');
|
|
@@ -20834,10 +20837,9 @@ function _writeStyleAttribute(element, styleMap) {
|
|
|
20834
20837
|
}
|
|
20835
20838
|
|
|
20836
20839
|
class ServerStylesHost extends ɵSharedStylesHost {
|
|
20837
|
-
constructor(doc,
|
|
20840
|
+
constructor(doc, appId) {
|
|
20838
20841
|
super();
|
|
20839
|
-
this.
|
|
20840
|
-
this.transitionId = transitionId;
|
|
20842
|
+
this.appId = appId;
|
|
20841
20843
|
this.head = null;
|
|
20842
20844
|
this._styleNodes = new Set();
|
|
20843
20845
|
this.head = doc.getElementsByTagName('head')[0];
|
|
@@ -20846,8 +20848,8 @@ class ServerStylesHost extends ɵSharedStylesHost {
|
|
|
20846
20848
|
const adapter = ɵgetDOM();
|
|
20847
20849
|
const el = adapter.createElement('style');
|
|
20848
20850
|
el.textContent = style;
|
|
20849
|
-
if (!!this.
|
|
20850
|
-
el.setAttribute('ng-
|
|
20851
|
+
if (!!this.appId) {
|
|
20852
|
+
el.setAttribute('ng-app', this.appId);
|
|
20851
20853
|
}
|
|
20852
20854
|
this.head.appendChild(el);
|
|
20853
20855
|
this._styleNodes.add(el);
|
|
@@ -20858,19 +20860,17 @@ class ServerStylesHost extends ɵSharedStylesHost {
|
|
|
20858
20860
|
super.ngOnDestroy();
|
|
20859
20861
|
}
|
|
20860
20862
|
}
|
|
20861
|
-
ServerStylesHost.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20862
|
-
ServerStylesHost.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20863
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20863
|
+
ServerStylesHost.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerStylesHost, deps: [{ token: DOCUMENT }, { token: APP_ID }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
20864
|
+
ServerStylesHost.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerStylesHost });
|
|
20865
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerStylesHost, decorators: [{
|
|
20864
20866
|
type: Injectable
|
|
20865
20867
|
}], ctorParameters: function () {
|
|
20866
20868
|
return [{ type: undefined, decorators: [{
|
|
20867
20869
|
type: Inject,
|
|
20868
20870
|
args: [DOCUMENT]
|
|
20869
20871
|
}] }, { type: undefined, decorators: [{
|
|
20870
|
-
type: Optional
|
|
20871
|
-
}, {
|
|
20872
20872
|
type: Inject,
|
|
20873
|
-
args: [
|
|
20873
|
+
args: [APP_ID]
|
|
20874
20874
|
}] }];
|
|
20875
20875
|
} });
|
|
20876
20876
|
|
|
@@ -20913,10 +20913,10 @@ function serializeTransferStateFactory(doc, appId, transferStore) {
|
|
|
20913
20913
|
*/
|
|
20914
20914
|
class ServerTransferStateModule {
|
|
20915
20915
|
}
|
|
20916
|
-
ServerTransferStateModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20917
|
-
ServerTransferStateModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.0-next.
|
|
20918
|
-
ServerTransferStateModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20919
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20916
|
+
ServerTransferStateModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerTransferStateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
20917
|
+
ServerTransferStateModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerTransferStateModule });
|
|
20918
|
+
ServerTransferStateModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerTransferStateModule });
|
|
20919
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerTransferStateModule, decorators: [{
|
|
20920
20920
|
type: NgModule,
|
|
20921
20921
|
args: [{}]
|
|
20922
20922
|
}] });
|
|
@@ -20952,6 +20952,14 @@ const SERVER_RENDER_PROVIDERS = [
|
|
|
20952
20952
|
{ provide: ɵSharedStylesHost, useExisting: ServerStylesHost },
|
|
20953
20953
|
{ provide: EVENT_MANAGER_PLUGINS, multi: true, useClass: ServerEventManagerPlugin },
|
|
20954
20954
|
];
|
|
20955
|
+
const PLATFORM_SERVER_PROVIDERS = [
|
|
20956
|
+
TRANSFER_STATE_SERIALIZATION_PROVIDERS,
|
|
20957
|
+
SERVER_RENDER_PROVIDERS,
|
|
20958
|
+
SERVER_HTTP_PROVIDERS,
|
|
20959
|
+
{ provide: Testability, useValue: null },
|
|
20960
|
+
{ provide: ɵTESTABILITY, useValue: null },
|
|
20961
|
+
{ provide: ViewportScroller, useClass: ɵNullViewportScroller },
|
|
20962
|
+
];
|
|
20955
20963
|
/**
|
|
20956
20964
|
* The ng module for the server.
|
|
20957
20965
|
*
|
|
@@ -20959,29 +20967,15 @@ const SERVER_RENDER_PROVIDERS = [
|
|
|
20959
20967
|
*/
|
|
20960
20968
|
class ServerModule {
|
|
20961
20969
|
}
|
|
20962
|
-
ServerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20963
|
-
ServerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.0-next.
|
|
20964
|
-
ServerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20965
|
-
|
|
20966
|
-
SERVER_RENDER_PROVIDERS,
|
|
20967
|
-
SERVER_HTTP_PROVIDERS,
|
|
20968
|
-
{ provide: Testability, useValue: null },
|
|
20969
|
-
{ provide: ɵTESTABILITY, useValue: null },
|
|
20970
|
-
{ provide: ViewportScroller, useClass: ɵNullViewportScroller },
|
|
20971
|
-
], imports: [HttpClientModule, NoopAnimationsModule, BrowserModule] });
|
|
20972
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.1", ngImport: i0, type: ServerModule, decorators: [{
|
|
20970
|
+
ServerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
20971
|
+
ServerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerModule, imports: [HttpClientModule, NoopAnimationsModule], exports: [BrowserModule] });
|
|
20972
|
+
ServerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerModule, providers: PLATFORM_SERVER_PROVIDERS, imports: [HttpClientModule, NoopAnimationsModule, BrowserModule] });
|
|
20973
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerModule, decorators: [{
|
|
20973
20974
|
type: NgModule,
|
|
20974
20975
|
args: [{
|
|
20975
20976
|
exports: [BrowserModule],
|
|
20976
20977
|
imports: [HttpClientModule, NoopAnimationsModule],
|
|
20977
|
-
providers:
|
|
20978
|
-
TRANSFER_STATE_SERIALIZATION_PROVIDERS,
|
|
20979
|
-
SERVER_RENDER_PROVIDERS,
|
|
20980
|
-
SERVER_HTTP_PROVIDERS,
|
|
20981
|
-
{ provide: Testability, useValue: null },
|
|
20982
|
-
{ provide: ɵTESTABILITY, useValue: null },
|
|
20983
|
-
{ provide: ViewportScroller, useClass: ɵNullViewportScroller },
|
|
20984
|
-
],
|
|
20978
|
+
providers: PLATFORM_SERVER_PROVIDERS,
|
|
20985
20979
|
}]
|
|
20986
20980
|
}] });
|
|
20987
20981
|
function _document(injector) {
|
|
@@ -21009,6 +21003,29 @@ const platformServer = createPlatformFactory(platformCore, 'server', INTERNAL_SE
|
|
|
21009
21003
|
*/
|
|
21010
21004
|
const platformDynamicServer = createPlatformFactory(ɵplatformCoreDynamic, 'serverDynamic', INTERNAL_SERVER_PLATFORM_PROVIDERS);
|
|
21011
21005
|
|
|
21006
|
+
/**
|
|
21007
|
+
* Sets up providers necessary to enable server rendering functionality for the application.
|
|
21008
|
+
*
|
|
21009
|
+
* @usageNotes
|
|
21010
|
+
*
|
|
21011
|
+
* Basic example of how you can add server support to your application:
|
|
21012
|
+
* ```ts
|
|
21013
|
+
* bootstrapApplication(AppComponent, {
|
|
21014
|
+
* providers: [provideServerSupport()]
|
|
21015
|
+
* });
|
|
21016
|
+
* ```
|
|
21017
|
+
*
|
|
21018
|
+
* @publicApi
|
|
21019
|
+
* @returns A set of providers to setup the server.
|
|
21020
|
+
*/
|
|
21021
|
+
function provideServerSupport() {
|
|
21022
|
+
return makeEnvironmentProviders([
|
|
21023
|
+
provideHttpClient(withInterceptorsFromDi()),
|
|
21024
|
+
provideNoopAnimations(),
|
|
21025
|
+
...PLATFORM_SERVER_PROVIDERS,
|
|
21026
|
+
]);
|
|
21027
|
+
}
|
|
21028
|
+
|
|
21012
21029
|
function _getPlatform(platformFactory, options) {
|
|
21013
21030
|
var _a;
|
|
21014
21031
|
const extraProviders = (_a = options.platformProviders) !== null && _a !== void 0 ? _a : [];
|
|
@@ -21033,11 +21050,6 @@ function appendServerContextInfo(serverContext, applicationRef) {
|
|
|
21033
21050
|
function _render(platform, bootstrapPromise) {
|
|
21034
21051
|
return bootstrapPromise.then((moduleOrApplicationRef) => {
|
|
21035
21052
|
const environmentInjector = moduleOrApplicationRef.injector;
|
|
21036
|
-
const transitionId = environmentInjector.get(ɵTRANSITION_ID, null);
|
|
21037
|
-
if (!transitionId) {
|
|
21038
|
-
throw new Error(`renderModule[Factory]() requires the use of BrowserModule.withServerTransition() to ensure
|
|
21039
|
-
the server-rendered app can be properly bootstrapped into a client app.`);
|
|
21040
|
-
}
|
|
21041
21053
|
const applicationRef = moduleOrApplicationRef instanceof ApplicationRef ?
|
|
21042
21054
|
moduleOrApplicationRef :
|
|
21043
21055
|
environmentInjector.get(ApplicationRef);
|
|
@@ -21048,6 +21060,9 @@ the server-rendered app can be properly bootstrapped into a client app.`);
|
|
|
21048
21060
|
appendServerContextInfo(serverContext, applicationRef);
|
|
21049
21061
|
const platformState = platform.injector.get(PlatformState);
|
|
21050
21062
|
const asyncPromises = [];
|
|
21063
|
+
if (applicationRef.injector.get(ɵIS_HYDRATION_FEATURE_ENABLED, false)) {
|
|
21064
|
+
ɵannotateForHydration(applicationRef, platformState.getDocument());
|
|
21065
|
+
}
|
|
21051
21066
|
// Run any BEFORE_APP_SERIALIZED callbacks just before rendering to string.
|
|
21052
21067
|
const callbacks = environmentInjector.get(BEFORE_APP_SERIALIZED, null);
|
|
21053
21068
|
if (callbacks) {
|
|
@@ -21119,71 +21134,23 @@ function renderModule(moduleType, options) {
|
|
|
21119
21134
|
const platform = _getPlatform(platformDynamicServer, { document, url, platformProviders });
|
|
21120
21135
|
return _render(platform, platform.bootstrapModule(moduleType));
|
|
21121
21136
|
}
|
|
21122
|
-
|
|
21123
|
-
* Bootstraps an instance of an Angular application and renders it to a string.
|
|
21124
|
-
*
|
|
21125
|
-
* Note: the root component passed into this function *must* be a standalone one (should have the
|
|
21126
|
-
* `standalone: true` flag in the `@Component` decorator config).
|
|
21127
|
-
*
|
|
21128
|
-
* ```typescript
|
|
21129
|
-
* @Component({
|
|
21130
|
-
* standalone: true,
|
|
21131
|
-
* template: 'Hello world!'
|
|
21132
|
-
* })
|
|
21133
|
-
* class RootComponent {}
|
|
21134
|
-
*
|
|
21135
|
-
* const output: string = await renderApplication(RootComponent, {appId: 'server-app'});
|
|
21136
|
-
* ```
|
|
21137
|
-
*
|
|
21138
|
-
* @param rootComponent A reference to a Standalone Component that should be rendered.
|
|
21139
|
-
* @param options Additional configuration for the render operation:
|
|
21140
|
-
* - `appId` - a string identifier of this application. The appId is used to prefix all
|
|
21141
|
-
* server-generated stylings and state keys of the application in TransferState
|
|
21142
|
-
* use-cases.
|
|
21143
|
-
* - `document` - the document of the page to render, either as an HTML string or
|
|
21144
|
-
* as a reference to the `document` instance.
|
|
21145
|
-
* - `url` - the URL for the current render request.
|
|
21146
|
-
* - `providers` - set of application level providers for the current render request.
|
|
21147
|
-
* - `platformProviders` - the platform level providers for the current render request.
|
|
21148
|
-
*
|
|
21149
|
-
* @returns A Promise, that returns serialized (to a string) rendered page, once resolved.
|
|
21150
|
-
*
|
|
21151
|
-
* @publicApi
|
|
21152
|
-
* @developerPreview
|
|
21153
|
-
*/
|
|
21154
|
-
function renderApplication(rootComponent, options) {
|
|
21137
|
+
function renderApplication(rootComponentOrBootstrapFn, options) {
|
|
21155
21138
|
var _a;
|
|
21156
|
-
const { document, url, platformProviders, appId } = options;
|
|
21139
|
+
const { document, url, platformProviders, appId = '' } = options;
|
|
21157
21140
|
const platform = _getPlatform(platformDynamicServer, { document, url, platformProviders });
|
|
21141
|
+
if (isBootstrapFn(rootComponentOrBootstrapFn)) {
|
|
21142
|
+
return _render(platform, rootComponentOrBootstrapFn());
|
|
21143
|
+
}
|
|
21158
21144
|
const appProviders = [
|
|
21159
21145
|
importProvidersFrom(BrowserModule.withServerTransition({ appId })),
|
|
21160
21146
|
importProvidersFrom(ServerModule),
|
|
21161
21147
|
...((_a = options.providers) !== null && _a !== void 0 ? _a : []),
|
|
21162
21148
|
];
|
|
21163
|
-
return _render(platform, ɵinternalCreateApplication({ rootComponent, appProviders }));
|
|
21149
|
+
return _render(platform, ɵinternalCreateApplication({ rootComponent: rootComponentOrBootstrapFn, appProviders }));
|
|
21164
21150
|
}
|
|
21165
|
-
|
|
21166
|
-
|
|
21167
|
-
|
|
21168
|
-
*
|
|
21169
|
-
* @param moduleFactory An instance of the {@link NgModuleFactory} that should be used for
|
|
21170
|
-
* bootstrap.
|
|
21171
|
-
* @param options Additional configuration for the render operation:
|
|
21172
|
-
* - `document` - the document of the page to render, either as an HTML string or
|
|
21173
|
-
* as a reference to the `document` instance.
|
|
21174
|
-
* - `url` - the URL for the current render request.
|
|
21175
|
-
* - `extraProviders` - set of platform level providers for the current render request.
|
|
21176
|
-
*
|
|
21177
|
-
* @publicApi
|
|
21178
|
-
*
|
|
21179
|
-
* @deprecated
|
|
21180
|
-
* This symbol is no longer necessary as of Angular v13.
|
|
21181
|
-
* Use {@link renderModule} API instead.
|
|
21182
|
-
*/
|
|
21183
|
-
function renderModuleFactory(moduleFactory, options) {
|
|
21184
|
-
const { document, url, extraProviders: platformProviders } = options;
|
|
21185
|
-
const platform = _getPlatform(platformServer, { document, url, platformProviders });
|
|
21186
|
-
return _render(platform, platform.bootstrapModuleFactory(moduleFactory));
|
|
21151
|
+
function isBootstrapFn(value) {
|
|
21152
|
+
// We can differentiate between a component and a bootstrap function by reading `cmp`:
|
|
21153
|
+
return typeof value === 'function' && !ɵgetComponentDef(value);
|
|
21187
21154
|
}
|
|
21188
21155
|
|
|
21189
21156
|
/**
|
|
@@ -21194,7 +21161,7 @@ function renderModuleFactory(moduleFactory, options) {
|
|
|
21194
21161
|
/**
|
|
21195
21162
|
* @publicApi
|
|
21196
21163
|
*/
|
|
21197
|
-
const VERSION = new Version('16.0.0-next.
|
|
21164
|
+
const VERSION = new Version('16.0.0-next.3');
|
|
21198
21165
|
|
|
21199
21166
|
/// <reference types="node" />
|
|
21200
21167
|
// This file only reexports content of the `src` folder. Keep it that way.
|
|
@@ -21205,5 +21172,5 @@ const VERSION = new Version('16.0.0-next.1');
|
|
|
21205
21172
|
* Generated bundle index. Do not edit.
|
|
21206
21173
|
*/
|
|
21207
21174
|
|
|
21208
|
-
export { BEFORE_APP_SERIALIZED, INITIAL_CONFIG, PlatformState, ServerModule, ServerTransferStateModule, VERSION, platformDynamicServer, platformServer, renderApplication, renderModule,
|
|
21175
|
+
export { BEFORE_APP_SERIALIZED, INITIAL_CONFIG, PlatformState, ServerModule, ServerTransferStateModule, VERSION, platformDynamicServer, platformServer, provideServerSupport, renderApplication, renderModule, INTERNAL_SERVER_PLATFORM_PROVIDERS as ɵINTERNAL_SERVER_PLATFORM_PROVIDERS, SERVER_CONTEXT as ɵSERVER_CONTEXT, SERVER_RENDER_PROVIDERS as ɵSERVER_RENDER_PROVIDERS, ServerRendererFactory2 as ɵServerRendererFactory2, setDomTypes as ɵsetDomTypes };
|
|
21209
21176
|
//# sourceMappingURL=platform-server.mjs.map
|