@angular/platform-server 17.0.0-next.5 → 17.0.0-next.7

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,18 +1,17 @@
1
1
  /**
2
- * @license Angular v17.0.0-next.5
2
+ * @license Angular v17.0.0-next.7
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
7
  import { ɵsetRootDomAdapter, DOCUMENT, XhrFactory, ɵgetDOM, ɵPLATFORM_SERVER_ID, PlatformLocation, ViewportScroller, ɵNullViewportScroller } from '@angular/common';
8
8
  import * as i0 from '@angular/core';
9
- import { Injectable, Inject, InjectionToken, Optional, APP_ID, TransferState, NgModule, Injector, PLATFORM_ID, PLATFORM_INITIALIZER, ɵALLOW_MULTIPLE_PLATFORMS, Testability, ɵTESTABILITY, ɵsetDocument, createPlatformFactory, platformCore, makeEnvironmentProviders, ɵSSR_CONTENT_INTEGRITY_MARKER, ɵENABLED_SSR_FEATURES, Renderer2, ɵIS_HYDRATION_DOM_REUSE_ENABLED, ɵannotateForHydration, ApplicationRef, Version } from '@angular/core';
9
+ import { Injectable, Inject, InjectionToken, Optional, APP_ID, TransferState, NgModule, Injector, PLATFORM_ID, PLATFORM_INITIALIZER, ɵALLOW_MULTIPLE_PLATFORMS, Testability, ɵTESTABILITY, ɵsetDocument, createPlatformFactory, platformCore, makeEnvironmentProviders, ɵSSR_CONTENT_INTEGRITY_MARKER, ɵENABLED_SSR_FEATURES, Renderer2, ɵwhenStable, ɵIS_HYDRATION_DOM_REUSE_ENABLED, ɵannotateForHydration, ApplicationRef, Version } from '@angular/core';
10
10
  import { ɵBrowserDomAdapter, EventManagerPlugin, EVENT_MANAGER_PLUGINS, BrowserModule } from '@angular/platform-browser';
11
11
  import { NoopAnimationsModule, provideNoopAnimations } from '@angular/platform-browser/animations';
12
12
  import { HttpClientModule } from '@angular/common/http';
13
13
  import { Subject } from 'rxjs';
14
14
  import * as url from 'url';
15
- import { first } from 'rxjs/operators';
16
15
 
17
16
  var __getOwnPropNames = Object.getOwnPropertyNames;
18
17
  var __commonJS = (cb, mod) => function __require() {
@@ -670,7 +669,10 @@ var require_NodeUtils = __commonJS({
670
669
  "external/npm/node_modules/domino/lib/NodeUtils.js"(exports, module) {
671
670
  "use strict";
672
671
  module.exports = {
673
- serializeOne
672
+ serializeOne,
673
+ \u0275escapeMatchingClosingTag: escapeMatchingClosingTag,
674
+ \u0275escapeClosingCommentTag: escapeClosingCommentTag,
675
+ \u0275escapeProcessingInstructionContent: escapeProcessingInstructionContent
674
676
  };
675
677
  var utils = require_utils();
676
678
  var NAMESPACE = utils.NAMESPACE;
@@ -704,8 +706,13 @@ var require_NodeUtils = __commonJS({
704
706
  wbr: true
705
707
  };
706
708
  var extraNewLine = {};
709
+ var ESCAPE_REGEXP = /[&<>\u00A0]/g;
710
+ var ESCAPE_ATTR_REGEXP = /[&"<>\u00A0]/g;
707
711
  function escape(s) {
708
- return s.replace(/[&<>\u00A0]/g, function(c) {
712
+ if (!ESCAPE_REGEXP.test(s)) {
713
+ return s;
714
+ }
715
+ return s.replace(ESCAPE_REGEXP, (c) => {
709
716
  switch (c) {
710
717
  case "&":
711
718
  return "&amp;";
@@ -719,21 +726,23 @@ var require_NodeUtils = __commonJS({
719
726
  });
720
727
  }
721
728
  function escapeAttr(s) {
722
- var toEscape = /[&"\u00A0]/g;
723
- if (!toEscape.test(s)) {
729
+ if (!ESCAPE_ATTR_REGEXP.test(s)) {
724
730
  return s;
725
- } else {
726
- return s.replace(toEscape, function(c) {
727
- switch (c) {
728
- case "&":
729
- return "&amp;";
730
- case '"':
731
- return "&quot;";
732
- case "\xA0":
733
- return "&nbsp;";
734
- }
735
- });
736
731
  }
732
+ return s.replace(ESCAPE_ATTR_REGEXP, (c) => {
733
+ switch (c) {
734
+ case "<":
735
+ return "&lt;";
736
+ case ">":
737
+ return "&gt;";
738
+ case "&":
739
+ return "&amp;";
740
+ case '"':
741
+ return "&quot;";
742
+ case "\xA0":
743
+ return "&nbsp;";
744
+ }
745
+ });
737
746
  }
738
747
  function attrname(a) {
739
748
  var ns = a.namespaceURI;
@@ -751,6 +760,28 @@ var require_NodeUtils = __commonJS({
751
760
  }
752
761
  return a.name;
753
762
  }
763
+ function escapeMatchingClosingTag(rawText, parentTag) {
764
+ const parentClosingTag = "</" + parentTag;
765
+ if (!rawText.toLowerCase().includes(parentClosingTag)) {
766
+ return rawText;
767
+ }
768
+ const result = [...rawText];
769
+ const matches = rawText.matchAll(new RegExp(parentClosingTag, "ig"));
770
+ for (const match of matches) {
771
+ result[match.index] = "&lt;";
772
+ }
773
+ return result.join("");
774
+ }
775
+ var CLOSING_COMMENT_REGEXP = /--!?>/;
776
+ function escapeClosingCommentTag(rawContent) {
777
+ if (!CLOSING_COMMENT_REGEXP.test(rawContent)) {
778
+ return rawContent;
779
+ }
780
+ return rawContent.replace(/(--\!?)>/g, "$1&gt;");
781
+ }
782
+ function escapeProcessingInstructionContent(rawContent) {
783
+ return rawContent.includes(">") ? rawContent.replaceAll(">", "&gt;") : rawContent;
784
+ }
754
785
  function serializeOne(kid, parent) {
755
786
  var s = "";
756
787
  switch (kid.nodeType) {
@@ -768,6 +799,9 @@ var require_NodeUtils = __commonJS({
768
799
  s += ">";
769
800
  if (!(html && emptyElements[tagname])) {
770
801
  var ss = kid.serialize();
802
+ if (hasRawContent[tagname.toUpperCase()]) {
803
+ ss = escapeMatchingClosingTag(ss, tagname);
804
+ }
771
805
  if (html && extraNewLine[tagname] && ss.charAt(0) === "\n")
772
806
  s += "\n";
773
807
  s += ss;
@@ -788,10 +822,11 @@ var require_NodeUtils = __commonJS({
788
822
  }
789
823
  break;
790
824
  case 8:
791
- s += "<!--" + kid.data + "-->";
825
+ s += "<!--" + escapeClosingCommentTag(kid.data) + "-->";
792
826
  break;
793
827
  case 7:
794
- s += "<?" + kid.target + " " + kid.data + "?>";
828
+ const content = escapeProcessingInstructionContent(kid.data);
829
+ s += "<?" + kid.target + " " + content + "?>";
795
830
  break;
796
831
  case 10:
797
832
  s += "<!DOCTYPE " + kid.name;
@@ -10842,9 +10877,6 @@ var require_HTMLParser = __commonJS({
10842
10877
  case "plaintext":
10843
10878
  tokenizer = plaintext_state;
10844
10879
  break;
10845
- case "noscript":
10846
- if (scripting_enabled)
10847
- tokenizer = plaintext_state;
10848
10880
  }
10849
10881
  }
10850
10882
  var root = doc.createElement("html");
@@ -14598,12 +14630,6 @@ var require_HTMLParser = __commonJS({
14598
14630
  case "noembed":
14599
14631
  parseRawText(value, arg3);
14600
14632
  return;
14601
- case "noscript":
14602
- if (scripting_enabled) {
14603
- parseRawText(value, arg3);
14604
- return;
14605
- }
14606
- break;
14607
14633
  case "select":
14608
14634
  afereconstruct();
14609
14635
  insertHTMLElement(value, arg3);
@@ -16189,15 +16215,15 @@ class PlatformState {
16189
16215
  getDocument() {
16190
16216
  return this._doc;
16191
16217
  }
16192
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-next.5", ngImport: i0, type: PlatformState, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable }); }
16193
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.0-next.5", ngImport: i0, type: PlatformState }); }
16218
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-next.7", ngImport: i0, type: PlatformState, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable }); }
16219
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.0-next.7", ngImport: i0, type: PlatformState }); }
16194
16220
  }
16195
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-next.5", ngImport: i0, type: PlatformState, decorators: [{
16221
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-next.7", ngImport: i0, type: PlatformState, decorators: [{
16196
16222
  type: Injectable
16197
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
16223
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
16198
16224
  type: Inject,
16199
16225
  args: [DOCUMENT]
16200
- }] }]; } });
16226
+ }] }] });
16201
16227
 
16202
16228
  class ServerXhr {
16203
16229
  // The `xhr2` dependency has a side-effect of accessing and modifying a
@@ -16217,10 +16243,10 @@ class ServerXhr {
16217
16243
  }
16218
16244
  return new impl.XMLHttpRequest();
16219
16245
  }
16220
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-next.5", ngImport: i0, type: ServerXhr, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
16221
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.0-next.5", ngImport: i0, type: ServerXhr }); }
16246
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-next.7", ngImport: i0, type: ServerXhr, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
16247
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.0-next.7", ngImport: i0, type: ServerXhr }); }
16222
16248
  }
16223
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-next.5", ngImport: i0, type: ServerXhr, decorators: [{
16249
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-next.7", ngImport: i0, type: ServerXhr, decorators: [{
16224
16250
  type: Injectable
16225
16251
  }] });
16226
16252
  const SERVER_HTTP_PROVIDERS = [
@@ -16335,12 +16361,12 @@ class ServerPlatformLocation {
16335
16361
  getState() {
16336
16362
  return undefined;
16337
16363
  }
16338
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-next.5", ngImport: i0, type: ServerPlatformLocation, deps: [{ token: DOCUMENT }, { token: INITIAL_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
16339
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.0-next.5", ngImport: i0, type: ServerPlatformLocation }); }
16364
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-next.7", ngImport: i0, type: ServerPlatformLocation, deps: [{ token: DOCUMENT }, { token: INITIAL_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
16365
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.0-next.7", ngImport: i0, type: ServerPlatformLocation }); }
16340
16366
  }
16341
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-next.5", ngImport: i0, type: ServerPlatformLocation, decorators: [{
16367
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-next.7", ngImport: i0, type: ServerPlatformLocation, decorators: [{
16342
16368
  type: Injectable
16343
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
16369
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
16344
16370
  type: Inject,
16345
16371
  args: [DOCUMENT]
16346
16372
  }] }, { type: undefined, decorators: [{
@@ -16348,7 +16374,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-next.5",
16348
16374
  }, {
16349
16375
  type: Inject,
16350
16376
  args: [INITIAL_CONFIG]
16351
- }] }]; } });
16377
+ }] }] });
16352
16378
 
16353
16379
  class ServerEventManagerPlugin extends EventManagerPlugin {
16354
16380
  constructor(doc) {
@@ -16362,15 +16388,15 @@ class ServerEventManagerPlugin extends EventManagerPlugin {
16362
16388
  addEventListener(element, eventName, handler) {
16363
16389
  return ɵgetDOM().onAndCancel(element, eventName, handler);
16364
16390
  }
16365
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-next.5", ngImport: i0, type: ServerEventManagerPlugin, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable }); }
16366
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.0-next.5", ngImport: i0, type: ServerEventManagerPlugin }); }
16391
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-next.7", ngImport: i0, type: ServerEventManagerPlugin, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable }); }
16392
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.0-next.7", ngImport: i0, type: ServerEventManagerPlugin }); }
16367
16393
  }
16368
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-next.5", ngImport: i0, type: ServerEventManagerPlugin, decorators: [{
16394
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-next.7", ngImport: i0, type: ServerEventManagerPlugin, decorators: [{
16369
16395
  type: Injectable
16370
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
16396
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
16371
16397
  type: Inject,
16372
16398
  args: [DOCUMENT]
16373
- }] }]; } });
16399
+ }] }] });
16374
16400
 
16375
16401
  const TRANSFER_STATE_SERIALIZATION_PROVIDERS = [{
16376
16402
  provide: BEFORE_APP_SERIALIZED,
@@ -16410,11 +16436,11 @@ function serializeTransferStateFactory(doc, appId, transferStore) {
16410
16436
  * this module.
16411
16437
  */
16412
16438
  class ServerTransferStateModule {
16413
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-next.5", ngImport: i0, type: ServerTransferStateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
16414
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.0-next.5", ngImport: i0, type: ServerTransferStateModule }); }
16415
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.0-next.5", ngImport: i0, type: ServerTransferStateModule }); }
16439
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-next.7", ngImport: i0, type: ServerTransferStateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
16440
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.0-next.7", ngImport: i0, type: ServerTransferStateModule }); }
16441
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.0-next.7", ngImport: i0, type: ServerTransferStateModule }); }
16416
16442
  }
16417
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-next.5", ngImport: i0, type: ServerTransferStateModule, decorators: [{
16443
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-next.7", ngImport: i0, type: ServerTransferStateModule, decorators: [{
16418
16444
  type: NgModule,
16419
16445
  args: [{}]
16420
16446
  }] });
@@ -16453,11 +16479,11 @@ const PLATFORM_SERVER_PROVIDERS = [
16453
16479
  * @publicApi
16454
16480
  */
16455
16481
  class ServerModule {
16456
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-next.5", ngImport: i0, type: ServerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
16457
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.0-next.5", ngImport: i0, type: ServerModule, imports: [HttpClientModule, NoopAnimationsModule], exports: [BrowserModule] }); }
16458
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.0-next.5", ngImport: i0, type: ServerModule, providers: PLATFORM_SERVER_PROVIDERS, imports: [HttpClientModule, NoopAnimationsModule, BrowserModule] }); }
16482
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-next.7", ngImport: i0, type: ServerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
16483
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.0-next.7", ngImport: i0, type: ServerModule, imports: [HttpClientModule, NoopAnimationsModule], exports: [BrowserModule] }); }
16484
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.0-next.7", ngImport: i0, type: ServerModule, providers: PLATFORM_SERVER_PROVIDERS, imports: [HttpClientModule, NoopAnimationsModule, BrowserModule] }); }
16459
16485
  }
16460
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-next.5", ngImport: i0, type: ServerModule, decorators: [{
16486
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-next.7", ngImport: i0, type: ServerModule, decorators: [{
16461
16487
  type: NgModule,
16462
16488
  args: [{
16463
16489
  exports: [BrowserModule],
@@ -16561,7 +16587,7 @@ function appendServerContextInfo(applicationRef) {
16561
16587
  async function _render(platformRef, applicationRef) {
16562
16588
  const environmentInjector = applicationRef.injector;
16563
16589
  // Block until application is stable.
16564
- await applicationRef.isStable.pipe((first((isStable) => isStable))).toPromise();
16590
+ await ɵwhenStable(applicationRef);
16565
16591
  const platformState = platformRef.injector.get(PlatformState);
16566
16592
  if (applicationRef.injector.get(ɵIS_HYDRATION_DOM_REUSE_ENABLED, false)) {
16567
16593
  const doc = platformState.getDocument();
@@ -16677,7 +16703,7 @@ async function renderApplication(bootstrap, options) {
16677
16703
  /**
16678
16704
  * @publicApi
16679
16705
  */
16680
- const VERSION = new Version('17.0.0-next.5');
16706
+ const VERSION = new Version('17.0.0-next.7');
16681
16707
 
16682
16708
  /// <reference types="node" />
16683
16709
  // This file only reexports content of the `src` folder. Keep it that way.