@angular/platform-server 14.1.0 → 14.2.0-next.1

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,14 +1,14 @@
1
1
  /**
2
- * @license Angular v14.1.0
2
+ * @license Angular v14.2.0-next.1
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, ɵTESTABILITY, NgModule, ɵsetDocument, createPlatformFactory, platformCore, APP_ID, ApplicationRef, ɵisPromise, importProvidersFrom, ɵinternalBootstrapApplication, Version } from '@angular/core';
9
+ import { Injectable, Inject, InjectionToken, Injector, Optional, ViewEncapsulation, RendererStyleFlags2, APP_ID, NgModule, PLATFORM_ID, PLATFORM_INITIALIZER, ɵALLOW_MULTIPLE_PLATFORMS, RendererFactory2, NgZone, Testability, ɵTESTABILITY, ɵsetDocument, createPlatformFactory, platformCore, ApplicationRef, ɵisPromise, importProvidersFrom, ɵinternalCreateApplication, Version } from '@angular/core';
10
10
  import * as i1 from '@angular/platform-browser';
11
- import { ɵBrowserDomAdapter, ɵflattenStyles, ɵNAMESPACE_URIS, ɵshimContentAttribute, ɵshimHostAttribute, ɵSharedStylesHost, ɵTRANSITION_ID, EVENT_MANAGER_PLUGINS, BrowserModule, ɵescapeHtml, TransferState } from '@angular/platform-browser';
11
+ import { ɵBrowserDomAdapter, ɵflattenStyles, ɵNAMESPACE_URIS, ɵshimContentAttribute, ɵshimHostAttribute, ɵSharedStylesHost, ɵTRANSITION_ID, TransferState, ɵescapeHtml, EVENT_MANAGER_PLUGINS, BrowserModule } from '@angular/platform-browser';
12
12
  import * as domino from 'domino';
13
13
  import { ɵAnimationEngine } from '@angular/animations/browser';
14
14
  import { ɵHttpInterceptingHandler, HttpHandler, HttpBackend, HttpClientModule } from '@angular/common/http';
@@ -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.1.0", ngImport: i0, type: PlatformState, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
141
- PlatformState.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: PlatformState });
142
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: PlatformState, decorators: [{
140
+ PlatformState.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: PlatformState, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
141
+ PlatformState.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: PlatformState });
142
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: PlatformState, decorators: [{
143
143
  type: Injectable
144
144
  }], ctorParameters: function () {
145
145
  return [{ type: undefined, decorators: [{
@@ -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.1.0", ngImport: i0, type: ServerXhr, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
187
- ServerXhr.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ServerXhr });
188
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ServerXhr, decorators: [{
186
+ ServerXhr.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: ServerXhr, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
187
+ ServerXhr.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: ServerXhr });
188
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.1", 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.1.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.1.0", ngImport: i0, type: ServerPlatformLocation });
394
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ServerPlatformLocation, decorators: [{
392
+ ServerPlatformLocation.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.1", 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.2.0-next.1", ngImport: i0, type: ServerPlatformLocation });
394
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.1", 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.1.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.1.0", ngImport: i0, type: ServerEventManagerPlugin /* extends EventManagerPlugin which is private */ });
440
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ServerEventManagerPlugin /* extends EventManagerPlugin which is private */, decorators: [{
438
+ ServerEventManagerPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.1", 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.2.0-next.1", ngImport: i0, type: ServerEventManagerPlugin /* extends EventManagerPlugin which is private */ });
440
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.1", 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.1.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.1.0", ngImport: i0, type: ServerRendererFactory2 });
497
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ServerRendererFactory2, decorators: [{
495
+ ServerRendererFactory2.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.1", 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.2.0-next.1", ngImport: i0, type: ServerRendererFactory2 });
497
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.1", 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: [{
@@ -756,9 +756,9 @@ class ServerStylesHost extends ɵSharedStylesHost {
756
756
  this._styleNodes.forEach(styleNode => styleNode.remove());
757
757
  }
758
758
  }
759
- ServerStylesHost.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ServerStylesHost, deps: [{ token: DOCUMENT }, { token: ɵTRANSITION_ID, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
760
- ServerStylesHost.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ServerStylesHost });
761
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ServerStylesHost, decorators: [{
759
+ ServerStylesHost.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: ServerStylesHost, deps: [{ token: DOCUMENT }, { token: ɵTRANSITION_ID, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
760
+ ServerStylesHost.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: ServerStylesHost });
761
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: ServerStylesHost, decorators: [{
762
762
  type: Injectable
763
763
  }], ctorParameters: function () {
764
764
  return [{ type: undefined, decorators: [{
@@ -772,6 +772,54 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImpor
772
772
  }] }];
773
773
  } });
774
774
 
775
+ /**
776
+ * @license
777
+ * Copyright Google LLC All Rights Reserved.
778
+ *
779
+ * Use of this source code is governed by an MIT-style license that can be
780
+ * found in the LICENSE file at https://angular.io/license
781
+ */
782
+ const TRANSFER_STATE_SERIALIZATION_PROVIDERS = [{
783
+ provide: BEFORE_APP_SERIALIZED,
784
+ useFactory: serializeTransferStateFactory,
785
+ deps: [DOCUMENT, APP_ID, TransferState],
786
+ multi: true,
787
+ }];
788
+ function serializeTransferStateFactory(doc, appId, transferStore) {
789
+ return () => {
790
+ if (transferStore.isEmpty) {
791
+ // The state is empty, nothing to transfer,
792
+ // avoid creating an extra `<script>` tag in this case.
793
+ return;
794
+ }
795
+ const script = doc.createElement('script');
796
+ script.id = appId + '-state';
797
+ script.setAttribute('type', 'application/json');
798
+ script.textContent = ɵescapeHtml(transferStore.toJson());
799
+ doc.body.appendChild(script);
800
+ };
801
+ }
802
+ /**
803
+ * NgModule to install on the server side while using the `TransferState` to transfer state from
804
+ * server to client.
805
+ *
806
+ * Note: this module is not needed if the `renderApplication` function is used.
807
+ * The `renderApplication` makes all providers from this module available in the application.
808
+ *
809
+ * @publicApi
810
+ * @deprecated no longer needed, you can inject the `TransferState` in an app without providing
811
+ * this module.
812
+ */
813
+ class ServerTransferStateModule {
814
+ }
815
+ ServerTransferStateModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: ServerTransferStateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
816
+ ServerTransferStateModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.0-next.1", ngImport: i0, type: ServerTransferStateModule });
817
+ ServerTransferStateModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: ServerTransferStateModule });
818
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: ServerTransferStateModule, decorators: [{
819
+ type: NgModule,
820
+ args: [{}]
821
+ }] });
822
+
775
823
  /**
776
824
  * @license
777
825
  * Copyright Google LLC All Rights Reserved.
@@ -817,21 +865,23 @@ const SERVER_RENDER_PROVIDERS = [
817
865
  */
818
866
  class ServerModule {
819
867
  }
820
- ServerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ServerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
821
- ServerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.0", ngImport: i0, type: ServerModule, imports: [HttpClientModule, NoopAnimationsModule], exports: [BrowserModule] });
822
- ServerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ServerModule, providers: [
868
+ ServerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: ServerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
869
+ ServerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.0-next.1", ngImport: i0, type: ServerModule, imports: [HttpClientModule, NoopAnimationsModule], exports: [BrowserModule] });
870
+ ServerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: ServerModule, providers: [
871
+ TRANSFER_STATE_SERIALIZATION_PROVIDERS,
823
872
  SERVER_RENDER_PROVIDERS,
824
873
  SERVER_HTTP_PROVIDERS,
825
874
  { provide: Testability, useValue: null },
826
875
  { provide: ɵTESTABILITY, useValue: null },
827
876
  { provide: ViewportScroller, useClass: ɵNullViewportScroller },
828
877
  ], imports: [HttpClientModule, NoopAnimationsModule, BrowserModule] });
829
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ServerModule, decorators: [{
878
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.1", ngImport: i0, type: ServerModule, decorators: [{
830
879
  type: NgModule,
831
880
  args: [{
832
881
  exports: [BrowserModule],
833
882
  imports: [HttpClientModule, NoopAnimationsModule],
834
883
  providers: [
884
+ TRANSFER_STATE_SERIALIZATION_PROVIDERS,
835
885
  SERVER_RENDER_PROVIDERS,
836
886
  SERVER_HTTP_PROVIDERS,
837
887
  { provide: Testability, useValue: null },
@@ -841,9 +891,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImpor
841
891
  }]
842
892
  }] });
843
893
  function _document(injector) {
844
- let config = injector.get(INITIAL_CONFIG, null);
845
- const document = config && config.document ? parseDocument(config.document, config.url) :
846
- ɵgetDOM().createHtmlDocument();
894
+ const config = injector.get(INITIAL_CONFIG, null);
895
+ let document;
896
+ if (config && config.document) {
897
+ document = typeof config.document === 'string' ? parseDocument(config.document, config.url) :
898
+ config.document;
899
+ }
900
+ else {
901
+ document = ɵgetDOM().createHtmlDocument();
902
+ }
847
903
  // Tell ivy about the global document
848
904
  ɵsetDocument(document);
849
905
  return document;
@@ -859,54 +915,6 @@ const platformServer = createPlatformFactory(platformCore, 'server', INTERNAL_SE
859
915
  */
860
916
  const platformDynamicServer = createPlatformFactory(ɵplatformCoreDynamic, 'serverDynamic', INTERNAL_SERVER_PLATFORM_PROVIDERS);
861
917
 
862
- /**
863
- * @license
864
- * Copyright Google LLC All Rights Reserved.
865
- *
866
- * Use of this source code is governed by an MIT-style license that can be
867
- * found in the LICENSE file at https://angular.io/license
868
- */
869
- function serializeTransferStateFactory(doc, appId, transferStore) {
870
- return () => {
871
- const script = doc.createElement('script');
872
- script.id = appId + '-state';
873
- script.setAttribute('type', 'application/json');
874
- script.textContent = ɵescapeHtml(transferStore.toJson());
875
- doc.body.appendChild(script);
876
- };
877
- }
878
- /**
879
- * NgModule to install on the server side while using the `TransferState` to transfer state from
880
- * server to client.
881
- *
882
- * @publicApi
883
- */
884
- class ServerTransferStateModule {
885
- }
886
- ServerTransferStateModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ServerTransferStateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
887
- ServerTransferStateModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.0", ngImport: i0, type: ServerTransferStateModule });
888
- ServerTransferStateModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ServerTransferStateModule, providers: [
889
- TransferState, {
890
- provide: BEFORE_APP_SERIALIZED,
891
- useFactory: serializeTransferStateFactory,
892
- deps: [DOCUMENT, APP_ID, TransferState],
893
- multi: true,
894
- }
895
- ] });
896
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ServerTransferStateModule, decorators: [{
897
- type: NgModule,
898
- args: [{
899
- providers: [
900
- TransferState, {
901
- provide: BEFORE_APP_SERIALIZED,
902
- useFactory: serializeTransferStateFactory,
903
- deps: [DOCUMENT, APP_ID, TransferState],
904
- multi: true,
905
- }
906
- ]
907
- }]
908
- }] });
909
-
910
918
  /**
911
919
  * @license
912
920
  * Copyright Google LLC All Rights Reserved.
@@ -976,7 +984,8 @@ the server-rendered app can be properly bootstrapped into a client app.`);
976
984
  /**
977
985
  * Renders a Module to string.
978
986
  *
979
- * `document` is the full document HTML of the page to render, as a string.
987
+ * `document` is the document of the page to render, either as an HTML string or
988
+ * as a reference to the `document` instance.
980
989
  * `url` is the URL for the current render request.
981
990
  * `extraProviders` are the platform level providers for the current render request.
982
991
  *
@@ -1008,7 +1017,8 @@ function renderModule(module, options) {
1008
1017
  * - `appId` - a string identifier of this application. The appId is used to prefix all
1009
1018
  * server-generated stylings and state keys of the application in TransferState
1010
1019
  * use-cases.
1011
- * - `document` - the full document HTML of the page to render, as a string.
1020
+ * - `document` - the document of the page to render, either as an HTML string or
1021
+ * as a reference to the `document` instance.
1012
1022
  * - `url` - the URL for the current render request.
1013
1023
  * - `providers` - set of application level providers for the current render request.
1014
1024
  * - `platformProviders` - the platform level providers for the current render request.
@@ -1024,9 +1034,10 @@ function renderApplication(rootComponent, options) {
1024
1034
  const appProviders = [
1025
1035
  importProvidersFrom(BrowserModule.withServerTransition({ appId })),
1026
1036
  importProvidersFrom(ServerModule),
1037
+ ...TRANSFER_STATE_SERIALIZATION_PROVIDERS,
1027
1038
  ...((_a = options.providers) !== null && _a !== void 0 ? _a : []),
1028
1039
  ];
1029
- return _render(platform, ɵinternalBootstrapApplication({ rootComponent, appProviders }));
1040
+ return _render(platform, ɵinternalCreateApplication({ rootComponent, appProviders }));
1030
1041
  }
1031
1042
  /**
1032
1043
  * Renders a {@link NgModuleFactory} to string.
@@ -1065,7 +1076,7 @@ function renderModuleFactory(moduleFactory, options) {
1065
1076
  /**
1066
1077
  * @publicApi
1067
1078
  */
1068
- const VERSION = new Version('14.1.0');
1079
+ const VERSION = new Version('14.2.0-next.1');
1069
1080
 
1070
1081
  /**
1071
1082
  * @license