@angular/platform-server 17.0.0-next.8 → 17.0.0-rc.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,17 +1,16 @@
1
1
  /**
2
- * @license Angular v17.0.0-next.8
2
+ * @license Angular v17.0.0-rc.1
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
- import { ɵsetRootDomAdapter, DOCUMENT, XhrFactory, ɵgetDOM, ɵPLATFORM_SERVER_ID, PlatformLocation, ViewportScroller, ɵNullViewportScroller } from '@angular/common';
7
+ import { ɵsetRootDomAdapter, DOCUMENT, PlatformLocation, XhrFactory, ɵgetDOM, ɵPLATFORM_SERVER_ID, 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, ɵwhenStable, ɵIS_HYDRATION_DOM_REUSE_ENABLED, ɵannotateForHydration, ApplicationRef, Version } from '@angular/core';
9
+ import { Injectable, Inject, 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, 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
- import { HttpClientModule } from '@angular/common/http';
12
+ import { ɵHTTP_ROOT_INTERCEPTOR_FNS, HttpClientModule } from '@angular/common/http';
13
13
  import { Subject } from 'rxjs';
14
- import * as url from 'url';
15
14
 
16
15
  var __getOwnPropNames = Object.getOwnPropertyNames;
17
16
  var __commonJS = (cb, mod) => function __require() {
@@ -16116,8 +16115,9 @@ var domino = require_lib();
16116
16115
 
16117
16116
  function setDomTypes() {
16118
16117
  // Make all Domino types available in the global env.
16119
- Object.assign(global, domino.impl);
16120
- global['KeyboardEvent'] = domino.impl.Event;
16118
+ // NB: Any changes here should also be done in `packages/platform-server/init/src/shims.ts`.
16119
+ Object.assign(globalThis, domino.impl);
16120
+ globalThis['KeyboardEvent'] = domino.impl.Event;
16121
16121
  }
16122
16122
  /**
16123
16123
  * Parses a document string to a Document object.
@@ -16215,10 +16215,10 @@ class PlatformState {
16215
16215
  getDocument() {
16216
16216
  return this._doc;
16217
16217
  }
16218
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-next.8", 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.8", ngImport: i0, type: PlatformState }); }
16218
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-rc.1", 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-rc.1", ngImport: i0, type: PlatformState }); }
16220
16220
  }
16221
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-next.8", ngImport: i0, type: PlatformState, decorators: [{
16221
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-rc.1", ngImport: i0, type: PlatformState, decorators: [{
16222
16222
  type: Injectable
16223
16223
  }], ctorParameters: () => [{ type: undefined, decorators: [{
16224
16224
  type: Inject,
@@ -16243,14 +16243,34 @@ class ServerXhr {
16243
16243
  }
16244
16244
  return new impl.XMLHttpRequest();
16245
16245
  }
16246
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-next.8", ngImport: i0, type: ServerXhr, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
16247
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.0-next.8", ngImport: i0, type: ServerXhr }); }
16246
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-rc.1", ngImport: i0, type: ServerXhr, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
16247
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.0-rc.1", ngImport: i0, type: ServerXhr }); }
16248
16248
  }
16249
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-next.8", ngImport: i0, type: ServerXhr, decorators: [{
16249
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-rc.1", ngImport: i0, type: ServerXhr, decorators: [{
16250
16250
  type: Injectable
16251
16251
  }] });
16252
+ function relativeUrlsTransformerInterceptorFn(request, next) {
16253
+ const platformLocation = inject(PlatformLocation);
16254
+ const { href, protocol, hostname, port } = platformLocation;
16255
+ if (!protocol.startsWith('http')) {
16256
+ return next(request);
16257
+ }
16258
+ let urlPrefix = `${protocol}//${hostname}`;
16259
+ if (port) {
16260
+ urlPrefix += `:${port}`;
16261
+ }
16262
+ const baseHref = platformLocation.getBaseHrefFromDOM() || href;
16263
+ const baseUrl = new URL(baseHref, urlPrefix);
16264
+ const newUrl = new URL(request.url, baseUrl).toString();
16265
+ return next(request.clone({ url: newUrl }));
16266
+ }
16252
16267
  const SERVER_HTTP_PROVIDERS = [
16253
16268
  { provide: XhrFactory, useClass: ServerXhr },
16269
+ {
16270
+ provide: ɵHTTP_ROOT_INTERCEPTOR_FNS,
16271
+ useValue: relativeUrlsTransformerInterceptorFn,
16272
+ multi: true,
16273
+ },
16254
16274
  ];
16255
16275
 
16256
16276
  /**
@@ -16267,15 +16287,31 @@ const INITIAL_CONFIG = new InjectionToken('Server.INITIAL_CONFIG');
16267
16287
  */
16268
16288
  const BEFORE_APP_SERIALIZED = new InjectionToken('Server.RENDER_MODULE_HOOK');
16269
16289
 
16290
+ const RESOLVE_PROTOCOL = 'resolve:';
16270
16291
  function parseUrl(urlStr) {
16271
- const parsedUrl = url.parse(urlStr);
16292
+ let { hostname, protocol, port, pathname, search, hash } = new URL(urlStr, RESOLVE_PROTOCOL + '//');
16293
+ /**
16294
+ * TODO(alanagius): Remove the below in version 18.
16295
+ * The following are done to maintain the same behaviour as `url.parse`.
16296
+ * The main differences are;
16297
+ * - `pathname` is always suffixed with a `/`.
16298
+ * - `port` is empty when `http:` protocol and port in url is `80`
16299
+ * - `port` is empty when `https:` protocol and port in url is `443`
16300
+ */
16301
+ if (protocol !== RESOLVE_PROTOCOL && port === '' && /\:(80|443)/.test(urlStr)) {
16302
+ port = protocol === 'http:' ? '80' : '443';
16303
+ }
16304
+ if (protocol === RESOLVE_PROTOCOL && urlStr.charAt(0) !== '/') {
16305
+ pathname = pathname.slice(1); // Remove leading slash.
16306
+ }
16307
+ // END TODO
16272
16308
  return {
16273
- hostname: parsedUrl.hostname || '',
16274
- protocol: parsedUrl.protocol || '',
16275
- port: parsedUrl.port || '',
16276
- pathname: parsedUrl.pathname || '',
16277
- search: parsedUrl.search || '',
16278
- hash: parsedUrl.hash || '',
16309
+ hostname,
16310
+ protocol: protocol === RESOLVE_PROTOCOL ? '' : protocol,
16311
+ port,
16312
+ pathname,
16313
+ search,
16314
+ hash,
16279
16315
  };
16280
16316
  }
16281
16317
  /**
@@ -16361,10 +16397,10 @@ class ServerPlatformLocation {
16361
16397
  getState() {
16362
16398
  return undefined;
16363
16399
  }
16364
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-next.8", 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.8", ngImport: i0, type: ServerPlatformLocation }); }
16400
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-rc.1", ngImport: i0, type: ServerPlatformLocation, deps: [{ token: DOCUMENT }, { token: INITIAL_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
16401
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.0-rc.1", ngImport: i0, type: ServerPlatformLocation }); }
16366
16402
  }
16367
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-next.8", ngImport: i0, type: ServerPlatformLocation, decorators: [{
16403
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-rc.1", ngImport: i0, type: ServerPlatformLocation, decorators: [{
16368
16404
  type: Injectable
16369
16405
  }], ctorParameters: () => [{ type: undefined, decorators: [{
16370
16406
  type: Inject,
@@ -16388,10 +16424,10 @@ class ServerEventManagerPlugin extends EventManagerPlugin {
16388
16424
  addEventListener(element, eventName, handler) {
16389
16425
  return ɵgetDOM().onAndCancel(element, eventName, handler);
16390
16426
  }
16391
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-next.8", 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.8", ngImport: i0, type: ServerEventManagerPlugin }); }
16427
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-rc.1", ngImport: i0, type: ServerEventManagerPlugin, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable }); }
16428
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.0-rc.1", ngImport: i0, type: ServerEventManagerPlugin }); }
16393
16429
  }
16394
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-next.8", ngImport: i0, type: ServerEventManagerPlugin, decorators: [{
16430
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-rc.1", ngImport: i0, type: ServerEventManagerPlugin, decorators: [{
16395
16431
  type: Injectable
16396
16432
  }], ctorParameters: () => [{ type: undefined, decorators: [{
16397
16433
  type: Inject,
@@ -16436,11 +16472,11 @@ function serializeTransferStateFactory(doc, appId, transferStore) {
16436
16472
  * this module.
16437
16473
  */
16438
16474
  class ServerTransferStateModule {
16439
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-next.8", ngImport: i0, type: ServerTransferStateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
16440
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.0-next.8", ngImport: i0, type: ServerTransferStateModule }); }
16441
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.0-next.8", ngImport: i0, type: ServerTransferStateModule }); }
16475
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-rc.1", ngImport: i0, type: ServerTransferStateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
16476
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.0-rc.1", ngImport: i0, type: ServerTransferStateModule }); }
16477
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.0-rc.1", ngImport: i0, type: ServerTransferStateModule }); }
16442
16478
  }
16443
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-next.8", ngImport: i0, type: ServerTransferStateModule, decorators: [{
16479
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-rc.1", ngImport: i0, type: ServerTransferStateModule, decorators: [{
16444
16480
  type: NgModule,
16445
16481
  args: [{}]
16446
16482
  }] });
@@ -16479,11 +16515,11 @@ const PLATFORM_SERVER_PROVIDERS = [
16479
16515
  * @publicApi
16480
16516
  */
16481
16517
  class ServerModule {
16482
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-next.8", ngImport: i0, type: ServerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
16483
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.0-next.8", ngImport: i0, type: ServerModule, imports: [HttpClientModule, NoopAnimationsModule], exports: [BrowserModule] }); }
16484
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.0-next.8", ngImport: i0, type: ServerModule, providers: PLATFORM_SERVER_PROVIDERS, imports: [HttpClientModule, NoopAnimationsModule, BrowserModule] }); }
16518
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-rc.1", ngImport: i0, type: ServerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
16519
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.0-rc.1", ngImport: i0, type: ServerModule, imports: [HttpClientModule, NoopAnimationsModule], exports: [BrowserModule] }); }
16520
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.0-rc.1", ngImport: i0, type: ServerModule, providers: PLATFORM_SERVER_PROVIDERS, imports: [HttpClientModule, NoopAnimationsModule, BrowserModule] }); }
16485
16521
  }
16486
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-next.8", ngImport: i0, type: ServerModule, decorators: [{
16522
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-rc.1", ngImport: i0, type: ServerModule, decorators: [{
16487
16523
  type: NgModule,
16488
16524
  args: [{
16489
16525
  exports: [BrowserModule],
@@ -16571,11 +16607,6 @@ function appendSsrContentIntegrityMarker(doc) {
16571
16607
  function appendServerContextInfo(applicationRef) {
16572
16608
  const injector = applicationRef.injector;
16573
16609
  let serverContext = sanitizeServerContext(injector.get(SERVER_CONTEXT, DEFAULT_SERVER_CONTEXT));
16574
- const features = injector.get(ɵENABLED_SSR_FEATURES);
16575
- if (features.size > 0) {
16576
- // Append features information into the server context value.
16577
- serverContext += `|${Array.from(features).join(',')}`;
16578
- }
16579
16610
  applicationRef.components.forEach(componentRef => {
16580
16611
  const renderer = componentRef.injector.get(Renderer2);
16581
16612
  const element = componentRef.location.nativeElement;
@@ -16687,7 +16718,6 @@ async function renderModule(moduleType, options) {
16687
16718
  * @returns A Promise, that returns serialized (to a string) rendered page, once resolved.
16688
16719
  *
16689
16720
  * @publicApi
16690
- * @developerPreview
16691
16721
  */
16692
16722
  async function renderApplication(bootstrap, options) {
16693
16723
  const platformRef = createServerPlatform(options);
@@ -16703,7 +16733,7 @@ async function renderApplication(bootstrap, options) {
16703
16733
  /**
16704
16734
  * @publicApi
16705
16735
  */
16706
- const VERSION = new Version('17.0.0-next.8');
16736
+ const VERSION = new Version('17.0.0-rc.1');
16707
16737
 
16708
16738
  /// <reference types="node" />
16709
16739
  // This file only reexports content of the `src` folder. Keep it that way.
@@ -16714,5 +16744,5 @@ const VERSION = new Version('17.0.0-next.8');
16714
16744
  * Generated bundle index. Do not edit.
16715
16745
  */
16716
16746
 
16717
- export { BEFORE_APP_SERIALIZED, INITIAL_CONFIG, PlatformState, ServerModule, ServerTransferStateModule, VERSION, platformDynamicServer, platformServer, provideServerRendering, renderApplication, renderModule, INTERNAL_SERVER_PLATFORM_PROVIDERS as ɵINTERNAL_SERVER_PLATFORM_PROVIDERS, SERVER_CONTEXT as ɵSERVER_CONTEXT, SERVER_RENDER_PROVIDERS as ɵSERVER_RENDER_PROVIDERS, setDomTypes as ɵsetDomTypes };
16747
+ export { BEFORE_APP_SERIALIZED, INITIAL_CONFIG, PlatformState, ServerModule, ServerTransferStateModule, VERSION, platformDynamicServer, platformServer, provideServerRendering, renderApplication, renderModule, INTERNAL_SERVER_PLATFORM_PROVIDERS as ɵINTERNAL_SERVER_PLATFORM_PROVIDERS, SERVER_CONTEXT as ɵSERVER_CONTEXT, SERVER_RENDER_PROVIDERS as ɵSERVER_RENDER_PROVIDERS };
16718
16748
  //# sourceMappingURL=platform-server.mjs.map