@angular/platform-server 19.0.0-next.8 → 19.0.0-next.9
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 +115 -100
- package/fesm2022/platform-server.mjs.map +1 -1
- package/fesm2022/testing.mjs +5 -5
- package/index.d.ts +2 -9
- 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-next.
|
|
2
|
+
* @license Angular v19.0.0-next.9
|
|
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';
|
|
@@ -16195,6 +16195,21 @@ class DominoAdapter extends ɵBrowserDomAdapter {
|
|
|
16195
16195
|
}
|
|
16196
16196
|
}
|
|
16197
16197
|
|
|
16198
|
+
/**
|
|
16199
|
+
* The DI token for setting the initial config for the platform.
|
|
16200
|
+
*
|
|
16201
|
+
* @publicApi
|
|
16202
|
+
*/
|
|
16203
|
+
const INITIAL_CONFIG = new InjectionToken('Server.INITIAL_CONFIG');
|
|
16204
|
+
/**
|
|
16205
|
+
* A function that will be executed when calling `renderApplication` or
|
|
16206
|
+
* `renderModule` just before current platform state is rendered to string.
|
|
16207
|
+
*
|
|
16208
|
+
* @publicApi
|
|
16209
|
+
*/
|
|
16210
|
+
const BEFORE_APP_SERIALIZED = new InjectionToken('Server.RENDER_MODULE_HOOK');
|
|
16211
|
+
const ENABLE_DOM_EMULATION = new InjectionToken('ENABLE_DOM_EMULATION');
|
|
16212
|
+
|
|
16198
16213
|
/**
|
|
16199
16214
|
* Representation of the current platform state.
|
|
16200
16215
|
*
|
|
@@ -16203,12 +16218,24 @@ class DominoAdapter extends ɵBrowserDomAdapter {
|
|
|
16203
16218
|
class PlatformState {
|
|
16204
16219
|
constructor(_doc) {
|
|
16205
16220
|
this._doc = _doc;
|
|
16221
|
+
/* @internal */
|
|
16222
|
+
this._enableDomEmulation = enableDomEmulation(inject(Injector));
|
|
16206
16223
|
}
|
|
16207
16224
|
/**
|
|
16208
16225
|
* Renders the current state of the platform to string.
|
|
16209
16226
|
*/
|
|
16210
16227
|
renderToString() {
|
|
16211
|
-
|
|
16228
|
+
if (ngDevMode && !this._enableDomEmulation && !window?.document) {
|
|
16229
|
+
throw new Error('Disabled DOM emulation should only run in browser environments');
|
|
16230
|
+
}
|
|
16231
|
+
const measuringLabel = 'renderToString';
|
|
16232
|
+
ɵstartMeasuring(measuringLabel);
|
|
16233
|
+
const rendered = this._enableDomEmulation
|
|
16234
|
+
? serializeDocument(this._doc)
|
|
16235
|
+
: // In the case we run/test the platform-server in a browser environment
|
|
16236
|
+
this._doc.documentElement.outerHTML;
|
|
16237
|
+
ɵstopMeasuring(measuringLabel);
|
|
16238
|
+
return rendered;
|
|
16212
16239
|
}
|
|
16213
16240
|
/**
|
|
16214
16241
|
* Returns the current DOM state.
|
|
@@ -16216,15 +16243,18 @@ class PlatformState {
|
|
|
16216
16243
|
getDocument() {
|
|
16217
16244
|
return this._doc;
|
|
16218
16245
|
}
|
|
16219
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-next.
|
|
16220
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0-next.
|
|
16246
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-next.9", ngImport: i0, type: PlatformState, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
16247
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0-next.9", ngImport: i0, type: PlatformState }); }
|
|
16221
16248
|
}
|
|
16222
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.
|
|
16249
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.9", ngImport: i0, type: PlatformState, decorators: [{
|
|
16223
16250
|
type: Injectable
|
|
16224
16251
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
16225
16252
|
type: Inject,
|
|
16226
16253
|
args: [DOCUMENT]
|
|
16227
16254
|
}] }] });
|
|
16255
|
+
function enableDomEmulation(injector) {
|
|
16256
|
+
return injector.get(ENABLE_DOM_EMULATION, true);
|
|
16257
|
+
}
|
|
16228
16258
|
|
|
16229
16259
|
class ServerXhr {
|
|
16230
16260
|
// The `xhr2` dependency has a side-effect of accessing and modifying a
|
|
@@ -16244,10 +16274,10 @@ class ServerXhr {
|
|
|
16244
16274
|
}
|
|
16245
16275
|
return new impl.XMLHttpRequest();
|
|
16246
16276
|
}
|
|
16247
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-next.
|
|
16248
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0-next.
|
|
16277
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-next.9", ngImport: i0, type: ServerXhr, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
16278
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0-next.9", ngImport: i0, type: ServerXhr }); }
|
|
16249
16279
|
}
|
|
16250
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.
|
|
16280
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.9", 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 + '//');
|
|
@@ -16379,10 +16395,10 @@ class ServerPlatformLocation {
|
|
|
16379
16395
|
getState() {
|
|
16380
16396
|
return undefined;
|
|
16381
16397
|
}
|
|
16382
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-next.
|
|
16383
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0-next.
|
|
16398
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-next.9", ngImport: i0, type: ServerPlatformLocation, deps: [{ token: DOCUMENT }, { token: INITIAL_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
16399
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0-next.9", ngImport: i0, type: ServerPlatformLocation }); }
|
|
16384
16400
|
}
|
|
16385
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.
|
|
16401
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.9", ngImport: i0, type: ServerPlatformLocation, decorators: [{
|
|
16386
16402
|
type: Injectable
|
|
16387
16403
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
16388
16404
|
type: Inject,
|
|
@@ -16406,10 +16422,10 @@ class ServerEventManagerPlugin extends EventManagerPlugin {
|
|
|
16406
16422
|
addEventListener(element, eventName, handler) {
|
|
16407
16423
|
return ɵgetDOM().onAndCancel(element, eventName, handler);
|
|
16408
16424
|
}
|
|
16409
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-next.
|
|
16410
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0-next.
|
|
16425
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-next.9", ngImport: i0, type: ServerEventManagerPlugin, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
16426
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0-next.9", ngImport: i0, type: ServerEventManagerPlugin }); }
|
|
16411
16427
|
}
|
|
16412
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.
|
|
16428
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.9", ngImport: i0, type: ServerEventManagerPlugin, decorators: [{
|
|
16413
16429
|
type: Injectable
|
|
16414
16430
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
16415
16431
|
type: Inject,
|
|
@@ -16435,6 +16451,8 @@ function createScript(doc, textContent, nonce) {
|
|
|
16435
16451
|
}
|
|
16436
16452
|
function serializeTransferStateFactory(doc, appId, transferStore) {
|
|
16437
16453
|
return () => {
|
|
16454
|
+
const measuringLabel = 'serializeTransferStateFactory';
|
|
16455
|
+
ɵstartMeasuring(measuringLabel);
|
|
16438
16456
|
// The `.toJSON` here causes the `onSerialize` callbacks to be called.
|
|
16439
16457
|
// These callbacks can be used to provide the value for a given key.
|
|
16440
16458
|
const content = transferStore.toJson();
|
|
@@ -16455,13 +16473,14 @@ function serializeTransferStateFactory(doc, appId, transferStore) {
|
|
|
16455
16473
|
// bundles are always `type="module"`. These are deferred by default and cause the transfer
|
|
16456
16474
|
// transfer data to be queried only after the browser has finished parsing the DOM.
|
|
16457
16475
|
doc.body.appendChild(script);
|
|
16476
|
+
ɵstopMeasuring(measuringLabel);
|
|
16458
16477
|
};
|
|
16459
16478
|
}
|
|
16460
16479
|
|
|
16461
16480
|
const INTERNAL_SERVER_PLATFORM_PROVIDERS = [
|
|
16462
16481
|
{ provide: DOCUMENT, useFactory: _document, deps: [Injector] },
|
|
16463
16482
|
{ provide: PLATFORM_ID, useValue: ɵPLATFORM_SERVER_ID },
|
|
16464
|
-
{ provide: PLATFORM_INITIALIZER, useFactory: initDominoAdapter, multi: true },
|
|
16483
|
+
{ provide: PLATFORM_INITIALIZER, useFactory: initDominoAdapter, multi: true, deps: [Injector] },
|
|
16465
16484
|
{
|
|
16466
16485
|
provide: PlatformLocation,
|
|
16467
16486
|
useClass: ServerPlatformLocation,
|
|
@@ -16471,9 +16490,15 @@ const INTERNAL_SERVER_PLATFORM_PROVIDERS = [
|
|
|
16471
16490
|
// Add special provider that allows multiple instances of platformServer* to be created.
|
|
16472
16491
|
{ provide: ɵALLOW_MULTIPLE_PLATFORMS, useValue: true },
|
|
16473
16492
|
];
|
|
16474
|
-
function initDominoAdapter() {
|
|
16493
|
+
function initDominoAdapter(injector) {
|
|
16494
|
+
const _enableDomEmulation = enableDomEmulation(injector);
|
|
16475
16495
|
return () => {
|
|
16476
|
-
|
|
16496
|
+
if (_enableDomEmulation) {
|
|
16497
|
+
DominoAdapter.makeCurrent();
|
|
16498
|
+
}
|
|
16499
|
+
else {
|
|
16500
|
+
ɵBrowserDomAdapter.makeCurrent();
|
|
16501
|
+
}
|
|
16477
16502
|
};
|
|
16478
16503
|
}
|
|
16479
16504
|
const SERVER_RENDER_PROVIDERS = [
|
|
@@ -16493,11 +16518,11 @@ const PLATFORM_SERVER_PROVIDERS = [
|
|
|
16493
16518
|
* @publicApi
|
|
16494
16519
|
*/
|
|
16495
16520
|
class ServerModule {
|
|
16496
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-next.
|
|
16497
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.0-next.
|
|
16498
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.0-next.
|
|
16521
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-next.9", ngImport: i0, type: ServerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
16522
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.0-next.9", ngImport: i0, type: ServerModule, imports: [NoopAnimationsModule], exports: [BrowserModule] }); }
|
|
16523
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.0-next.9", ngImport: i0, type: ServerModule, providers: PLATFORM_SERVER_PROVIDERS, imports: [NoopAnimationsModule, BrowserModule] }); }
|
|
16499
16524
|
}
|
|
16500
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.
|
|
16525
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.9", ngImport: i0, type: ServerModule, decorators: [{
|
|
16501
16526
|
type: NgModule,
|
|
16502
16527
|
args: [{
|
|
16503
16528
|
exports: [BrowserModule],
|
|
@@ -16507,11 +16532,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.8",
|
|
|
16507
16532
|
}] });
|
|
16508
16533
|
function _document(injector) {
|
|
16509
16534
|
const config = injector.get(INITIAL_CONFIG, null);
|
|
16535
|
+
const _enableDomEmulation = enableDomEmulation(injector);
|
|
16510
16536
|
let document;
|
|
16511
16537
|
if (config && config.document) {
|
|
16512
16538
|
document =
|
|
16513
16539
|
typeof config.document === 'string'
|
|
16514
|
-
?
|
|
16540
|
+
? _enableDomEmulation
|
|
16541
|
+
? parseDocument(config.document, config.url)
|
|
16542
|
+
: window.document
|
|
16515
16543
|
: config.document;
|
|
16516
16544
|
}
|
|
16517
16545
|
else {
|
|
@@ -16545,54 +16573,6 @@ function provideServerRendering() {
|
|
|
16545
16573
|
return makeEnvironmentProviders([provideNoopAnimations(), ...PLATFORM_SERVER_PROVIDERS]);
|
|
16546
16574
|
}
|
|
16547
16575
|
|
|
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;
|
|
16589
|
-
}
|
|
16590
|
-
enablePerfLogging = true;
|
|
16591
|
-
}
|
|
16592
|
-
function disableSsrProfiling() {
|
|
16593
|
-
enablePerfLogging = false;
|
|
16594
|
-
}
|
|
16595
|
-
|
|
16596
16576
|
/**
|
|
16597
16577
|
* Event dispatch (JSAction) script is inlined into the HTML by the build
|
|
16598
16578
|
* process to avoid extra blocking request on a page. The script looks like this:
|
|
@@ -16608,10 +16588,14 @@ const EVENT_DISPATCH_SCRIPT_ID = 'ng-event-dispatch-contract';
|
|
|
16608
16588
|
*/
|
|
16609
16589
|
function createServerPlatform(options) {
|
|
16610
16590
|
const extraProviders = options.platformProviders ?? [];
|
|
16611
|
-
|
|
16591
|
+
const measuringLabel = 'createServerPlatform';
|
|
16592
|
+
ɵstartMeasuring(measuringLabel);
|
|
16593
|
+
const platform = platformServer([
|
|
16612
16594
|
{ provide: INITIAL_CONFIG, useValue: { document: options.document, url: options.url } },
|
|
16613
16595
|
extraProviders,
|
|
16614
16596
|
]);
|
|
16597
|
+
ɵstopMeasuring(measuringLabel);
|
|
16598
|
+
return platform;
|
|
16615
16599
|
}
|
|
16616
16600
|
/**
|
|
16617
16601
|
* Finds and returns inlined event dispatch script if it exists.
|
|
@@ -16631,6 +16615,8 @@ function removeEventDispatchScript(doc) {
|
|
|
16631
16615
|
* Annotate nodes for hydration and remove event dispatch script when not needed.
|
|
16632
16616
|
*/
|
|
16633
16617
|
function prepareForHydration(platformState, applicationRef) {
|
|
16618
|
+
const measuringLabel = 'prepareForHydration';
|
|
16619
|
+
ɵstartMeasuring(measuringLabel);
|
|
16634
16620
|
const environmentInjector = applicationRef.injector;
|
|
16635
16621
|
const doc = platformState.getDocument();
|
|
16636
16622
|
if (!environmentInjector.get(ɵIS_HYDRATION_DOM_REUSE_ENABLED, false)) {
|
|
@@ -16649,6 +16635,7 @@ function prepareForHydration(platformState, applicationRef) {
|
|
|
16649
16635
|
// (which was injected by the build process) from the HTML.
|
|
16650
16636
|
removeEventDispatchScript(doc);
|
|
16651
16637
|
}
|
|
16638
|
+
ɵstopMeasuring(measuringLabel);
|
|
16652
16639
|
}
|
|
16653
16640
|
/**
|
|
16654
16641
|
* Creates a marker comment node and append it into the `<body>`.
|
|
@@ -16679,8 +16666,11 @@ function appendServerContextInfo(applicationRef) {
|
|
|
16679
16666
|
});
|
|
16680
16667
|
}
|
|
16681
16668
|
function insertEventRecordScript(appId, doc, eventTypesToReplay, nonce) {
|
|
16669
|
+
const measuringLabel = 'insertEventRecordScript';
|
|
16670
|
+
ɵstartMeasuring(measuringLabel);
|
|
16682
16671
|
const { regular, capture } = eventTypesToReplay;
|
|
16683
16672
|
const eventDispatchScript = findEventDispatchScript(doc);
|
|
16673
|
+
// Note: this is only true when build with the CLI tooling, which inserts the script in the HTML
|
|
16684
16674
|
if (eventDispatchScript) {
|
|
16685
16675
|
// This is defined in packages/core/primitives/event-dispatch/contract_binary.ts
|
|
16686
16676
|
const replayScriptContents = `window.__jsaction_bootstrap(` +
|
|
@@ -16694,10 +16684,14 @@ function insertEventRecordScript(appId, doc, eventTypesToReplay, nonce) {
|
|
|
16694
16684
|
// relies on `__jsaction_bootstrap` to be defined in the global scope.
|
|
16695
16685
|
eventDispatchScript.after(replayScript);
|
|
16696
16686
|
}
|
|
16687
|
+
ɵstopMeasuring(measuringLabel);
|
|
16697
16688
|
}
|
|
16698
16689
|
async function _render(platformRef, applicationRef) {
|
|
16690
|
+
const measuringLabel = 'whenStable';
|
|
16691
|
+
ɵstartMeasuring(measuringLabel);
|
|
16699
16692
|
// Block until application is stable.
|
|
16700
16693
|
await ɵwhenStable(applicationRef);
|
|
16694
|
+
ɵstopMeasuring(measuringLabel);
|
|
16701
16695
|
const platformState = platformRef.injector.get(PlatformState);
|
|
16702
16696
|
prepareForHydration(platformState, applicationRef);
|
|
16703
16697
|
// Run any BEFORE_APP_SERIALIZED callbacks just before rendering to string.
|
|
@@ -16726,16 +16720,19 @@ async function _render(platformRef, applicationRef) {
|
|
|
16726
16720
|
}
|
|
16727
16721
|
}
|
|
16728
16722
|
appendServerContextInfo(applicationRef);
|
|
16729
|
-
|
|
16730
|
-
|
|
16731
|
-
|
|
16732
|
-
|
|
16723
|
+
return platformState.renderToString();
|
|
16724
|
+
}
|
|
16725
|
+
/**
|
|
16726
|
+
* Destroy the application in a macrotask, this allows pending promises to be settled and errors
|
|
16727
|
+
* to be surfaced to the users.
|
|
16728
|
+
*/
|
|
16729
|
+
function asyncDestroyPlatform(platformRef) {
|
|
16730
|
+
return new Promise((resolve) => {
|
|
16733
16731
|
setTimeout(() => {
|
|
16734
16732
|
platformRef.destroy();
|
|
16735
16733
|
resolve();
|
|
16736
16734
|
}, 0);
|
|
16737
16735
|
});
|
|
16738
|
-
return output;
|
|
16739
16736
|
}
|
|
16740
16737
|
/**
|
|
16741
16738
|
* Specifies the value that should be used if no server context value has been provided.
|
|
@@ -16771,9 +16768,14 @@ function sanitizeServerContext(serverContext) {
|
|
|
16771
16768
|
async function renderModule(moduleType, options) {
|
|
16772
16769
|
const { document, url, extraProviders: platformProviders } = options;
|
|
16773
16770
|
const platformRef = createServerPlatform({ document, url, platformProviders });
|
|
16774
|
-
|
|
16775
|
-
|
|
16776
|
-
|
|
16771
|
+
try {
|
|
16772
|
+
const moduleRef = await platformRef.bootstrapModule(moduleType);
|
|
16773
|
+
const applicationRef = moduleRef.injector.get(ApplicationRef);
|
|
16774
|
+
return await _render(platformRef, applicationRef);
|
|
16775
|
+
}
|
|
16776
|
+
finally {
|
|
16777
|
+
await asyncDestroyPlatform(platformRef);
|
|
16778
|
+
}
|
|
16777
16779
|
}
|
|
16778
16780
|
/**
|
|
16779
16781
|
* Bootstraps an instance of an Angular application and renders it to a string.
|
|
@@ -16796,11 +16798,24 @@ async function renderModule(moduleType, options) {
|
|
|
16796
16798
|
* @publicApi
|
|
16797
16799
|
*/
|
|
16798
16800
|
async function renderApplication(bootstrap, options) {
|
|
16799
|
-
|
|
16800
|
-
|
|
16801
|
+
const renderAppLabel = 'renderApplication';
|
|
16802
|
+
const bootstrapLabel = 'bootstrap';
|
|
16803
|
+
const _renderLabel = '_render';
|
|
16804
|
+
ɵstartMeasuring(renderAppLabel);
|
|
16805
|
+
const platformRef = createServerPlatform(options);
|
|
16806
|
+
try {
|
|
16807
|
+
ɵstartMeasuring(bootstrapLabel);
|
|
16801
16808
|
const applicationRef = await bootstrap();
|
|
16802
|
-
|
|
16803
|
-
|
|
16809
|
+
ɵstopMeasuring(bootstrapLabel);
|
|
16810
|
+
ɵstartMeasuring(_renderLabel);
|
|
16811
|
+
const rendered = await _render(platformRef, applicationRef);
|
|
16812
|
+
ɵstopMeasuring(_renderLabel);
|
|
16813
|
+
return rendered;
|
|
16814
|
+
}
|
|
16815
|
+
finally {
|
|
16816
|
+
await asyncDestroyPlatform(platformRef);
|
|
16817
|
+
ɵstopMeasuring(renderAppLabel);
|
|
16818
|
+
}
|
|
16804
16819
|
}
|
|
16805
16820
|
|
|
16806
16821
|
/**
|
|
@@ -16811,7 +16826,7 @@ async function renderApplication(bootstrap, options) {
|
|
|
16811
16826
|
/**
|
|
16812
16827
|
* @publicApi
|
|
16813
16828
|
*/
|
|
16814
|
-
const VERSION = new Version('19.0.0-next.
|
|
16829
|
+
const VERSION = new Version('19.0.0-next.9');
|
|
16815
16830
|
|
|
16816
16831
|
/// <reference types="node" />
|
|
16817
16832
|
// This file only reexports content of the `src` folder. Keep it that way.
|
|
@@ -16822,5 +16837,5 @@ const VERSION = new Version('19.0.0-next.8');
|
|
|
16822
16837
|
* Generated bundle index. Do not edit.
|
|
16823
16838
|
*/
|
|
16824
16839
|
|
|
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
|
|
16840
|
+
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
16841
|
//# sourceMappingURL=platform-server.mjs.map
|