@angular/platform-server 19.1.0-next.2 → 19.1.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.
package/fesm2022/init.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v19.1.0-next.2
2
+ * @license Angular v19.1.0-next.4
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v19.1.0-next.2
2
+ * @license Angular v19.1.0-next.4
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -16242,10 +16242,10 @@ class PlatformState {
16242
16242
  getDocument() {
16243
16243
  return this._doc;
16244
16244
  }
16245
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: PlatformState, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
16246
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: PlatformState });
16245
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.4", ngImport: i0, type: PlatformState, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
16246
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.0-next.4", ngImport: i0, type: PlatformState });
16247
16247
  }
16248
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: PlatformState, decorators: [{
16248
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.4", ngImport: i0, type: PlatformState, decorators: [{
16249
16249
  type: Injectable
16250
16250
  }], ctorParameters: () => [{ type: undefined, decorators: [{
16251
16251
  type: Inject,
@@ -16274,10 +16274,10 @@ class ServerXhr {
16274
16274
  }
16275
16275
  return new impl.XMLHttpRequest();
16276
16276
  }
16277
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: ServerXhr, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
16278
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: ServerXhr });
16277
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.4", ngImport: i0, type: ServerXhr, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
16278
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.0-next.4", ngImport: i0, type: ServerXhr });
16279
16279
  }
16280
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: ServerXhr, decorators: [{
16280
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.4", ngImport: i0, type: ServerXhr, decorators: [{
16281
16281
  type: Injectable
16282
16282
  }] });
16283
16283
  function relativeUrlsTransformerInterceptorFn(request, next) {
@@ -16396,10 +16396,10 @@ class ServerPlatformLocation {
16396
16396
  getState() {
16397
16397
  return undefined;
16398
16398
  }
16399
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: ServerPlatformLocation, deps: [{ token: DOCUMENT }, { token: INITIAL_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
16400
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: ServerPlatformLocation });
16399
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.4", ngImport: i0, type: ServerPlatformLocation, deps: [{ token: DOCUMENT }, { token: INITIAL_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
16400
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.0-next.4", ngImport: i0, type: ServerPlatformLocation });
16401
16401
  }
16402
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: ServerPlatformLocation, decorators: [{
16402
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.4", ngImport: i0, type: ServerPlatformLocation, decorators: [{
16403
16403
  type: Injectable
16404
16404
  }], ctorParameters: () => [{ type: undefined, decorators: [{
16405
16405
  type: Inject,
@@ -16421,24 +16421,28 @@ class ServerEventManagerPlugin extends EventManagerPlugin {
16421
16421
  supports(eventName) {
16422
16422
  return true;
16423
16423
  }
16424
- addEventListener(element, eventName, handler) {
16425
- return ɵgetDOM().onAndCancel(element, eventName, handler);
16424
+ addEventListener(element, eventName, handler, options) {
16425
+ return ɵgetDOM().onAndCancel(element, eventName, handler, options);
16426
16426
  }
16427
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: ServerEventManagerPlugin, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
16428
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: ServerEventManagerPlugin });
16427
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.4", ngImport: i0, type: ServerEventManagerPlugin, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
16428
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.0-next.4", ngImport: i0, type: ServerEventManagerPlugin });
16429
16429
  }
16430
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: ServerEventManagerPlugin, decorators: [{
16430
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.4", ngImport: i0, type: ServerEventManagerPlugin, decorators: [{
16431
16431
  type: Injectable
16432
16432
  }], ctorParameters: () => [{ type: undefined, decorators: [{
16433
16433
  type: Inject,
16434
16434
  args: [DOCUMENT]
16435
16435
  }] }] });
16436
16436
 
16437
+ // Tracks whether the server-side application state for a given app ID has been serialized already.
16438
+ const TRANSFER_STATE_SERIALIZED_FOR_APPID = new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'TRANSFER_STATE_SERIALIZED_FOR_APPID' : '', {
16439
+ providedIn: 'platform',
16440
+ factory: () => new Set(),
16441
+ });
16437
16442
  const TRANSFER_STATE_SERIALIZATION_PROVIDERS = [
16438
16443
  {
16439
16444
  provide: BEFORE_APP_SERIALIZED,
16440
16445
  useFactory: serializeTransferStateFactory,
16441
- deps: [DOCUMENT, APP_ID, TransferState],
16442
16446
  multi: true,
16443
16447
  },
16444
16448
  ];
@@ -16451,7 +16455,23 @@ function createScript(doc, textContent, nonce) {
16451
16455
  }
16452
16456
  return script;
16453
16457
  }
16454
- function serializeTransferStateFactory(doc, appId, transferStore) {
16458
+ function warnIfStateTransferHappened(injector) {
16459
+ const appId = injector.get(APP_ID);
16460
+ const appIdsWithTransferStateSerialized = injector.get(TRANSFER_STATE_SERIALIZED_FOR_APPID);
16461
+ if (appIdsWithTransferStateSerialized.has(appId)) {
16462
+ console.warn(`Angular detected an incompatible configuration, which causes duplicate serialization of the server-side application state.\n\n` +
16463
+ `This can happen if the server providers have been provided more than once using different mechanisms. For example:\n\n` +
16464
+ ` imports: [ServerModule], // Registers server providers\n` +
16465
+ ` providers: [provideServerRendering()] // Also registers server providers\n\n` +
16466
+ `To fix this, ensure that the \`provideServerRendering()\` function is the only provider used and remove the other(s).`);
16467
+ }
16468
+ appIdsWithTransferStateSerialized.add(appId);
16469
+ }
16470
+ function serializeTransferStateFactory() {
16471
+ const doc = inject(DOCUMENT);
16472
+ const appId = inject(APP_ID);
16473
+ const transferStore = inject(TransferState);
16474
+ const injector = inject(Injector);
16455
16475
  return () => {
16456
16476
  const measuringLabel = 'serializeTransferStateFactory';
16457
16477
  ɵstartMeasuring(measuringLabel);
@@ -16463,6 +16483,9 @@ function serializeTransferStateFactory(doc, appId, transferStore) {
16463
16483
  // avoid creating an extra `<script>` tag in this case.
16464
16484
  return;
16465
16485
  }
16486
+ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
16487
+ warnIfStateTransferHappened(injector);
16488
+ }
16466
16489
  const script = createScript(doc, content,
16467
16490
  /**
16468
16491
  * `nonce` is not required for 'application/json'
@@ -16472,7 +16495,7 @@ function serializeTransferStateFactory(doc, appId, transferStore) {
16472
16495
  script.id = appId + '-state';
16473
16496
  script.setAttribute('type', 'application/json');
16474
16497
  // It is intentional that we add the script at the very bottom. Angular CLI script tags for
16475
- // bundles are always `type="module"`. These are deferred by default and cause the transfer
16498
+ // bundles are always `type="module"`. These are deferred by default and cause the
16476
16499
  // transfer data to be queried only after the browser has finished parsing the DOM.
16477
16500
  doc.body.appendChild(script);
16478
16501
  ɵstopMeasuring(measuringLabel);
@@ -16520,11 +16543,11 @@ const PLATFORM_SERVER_PROVIDERS = [
16520
16543
  * @publicApi
16521
16544
  */
16522
16545
  class ServerModule {
16523
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: ServerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
16524
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.0-next.2", ngImport: i0, type: ServerModule, imports: [NoopAnimationsModule], exports: [BrowserModule] });
16525
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: ServerModule, providers: PLATFORM_SERVER_PROVIDERS, imports: [NoopAnimationsModule, BrowserModule] });
16546
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.4", ngImport: i0, type: ServerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
16547
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.0-next.4", ngImport: i0, type: ServerModule, imports: [NoopAnimationsModule], exports: [BrowserModule] });
16548
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.0-next.4", ngImport: i0, type: ServerModule, providers: PLATFORM_SERVER_PROVIDERS, imports: [NoopAnimationsModule, BrowserModule] });
16526
16549
  }
16527
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: ServerModule, decorators: [{
16550
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.4", ngImport: i0, type: ServerModule, decorators: [{
16528
16551
  type: NgModule,
16529
16552
  args: [{
16530
16553
  exports: [BrowserModule],
@@ -16840,7 +16863,7 @@ async function renderApplication(bootstrap, options) {
16840
16863
  /**
16841
16864
  * @publicApi
16842
16865
  */
16843
- const VERSION = new Version('19.1.0-next.2');
16866
+ const VERSION = new Version('19.1.0-next.4');
16844
16867
 
16845
16868
  /// <reference types="node" />
16846
16869
  // This file only reexports content of the `src` folder. Keep it that way.