@angular/platform-server 16.0.0-next.2 → 16.0.0-next.4

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v16.0.0-next.2
2
+ * @license Angular v16.0.0-next.4
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.2", ngImport: i0, type: ServerTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
27
- ServerTestingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.0-next.2", ngImport: i0, type: ServerTestingModule, imports: [NoopAnimationsModule], exports: [BrowserDynamicTestingModule] });
28
- ServerTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.0-next.2", ngImport: i0, type: ServerTestingModule, providers: ɵSERVER_RENDER_PROVIDERS, imports: [NoopAnimationsModule, BrowserDynamicTestingModule] });
29
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.2", ngImport: i0, type: ServerTestingModule, decorators: [{
26
+ ServerTestingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
27
+ ServerTestingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerTestingModule, imports: [NoopAnimationsModule], exports: [BrowserDynamicTestingModule] });
28
+ ServerTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerTestingModule, providers: ɵSERVER_RENDER_PROVIDERS, imports: [NoopAnimationsModule, BrowserDynamicTestingModule] });
29
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerTestingModule, decorators: [{
30
30
  type: NgModule,
31
31
  args: [{
32
32
  exports: [BrowserDynamicTestingModule],
package/fesm2020/init.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v16.0.0-next.2
2
+ * @license Angular v16.0.0-next.4
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1,18 +1,18 @@
1
1
  /**
2
- * @license Angular v16.0.0-next.2
2
+ * @license Angular v16.0.0-next.4
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, RendererStyleFlags2, APP_ID, ɵescapeTransferStateContent, NgModule, Injector, PLATFORM_ID, PLATFORM_INITIALIZER, ɵALLOW_MULTIPLE_PLATFORMS, RendererFactory2, NgZone, Testability, ɵTESTABILITY, ɵsetDocument, createPlatformFactory, platformCore, Renderer2, ApplicationRef, ɵIS_HYDRATION_FEATURE_ENABLED, ɵannotateForHydration, ɵisPromise, importProvidersFrom, ɵinternalCreateApplication, ɵgetComponentDef, Version } from '@angular/core';
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, Version } from '@angular/core';
10
10
  import * as i1 from '@angular/platform-browser';
11
- import { ɵBrowserDomAdapter, ɵshimStyles, ɵNAMESPACE_URIS, ɵshimContentAttribute, ɵshimHostAttribute, ɵSharedStylesHost, ɵTRANSITION_ID, TransferState, EVENT_MANAGER_PLUGINS, BrowserModule } from '@angular/platform-browser';
11
+ import { ɵBrowserDomAdapter, ɵshimStyles, ɵNAMESPACE_URIS, ɵshimContentAttribute, ɵshimHostAttribute, 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.2", 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.2", ngImport: i0, type: PlatformState });
20090
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.2", ngImport: i0, type: PlatformState, decorators: [{
20088
+ PlatformState.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.4", 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.4", ngImport: i0, type: PlatformState });
20090
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: PlatformState, decorators: [{
20091
20091
  type: Injectable
20092
20092
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
20093
20093
  type: Inject,
@@ -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.2", ngImport: i0, type: ServerXhr, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
20119
- ServerXhr.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.2", ngImport: i0, type: ServerXhr });
20120
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.2", ngImport: i0, type: ServerXhr, decorators: [{
20118
+ ServerXhr.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerXhr, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
20119
+ ServerXhr.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerXhr });
20120
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.4", 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.2", 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.2", ngImport: i0, type: ServerPlatformLocation });
20318
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.2", ngImport: i0, type: ServerPlatformLocation, decorators: [{
20316
+ ServerPlatformLocation.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.4", 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.4", ngImport: i0, type: ServerPlatformLocation });
20318
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.4", 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.2", 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.2", ngImport: i0, type: ServerEventManagerPlugin /* extends EventManagerPlugin which is private */ });
20355
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.2", ngImport: i0, type: ServerEventManagerPlugin /* extends EventManagerPlugin which is private */, decorators: [{
20353
+ ServerEventManagerPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.4", 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.4", ngImport: i0, type: ServerEventManagerPlugin /* extends EventManagerPlugin which is private */ });
20355
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.4", 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.2",
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.2", ngImport: i0, type: ServerRendererFactory2, deps: [{ token: i1.EventManager }, { token: i0.NgZone }, { token: DOCUMENT }, { token: i1.ɵSharedStylesHost }], target: i0.ɵɵFactoryTarget.Injectable });
20402
- ServerRendererFactory2.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.2", ngImport: i0, type: ServerRendererFactory2 });
20403
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.2", ngImport: i0, type: ServerRendererFactory2, decorators: [{
20402
+ ServerRendererFactory2.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.4", 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.4", ngImport: i0, type: ServerRendererFactory2 });
20404
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerRendererFactory2, decorators: [{
20404
20405
  type: Injectable
20405
- }], ctorParameters: function () { return [{ type: i1.EventManager }, { type: i0.NgZone }, { type: undefined, decorators: [{
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
- // Add a 's' prefix to style attributes to indicate server.
20574
- const componentId = 's' + component.id;
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(componentId);
20578
- this.hostAttr = ɵshimHostAttribute(componentId);
20580
+ this.contentAttr = ɵshimContentAttribute(componentShortId);
20581
+ this.hostAttr = ɵshimHostAttribute(componentShortId);
20579
20582
  }
20580
20583
  applyToHost(element) {
20581
20584
  super.setAttribute(element, this.hostAttr, '');
@@ -20624,45 +20627,6 @@ function _writeStyleAttribute(element, styleMap) {
20624
20627
  }
20625
20628
  }
20626
20629
 
20627
- class ServerStylesHost extends ɵSharedStylesHost {
20628
- constructor(doc, transitionId) {
20629
- super();
20630
- this.doc = doc;
20631
- this.transitionId = transitionId;
20632
- this.head = null;
20633
- this._styleNodes = new Set();
20634
- this.head = doc.getElementsByTagName('head')[0];
20635
- }
20636
- onStyleAdded(style) {
20637
- const adapter = ɵgetDOM();
20638
- const el = adapter.createElement('style');
20639
- el.textContent = style;
20640
- if (!!this.transitionId) {
20641
- el.setAttribute('ng-transition', this.transitionId);
20642
- }
20643
- this.head.appendChild(el);
20644
- this._styleNodes.add(el);
20645
- }
20646
- ngOnDestroy() {
20647
- this._styleNodes.forEach(styleNode => styleNode.remove());
20648
- this._styleNodes.clear();
20649
- super.ngOnDestroy();
20650
- }
20651
- }
20652
- ServerStylesHost.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.2", ngImport: i0, type: ServerStylesHost, deps: [{ token: DOCUMENT }, { token: ɵTRANSITION_ID, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
20653
- ServerStylesHost.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.2", ngImport: i0, type: ServerStylesHost });
20654
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.2", ngImport: i0, type: ServerStylesHost, decorators: [{
20655
- type: Injectable
20656
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
20657
- type: Inject,
20658
- args: [DOCUMENT]
20659
- }] }, { type: undefined, decorators: [{
20660
- type: Optional
20661
- }, {
20662
- type: Inject,
20663
- args: [ɵTRANSITION_ID]
20664
- }] }]; } });
20665
-
20666
20630
  const TRANSFER_STATE_SERIALIZATION_PROVIDERS = [{
20667
20631
  provide: BEFORE_APP_SERIALIZED,
20668
20632
  useFactory: serializeTransferStateFactory,
@@ -20702,10 +20666,10 @@ function serializeTransferStateFactory(doc, appId, transferStore) {
20702
20666
  */
20703
20667
  class ServerTransferStateModule {
20704
20668
  }
20705
- ServerTransferStateModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.2", ngImport: i0, type: ServerTransferStateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
20706
- ServerTransferStateModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.0-next.2", ngImport: i0, type: ServerTransferStateModule });
20707
- ServerTransferStateModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.0-next.2", ngImport: i0, type: ServerTransferStateModule });
20708
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.2", ngImport: i0, type: ServerTransferStateModule, decorators: [{
20669
+ ServerTransferStateModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerTransferStateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
20670
+ ServerTransferStateModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerTransferStateModule });
20671
+ ServerTransferStateModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerTransferStateModule });
20672
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerTransferStateModule, decorators: [{
20709
20673
  type: NgModule,
20710
20674
  args: [{}]
20711
20675
  }] });
@@ -20737,10 +20701,16 @@ const SERVER_RENDER_PROVIDERS = [
20737
20701
  useFactory: instantiateServerRendererFactory,
20738
20702
  deps: [ServerRendererFactory2, ɵAnimationEngine, NgZone]
20739
20703
  },
20740
- ServerStylesHost,
20741
- { provide: ɵSharedStylesHost, useExisting: ServerStylesHost },
20742
20704
  { provide: EVENT_MANAGER_PLUGINS, multi: true, useClass: ServerEventManagerPlugin },
20743
20705
  ];
20706
+ const PLATFORM_SERVER_PROVIDERS = [
20707
+ TRANSFER_STATE_SERIALIZATION_PROVIDERS,
20708
+ SERVER_RENDER_PROVIDERS,
20709
+ SERVER_HTTP_PROVIDERS,
20710
+ { provide: Testability, useValue: null },
20711
+ { provide: ɵTESTABILITY, useValue: null },
20712
+ { provide: ViewportScroller, useClass: ɵNullViewportScroller },
20713
+ ];
20744
20714
  /**
20745
20715
  * The ng module for the server.
20746
20716
  *
@@ -20748,29 +20718,15 @@ const SERVER_RENDER_PROVIDERS = [
20748
20718
  */
20749
20719
  class ServerModule {
20750
20720
  }
20751
- ServerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.2", ngImport: i0, type: ServerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
20752
- ServerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.0-next.2", ngImport: i0, type: ServerModule, imports: [HttpClientModule, NoopAnimationsModule], exports: [BrowserModule] });
20753
- ServerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.0-next.2", ngImport: i0, type: ServerModule, providers: [
20754
- TRANSFER_STATE_SERIALIZATION_PROVIDERS,
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.2", ngImport: i0, type: ServerModule, decorators: [{
20721
+ ServerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
20722
+ ServerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerModule, imports: [HttpClientModule, NoopAnimationsModule], exports: [BrowserModule] });
20723
+ ServerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerModule, providers: PLATFORM_SERVER_PROVIDERS, imports: [HttpClientModule, NoopAnimationsModule, BrowserModule] });
20724
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerModule, decorators: [{
20762
20725
  type: NgModule,
20763
20726
  args: [{
20764
20727
  exports: [BrowserModule],
20765
20728
  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
- ],
20729
+ providers: PLATFORM_SERVER_PROVIDERS,
20774
20730
  }]
20775
20731
  }] });
20776
20732
  function _document(injector) {
@@ -20798,6 +20754,29 @@ const platformServer = createPlatformFactory(platformCore, 'server', INTERNAL_SE
20798
20754
  */
20799
20755
  const platformDynamicServer = createPlatformFactory(ɵplatformCoreDynamic, 'serverDynamic', INTERNAL_SERVER_PLATFORM_PROVIDERS);
20800
20756
 
20757
+ /**
20758
+ * Sets up providers necessary to enable server rendering functionality for the application.
20759
+ *
20760
+ * @usageNotes
20761
+ *
20762
+ * Basic example of how you can add server support to your application:
20763
+ * ```ts
20764
+ * bootstrapApplication(AppComponent, {
20765
+ * providers: [provideServerSupport()]
20766
+ * });
20767
+ * ```
20768
+ *
20769
+ * @publicApi
20770
+ * @returns A set of providers to setup the server.
20771
+ */
20772
+ function provideServerSupport() {
20773
+ return makeEnvironmentProviders([
20774
+ provideHttpClient(withInterceptorsFromDi()),
20775
+ provideNoopAnimations(),
20776
+ ...PLATFORM_SERVER_PROVIDERS,
20777
+ ]);
20778
+ }
20779
+
20801
20780
  function _getPlatform(platformFactory, options) {
20802
20781
  const extraProviders = options.platformProviders ?? [];
20803
20782
  return platformFactory([
@@ -20821,11 +20800,6 @@ function appendServerContextInfo(serverContext, applicationRef) {
20821
20800
  function _render(platform, bootstrapPromise) {
20822
20801
  return bootstrapPromise.then((moduleOrApplicationRef) => {
20823
20802
  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
20803
  const applicationRef = moduleOrApplicationRef instanceof ApplicationRef ?
20830
20804
  moduleOrApplicationRef :
20831
20805
  environmentInjector.get(ApplicationRef);
@@ -20910,22 +20884,30 @@ function renderModule(moduleType, options) {
20910
20884
  const platform = _getPlatform(platformDynamicServer, { document, url, platformProviders });
20911
20885
  return _render(platform, platform.bootstrapModule(moduleType));
20912
20886
  }
20913
- function renderApplication(rootComponentOrBootstrapFn, options) {
20914
- const { document, url, platformProviders, appId = '' } = options;
20915
- const platform = _getPlatform(platformDynamicServer, { document, url, platformProviders });
20916
- if (isBootstrapFn(rootComponentOrBootstrapFn)) {
20917
- return _render(platform, rootComponentOrBootstrapFn());
20918
- }
20919
- const appProviders = [
20920
- importProvidersFrom(BrowserModule.withServerTransition({ appId })),
20921
- importProvidersFrom(ServerModule),
20922
- ...(options.providers ?? []),
20923
- ];
20924
- return _render(platform, ɵinternalCreateApplication({ rootComponent: rootComponentOrBootstrapFn, appProviders }));
20925
- }
20926
- function isBootstrapFn(value) {
20927
- // We can differentiate between a component and a bootstrap function by reading `cmp`:
20928
- return typeof value === 'function' && !ɵgetComponentDef(value);
20887
+ /**
20888
+ * Bootstraps an instance of an Angular application and renders it to a string.
20889
+
20890
+ * ```typescript
20891
+ * const bootstrap = () => bootstrapApplication(RootComponent, appConfig);
20892
+ * const output: string = await renderApplication(bootstrap);
20893
+ * ```
20894
+ *
20895
+ * @param bootstrap A method that when invoked returns a promise that returns an `ApplicationRef`
20896
+ * instance once resolved.
20897
+ * @param options Additional configuration for the render operation:
20898
+ * - `document` - the document of the page to render, either as an HTML string or
20899
+ * as a reference to the `document` instance.
20900
+ * - `url` - the URL for the current render request.
20901
+ * - `platformProviders` - the platform level providers for the current render request.
20902
+ *
20903
+ * @returns A Promise, that returns serialized (to a string) rendered page, once resolved.
20904
+ *
20905
+ * @publicApi
20906
+ * @developerPreview
20907
+ */
20908
+ function renderApplication(bootstrap, options) {
20909
+ const platform = _getPlatform(platformDynamicServer, options);
20910
+ return _render(platform, bootstrap());
20929
20911
  }
20930
20912
 
20931
20913
  /**
@@ -20936,7 +20918,7 @@ function isBootstrapFn(value) {
20936
20918
  /**
20937
20919
  * @publicApi
20938
20920
  */
20939
- const VERSION = new Version('16.0.0-next.2');
20921
+ const VERSION = new Version('16.0.0-next.4');
20940
20922
 
20941
20923
  /// <reference types="node" />
20942
20924
  // This file only reexports content of the `src` folder. Keep it that way.
@@ -20947,5 +20929,5 @@ const VERSION = new Version('16.0.0-next.2');
20947
20929
  * Generated bundle index. Do not edit.
20948
20930
  */
20949
20931
 
20950
- export { BEFORE_APP_SERIALIZED, INITIAL_CONFIG, PlatformState, ServerModule, ServerTransferStateModule, VERSION, platformDynamicServer, platformServer, 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 };
20932
+ 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 };
20951
20933
  //# sourceMappingURL=platform-server.mjs.map