@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
package/fesm2015/testing.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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
|
*/
|
|
@@ -23,10 +23,10 @@ const platformServerTesting = createPlatformFactory(ɵplatformCoreDynamicTesting
|
|
|
23
23
|
*/
|
|
24
24
|
class ServerTestingModule {
|
|
25
25
|
}
|
|
26
|
-
ServerTestingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
27
|
-
ServerTestingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.0-next.
|
|
28
|
-
ServerTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
29
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
26
|
+
ServerTestingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
27
|
+
ServerTestingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerTestingModule, imports: [NoopAnimationsModule], exports: [BrowserDynamicTestingModule] });
|
|
28
|
+
ServerTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerTestingModule, providers: ɵSERVER_RENDER_PROVIDERS, imports: [NoopAnimationsModule, BrowserDynamicTestingModule] });
|
|
29
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerTestingModule, decorators: [{
|
|
30
30
|
type: NgModule,
|
|
31
31
|
args: [{
|
|
32
32
|
exports: [BrowserDynamicTestingModule],
|
package/fesm2020/init.mjs
CHANGED
|
@@ -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';
|
|
@@ -20085,9 +20085,9 @@ class PlatformState {
|
|
|
20085
20085
|
return this._doc;
|
|
20086
20086
|
}
|
|
20087
20087
|
}
|
|
20088
|
-
PlatformState.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20089
|
-
PlatformState.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20090
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20088
|
+
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 });
|
|
20089
|
+
PlatformState.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: PlatformState });
|
|
20090
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: PlatformState, decorators: [{
|
|
20091
20091
|
type: Injectable
|
|
20092
20092
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
20093
20093
|
type: Inject,
|
|
@@ -20101,7 +20101,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.1",
|
|
|
20101
20101
|
*/
|
|
20102
20102
|
const INITIAL_CONFIG = new InjectionToken('Server.INITIAL_CONFIG');
|
|
20103
20103
|
/**
|
|
20104
|
-
* A function that will be executed when calling `renderApplication
|
|
20104
|
+
* A function that will be executed when calling `renderApplication` or
|
|
20105
20105
|
* `renderModule` just before current platform state is rendered to string.
|
|
20106
20106
|
*
|
|
20107
20107
|
* @publicApi
|
|
@@ -20115,9 +20115,9 @@ class ServerXhr {
|
|
|
20115
20115
|
return new xhr2.XMLHttpRequest();
|
|
20116
20116
|
}
|
|
20117
20117
|
}
|
|
20118
|
-
ServerXhr.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20119
|
-
ServerXhr.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20120
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20118
|
+
ServerXhr.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerXhr, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
20119
|
+
ServerXhr.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerXhr });
|
|
20120
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerXhr, decorators: [{
|
|
20121
20121
|
type: Injectable
|
|
20122
20122
|
}] });
|
|
20123
20123
|
class ZoneMacroTaskWrapper {
|
|
@@ -20313,9 +20313,9 @@ class ServerPlatformLocation {
|
|
|
20313
20313
|
return undefined;
|
|
20314
20314
|
}
|
|
20315
20315
|
}
|
|
20316
|
-
ServerPlatformLocation.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20317
|
-
ServerPlatformLocation.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20318
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20316
|
+
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 });
|
|
20317
|
+
ServerPlatformLocation.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerPlatformLocation });
|
|
20318
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerPlatformLocation, decorators: [{
|
|
20319
20319
|
type: Injectable
|
|
20320
20320
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
20321
20321
|
type: Inject,
|
|
@@ -20350,9 +20350,9 @@ class ServerEventManagerPlugin /* extends EventManagerPlugin which is private */
|
|
|
20350
20350
|
return this.addEventListener(target, eventName, handler);
|
|
20351
20351
|
}
|
|
20352
20352
|
}
|
|
20353
|
-
ServerEventManagerPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20354
|
-
ServerEventManagerPlugin.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20355
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20353
|
+
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 });
|
|
20354
|
+
ServerEventManagerPlugin.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerEventManagerPlugin /* extends EventManagerPlugin which is private */ });
|
|
20355
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerEventManagerPlugin /* extends EventManagerPlugin which is private */, decorators: [{
|
|
20356
20356
|
type: Injectable
|
|
20357
20357
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
20358
20358
|
type: Inject,
|
|
@@ -20362,11 +20362,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.1",
|
|
|
20362
20362
|
const EMPTY_ARRAY = [];
|
|
20363
20363
|
const DEFAULT_SCHEMA = new DomElementSchemaRegistry();
|
|
20364
20364
|
class ServerRendererFactory2 {
|
|
20365
|
-
constructor(eventManager, ngZone, document, sharedStylesHost) {
|
|
20365
|
+
constructor(eventManager, ngZone, document, sharedStylesHost, appId) {
|
|
20366
20366
|
this.eventManager = eventManager;
|
|
20367
20367
|
this.ngZone = ngZone;
|
|
20368
20368
|
this.document = document;
|
|
20369
20369
|
this.sharedStylesHost = sharedStylesHost;
|
|
20370
|
+
this.appId = appId;
|
|
20370
20371
|
this.rendererByCompId = new Map();
|
|
20371
20372
|
this.schema = DEFAULT_SCHEMA;
|
|
20372
20373
|
this.defaultRenderer = new DefaultServerRenderer2(eventManager, document, ngZone, this.schema);
|
|
@@ -20379,7 +20380,7 @@ class ServerRendererFactory2 {
|
|
|
20379
20380
|
case ViewEncapsulation.Emulated: {
|
|
20380
20381
|
let renderer = this.rendererByCompId.get(type.id);
|
|
20381
20382
|
if (!renderer) {
|
|
20382
|
-
renderer = new EmulatedEncapsulationServerRenderer2(this.eventManager, this.document, this.ngZone, this.sharedStylesHost, this.schema, type);
|
|
20383
|
+
renderer = new EmulatedEncapsulationServerRenderer2(this.eventManager, this.document, this.ngZone, this.sharedStylesHost, this.schema, type, this.appId);
|
|
20383
20384
|
this.rendererByCompId.set(type.id, renderer);
|
|
20384
20385
|
}
|
|
20385
20386
|
renderer.applyToHost(element);
|
|
@@ -20398,14 +20399,17 @@ class ServerRendererFactory2 {
|
|
|
20398
20399
|
begin() { }
|
|
20399
20400
|
end() { }
|
|
20400
20401
|
}
|
|
20401
|
-
ServerRendererFactory2.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20402
|
-
ServerRendererFactory2.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20403
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20402
|
+
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 });
|
|
20403
|
+
ServerRendererFactory2.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerRendererFactory2 });
|
|
20404
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerRendererFactory2, decorators: [{
|
|
20404
20405
|
type: Injectable
|
|
20405
|
-
}], ctorParameters: function () { return [{ type: i1.EventManager }, { type: i0.NgZone }, { type:
|
|
20406
|
+
}], ctorParameters: function () { return [{ type: i1.EventManager }, { type: i0.NgZone }, { type: Document, decorators: [{
|
|
20406
20407
|
type: Inject,
|
|
20407
20408
|
args: [DOCUMENT]
|
|
20408
|
-
}] }, { type: i1.ɵSharedStylesHost }
|
|
20409
|
+
}] }, { type: i1.ɵSharedStylesHost }, { type: undefined, decorators: [{
|
|
20410
|
+
type: Inject,
|
|
20411
|
+
args: [APP_ID]
|
|
20412
|
+
}] }]; } });
|
|
20409
20413
|
class DefaultServerRenderer2 {
|
|
20410
20414
|
constructor(eventManager, document, ngZone, schema) {
|
|
20411
20415
|
this.eventManager = eventManager;
|
|
@@ -20567,15 +20571,14 @@ function isTemplateNode(node) {
|
|
|
20567
20571
|
return node.tagName === 'TEMPLATE' && node.content !== undefined;
|
|
20568
20572
|
}
|
|
20569
20573
|
class EmulatedEncapsulationServerRenderer2 extends DefaultServerRenderer2 {
|
|
20570
|
-
constructor(eventManager, document, ngZone, sharedStylesHost, schema, component) {
|
|
20574
|
+
constructor(eventManager, document, ngZone, sharedStylesHost, schema, component, appId) {
|
|
20571
20575
|
super(eventManager, document, ngZone, schema);
|
|
20572
20576
|
this.component = component;
|
|
20573
|
-
|
|
20574
|
-
const
|
|
20575
|
-
const styles = ɵshimStyles(componentId, component.styles);
|
|
20577
|
+
const componentShortId = appId + '-' + this.component.id;
|
|
20578
|
+
const styles = ɵshimStyles(componentShortId, this.component.styles);
|
|
20576
20579
|
sharedStylesHost.addStyles(styles);
|
|
20577
|
-
this.contentAttr = ɵshimContentAttribute(
|
|
20578
|
-
this.hostAttr = ɵshimHostAttribute(
|
|
20580
|
+
this.contentAttr = ɵshimContentAttribute(componentShortId);
|
|
20581
|
+
this.hostAttr = ɵshimHostAttribute(componentShortId);
|
|
20579
20582
|
}
|
|
20580
20583
|
applyToHost(element) {
|
|
20581
20584
|
super.setAttribute(element, this.hostAttr, '');
|
|
@@ -20625,10 +20628,9 @@ function _writeStyleAttribute(element, styleMap) {
|
|
|
20625
20628
|
}
|
|
20626
20629
|
|
|
20627
20630
|
class ServerStylesHost extends ɵSharedStylesHost {
|
|
20628
|
-
constructor(doc,
|
|
20631
|
+
constructor(doc, appId) {
|
|
20629
20632
|
super();
|
|
20630
|
-
this.
|
|
20631
|
-
this.transitionId = transitionId;
|
|
20633
|
+
this.appId = appId;
|
|
20632
20634
|
this.head = null;
|
|
20633
20635
|
this._styleNodes = new Set();
|
|
20634
20636
|
this.head = doc.getElementsByTagName('head')[0];
|
|
@@ -20637,8 +20639,8 @@ class ServerStylesHost extends ɵSharedStylesHost {
|
|
|
20637
20639
|
const adapter = ɵgetDOM();
|
|
20638
20640
|
const el = adapter.createElement('style');
|
|
20639
20641
|
el.textContent = style;
|
|
20640
|
-
if (!!this.
|
|
20641
|
-
el.setAttribute('ng-
|
|
20642
|
+
if (!!this.appId) {
|
|
20643
|
+
el.setAttribute('ng-app', this.appId);
|
|
20642
20644
|
}
|
|
20643
20645
|
this.head.appendChild(el);
|
|
20644
20646
|
this._styleNodes.add(el);
|
|
@@ -20649,18 +20651,16 @@ class ServerStylesHost extends ɵSharedStylesHost {
|
|
|
20649
20651
|
super.ngOnDestroy();
|
|
20650
20652
|
}
|
|
20651
20653
|
}
|
|
20652
|
-
ServerStylesHost.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20653
|
-
ServerStylesHost.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20654
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20654
|
+
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 });
|
|
20655
|
+
ServerStylesHost.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerStylesHost });
|
|
20656
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerStylesHost, decorators: [{
|
|
20655
20657
|
type: Injectable
|
|
20656
20658
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
20657
20659
|
type: Inject,
|
|
20658
20660
|
args: [DOCUMENT]
|
|
20659
20661
|
}] }, { type: undefined, decorators: [{
|
|
20660
|
-
type: Optional
|
|
20661
|
-
}, {
|
|
20662
20662
|
type: Inject,
|
|
20663
|
-
args: [
|
|
20663
|
+
args: [APP_ID]
|
|
20664
20664
|
}] }]; } });
|
|
20665
20665
|
|
|
20666
20666
|
const TRANSFER_STATE_SERIALIZATION_PROVIDERS = [{
|
|
@@ -20702,10 +20702,10 @@ function serializeTransferStateFactory(doc, appId, transferStore) {
|
|
|
20702
20702
|
*/
|
|
20703
20703
|
class ServerTransferStateModule {
|
|
20704
20704
|
}
|
|
20705
|
-
ServerTransferStateModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20706
|
-
ServerTransferStateModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.0-next.
|
|
20707
|
-
ServerTransferStateModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20708
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20705
|
+
ServerTransferStateModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerTransferStateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
20706
|
+
ServerTransferStateModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerTransferStateModule });
|
|
20707
|
+
ServerTransferStateModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerTransferStateModule });
|
|
20708
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerTransferStateModule, decorators: [{
|
|
20709
20709
|
type: NgModule,
|
|
20710
20710
|
args: [{}]
|
|
20711
20711
|
}] });
|
|
@@ -20741,6 +20741,14 @@ const SERVER_RENDER_PROVIDERS = [
|
|
|
20741
20741
|
{ provide: ɵSharedStylesHost, useExisting: ServerStylesHost },
|
|
20742
20742
|
{ provide: EVENT_MANAGER_PLUGINS, multi: true, useClass: ServerEventManagerPlugin },
|
|
20743
20743
|
];
|
|
20744
|
+
const PLATFORM_SERVER_PROVIDERS = [
|
|
20745
|
+
TRANSFER_STATE_SERIALIZATION_PROVIDERS,
|
|
20746
|
+
SERVER_RENDER_PROVIDERS,
|
|
20747
|
+
SERVER_HTTP_PROVIDERS,
|
|
20748
|
+
{ provide: Testability, useValue: null },
|
|
20749
|
+
{ provide: ɵTESTABILITY, useValue: null },
|
|
20750
|
+
{ provide: ViewportScroller, useClass: ɵNullViewportScroller },
|
|
20751
|
+
];
|
|
20744
20752
|
/**
|
|
20745
20753
|
* The ng module for the server.
|
|
20746
20754
|
*
|
|
@@ -20748,29 +20756,15 @@ const SERVER_RENDER_PROVIDERS = [
|
|
|
20748
20756
|
*/
|
|
20749
20757
|
class ServerModule {
|
|
20750
20758
|
}
|
|
20751
|
-
ServerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20752
|
-
ServerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.0-next.
|
|
20753
|
-
ServerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
20754
|
-
|
|
20755
|
-
SERVER_RENDER_PROVIDERS,
|
|
20756
|
-
SERVER_HTTP_PROVIDERS,
|
|
20757
|
-
{ provide: Testability, useValue: null },
|
|
20758
|
-
{ provide: ɵTESTABILITY, useValue: null },
|
|
20759
|
-
{ provide: ViewportScroller, useClass: ɵNullViewportScroller },
|
|
20760
|
-
], imports: [HttpClientModule, NoopAnimationsModule, BrowserModule] });
|
|
20761
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.1", ngImport: i0, type: ServerModule, decorators: [{
|
|
20759
|
+
ServerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
20760
|
+
ServerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerModule, imports: [HttpClientModule, NoopAnimationsModule], exports: [BrowserModule] });
|
|
20761
|
+
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] });
|
|
20762
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.3", ngImport: i0, type: ServerModule, decorators: [{
|
|
20762
20763
|
type: NgModule,
|
|
20763
20764
|
args: [{
|
|
20764
20765
|
exports: [BrowserModule],
|
|
20765
20766
|
imports: [HttpClientModule, NoopAnimationsModule],
|
|
20766
|
-
providers:
|
|
20767
|
-
TRANSFER_STATE_SERIALIZATION_PROVIDERS,
|
|
20768
|
-
SERVER_RENDER_PROVIDERS,
|
|
20769
|
-
SERVER_HTTP_PROVIDERS,
|
|
20770
|
-
{ provide: Testability, useValue: null },
|
|
20771
|
-
{ provide: ɵTESTABILITY, useValue: null },
|
|
20772
|
-
{ provide: ViewportScroller, useClass: ɵNullViewportScroller },
|
|
20773
|
-
],
|
|
20767
|
+
providers: PLATFORM_SERVER_PROVIDERS,
|
|
20774
20768
|
}]
|
|
20775
20769
|
}] });
|
|
20776
20770
|
function _document(injector) {
|
|
@@ -20798,6 +20792,29 @@ const platformServer = createPlatformFactory(platformCore, 'server', INTERNAL_SE
|
|
|
20798
20792
|
*/
|
|
20799
20793
|
const platformDynamicServer = createPlatformFactory(ɵplatformCoreDynamic, 'serverDynamic', INTERNAL_SERVER_PLATFORM_PROVIDERS);
|
|
20800
20794
|
|
|
20795
|
+
/**
|
|
20796
|
+
* Sets up providers necessary to enable server rendering functionality for the application.
|
|
20797
|
+
*
|
|
20798
|
+
* @usageNotes
|
|
20799
|
+
*
|
|
20800
|
+
* Basic example of how you can add server support to your application:
|
|
20801
|
+
* ```ts
|
|
20802
|
+
* bootstrapApplication(AppComponent, {
|
|
20803
|
+
* providers: [provideServerSupport()]
|
|
20804
|
+
* });
|
|
20805
|
+
* ```
|
|
20806
|
+
*
|
|
20807
|
+
* @publicApi
|
|
20808
|
+
* @returns A set of providers to setup the server.
|
|
20809
|
+
*/
|
|
20810
|
+
function provideServerSupport() {
|
|
20811
|
+
return makeEnvironmentProviders([
|
|
20812
|
+
provideHttpClient(withInterceptorsFromDi()),
|
|
20813
|
+
provideNoopAnimations(),
|
|
20814
|
+
...PLATFORM_SERVER_PROVIDERS,
|
|
20815
|
+
]);
|
|
20816
|
+
}
|
|
20817
|
+
|
|
20801
20818
|
function _getPlatform(platformFactory, options) {
|
|
20802
20819
|
const extraProviders = options.platformProviders ?? [];
|
|
20803
20820
|
return platformFactory([
|
|
@@ -20821,11 +20838,6 @@ function appendServerContextInfo(serverContext, applicationRef) {
|
|
|
20821
20838
|
function _render(platform, bootstrapPromise) {
|
|
20822
20839
|
return bootstrapPromise.then((moduleOrApplicationRef) => {
|
|
20823
20840
|
const environmentInjector = moduleOrApplicationRef.injector;
|
|
20824
|
-
const transitionId = environmentInjector.get(ɵTRANSITION_ID, null);
|
|
20825
|
-
if (!transitionId) {
|
|
20826
|
-
throw new Error(`renderModule[Factory]() requires the use of BrowserModule.withServerTransition() to ensure
|
|
20827
|
-
the server-rendered app can be properly bootstrapped into a client app.`);
|
|
20828
|
-
}
|
|
20829
20841
|
const applicationRef = moduleOrApplicationRef instanceof ApplicationRef ?
|
|
20830
20842
|
moduleOrApplicationRef :
|
|
20831
20843
|
environmentInjector.get(ApplicationRef);
|
|
@@ -20836,6 +20848,9 @@ the server-rendered app can be properly bootstrapped into a client app.`);
|
|
|
20836
20848
|
appendServerContextInfo(serverContext, applicationRef);
|
|
20837
20849
|
const platformState = platform.injector.get(PlatformState);
|
|
20838
20850
|
const asyncPromises = [];
|
|
20851
|
+
if (applicationRef.injector.get(ɵIS_HYDRATION_FEATURE_ENABLED, false)) {
|
|
20852
|
+
ɵannotateForHydration(applicationRef, platformState.getDocument());
|
|
20853
|
+
}
|
|
20839
20854
|
// Run any BEFORE_APP_SERIALIZED callbacks just before rendering to string.
|
|
20840
20855
|
const callbacks = environmentInjector.get(BEFORE_APP_SERIALIZED, null);
|
|
20841
20856
|
if (callbacks) {
|
|
@@ -20907,70 +20922,22 @@ function renderModule(moduleType, options) {
|
|
|
20907
20922
|
const platform = _getPlatform(platformDynamicServer, { document, url, platformProviders });
|
|
20908
20923
|
return _render(platform, platform.bootstrapModule(moduleType));
|
|
20909
20924
|
}
|
|
20910
|
-
|
|
20911
|
-
|
|
20912
|
-
*
|
|
20913
|
-
* Note: the root component passed into this function *must* be a standalone one (should have the
|
|
20914
|
-
* `standalone: true` flag in the `@Component` decorator config).
|
|
20915
|
-
*
|
|
20916
|
-
* ```typescript
|
|
20917
|
-
* @Component({
|
|
20918
|
-
* standalone: true,
|
|
20919
|
-
* template: 'Hello world!'
|
|
20920
|
-
* })
|
|
20921
|
-
* class RootComponent {}
|
|
20922
|
-
*
|
|
20923
|
-
* const output: string = await renderApplication(RootComponent, {appId: 'server-app'});
|
|
20924
|
-
* ```
|
|
20925
|
-
*
|
|
20926
|
-
* @param rootComponent A reference to a Standalone Component that should be rendered.
|
|
20927
|
-
* @param options Additional configuration for the render operation:
|
|
20928
|
-
* - `appId` - a string identifier of this application. The appId is used to prefix all
|
|
20929
|
-
* server-generated stylings and state keys of the application in TransferState
|
|
20930
|
-
* use-cases.
|
|
20931
|
-
* - `document` - the document of the page to render, either as an HTML string or
|
|
20932
|
-
* as a reference to the `document` instance.
|
|
20933
|
-
* - `url` - the URL for the current render request.
|
|
20934
|
-
* - `providers` - set of application level providers for the current render request.
|
|
20935
|
-
* - `platformProviders` - the platform level providers for the current render request.
|
|
20936
|
-
*
|
|
20937
|
-
* @returns A Promise, that returns serialized (to a string) rendered page, once resolved.
|
|
20938
|
-
*
|
|
20939
|
-
* @publicApi
|
|
20940
|
-
* @developerPreview
|
|
20941
|
-
*/
|
|
20942
|
-
function renderApplication(rootComponent, options) {
|
|
20943
|
-
const { document, url, platformProviders, appId } = options;
|
|
20925
|
+
function renderApplication(rootComponentOrBootstrapFn, options) {
|
|
20926
|
+
const { document, url, platformProviders, appId = '' } = options;
|
|
20944
20927
|
const platform = _getPlatform(platformDynamicServer, { document, url, platformProviders });
|
|
20928
|
+
if (isBootstrapFn(rootComponentOrBootstrapFn)) {
|
|
20929
|
+
return _render(platform, rootComponentOrBootstrapFn());
|
|
20930
|
+
}
|
|
20945
20931
|
const appProviders = [
|
|
20946
20932
|
importProvidersFrom(BrowserModule.withServerTransition({ appId })),
|
|
20947
20933
|
importProvidersFrom(ServerModule),
|
|
20948
20934
|
...(options.providers ?? []),
|
|
20949
20935
|
];
|
|
20950
|
-
return _render(platform, ɵinternalCreateApplication({ rootComponent, appProviders }));
|
|
20936
|
+
return _render(platform, ɵinternalCreateApplication({ rootComponent: rootComponentOrBootstrapFn, appProviders }));
|
|
20951
20937
|
}
|
|
20952
|
-
|
|
20953
|
-
|
|
20954
|
-
|
|
20955
|
-
*
|
|
20956
|
-
* @param moduleFactory An instance of the {@link NgModuleFactory} that should be used for
|
|
20957
|
-
* bootstrap.
|
|
20958
|
-
* @param options Additional configuration for the render operation:
|
|
20959
|
-
* - `document` - the document of the page to render, either as an HTML string or
|
|
20960
|
-
* as a reference to the `document` instance.
|
|
20961
|
-
* - `url` - the URL for the current render request.
|
|
20962
|
-
* - `extraProviders` - set of platform level providers for the current render request.
|
|
20963
|
-
*
|
|
20964
|
-
* @publicApi
|
|
20965
|
-
*
|
|
20966
|
-
* @deprecated
|
|
20967
|
-
* This symbol is no longer necessary as of Angular v13.
|
|
20968
|
-
* Use {@link renderModule} API instead.
|
|
20969
|
-
*/
|
|
20970
|
-
function renderModuleFactory(moduleFactory, options) {
|
|
20971
|
-
const { document, url, extraProviders: platformProviders } = options;
|
|
20972
|
-
const platform = _getPlatform(platformServer, { document, url, platformProviders });
|
|
20973
|
-
return _render(platform, platform.bootstrapModuleFactory(moduleFactory));
|
|
20938
|
+
function isBootstrapFn(value) {
|
|
20939
|
+
// We can differentiate between a component and a bootstrap function by reading `cmp`:
|
|
20940
|
+
return typeof value === 'function' && !ɵgetComponentDef(value);
|
|
20974
20941
|
}
|
|
20975
20942
|
|
|
20976
20943
|
/**
|
|
@@ -20981,7 +20948,7 @@ function renderModuleFactory(moduleFactory, options) {
|
|
|
20981
20948
|
/**
|
|
20982
20949
|
* @publicApi
|
|
20983
20950
|
*/
|
|
20984
|
-
const VERSION = new Version('16.0.0-next.
|
|
20951
|
+
const VERSION = new Version('16.0.0-next.3');
|
|
20985
20952
|
|
|
20986
20953
|
/// <reference types="node" />
|
|
20987
20954
|
// This file only reexports content of the `src` folder. Keep it that way.
|
|
@@ -20992,5 +20959,5 @@ const VERSION = new Version('16.0.0-next.1');
|
|
|
20992
20959
|
* Generated bundle index. Do not edit.
|
|
20993
20960
|
*/
|
|
20994
20961
|
|
|
20995
|
-
export { BEFORE_APP_SERIALIZED, INITIAL_CONFIG, PlatformState, ServerModule, ServerTransferStateModule, VERSION, platformDynamicServer, platformServer, renderApplication, renderModule,
|
|
20962
|
+
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 };
|
|
20996
20963
|
//# sourceMappingURL=platform-server.mjs.map
|