@angular/platform-server 19.0.0-next.8 → 19.0.0-rc.0
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 +1 -1
- package/fesm2022/platform-server.mjs +142 -113
- package/fesm2022/platform-server.mjs.map +1 -1
- package/fesm2022/testing.mjs +5 -5
- package/fesm2022/testing.mjs.map +1 -1
- package/index.d.ts +3 -10
- package/init/index.d.ts +1 -1
- package/package.json +6 -6
- package/testing/index.d.ts +1 -1
package/fesm2022/init.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v19.0.0-
|
|
2
|
+
* @license Angular v19.0.0-rc.0
|
|
3
3
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
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 {
|
|
9
|
+
import { InjectionToken, inject, Injector, ɵstartMeasuring, ɵstopMeasuring, Injectable, Inject, Optional, APP_ID, TransferState, PLATFORM_ID, PLATFORM_INITIALIZER, ɵALLOW_MULTIPLE_PLATFORMS, Testability, ɵTESTABILITY, NgModule, ɵsetDocument, createPlatformFactory, platformCore, makeEnvironmentProviders, ɵIS_HYDRATION_DOM_REUSE_ENABLED, ɵannotateForHydration, CSP_NONCE, ɵSSR_CONTENT_INTEGRITY_MARKER, Renderer2, ɵwhenStable, 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 { ɵHTTP_ROOT_INTERCEPTOR_FNS } from '@angular/common/http';
|
|
@@ -16138,14 +16138,12 @@ function serializeDocument(doc) {
|
|
|
16138
16138
|
* DOM Adapter for the server platform based on https://github.com/fgnass/domino.
|
|
16139
16139
|
*/
|
|
16140
16140
|
class DominoAdapter extends ɵBrowserDomAdapter {
|
|
16141
|
-
constructor() {
|
|
16142
|
-
super(...arguments);
|
|
16143
|
-
this.supportsDOMEvents = false;
|
|
16144
|
-
}
|
|
16145
16141
|
static makeCurrent() {
|
|
16146
16142
|
setDomTypes();
|
|
16147
16143
|
ɵsetRootDomAdapter(new DominoAdapter());
|
|
16148
16144
|
}
|
|
16145
|
+
supportsDOMEvents = false;
|
|
16146
|
+
static defaultDoc;
|
|
16149
16147
|
createHtmlDocument() {
|
|
16150
16148
|
return parseDocument('<html><head><title>fakeTitle</title></head><body></body></html>');
|
|
16151
16149
|
}
|
|
@@ -16195,12 +16193,30 @@ class DominoAdapter extends ɵBrowserDomAdapter {
|
|
|
16195
16193
|
}
|
|
16196
16194
|
}
|
|
16197
16195
|
|
|
16196
|
+
/**
|
|
16197
|
+
* The DI token for setting the initial config for the platform.
|
|
16198
|
+
*
|
|
16199
|
+
* @publicApi
|
|
16200
|
+
*/
|
|
16201
|
+
const INITIAL_CONFIG = new InjectionToken('Server.INITIAL_CONFIG');
|
|
16202
|
+
/**
|
|
16203
|
+
* A function that will be executed when calling `renderApplication` or
|
|
16204
|
+
* `renderModule` just before current platform state is rendered to string.
|
|
16205
|
+
*
|
|
16206
|
+
* @publicApi
|
|
16207
|
+
*/
|
|
16208
|
+
const BEFORE_APP_SERIALIZED = new InjectionToken('Server.RENDER_MODULE_HOOK');
|
|
16209
|
+
const ENABLE_DOM_EMULATION = new InjectionToken('ENABLE_DOM_EMULATION');
|
|
16210
|
+
|
|
16198
16211
|
/**
|
|
16199
16212
|
* Representation of the current platform state.
|
|
16200
16213
|
*
|
|
16201
16214
|
* @publicApi
|
|
16202
16215
|
*/
|
|
16203
16216
|
class PlatformState {
|
|
16217
|
+
_doc;
|
|
16218
|
+
/* @internal */
|
|
16219
|
+
_enableDomEmulation = enableDomEmulation(inject(Injector));
|
|
16204
16220
|
constructor(_doc) {
|
|
16205
16221
|
this._doc = _doc;
|
|
16206
16222
|
}
|
|
@@ -16208,7 +16224,17 @@ class PlatformState {
|
|
|
16208
16224
|
* Renders the current state of the platform to string.
|
|
16209
16225
|
*/
|
|
16210
16226
|
renderToString() {
|
|
16211
|
-
|
|
16227
|
+
if (ngDevMode && !this._enableDomEmulation && !window?.document) {
|
|
16228
|
+
throw new Error('Disabled DOM emulation should only run in browser environments');
|
|
16229
|
+
}
|
|
16230
|
+
const measuringLabel = 'renderToString';
|
|
16231
|
+
ɵstartMeasuring(measuringLabel);
|
|
16232
|
+
const rendered = this._enableDomEmulation
|
|
16233
|
+
? serializeDocument(this._doc)
|
|
16234
|
+
: // In the case we run/test the platform-server in a browser environment
|
|
16235
|
+
this._doc.documentElement.outerHTML;
|
|
16236
|
+
ɵstopMeasuring(measuringLabel);
|
|
16237
|
+
return rendered;
|
|
16212
16238
|
}
|
|
16213
16239
|
/**
|
|
16214
16240
|
* Returns the current DOM state.
|
|
@@ -16216,17 +16242,21 @@ class PlatformState {
|
|
|
16216
16242
|
getDocument() {
|
|
16217
16243
|
return this._doc;
|
|
16218
16244
|
}
|
|
16219
|
-
static
|
|
16220
|
-
static
|
|
16245
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: PlatformState, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
16246
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: PlatformState });
|
|
16221
16247
|
}
|
|
16222
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-
|
|
16248
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: PlatformState, decorators: [{
|
|
16223
16249
|
type: Injectable
|
|
16224
16250
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
16225
16251
|
type: Inject,
|
|
16226
16252
|
args: [DOCUMENT]
|
|
16227
16253
|
}] }] });
|
|
16254
|
+
function enableDomEmulation(injector) {
|
|
16255
|
+
return injector.get(ENABLE_DOM_EMULATION, true);
|
|
16256
|
+
}
|
|
16228
16257
|
|
|
16229
16258
|
class ServerXhr {
|
|
16259
|
+
xhrImpl;
|
|
16230
16260
|
// The `xhr2` dependency has a side-effect of accessing and modifying a
|
|
16231
16261
|
// global scope. Loading `xhr2` dynamically allows us to delay the loading
|
|
16232
16262
|
// and start the process once the global scope is established by the underlying
|
|
@@ -16244,10 +16274,10 @@ class ServerXhr {
|
|
|
16244
16274
|
}
|
|
16245
16275
|
return new impl.XMLHttpRequest();
|
|
16246
16276
|
}
|
|
16247
|
-
static
|
|
16248
|
-
static
|
|
16277
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: ServerXhr, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
16278
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: ServerXhr });
|
|
16249
16279
|
}
|
|
16250
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-
|
|
16280
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: ServerXhr, decorators: [{
|
|
16251
16281
|
type: Injectable
|
|
16252
16282
|
}] });
|
|
16253
16283
|
function relativeUrlsTransformerInterceptorFn(request, next) {
|
|
@@ -16274,20 +16304,6 @@ const SERVER_HTTP_PROVIDERS = [
|
|
|
16274
16304
|
},
|
|
16275
16305
|
];
|
|
16276
16306
|
|
|
16277
|
-
/**
|
|
16278
|
-
* The DI token for setting the initial config for the platform.
|
|
16279
|
-
*
|
|
16280
|
-
* @publicApi
|
|
16281
|
-
*/
|
|
16282
|
-
const INITIAL_CONFIG = new InjectionToken('Server.INITIAL_CONFIG');
|
|
16283
|
-
/**
|
|
16284
|
-
* A function that will be executed when calling `renderApplication` or
|
|
16285
|
-
* `renderModule` just before current platform state is rendered to string.
|
|
16286
|
-
*
|
|
16287
|
-
* @publicApi
|
|
16288
|
-
*/
|
|
16289
|
-
const BEFORE_APP_SERIALIZED = new InjectionToken('Server.RENDER_MODULE_HOOK');
|
|
16290
|
-
|
|
16291
16307
|
const RESOLVE_PROTOCOL = 'resolve:';
|
|
16292
16308
|
function parseUrl(urlStr) {
|
|
16293
16309
|
const { hostname, protocol, port, pathname, search, hash } = new URL(urlStr, RESOLVE_PROTOCOL + '//');
|
|
@@ -16305,16 +16321,17 @@ function parseUrl(urlStr) {
|
|
|
16305
16321
|
* but not the state stack.
|
|
16306
16322
|
*/
|
|
16307
16323
|
class ServerPlatformLocation {
|
|
16324
|
+
_doc;
|
|
16325
|
+
href = '/';
|
|
16326
|
+
hostname = '/';
|
|
16327
|
+
protocol = '/';
|
|
16328
|
+
port = '/';
|
|
16329
|
+
pathname = '/';
|
|
16330
|
+
search = '';
|
|
16331
|
+
hash = '';
|
|
16332
|
+
_hashUpdate = new Subject();
|
|
16308
16333
|
constructor(_doc, _config) {
|
|
16309
16334
|
this._doc = _doc;
|
|
16310
|
-
this.href = '/';
|
|
16311
|
-
this.hostname = '/';
|
|
16312
|
-
this.protocol = '/';
|
|
16313
|
-
this.port = '/';
|
|
16314
|
-
this.pathname = '/';
|
|
16315
|
-
this.search = '';
|
|
16316
|
-
this.hash = '';
|
|
16317
|
-
this._hashUpdate = new Subject();
|
|
16318
16335
|
const config = _config;
|
|
16319
16336
|
if (!config) {
|
|
16320
16337
|
return;
|
|
@@ -16379,10 +16396,10 @@ class ServerPlatformLocation {
|
|
|
16379
16396
|
getState() {
|
|
16380
16397
|
return undefined;
|
|
16381
16398
|
}
|
|
16382
|
-
static
|
|
16383
|
-
static
|
|
16399
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-rc.0", 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.0.0-rc.0", ngImport: i0, type: ServerPlatformLocation });
|
|
16384
16401
|
}
|
|
16385
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-
|
|
16402
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: ServerPlatformLocation, decorators: [{
|
|
16386
16403
|
type: Injectable
|
|
16387
16404
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
16388
16405
|
type: Inject,
|
|
@@ -16395,6 +16412,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.8",
|
|
|
16395
16412
|
}] }] });
|
|
16396
16413
|
|
|
16397
16414
|
class ServerEventManagerPlugin extends EventManagerPlugin {
|
|
16415
|
+
doc;
|
|
16398
16416
|
constructor(doc) {
|
|
16399
16417
|
super(doc);
|
|
16400
16418
|
this.doc = doc;
|
|
@@ -16406,10 +16424,10 @@ class ServerEventManagerPlugin extends EventManagerPlugin {
|
|
|
16406
16424
|
addEventListener(element, eventName, handler) {
|
|
16407
16425
|
return ɵgetDOM().onAndCancel(element, eventName, handler);
|
|
16408
16426
|
}
|
|
16409
|
-
static
|
|
16410
|
-
static
|
|
16427
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: ServerEventManagerPlugin, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
16428
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: ServerEventManagerPlugin });
|
|
16411
16429
|
}
|
|
16412
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-
|
|
16430
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: ServerEventManagerPlugin, decorators: [{
|
|
16413
16431
|
type: Injectable
|
|
16414
16432
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
16415
16433
|
type: Inject,
|
|
@@ -16435,6 +16453,8 @@ function createScript(doc, textContent, nonce) {
|
|
|
16435
16453
|
}
|
|
16436
16454
|
function serializeTransferStateFactory(doc, appId, transferStore) {
|
|
16437
16455
|
return () => {
|
|
16456
|
+
const measuringLabel = 'serializeTransferStateFactory';
|
|
16457
|
+
ɵstartMeasuring(measuringLabel);
|
|
16438
16458
|
// The `.toJSON` here causes the `onSerialize` callbacks to be called.
|
|
16439
16459
|
// These callbacks can be used to provide the value for a given key.
|
|
16440
16460
|
const content = transferStore.toJson();
|
|
@@ -16455,13 +16475,14 @@ function serializeTransferStateFactory(doc, appId, transferStore) {
|
|
|
16455
16475
|
// bundles are always `type="module"`. These are deferred by default and cause the transfer
|
|
16456
16476
|
// transfer data to be queried only after the browser has finished parsing the DOM.
|
|
16457
16477
|
doc.body.appendChild(script);
|
|
16478
|
+
ɵstopMeasuring(measuringLabel);
|
|
16458
16479
|
};
|
|
16459
16480
|
}
|
|
16460
16481
|
|
|
16461
16482
|
const INTERNAL_SERVER_PLATFORM_PROVIDERS = [
|
|
16462
16483
|
{ provide: DOCUMENT, useFactory: _document, deps: [Injector] },
|
|
16463
16484
|
{ provide: PLATFORM_ID, useValue: ɵPLATFORM_SERVER_ID },
|
|
16464
|
-
{ provide: PLATFORM_INITIALIZER, useFactory: initDominoAdapter, multi: true },
|
|
16485
|
+
{ provide: PLATFORM_INITIALIZER, useFactory: initDominoAdapter, multi: true, deps: [Injector] },
|
|
16465
16486
|
{
|
|
16466
16487
|
provide: PlatformLocation,
|
|
16467
16488
|
useClass: ServerPlatformLocation,
|
|
@@ -16471,9 +16492,15 @@ const INTERNAL_SERVER_PLATFORM_PROVIDERS = [
|
|
|
16471
16492
|
// Add special provider that allows multiple instances of platformServer* to be created.
|
|
16472
16493
|
{ provide: ɵALLOW_MULTIPLE_PLATFORMS, useValue: true },
|
|
16473
16494
|
];
|
|
16474
|
-
function initDominoAdapter() {
|
|
16495
|
+
function initDominoAdapter(injector) {
|
|
16496
|
+
const _enableDomEmulation = enableDomEmulation(injector);
|
|
16475
16497
|
return () => {
|
|
16476
|
-
|
|
16498
|
+
if (_enableDomEmulation) {
|
|
16499
|
+
DominoAdapter.makeCurrent();
|
|
16500
|
+
}
|
|
16501
|
+
else {
|
|
16502
|
+
ɵBrowserDomAdapter.makeCurrent();
|
|
16503
|
+
}
|
|
16477
16504
|
};
|
|
16478
16505
|
}
|
|
16479
16506
|
const SERVER_RENDER_PROVIDERS = [
|
|
@@ -16493,11 +16520,11 @@ const PLATFORM_SERVER_PROVIDERS = [
|
|
|
16493
16520
|
* @publicApi
|
|
16494
16521
|
*/
|
|
16495
16522
|
class ServerModule {
|
|
16496
|
-
static
|
|
16497
|
-
static
|
|
16498
|
-
static
|
|
16523
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: ServerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
16524
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.0-rc.0", ngImport: i0, type: ServerModule, imports: [NoopAnimationsModule], exports: [BrowserModule] });
|
|
16525
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: ServerModule, providers: PLATFORM_SERVER_PROVIDERS, imports: [NoopAnimationsModule, BrowserModule] });
|
|
16499
16526
|
}
|
|
16500
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-
|
|
16527
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-rc.0", ngImport: i0, type: ServerModule, decorators: [{
|
|
16501
16528
|
type: NgModule,
|
|
16502
16529
|
args: [{
|
|
16503
16530
|
exports: [BrowserModule],
|
|
@@ -16507,11 +16534,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.8",
|
|
|
16507
16534
|
}] });
|
|
16508
16535
|
function _document(injector) {
|
|
16509
16536
|
const config = injector.get(INITIAL_CONFIG, null);
|
|
16537
|
+
const _enableDomEmulation = enableDomEmulation(injector);
|
|
16510
16538
|
let document;
|
|
16511
16539
|
if (config && config.document) {
|
|
16512
16540
|
document =
|
|
16513
16541
|
typeof config.document === 'string'
|
|
16514
|
-
?
|
|
16542
|
+
? _enableDomEmulation
|
|
16543
|
+
? parseDocument(config.document, config.url)
|
|
16544
|
+
: window.document
|
|
16515
16545
|
: config.document;
|
|
16516
16546
|
}
|
|
16517
16547
|
else {
|
|
@@ -16524,7 +16554,16 @@ function _document(injector) {
|
|
|
16524
16554
|
/**
|
|
16525
16555
|
* @publicApi
|
|
16526
16556
|
*/
|
|
16527
|
-
|
|
16557
|
+
function platformServer(extraProviders) {
|
|
16558
|
+
if (typeof ngServerMode === 'undefined') {
|
|
16559
|
+
globalThis['ngServerMode'] = true;
|
|
16560
|
+
}
|
|
16561
|
+
const platform = createPlatformFactory(platformCore, 'server', INTERNAL_SERVER_PLATFORM_PROVIDERS)(extraProviders);
|
|
16562
|
+
platform.onDestroy(() => {
|
|
16563
|
+
globalThis['ngServerMode'] = undefined;
|
|
16564
|
+
});
|
|
16565
|
+
return platform;
|
|
16566
|
+
}
|
|
16528
16567
|
|
|
16529
16568
|
/**
|
|
16530
16569
|
* Sets up providers necessary to enable server rendering functionality for the application.
|
|
@@ -16542,55 +16581,10 @@ const platformServer = createPlatformFactory(platformCore, 'server', INTERNAL_SE
|
|
|
16542
16581
|
* @returns A set of providers to setup the server.
|
|
16543
16582
|
*/
|
|
16544
16583
|
function provideServerRendering() {
|
|
16545
|
-
|
|
16546
|
-
|
|
16547
|
-
|
|
16548
|
-
const PERFORMANCE_MARK_PREFIX = '🅰️';
|
|
16549
|
-
let enablePerfLogging = false;
|
|
16550
|
-
function runAndMeasurePerf(label, method) {
|
|
16551
|
-
if (!enablePerfLogging) {
|
|
16552
|
-
return method();
|
|
16553
|
-
}
|
|
16554
|
-
const labelName = `${PERFORMANCE_MARK_PREFIX}:${label}`;
|
|
16555
|
-
const startLabel = `start:${labelName}`;
|
|
16556
|
-
const endLabel = `end:${labelName}`;
|
|
16557
|
-
const end = () => {
|
|
16558
|
-
/* tslint:disable:ban */
|
|
16559
|
-
performance.mark(endLabel);
|
|
16560
|
-
performance.measure(labelName, startLabel, endLabel);
|
|
16561
|
-
performance.clearMarks(startLabel);
|
|
16562
|
-
performance.clearMarks(endLabel);
|
|
16563
|
-
/* tslint:enable:ban */
|
|
16564
|
-
};
|
|
16565
|
-
/* tslint:disable:ban */
|
|
16566
|
-
performance.mark(startLabel);
|
|
16567
|
-
/* tslint:enable:ban */
|
|
16568
|
-
const returnValue = method();
|
|
16569
|
-
if (returnValue instanceof Promise) {
|
|
16570
|
-
return returnValue.finally(() => end());
|
|
16571
|
-
}
|
|
16572
|
-
else {
|
|
16573
|
-
end();
|
|
16574
|
-
return returnValue;
|
|
16575
|
-
}
|
|
16576
|
-
}
|
|
16577
|
-
let warningLogged = false;
|
|
16578
|
-
/**
|
|
16579
|
-
* This enables an internal performance profiler for SSR apps
|
|
16580
|
-
*
|
|
16581
|
-
* It should not be imported in application code
|
|
16582
|
-
*/
|
|
16583
|
-
function enableSsrProfiling() {
|
|
16584
|
-
if (!warningLogged &&
|
|
16585
|
-
(typeof performance === 'undefined' || !performance.mark || !performance.measure)) {
|
|
16586
|
-
warningLogged = true;
|
|
16587
|
-
console.warn('Performance API is not supported on this platform');
|
|
16588
|
-
return;
|
|
16584
|
+
if (typeof ngServerMode === 'undefined') {
|
|
16585
|
+
globalThis['ngServerMode'] = true;
|
|
16589
16586
|
}
|
|
16590
|
-
|
|
16591
|
-
}
|
|
16592
|
-
function disableSsrProfiling() {
|
|
16593
|
-
enablePerfLogging = false;
|
|
16587
|
+
return makeEnvironmentProviders([provideNoopAnimations(), ...PLATFORM_SERVER_PROVIDERS]);
|
|
16594
16588
|
}
|
|
16595
16589
|
|
|
16596
16590
|
/**
|
|
@@ -16608,10 +16602,14 @@ const EVENT_DISPATCH_SCRIPT_ID = 'ng-event-dispatch-contract';
|
|
|
16608
16602
|
*/
|
|
16609
16603
|
function createServerPlatform(options) {
|
|
16610
16604
|
const extraProviders = options.platformProviders ?? [];
|
|
16611
|
-
|
|
16605
|
+
const measuringLabel = 'createServerPlatform';
|
|
16606
|
+
ɵstartMeasuring(measuringLabel);
|
|
16607
|
+
const platform = platformServer([
|
|
16612
16608
|
{ provide: INITIAL_CONFIG, useValue: { document: options.document, url: options.url } },
|
|
16613
16609
|
extraProviders,
|
|
16614
16610
|
]);
|
|
16611
|
+
ɵstopMeasuring(measuringLabel);
|
|
16612
|
+
return platform;
|
|
16615
16613
|
}
|
|
16616
16614
|
/**
|
|
16617
16615
|
* Finds and returns inlined event dispatch script if it exists.
|
|
@@ -16631,6 +16629,8 @@ function removeEventDispatchScript(doc) {
|
|
|
16631
16629
|
* Annotate nodes for hydration and remove event dispatch script when not needed.
|
|
16632
16630
|
*/
|
|
16633
16631
|
function prepareForHydration(platformState, applicationRef) {
|
|
16632
|
+
const measuringLabel = 'prepareForHydration';
|
|
16633
|
+
ɵstartMeasuring(measuringLabel);
|
|
16634
16634
|
const environmentInjector = applicationRef.injector;
|
|
16635
16635
|
const doc = platformState.getDocument();
|
|
16636
16636
|
if (!environmentInjector.get(ɵIS_HYDRATION_DOM_REUSE_ENABLED, false)) {
|
|
@@ -16649,6 +16649,7 @@ function prepareForHydration(platformState, applicationRef) {
|
|
|
16649
16649
|
// (which was injected by the build process) from the HTML.
|
|
16650
16650
|
removeEventDispatchScript(doc);
|
|
16651
16651
|
}
|
|
16652
|
+
ɵstopMeasuring(measuringLabel);
|
|
16652
16653
|
}
|
|
16653
16654
|
/**
|
|
16654
16655
|
* Creates a marker comment node and append it into the `<body>`.
|
|
@@ -16679,8 +16680,11 @@ function appendServerContextInfo(applicationRef) {
|
|
|
16679
16680
|
});
|
|
16680
16681
|
}
|
|
16681
16682
|
function insertEventRecordScript(appId, doc, eventTypesToReplay, nonce) {
|
|
16683
|
+
const measuringLabel = 'insertEventRecordScript';
|
|
16684
|
+
ɵstartMeasuring(measuringLabel);
|
|
16682
16685
|
const { regular, capture } = eventTypesToReplay;
|
|
16683
16686
|
const eventDispatchScript = findEventDispatchScript(doc);
|
|
16687
|
+
// Note: this is only true when build with the CLI tooling, which inserts the script in the HTML
|
|
16684
16688
|
if (eventDispatchScript) {
|
|
16685
16689
|
// This is defined in packages/core/primitives/event-dispatch/contract_binary.ts
|
|
16686
16690
|
const replayScriptContents = `window.__jsaction_bootstrap(` +
|
|
@@ -16694,10 +16698,14 @@ function insertEventRecordScript(appId, doc, eventTypesToReplay, nonce) {
|
|
|
16694
16698
|
// relies on `__jsaction_bootstrap` to be defined in the global scope.
|
|
16695
16699
|
eventDispatchScript.after(replayScript);
|
|
16696
16700
|
}
|
|
16701
|
+
ɵstopMeasuring(measuringLabel);
|
|
16697
16702
|
}
|
|
16698
16703
|
async function _render(platformRef, applicationRef) {
|
|
16704
|
+
const measuringLabel = 'whenStable';
|
|
16705
|
+
ɵstartMeasuring(measuringLabel);
|
|
16699
16706
|
// Block until application is stable.
|
|
16700
16707
|
await ɵwhenStable(applicationRef);
|
|
16708
|
+
ɵstopMeasuring(measuringLabel);
|
|
16701
16709
|
const platformState = platformRef.injector.get(PlatformState);
|
|
16702
16710
|
prepareForHydration(platformState, applicationRef);
|
|
16703
16711
|
// Run any BEFORE_APP_SERIALIZED callbacks just before rendering to string.
|
|
@@ -16726,16 +16734,19 @@ async function _render(platformRef, applicationRef) {
|
|
|
16726
16734
|
}
|
|
16727
16735
|
}
|
|
16728
16736
|
appendServerContextInfo(applicationRef);
|
|
16729
|
-
|
|
16730
|
-
|
|
16731
|
-
|
|
16732
|
-
|
|
16737
|
+
return platformState.renderToString();
|
|
16738
|
+
}
|
|
16739
|
+
/**
|
|
16740
|
+
* Destroy the application in a macrotask, this allows pending promises to be settled and errors
|
|
16741
|
+
* to be surfaced to the users.
|
|
16742
|
+
*/
|
|
16743
|
+
function asyncDestroyPlatform(platformRef) {
|
|
16744
|
+
return new Promise((resolve) => {
|
|
16733
16745
|
setTimeout(() => {
|
|
16734
16746
|
platformRef.destroy();
|
|
16735
16747
|
resolve();
|
|
16736
16748
|
}, 0);
|
|
16737
16749
|
});
|
|
16738
|
-
return output;
|
|
16739
16750
|
}
|
|
16740
16751
|
/**
|
|
16741
16752
|
* Specifies the value that should be used if no server context value has been provided.
|
|
@@ -16771,9 +16782,14 @@ function sanitizeServerContext(serverContext) {
|
|
|
16771
16782
|
async function renderModule(moduleType, options) {
|
|
16772
16783
|
const { document, url, extraProviders: platformProviders } = options;
|
|
16773
16784
|
const platformRef = createServerPlatform({ document, url, platformProviders });
|
|
16774
|
-
|
|
16775
|
-
|
|
16776
|
-
|
|
16785
|
+
try {
|
|
16786
|
+
const moduleRef = await platformRef.bootstrapModule(moduleType);
|
|
16787
|
+
const applicationRef = moduleRef.injector.get(ApplicationRef);
|
|
16788
|
+
return await _render(platformRef, applicationRef);
|
|
16789
|
+
}
|
|
16790
|
+
finally {
|
|
16791
|
+
await asyncDestroyPlatform(platformRef);
|
|
16792
|
+
}
|
|
16777
16793
|
}
|
|
16778
16794
|
/**
|
|
16779
16795
|
* Bootstraps an instance of an Angular application and renders it to a string.
|
|
@@ -16796,11 +16812,24 @@ async function renderModule(moduleType, options) {
|
|
|
16796
16812
|
* @publicApi
|
|
16797
16813
|
*/
|
|
16798
16814
|
async function renderApplication(bootstrap, options) {
|
|
16799
|
-
|
|
16800
|
-
|
|
16815
|
+
const renderAppLabel = 'renderApplication';
|
|
16816
|
+
const bootstrapLabel = 'bootstrap';
|
|
16817
|
+
const _renderLabel = '_render';
|
|
16818
|
+
ɵstartMeasuring(renderAppLabel);
|
|
16819
|
+
const platformRef = createServerPlatform(options);
|
|
16820
|
+
try {
|
|
16821
|
+
ɵstartMeasuring(bootstrapLabel);
|
|
16801
16822
|
const applicationRef = await bootstrap();
|
|
16802
|
-
|
|
16803
|
-
|
|
16823
|
+
ɵstopMeasuring(bootstrapLabel);
|
|
16824
|
+
ɵstartMeasuring(_renderLabel);
|
|
16825
|
+
const rendered = await _render(platformRef, applicationRef);
|
|
16826
|
+
ɵstopMeasuring(_renderLabel);
|
|
16827
|
+
return rendered;
|
|
16828
|
+
}
|
|
16829
|
+
finally {
|
|
16830
|
+
await asyncDestroyPlatform(platformRef);
|
|
16831
|
+
ɵstopMeasuring(renderAppLabel);
|
|
16832
|
+
}
|
|
16804
16833
|
}
|
|
16805
16834
|
|
|
16806
16835
|
/**
|
|
@@ -16811,7 +16840,7 @@ async function renderApplication(bootstrap, options) {
|
|
|
16811
16840
|
/**
|
|
16812
16841
|
* @publicApi
|
|
16813
16842
|
*/
|
|
16814
|
-
const VERSION = new Version('19.0.0-
|
|
16843
|
+
const VERSION = new Version('19.0.0-rc.0');
|
|
16815
16844
|
|
|
16816
16845
|
/// <reference types="node" />
|
|
16817
16846
|
// This file only reexports content of the `src` folder. Keep it that way.
|
|
@@ -16822,5 +16851,5 @@ const VERSION = new Version('19.0.0-next.8');
|
|
|
16822
16851
|
* Generated bundle index. Do not edit.
|
|
16823
16852
|
*/
|
|
16824
16853
|
|
|
16825
|
-
export { BEFORE_APP_SERIALIZED, INITIAL_CONFIG, PlatformState, ServerModule, VERSION, 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
|
|
16854
|
+
export { BEFORE_APP_SERIALIZED, INITIAL_CONFIG, PlatformState, ServerModule, VERSION, platformServer, provideServerRendering, renderApplication, renderModule, ENABLE_DOM_EMULATION as ɵENABLE_DOM_EMULATION, INTERNAL_SERVER_PLATFORM_PROVIDERS as ɵINTERNAL_SERVER_PLATFORM_PROVIDERS, SERVER_CONTEXT as ɵSERVER_CONTEXT, SERVER_RENDER_PROVIDERS as ɵSERVER_RENDER_PROVIDERS };
|
|
16826
16855
|
//# sourceMappingURL=platform-server.mjs.map
|