@angular/ssr 18.2.0 → 19.0.0-next.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/esm2022/public_api.mjs +2 -1
- package/esm2022/src/app-engine.mjs +106 -0
- package/esm2022/src/app.mjs +85 -0
- package/esm2022/src/assets.mjs +44 -0
- package/esm2022/src/console.mjs +34 -0
- package/esm2022/src/hooks.mjs +94 -0
- package/esm2022/src/i18n.mjs +41 -0
- package/esm2022/src/manifest.mjs +59 -0
- package/esm2022/src/render.mjs +74 -0
- package/esm2022/src/request.mjs +63 -0
- package/esm2022/src/response.mjs +58 -0
- package/esm2022/src/routes/ng-routes.mjs +155 -0
- package/esm2022/src/routes/route-tree.mjs +180 -0
- package/esm2022/src/routes/router.mjs +88 -0
- package/esm2022/src/tokens.mjs +20 -0
- package/esm2022/src/utils/ng.mjs +51 -0
- package/esm2022/src/utils/url.mjs +85 -0
- package/fesm2022/ssr.mjs +298 -4
- package/fesm2022/ssr.mjs.map +1 -1
- package/index.d.ts +78 -0
- package/package.json +13 -3
- /package/esm2022/src/{common-engine.mjs → common-engine/common-engine.mjs} +0 -0
- /package/esm2022/src/{inline-css-processor.mjs → common-engine/inline-css-processor.mjs} +0 -0
- /package/esm2022/src/{peformance-profiler.mjs → common-engine/peformance-profiler.mjs} +0 -0
package/fesm2022/ssr.mjs
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { ɵSERVER_CONTEXT as _SERVER_CONTEXT, renderApplication, renderModule } from '@angular/platform-server';
|
|
1
|
+
import { ɵSERVER_CONTEXT as _SERVER_CONTEXT, renderApplication, renderModule, INITIAL_CONFIG, ɵINTERNAL_SERVER_PLATFORM_PROVIDERS as _INTERNAL_SERVER_PLATFORM_PROVIDERS } from '@angular/platform-server';
|
|
2
2
|
import * as fs from 'node:fs';
|
|
3
3
|
import { dirname, join, normalize, resolve } from 'node:path';
|
|
4
|
-
import { URL } from 'node:url';
|
|
4
|
+
import { URL as URL$1 } from 'node:url';
|
|
5
5
|
import Critters from 'critters';
|
|
6
6
|
import { readFile } from 'node:fs/promises';
|
|
7
|
+
import { APP_BASE_HREF, PlatformLocation } from '@angular/common';
|
|
8
|
+
import { ɵConsole as _Console, ɵresetCompiledComponents as _resetCompiledComponents, createPlatformFactory, platformCore, ApplicationRef, ɵwhenStable as _whenStable, Compiler } from '@angular/core';
|
|
9
|
+
import { ɵloadChildren as _loadChildren, Router } from '@angular/router';
|
|
7
10
|
|
|
8
11
|
/**
|
|
9
12
|
* Pattern used to extract the media query set by Critters in an `onload` handler.
|
|
@@ -275,7 +278,7 @@ class CommonEngine {
|
|
|
275
278
|
if (!publicPath || !documentFilePath || url === undefined) {
|
|
276
279
|
return undefined;
|
|
277
280
|
}
|
|
278
|
-
const { pathname } = new URL(url, 'resolve://');
|
|
281
|
+
const { pathname } = new URL$1(url, 'resolve://');
|
|
279
282
|
// Do not use `resolve` here as otherwise it can lead to path traversal vulnerability.
|
|
280
283
|
// See: https://portswigger.net/web-security/file-path-traversal
|
|
281
284
|
const pagePath = join(publicPath, pathname, 'index.html');
|
|
@@ -347,5 +350,296 @@ function isBootstrapFn(value) {
|
|
|
347
350
|
return typeof value === 'function' && !('ɵmod' in value);
|
|
348
351
|
}
|
|
349
352
|
|
|
350
|
-
|
|
353
|
+
/**
|
|
354
|
+
* Custom implementation of the Angular Console service that filters out specific log messages.
|
|
355
|
+
*
|
|
356
|
+
* This class extends the internal Angular `ɵConsole` class to provide customized logging behavior.
|
|
357
|
+
* It overrides the `log` method to suppress logs that match certain predefined messages.
|
|
358
|
+
*/
|
|
359
|
+
class Console extends _Console {
|
|
360
|
+
/**
|
|
361
|
+
* A set of log messages that should be ignored and not printed to the console.
|
|
362
|
+
*/
|
|
363
|
+
ignoredLogs = new Set(['Angular is running in development mode.']);
|
|
364
|
+
/**
|
|
365
|
+
* Logs a message to the console if it is not in the set of ignored messages.
|
|
366
|
+
*
|
|
367
|
+
* @param message - The message to log to the console.
|
|
368
|
+
*
|
|
369
|
+
* This method overrides the `log` method of the `ɵConsole` class. It checks if the
|
|
370
|
+
* message is in the `ignoredLogs` set. If it is not, it delegates the logging to
|
|
371
|
+
* the parent class's `log` method. Otherwise, the message is suppressed.
|
|
372
|
+
*/
|
|
373
|
+
log(message) {
|
|
374
|
+
if (!this.ignoredLogs.has(message)) {
|
|
375
|
+
super.log(message);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Removes the trailing slash from a URL if it exists.
|
|
382
|
+
*
|
|
383
|
+
* @param url - The URL string from which to remove the trailing slash.
|
|
384
|
+
* @returns The URL string without a trailing slash.
|
|
385
|
+
*
|
|
386
|
+
* @example
|
|
387
|
+
* ```js
|
|
388
|
+
* stripTrailingSlash('path/'); // 'path'
|
|
389
|
+
* stripTrailingSlash('/path'); // '/path'
|
|
390
|
+
* ```
|
|
391
|
+
*/
|
|
392
|
+
function stripTrailingSlash(url) {
|
|
393
|
+
// Check if the last character of the URL is a slash
|
|
394
|
+
return url[url.length - 1] === '/' ? url.slice(0, -1) : url;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Joins URL parts into a single URL string.
|
|
398
|
+
*
|
|
399
|
+
* This function takes multiple URL segments, normalizes them by removing leading
|
|
400
|
+
* and trailing slashes where appropriate, and then joins them into a single URL.
|
|
401
|
+
*
|
|
402
|
+
* @param parts - The parts of the URL to join. Each part can be a string with or without slashes.
|
|
403
|
+
* @returns The joined URL string, with normalized slashes.
|
|
404
|
+
*
|
|
405
|
+
* @example
|
|
406
|
+
* ```js
|
|
407
|
+
* joinUrlParts('path/', '/to/resource'); // '/path/to/resource'
|
|
408
|
+
* joinUrlParts('/path/', 'to/resource'); // '/path/to/resource'
|
|
409
|
+
* ```
|
|
410
|
+
*/
|
|
411
|
+
function joinUrlParts(...parts) {
|
|
412
|
+
// Initialize an array with an empty string to always add a leading slash
|
|
413
|
+
const normalizeParts = [''];
|
|
414
|
+
for (const part of parts) {
|
|
415
|
+
if (part === '') {
|
|
416
|
+
// Skip any empty parts
|
|
417
|
+
continue;
|
|
418
|
+
}
|
|
419
|
+
let normalizedPart = part;
|
|
420
|
+
if (part[0] === '/') {
|
|
421
|
+
normalizedPart = normalizedPart.slice(1);
|
|
422
|
+
}
|
|
423
|
+
if (part[part.length - 1] === '/') {
|
|
424
|
+
normalizedPart = normalizedPart.slice(0, -1);
|
|
425
|
+
}
|
|
426
|
+
if (normalizedPart !== '') {
|
|
427
|
+
normalizeParts.push(normalizedPart);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
return normalizeParts.join('/');
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Strips `/index.html` from the end of a URL's path, if present.
|
|
434
|
+
*
|
|
435
|
+
* This function is used to convert URLs pointing to an `index.html` file into their directory
|
|
436
|
+
* equivalents. For example, it transforms a URL like `http://www.example.com/page/index.html`
|
|
437
|
+
* into `http://www.example.com/page`.
|
|
438
|
+
*
|
|
439
|
+
* @param url - The URL object to process.
|
|
440
|
+
* @returns A new URL object with `/index.html` removed from the path, if it was present.
|
|
441
|
+
*
|
|
442
|
+
* @example
|
|
443
|
+
* ```typescript
|
|
444
|
+
* const originalUrl = new URL('http://www.example.com/page/index.html');
|
|
445
|
+
* const cleanedUrl = stripIndexHtmlFromURL(originalUrl);
|
|
446
|
+
* console.log(cleanedUrl.href); // Output: 'http://www.example.com/page'
|
|
447
|
+
* ```
|
|
448
|
+
*/
|
|
449
|
+
function stripIndexHtmlFromURL(url) {
|
|
450
|
+
if (url.pathname.endsWith('/index.html')) {
|
|
451
|
+
const modifiedURL = new URL(url);
|
|
452
|
+
// Remove '/index.html' from the pathname
|
|
453
|
+
modifiedURL.pathname = modifiedURL.pathname.slice(0, /** '/index.html'.length */ -11);
|
|
454
|
+
return modifiedURL;
|
|
455
|
+
}
|
|
456
|
+
return url;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* Renders an Angular application or module to an HTML string.
|
|
461
|
+
*
|
|
462
|
+
* This function determines whether the provided `bootstrap` value is an Angular module
|
|
463
|
+
* or a bootstrap function and calls the appropriate rendering method (`renderModule` or
|
|
464
|
+
* `renderApplication`) based on that determination.
|
|
465
|
+
*
|
|
466
|
+
* @param html - The HTML string to be used as the initial document content.
|
|
467
|
+
* @param bootstrap - Either an Angular module type or a function that returns a promise
|
|
468
|
+
* resolving to an `ApplicationRef`.
|
|
469
|
+
* @param url - The URL of the application. This is used for server-side rendering to
|
|
470
|
+
* correctly handle route-based rendering.
|
|
471
|
+
* @param platformProviders - An array of platform providers to be used during the
|
|
472
|
+
* rendering process.
|
|
473
|
+
* @returns A promise that resolves to a string containing the rendered HTML.
|
|
474
|
+
*/
|
|
475
|
+
function renderAngular(html, bootstrap, url, platformProviders) {
|
|
476
|
+
// A request to `http://www.example.com/page/index.html` will render the Angular route corresponding to `http://www.example.com/page`.
|
|
477
|
+
const urlToRender = stripIndexHtmlFromURL(url).toString();
|
|
478
|
+
return isNgModule(bootstrap)
|
|
479
|
+
? renderModule(bootstrap, {
|
|
480
|
+
url: urlToRender,
|
|
481
|
+
document: html,
|
|
482
|
+
extraProviders: platformProviders,
|
|
483
|
+
})
|
|
484
|
+
: renderApplication(bootstrap, {
|
|
485
|
+
url: urlToRender,
|
|
486
|
+
document: html,
|
|
487
|
+
platformProviders,
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* Type guard to determine if a given value is an Angular module.
|
|
492
|
+
* Angular modules are identified by the presence of the `ɵmod` static property.
|
|
493
|
+
* This function helps distinguish between Angular modules and bootstrap functions.
|
|
494
|
+
*
|
|
495
|
+
* @param value - The value to be checked.
|
|
496
|
+
* @returns True if the value is an Angular module (i.e., it has the `ɵmod` property), false otherwise.
|
|
497
|
+
*/
|
|
498
|
+
function isNgModule(value) {
|
|
499
|
+
return 'ɵmod' in value;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
/**
|
|
503
|
+
* Recursively traverses the Angular router configuration to retrieve routes.
|
|
504
|
+
*
|
|
505
|
+
* Iterates through the router configuration, yielding each route along with its potential
|
|
506
|
+
* redirection or error status. Handles nested routes and lazy-loaded child routes.
|
|
507
|
+
*
|
|
508
|
+
* @param options - An object containing the parameters for traversing routes.
|
|
509
|
+
* @returns An async iterator yielding `RouteResult` objects.
|
|
510
|
+
*/
|
|
511
|
+
async function* traverseRoutesConfig(options) {
|
|
512
|
+
const { routes, compiler, parentInjector, parentRoute } = options;
|
|
513
|
+
for (const route of routes) {
|
|
514
|
+
const { path = '', redirectTo, loadChildren, children } = route;
|
|
515
|
+
const currentRoutePath = joinUrlParts(parentRoute, path);
|
|
516
|
+
yield {
|
|
517
|
+
route: currentRoutePath,
|
|
518
|
+
redirectTo: typeof redirectTo === 'string'
|
|
519
|
+
? resolveRedirectTo(currentRoutePath, redirectTo)
|
|
520
|
+
: undefined,
|
|
521
|
+
};
|
|
522
|
+
if (children?.length) {
|
|
523
|
+
// Recursively process child routes.
|
|
524
|
+
yield* traverseRoutesConfig({
|
|
525
|
+
routes: children,
|
|
526
|
+
compiler,
|
|
527
|
+
parentInjector,
|
|
528
|
+
parentRoute: currentRoutePath,
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
if (loadChildren) {
|
|
532
|
+
// Load and process lazy-loaded child routes.
|
|
533
|
+
const loadedChildRoutes = await _loadChildren(route, compiler, parentInjector).toPromise();
|
|
534
|
+
if (loadedChildRoutes) {
|
|
535
|
+
const { routes: childRoutes, injector = parentInjector } = loadedChildRoutes;
|
|
536
|
+
yield* traverseRoutesConfig({
|
|
537
|
+
routes: childRoutes,
|
|
538
|
+
compiler,
|
|
539
|
+
parentInjector: injector,
|
|
540
|
+
parentRoute: currentRoutePath,
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Resolves the `redirectTo` property for a given route.
|
|
548
|
+
*
|
|
549
|
+
* This function processes the `redirectTo` property to ensure that it correctly
|
|
550
|
+
* resolves relative to the current route path. If `redirectTo` is an absolute path,
|
|
551
|
+
* it is returned as is. If it is a relative path, it is resolved based on the current route path.
|
|
552
|
+
*
|
|
553
|
+
* @param routePath - The current route path.
|
|
554
|
+
* @param redirectTo - The target path for redirection.
|
|
555
|
+
* @returns The resolved redirect path as a string.
|
|
556
|
+
*/
|
|
557
|
+
function resolveRedirectTo(routePath, redirectTo) {
|
|
558
|
+
if (redirectTo[0] === '/') {
|
|
559
|
+
// If the redirectTo path is absolute, return it as is.
|
|
560
|
+
return redirectTo;
|
|
561
|
+
}
|
|
562
|
+
// Resolve relative redirectTo based on the current route path.
|
|
563
|
+
const segments = routePath.split('/');
|
|
564
|
+
segments.pop(); // Remove the last segment to make it relative.
|
|
565
|
+
return joinUrlParts(...segments, redirectTo);
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Retrieves routes from the given Angular application.
|
|
569
|
+
*
|
|
570
|
+
* This function initializes an Angular platform, bootstraps the application or module,
|
|
571
|
+
* and retrieves routes from the Angular router configuration. It handles both module-based
|
|
572
|
+
* and function-based bootstrapping. It yields the resulting routes as `RouteResult` objects.
|
|
573
|
+
*
|
|
574
|
+
* @param bootstrap - A function that returns a promise resolving to an `ApplicationRef` or an Angular module to bootstrap.
|
|
575
|
+
* @param document - The initial HTML document used for server-side rendering.
|
|
576
|
+
* This document is necessary to render the application on the server.
|
|
577
|
+
* @param url - The URL for server-side rendering. The URL is used to configure `ServerPlatformLocation`. This configuration is crucial
|
|
578
|
+
* for ensuring that API requests for relative paths succeed, which is essential for accurate route extraction.
|
|
579
|
+
* See:
|
|
580
|
+
* - https://github.com/angular/angular/blob/d608b857c689d17a7ffa33bbb510301014d24a17/packages/platform-server/src/location.ts#L51
|
|
581
|
+
* - https://github.com/angular/angular/blob/6882cc7d9eed26d3caeedca027452367ba25f2b9/packages/platform-server/src/http.ts#L44
|
|
582
|
+
* @returns A promise that resolves to an object of type `AngularRouterConfigResult`.
|
|
583
|
+
*/
|
|
584
|
+
async function getRoutesFromAngularRouterConfig(bootstrap, document, url) {
|
|
585
|
+
// Need to clean up GENERATED_COMP_IDS map in `@angular/core`.
|
|
586
|
+
// Otherwise an incorrect component ID generation collision detected warning will be displayed in development.
|
|
587
|
+
// See: https://github.com/angular/angular-cli/issues/25924
|
|
588
|
+
_resetCompiledComponents();
|
|
589
|
+
const { protocol, host } = url;
|
|
590
|
+
// Create and initialize the Angular platform for server-side rendering.
|
|
591
|
+
const platformRef = createPlatformFactory(platformCore, 'server', [
|
|
592
|
+
{
|
|
593
|
+
provide: INITIAL_CONFIG,
|
|
594
|
+
useValue: { document, url: `${protocol}//${host}/` },
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
provide: _Console,
|
|
598
|
+
useFactory: () => new Console(),
|
|
599
|
+
},
|
|
600
|
+
..._INTERNAL_SERVER_PLATFORM_PROVIDERS,
|
|
601
|
+
])();
|
|
602
|
+
try {
|
|
603
|
+
let applicationRef;
|
|
604
|
+
if (isNgModule(bootstrap)) {
|
|
605
|
+
const moduleRef = await platformRef.bootstrapModule(bootstrap);
|
|
606
|
+
applicationRef = moduleRef.injector.get(ApplicationRef);
|
|
607
|
+
}
|
|
608
|
+
else {
|
|
609
|
+
applicationRef = await bootstrap();
|
|
610
|
+
}
|
|
611
|
+
// Wait until the application is stable.
|
|
612
|
+
await _whenStable(applicationRef);
|
|
613
|
+
const injector = applicationRef.injector;
|
|
614
|
+
const router = injector.get(Router);
|
|
615
|
+
const routesResults = [];
|
|
616
|
+
if (router.config.length) {
|
|
617
|
+
const compiler = injector.get(Compiler);
|
|
618
|
+
// Retrieve all routes from the Angular router configuration.
|
|
619
|
+
const traverseRoutes = traverseRoutesConfig({
|
|
620
|
+
routes: router.config,
|
|
621
|
+
compiler,
|
|
622
|
+
parentInjector: injector,
|
|
623
|
+
parentRoute: '',
|
|
624
|
+
});
|
|
625
|
+
for await (const result of traverseRoutes) {
|
|
626
|
+
routesResults.push(result);
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
else {
|
|
630
|
+
routesResults.push({ route: '' });
|
|
631
|
+
}
|
|
632
|
+
const baseHref = injector.get(APP_BASE_HREF, null, { optional: true }) ??
|
|
633
|
+
injector.get(PlatformLocation).getBaseHrefFromDOM();
|
|
634
|
+
return {
|
|
635
|
+
baseHref,
|
|
636
|
+
routes: routesResults,
|
|
637
|
+
};
|
|
638
|
+
}
|
|
639
|
+
finally {
|
|
640
|
+
platformRef.destroy();
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
export { CommonEngine, getRoutesFromAngularRouterConfig as ɵgetRoutesFromAngularRouterConfig };
|
|
351
645
|
//# sourceMappingURL=ssr.mjs.map
|
package/fesm2022/ssr.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssr.mjs","sources":["../../../../../../darwin-fastbuild-ST-70f2edae98f4/bin/packages/angular/ssr/src/inline-css-processor.mjs","../../../../../../darwin-fastbuild-ST-70f2edae98f4/bin/packages/angular/ssr/src/peformance-profiler.mjs","../../../../../../darwin-fastbuild-ST-70f2edae98f4/bin/packages/angular/ssr/src/common-engine.mjs"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\nimport Critters from 'critters';\nimport { readFile } from 'node:fs/promises';\n/**\n * Pattern used to extract the media query set by Critters in an `onload` handler.\n */\nconst MEDIA_SET_HANDLER_PATTERN = /^this\\.media=[\"'](.*)[\"'];?$/;\n/**\n * Name of the attribute used to save the Critters media query so it can be re-assigned on load.\n */\nconst CSP_MEDIA_ATTR = 'ngCspMedia';\n/**\n * Script text used to change the media value of the link tags.\n *\n * NOTE:\n * We do not use `document.querySelectorAll('link').forEach((s) => s.addEventListener('load', ...)`\n * because this does not always fire on Chome.\n * See: https://github.com/angular/angular-cli/issues/26932 and https://crbug.com/1521256\n */\nconst LINK_LOAD_SCRIPT_CONTENT = [\n '(() => {',\n ` const CSP_MEDIA_ATTR = '${CSP_MEDIA_ATTR}';`,\n ' const documentElement = document.documentElement;',\n ' const listener = (e) => {',\n ' const target = e.target;',\n ` if (!target || target.tagName !== 'LINK' || !target.hasAttribute(CSP_MEDIA_ATTR)) {`,\n ' return;',\n ' }',\n ' target.media = target.getAttribute(CSP_MEDIA_ATTR);',\n ' target.removeAttribute(CSP_MEDIA_ATTR);',\n // Remove onload listener when there are no longer styles that need to be loaded.\n ' if (!document.head.querySelector(`link[${CSP_MEDIA_ATTR}]`)) {',\n ` documentElement.removeEventListener('load', listener);`,\n ' }',\n ' };',\n // We use an event with capturing (the true parameter) because load events don't bubble.\n ` documentElement.addEventListener('load', listener, true);`,\n '})();',\n].join('\\n');\nclass CrittersExtended extends Critters {\n optionsExtended;\n resourceCache;\n warnings = [];\n errors = [];\n initialEmbedLinkedStylesheet;\n addedCspScriptsDocuments = new WeakSet();\n documentNonces = new WeakMap();\n constructor(optionsExtended, resourceCache) {\n super({\n logger: {\n warn: (s) => this.warnings.push(s),\n error: (s) => this.errors.push(s),\n info: () => { },\n },\n logLevel: 'warn',\n path: optionsExtended.outputPath,\n publicPath: optionsExtended.deployUrl,\n compress: !!optionsExtended.minify,\n pruneSource: false,\n reduceInlineStyles: false,\n mergeStylesheets: false,\n // Note: if `preload` changes to anything other than `media`, the logic in\n // `embedLinkedStylesheetOverride` will have to be updated.\n preload: 'media',\n noscriptFallback: true,\n inlineFonts: true,\n });\n this.optionsExtended = optionsExtended;\n this.resourceCache = resourceCache;\n // We can't use inheritance to override `embedLinkedStylesheet`, because it's not declared in\n // the `Critters` .d.ts which means that we can't call the `super` implementation. TS doesn't\n // allow for `super` to be cast to a different type.\n this.initialEmbedLinkedStylesheet = this.embedLinkedStylesheet;\n this.embedLinkedStylesheet = this.embedLinkedStylesheetOverride;\n }\n async readFile(path) {\n let resourceContent = this.resourceCache.get(path);\n if (resourceContent === undefined) {\n resourceContent = await readFile(path, 'utf-8');\n this.resourceCache.set(path, resourceContent);\n }\n return resourceContent;\n }\n /**\n * Override of the Critters `embedLinkedStylesheet` method\n * that makes it work with Angular's CSP APIs.\n */\n embedLinkedStylesheetOverride = async (link, document) => {\n if (link.getAttribute('media') === 'print' && link.next?.name === 'noscript') {\n // Workaround for https://github.com/GoogleChromeLabs/critters/issues/64\n // NB: this is only needed for the webpack based builders.\n const media = link.getAttribute('onload')?.match(MEDIA_SET_HANDLER_PATTERN);\n if (media) {\n link.removeAttribute('onload');\n link.setAttribute('media', media[1]);\n link?.next?.remove();\n }\n }\n const returnValue = await this.initialEmbedLinkedStylesheet(link, document);\n const cspNonce = this.findCspNonce(document);\n if (cspNonce) {\n const crittersMedia = link.getAttribute('onload')?.match(MEDIA_SET_HANDLER_PATTERN);\n if (crittersMedia) {\n // If there's a Critters-generated `onload` handler and the file has an Angular CSP nonce,\n // we have to remove the handler, because it's incompatible with CSP. We save the value\n // in a different attribute and we generate a script tag with the nonce that uses\n // `addEventListener` to apply the media query instead.\n link.removeAttribute('onload');\n link.setAttribute(CSP_MEDIA_ATTR, crittersMedia[1]);\n this.conditionallyInsertCspLoadingScript(document, cspNonce, link);\n }\n // Ideally we would hook in at the time Critters inserts the `style` tags, but there isn't\n // a way of doing that at the moment so we fall back to doing it any time a `link` tag is\n // inserted. We mitigate it by only iterating the direct children of the `<head>` which\n // should be pretty shallow.\n document.head.children.forEach((child) => {\n if (child.tagName === 'style' && !child.hasAttribute('nonce')) {\n child.setAttribute('nonce', cspNonce);\n }\n });\n }\n return returnValue;\n };\n /**\n * Finds the CSP nonce for a specific document.\n */\n findCspNonce(document) {\n if (this.documentNonces.has(document)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this.documentNonces.get(document);\n }\n // HTML attribute are case-insensitive, but the parser used by Critters is case-sensitive.\n const nonceElement = document.querySelector('[ngCspNonce], [ngcspnonce]');\n const cspNonce = nonceElement?.getAttribute('ngCspNonce') || nonceElement?.getAttribute('ngcspnonce') || null;\n this.documentNonces.set(document, cspNonce);\n return cspNonce;\n }\n /**\n * Inserts the `script` tag that swaps the critical CSS at runtime,\n * if one hasn't been inserted into the document already.\n */\n conditionallyInsertCspLoadingScript(document, nonce, link) {\n if (this.addedCspScriptsDocuments.has(document)) {\n return;\n }\n if (document.head.textContent.includes(LINK_LOAD_SCRIPT_CONTENT)) {\n // Script was already added during the build.\n this.addedCspScriptsDocuments.add(document);\n return;\n }\n const script = document.createElement('script');\n script.setAttribute('nonce', nonce);\n script.textContent = LINK_LOAD_SCRIPT_CONTENT;\n // Prepend the script to the head since it needs to\n // run as early as possible, before the `link` tags.\n document.head.insertBefore(script, link);\n this.addedCspScriptsDocuments.add(document);\n }\n}\nexport class InlineCriticalCssProcessor {\n options;\n resourceCache = new Map();\n constructor(options) {\n this.options = options;\n }\n async process(html, options) {\n const critters = new CrittersExtended({ ...this.options, ...options }, this.resourceCache);\n const content = await critters.process(html);\n return {\n content,\n errors: critters.errors.length ? critters.errors : undefined,\n warnings: critters.warnings.length ? critters.warnings : undefined,\n };\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\nconst PERFORMANCE_MARK_PREFIX = '🅰️';\nexport function printPerformanceLogs() {\n let maxWordLength = 0;\n const benchmarks = [];\n for (const { name, duration } of performance.getEntriesByType('measure')) {\n if (!name.startsWith(PERFORMANCE_MARK_PREFIX)) {\n continue;\n }\n // `🅰️:Retrieve SSG Page` -> `Retrieve SSG Page:`\n const step = name.slice(PERFORMANCE_MARK_PREFIX.length + 1) + ':';\n if (step.length > maxWordLength) {\n maxWordLength = step.length;\n }\n benchmarks.push([step, `${duration.toFixed(1)}ms`]);\n performance.clearMeasures(name);\n }\n /* eslint-disable no-console */\n console.log('********** Performance results **********');\n for (const [step, value] of benchmarks) {\n const spaces = maxWordLength - step.length + 5;\n console.log(step + ' '.repeat(spaces) + value);\n }\n console.log('*****************************************');\n /* eslint-enable no-console */\n}\nexport async function runMethodAndMeasurePerf(label, asyncMethod) {\n const labelName = `${PERFORMANCE_MARK_PREFIX}:${label}`;\n const startLabel = `start:${labelName}`;\n const endLabel = `end:${labelName}`;\n try {\n performance.mark(startLabel);\n return await asyncMethod();\n }\n finally {\n performance.mark(endLabel);\n performance.measure(labelName, startLabel, endLabel);\n performance.clearMarks(startLabel);\n performance.clearMarks(endLabel);\n }\n}\nexport function noopRunMethodAndMeasurePerf(label, asyncMethod) {\n return asyncMethod();\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\nimport { renderApplication, renderModule, ɵSERVER_CONTEXT } from '@angular/platform-server';\nimport * as fs from 'node:fs';\nimport { dirname, join, normalize, resolve } from 'node:path';\nimport { URL } from 'node:url';\nimport { InlineCriticalCssProcessor } from './inline-css-processor';\nimport { noopRunMethodAndMeasurePerf, printPerformanceLogs, runMethodAndMeasurePerf, } from './peformance-profiler';\nconst SSG_MARKER_REGEXP = /ng-server-context=[\"']\\w*\\|?ssg\\|?\\w*[\"']/;\n/**\n * A common engine to use to server render an application.\n */\nexport class CommonEngine {\n options;\n templateCache = new Map();\n inlineCriticalCssProcessor;\n pageIsSSG = new Map();\n constructor(options) {\n this.options = options;\n this.inlineCriticalCssProcessor = new InlineCriticalCssProcessor({\n minify: false,\n });\n }\n /**\n * Render an HTML document for a specific URL with specified\n * render options\n */\n async render(opts) {\n const enablePerformanceProfiler = this.options?.enablePerformanceProfiler;\n const runMethod = enablePerformanceProfiler\n ? runMethodAndMeasurePerf\n : noopRunMethodAndMeasurePerf;\n let html = await runMethod('Retrieve SSG Page', () => this.retrieveSSGPage(opts));\n if (html === undefined) {\n html = await runMethod('Render Page', () => this.renderApplication(opts));\n if (opts.inlineCriticalCss !== false) {\n const { content, errors, warnings } = await runMethod('Inline Critical CSS', () => \n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.inlineCriticalCss(html, opts));\n html = content;\n // eslint-disable-next-line no-console\n warnings?.forEach((m) => console.warn(m));\n // eslint-disable-next-line no-console\n errors?.forEach((m) => console.error(m));\n }\n }\n if (enablePerformanceProfiler) {\n printPerformanceLogs();\n }\n return html;\n }\n inlineCriticalCss(html, opts) {\n return this.inlineCriticalCssProcessor.process(html, {\n outputPath: opts.publicPath ?? (opts.documentFilePath ? dirname(opts.documentFilePath) : ''),\n });\n }\n async retrieveSSGPage(opts) {\n const { publicPath, documentFilePath, url } = opts;\n if (!publicPath || !documentFilePath || url === undefined) {\n return undefined;\n }\n const { pathname } = new URL(url, 'resolve://');\n // Do not use `resolve` here as otherwise it can lead to path traversal vulnerability.\n // See: https://portswigger.net/web-security/file-path-traversal\n const pagePath = join(publicPath, pathname, 'index.html');\n if (this.pageIsSSG.get(pagePath)) {\n // Serve pre-rendered page.\n return fs.promises.readFile(pagePath, 'utf-8');\n }\n if (!pagePath.startsWith(normalize(publicPath))) {\n // Potential path traversal detected.\n return undefined;\n }\n if (pagePath === resolve(documentFilePath) || !(await exists(pagePath))) {\n // View matches with prerender path or file does not exist.\n this.pageIsSSG.set(pagePath, false);\n return undefined;\n }\n // Static file exists.\n const content = await fs.promises.readFile(pagePath, 'utf-8');\n const isSSG = SSG_MARKER_REGEXP.test(content);\n this.pageIsSSG.set(pagePath, isSSG);\n return isSSG ? content : undefined;\n }\n async renderApplication(opts) {\n const moduleOrFactory = this.options?.bootstrap ?? opts.bootstrap;\n if (!moduleOrFactory) {\n throw new Error('A module or bootstrap option must be provided.');\n }\n const extraProviders = [\n { provide: ɵSERVER_CONTEXT, useValue: 'ssr' },\n ...(opts.providers ?? []),\n ...(this.options?.providers ?? []),\n ];\n let document = opts.document;\n if (!document && opts.documentFilePath) {\n document = await this.getDocument(opts.documentFilePath);\n }\n const commonRenderingOptions = {\n url: opts.url,\n document,\n };\n return isBootstrapFn(moduleOrFactory)\n ? renderApplication(moduleOrFactory, {\n platformProviders: extraProviders,\n ...commonRenderingOptions,\n })\n : renderModule(moduleOrFactory, { extraProviders, ...commonRenderingOptions });\n }\n /** Retrieve the document from the cache or the filesystem */\n async getDocument(filePath) {\n let doc = this.templateCache.get(filePath);\n if (!doc) {\n doc = await fs.promises.readFile(filePath, 'utf-8');\n this.templateCache.set(filePath, doc);\n }\n return doc;\n }\n}\nasync function exists(path) {\n try {\n await fs.promises.access(path, fs.constants.F_OK);\n return true;\n }\n catch {\n return false;\n }\n}\nfunction isBootstrapFn(value) {\n // We can differentiate between a module and a bootstrap function by reading compiler-generated `ɵmod` static property:\n return typeof value === 'function' && !('ɵmod' in value);\n}\n"],"names":["ɵSERVER_CONTEXT"],"mappings":";;;;;;;AASA;AACA;AACA;AACA,MAAM,yBAAyB,GAAG,8BAA8B,CAAC;AACjE;AACA;AACA;AACA,MAAM,cAAc,GAAG,YAAY,CAAC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,wBAAwB,GAAG;AACjC,IAAI,UAAU;AACd,IAAI,CAAC,0BAA0B,EAAE,cAAc,CAAC,EAAE,CAAC;AACnD,IAAI,qDAAqD;AACzD,IAAI,6BAA6B;AACjC,IAAI,8BAA8B;AAClC,IAAI,CAAC,uFAAuF,CAAC;AAC7F,IAAI,cAAc;AAClB,IAAI,OAAO;AACX,IAAI,yDAAyD;AAC7D,IAAI,6CAA6C;AACjD;AACA,IAAI,oEAAoE;AACxE,IAAI,CAAC,4DAA4D,CAAC;AAClE,IAAI,OAAO;AACX,IAAI,MAAM;AACV;AACA,IAAI,CAAC,2DAA2D,CAAC;AACjE,IAAI,OAAO;AACX,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACb,MAAM,gBAAgB,SAAS,QAAQ,CAAC;AACxC,IAAI,eAAe,CAAC;AACpB,IAAI,aAAa,CAAC;AAClB,IAAI,QAAQ,GAAG,EAA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70f2edae98f4/bin/packages/angular/ssr/src/common-engine/inline-css-processor.mjs","../../../../../../darwin-fastbuild-ST-70f2edae98f4/bin/packages/angular/ssr/src/common-engine/peformance-profiler.mjs","../../../../../../darwin-fastbuild-ST-70f2edae98f4/bin/packages/angular/ssr/src/common-engine/common-engine.mjs","../../../../../../darwin-fastbuild-ST-70f2edae98f4/bin/packages/angular/ssr/src/console.mjs","../../../../../../darwin-fastbuild-ST-70f2edae98f4/bin/packages/angular/ssr/src/utils/url.mjs","../../../../../../darwin-fastbuild-ST-70f2edae98f4/bin/packages/angular/ssr/src/utils/ng.mjs","../../../../../../darwin-fastbuild-ST-70f2edae98f4/bin/packages/angular/ssr/src/routes/ng-routes.mjs"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\nimport Critters from 'critters';\nimport { readFile } from 'node:fs/promises';\n/**\n * Pattern used to extract the media query set by Critters in an `onload` handler.\n */\nconst MEDIA_SET_HANDLER_PATTERN = /^this\\.media=[\"'](.*)[\"'];?$/;\n/**\n * Name of the attribute used to save the Critters media query so it can be re-assigned on load.\n */\nconst CSP_MEDIA_ATTR = 'ngCspMedia';\n/**\n * Script text used to change the media value of the link tags.\n *\n * NOTE:\n * We do not use `document.querySelectorAll('link').forEach((s) => s.addEventListener('load', ...)`\n * because this does not always fire on Chome.\n * See: https://github.com/angular/angular-cli/issues/26932 and https://crbug.com/1521256\n */\nconst LINK_LOAD_SCRIPT_CONTENT = [\n '(() => {',\n ` const CSP_MEDIA_ATTR = '${CSP_MEDIA_ATTR}';`,\n ' const documentElement = document.documentElement;',\n ' const listener = (e) => {',\n ' const target = e.target;',\n ` if (!target || target.tagName !== 'LINK' || !target.hasAttribute(CSP_MEDIA_ATTR)) {`,\n ' return;',\n ' }',\n ' target.media = target.getAttribute(CSP_MEDIA_ATTR);',\n ' target.removeAttribute(CSP_MEDIA_ATTR);',\n // Remove onload listener when there are no longer styles that need to be loaded.\n ' if (!document.head.querySelector(`link[${CSP_MEDIA_ATTR}]`)) {',\n ` documentElement.removeEventListener('load', listener);`,\n ' }',\n ' };',\n // We use an event with capturing (the true parameter) because load events don't bubble.\n ` documentElement.addEventListener('load', listener, true);`,\n '})();',\n].join('\\n');\nclass CrittersExtended extends Critters {\n optionsExtended;\n resourceCache;\n warnings = [];\n errors = [];\n initialEmbedLinkedStylesheet;\n addedCspScriptsDocuments = new WeakSet();\n documentNonces = new WeakMap();\n constructor(optionsExtended, resourceCache) {\n super({\n logger: {\n warn: (s) => this.warnings.push(s),\n error: (s) => this.errors.push(s),\n info: () => { },\n },\n logLevel: 'warn',\n path: optionsExtended.outputPath,\n publicPath: optionsExtended.deployUrl,\n compress: !!optionsExtended.minify,\n pruneSource: false,\n reduceInlineStyles: false,\n mergeStylesheets: false,\n // Note: if `preload` changes to anything other than `media`, the logic in\n // `embedLinkedStylesheetOverride` will have to be updated.\n preload: 'media',\n noscriptFallback: true,\n inlineFonts: true,\n });\n this.optionsExtended = optionsExtended;\n this.resourceCache = resourceCache;\n // We can't use inheritance to override `embedLinkedStylesheet`, because it's not declared in\n // the `Critters` .d.ts which means that we can't call the `super` implementation. TS doesn't\n // allow for `super` to be cast to a different type.\n this.initialEmbedLinkedStylesheet = this.embedLinkedStylesheet;\n this.embedLinkedStylesheet = this.embedLinkedStylesheetOverride;\n }\n async readFile(path) {\n let resourceContent = this.resourceCache.get(path);\n if (resourceContent === undefined) {\n resourceContent = await readFile(path, 'utf-8');\n this.resourceCache.set(path, resourceContent);\n }\n return resourceContent;\n }\n /**\n * Override of the Critters `embedLinkedStylesheet` method\n * that makes it work with Angular's CSP APIs.\n */\n embedLinkedStylesheetOverride = async (link, document) => {\n if (link.getAttribute('media') === 'print' && link.next?.name === 'noscript') {\n // Workaround for https://github.com/GoogleChromeLabs/critters/issues/64\n // NB: this is only needed for the webpack based builders.\n const media = link.getAttribute('onload')?.match(MEDIA_SET_HANDLER_PATTERN);\n if (media) {\n link.removeAttribute('onload');\n link.setAttribute('media', media[1]);\n link?.next?.remove();\n }\n }\n const returnValue = await this.initialEmbedLinkedStylesheet(link, document);\n const cspNonce = this.findCspNonce(document);\n if (cspNonce) {\n const crittersMedia = link.getAttribute('onload')?.match(MEDIA_SET_HANDLER_PATTERN);\n if (crittersMedia) {\n // If there's a Critters-generated `onload` handler and the file has an Angular CSP nonce,\n // we have to remove the handler, because it's incompatible with CSP. We save the value\n // in a different attribute and we generate a script tag with the nonce that uses\n // `addEventListener` to apply the media query instead.\n link.removeAttribute('onload');\n link.setAttribute(CSP_MEDIA_ATTR, crittersMedia[1]);\n this.conditionallyInsertCspLoadingScript(document, cspNonce, link);\n }\n // Ideally we would hook in at the time Critters inserts the `style` tags, but there isn't\n // a way of doing that at the moment so we fall back to doing it any time a `link` tag is\n // inserted. We mitigate it by only iterating the direct children of the `<head>` which\n // should be pretty shallow.\n document.head.children.forEach((child) => {\n if (child.tagName === 'style' && !child.hasAttribute('nonce')) {\n child.setAttribute('nonce', cspNonce);\n }\n });\n }\n return returnValue;\n };\n /**\n * Finds the CSP nonce for a specific document.\n */\n findCspNonce(document) {\n if (this.documentNonces.has(document)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this.documentNonces.get(document);\n }\n // HTML attribute are case-insensitive, but the parser used by Critters is case-sensitive.\n const nonceElement = document.querySelector('[ngCspNonce], [ngcspnonce]');\n const cspNonce = nonceElement?.getAttribute('ngCspNonce') || nonceElement?.getAttribute('ngcspnonce') || null;\n this.documentNonces.set(document, cspNonce);\n return cspNonce;\n }\n /**\n * Inserts the `script` tag that swaps the critical CSS at runtime,\n * if one hasn't been inserted into the document already.\n */\n conditionallyInsertCspLoadingScript(document, nonce, link) {\n if (this.addedCspScriptsDocuments.has(document)) {\n return;\n }\n if (document.head.textContent.includes(LINK_LOAD_SCRIPT_CONTENT)) {\n // Script was already added during the build.\n this.addedCspScriptsDocuments.add(document);\n return;\n }\n const script = document.createElement('script');\n script.setAttribute('nonce', nonce);\n script.textContent = LINK_LOAD_SCRIPT_CONTENT;\n // Prepend the script to the head since it needs to\n // run as early as possible, before the `link` tags.\n document.head.insertBefore(script, link);\n this.addedCspScriptsDocuments.add(document);\n }\n}\nexport class InlineCriticalCssProcessor {\n options;\n resourceCache = new Map();\n constructor(options) {\n this.options = options;\n }\n async process(html, options) {\n const critters = new CrittersExtended({ ...this.options, ...options }, this.resourceCache);\n const content = await critters.process(html);\n return {\n content,\n errors: critters.errors.length ? critters.errors : undefined,\n warnings: critters.warnings.length ? critters.warnings : undefined,\n };\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\nconst PERFORMANCE_MARK_PREFIX = '🅰️';\nexport function printPerformanceLogs() {\n let maxWordLength = 0;\n const benchmarks = [];\n for (const { name, duration } of performance.getEntriesByType('measure')) {\n if (!name.startsWith(PERFORMANCE_MARK_PREFIX)) {\n continue;\n }\n // `🅰️:Retrieve SSG Page` -> `Retrieve SSG Page:`\n const step = name.slice(PERFORMANCE_MARK_PREFIX.length + 1) + ':';\n if (step.length > maxWordLength) {\n maxWordLength = step.length;\n }\n benchmarks.push([step, `${duration.toFixed(1)}ms`]);\n performance.clearMeasures(name);\n }\n /* eslint-disable no-console */\n console.log('********** Performance results **********');\n for (const [step, value] of benchmarks) {\n const spaces = maxWordLength - step.length + 5;\n console.log(step + ' '.repeat(spaces) + value);\n }\n console.log('*****************************************');\n /* eslint-enable no-console */\n}\nexport async function runMethodAndMeasurePerf(label, asyncMethod) {\n const labelName = `${PERFORMANCE_MARK_PREFIX}:${label}`;\n const startLabel = `start:${labelName}`;\n const endLabel = `end:${labelName}`;\n try {\n performance.mark(startLabel);\n return await asyncMethod();\n }\n finally {\n performance.mark(endLabel);\n performance.measure(labelName, startLabel, endLabel);\n performance.clearMarks(startLabel);\n performance.clearMarks(endLabel);\n }\n}\nexport function noopRunMethodAndMeasurePerf(label, asyncMethod) {\n return asyncMethod();\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\nimport { renderApplication, renderModule, ɵSERVER_CONTEXT } from '@angular/platform-server';\nimport * as fs from 'node:fs';\nimport { dirname, join, normalize, resolve } from 'node:path';\nimport { URL } from 'node:url';\nimport { InlineCriticalCssProcessor } from './inline-css-processor';\nimport { noopRunMethodAndMeasurePerf, printPerformanceLogs, runMethodAndMeasurePerf, } from './peformance-profiler';\nconst SSG_MARKER_REGEXP = /ng-server-context=[\"']\\w*\\|?ssg\\|?\\w*[\"']/;\n/**\n * A common engine to use to server render an application.\n */\nexport class CommonEngine {\n options;\n templateCache = new Map();\n inlineCriticalCssProcessor;\n pageIsSSG = new Map();\n constructor(options) {\n this.options = options;\n this.inlineCriticalCssProcessor = new InlineCriticalCssProcessor({\n minify: false,\n });\n }\n /**\n * Render an HTML document for a specific URL with specified\n * render options\n */\n async render(opts) {\n const enablePerformanceProfiler = this.options?.enablePerformanceProfiler;\n const runMethod = enablePerformanceProfiler\n ? runMethodAndMeasurePerf\n : noopRunMethodAndMeasurePerf;\n let html = await runMethod('Retrieve SSG Page', () => this.retrieveSSGPage(opts));\n if (html === undefined) {\n html = await runMethod('Render Page', () => this.renderApplication(opts));\n if (opts.inlineCriticalCss !== false) {\n const { content, errors, warnings } = await runMethod('Inline Critical CSS', () => \n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.inlineCriticalCss(html, opts));\n html = content;\n // eslint-disable-next-line no-console\n warnings?.forEach((m) => console.warn(m));\n // eslint-disable-next-line no-console\n errors?.forEach((m) => console.error(m));\n }\n }\n if (enablePerformanceProfiler) {\n printPerformanceLogs();\n }\n return html;\n }\n inlineCriticalCss(html, opts) {\n return this.inlineCriticalCssProcessor.process(html, {\n outputPath: opts.publicPath ?? (opts.documentFilePath ? dirname(opts.documentFilePath) : ''),\n });\n }\n async retrieveSSGPage(opts) {\n const { publicPath, documentFilePath, url } = opts;\n if (!publicPath || !documentFilePath || url === undefined) {\n return undefined;\n }\n const { pathname } = new URL(url, 'resolve://');\n // Do not use `resolve` here as otherwise it can lead to path traversal vulnerability.\n // See: https://portswigger.net/web-security/file-path-traversal\n const pagePath = join(publicPath, pathname, 'index.html');\n if (this.pageIsSSG.get(pagePath)) {\n // Serve pre-rendered page.\n return fs.promises.readFile(pagePath, 'utf-8');\n }\n if (!pagePath.startsWith(normalize(publicPath))) {\n // Potential path traversal detected.\n return undefined;\n }\n if (pagePath === resolve(documentFilePath) || !(await exists(pagePath))) {\n // View matches with prerender path or file does not exist.\n this.pageIsSSG.set(pagePath, false);\n return undefined;\n }\n // Static file exists.\n const content = await fs.promises.readFile(pagePath, 'utf-8');\n const isSSG = SSG_MARKER_REGEXP.test(content);\n this.pageIsSSG.set(pagePath, isSSG);\n return isSSG ? content : undefined;\n }\n async renderApplication(opts) {\n const moduleOrFactory = this.options?.bootstrap ?? opts.bootstrap;\n if (!moduleOrFactory) {\n throw new Error('A module or bootstrap option must be provided.');\n }\n const extraProviders = [\n { provide: ɵSERVER_CONTEXT, useValue: 'ssr' },\n ...(opts.providers ?? []),\n ...(this.options?.providers ?? []),\n ];\n let document = opts.document;\n if (!document && opts.documentFilePath) {\n document = await this.getDocument(opts.documentFilePath);\n }\n const commonRenderingOptions = {\n url: opts.url,\n document,\n };\n return isBootstrapFn(moduleOrFactory)\n ? renderApplication(moduleOrFactory, {\n platformProviders: extraProviders,\n ...commonRenderingOptions,\n })\n : renderModule(moduleOrFactory, { extraProviders, ...commonRenderingOptions });\n }\n /** Retrieve the document from the cache or the filesystem */\n async getDocument(filePath) {\n let doc = this.templateCache.get(filePath);\n if (!doc) {\n doc = await fs.promises.readFile(filePath, 'utf-8');\n this.templateCache.set(filePath, doc);\n }\n return doc;\n }\n}\nasync function exists(path) {\n try {\n await fs.promises.access(path, fs.constants.F_OK);\n return true;\n }\n catch {\n return false;\n }\n}\nfunction isBootstrapFn(value) {\n // We can differentiate between a module and a bootstrap function by reading compiler-generated `ɵmod` static property:\n return typeof value === 'function' && !('ɵmod' in value);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\nimport { ɵConsole } from '@angular/core';\n/**\n * Custom implementation of the Angular Console service that filters out specific log messages.\n *\n * This class extends the internal Angular `ɵConsole` class to provide customized logging behavior.\n * It overrides the `log` method to suppress logs that match certain predefined messages.\n */\nexport class Console extends ɵConsole {\n /**\n * A set of log messages that should be ignored and not printed to the console.\n */\n ignoredLogs = new Set(['Angular is running in development mode.']);\n /**\n * Logs a message to the console if it is not in the set of ignored messages.\n *\n * @param message - The message to log to the console.\n *\n * This method overrides the `log` method of the `ɵConsole` class. It checks if the\n * message is in the `ignoredLogs` set. If it is not, it delegates the logging to\n * the parent class's `log` method. Otherwise, the message is suppressed.\n */\n log(message) {\n if (!this.ignoredLogs.has(message)) {\n super.log(message);\n }\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n/**\n * Removes the trailing slash from a URL if it exists.\n *\n * @param url - The URL string from which to remove the trailing slash.\n * @returns The URL string without a trailing slash.\n *\n * @example\n * ```js\n * stripTrailingSlash('path/'); // 'path'\n * stripTrailingSlash('/path'); // '/path'\n * ```\n */\nexport function stripTrailingSlash(url) {\n // Check if the last character of the URL is a slash\n return url[url.length - 1] === '/' ? url.slice(0, -1) : url;\n}\n/**\n * Joins URL parts into a single URL string.\n *\n * This function takes multiple URL segments, normalizes them by removing leading\n * and trailing slashes where appropriate, and then joins them into a single URL.\n *\n * @param parts - The parts of the URL to join. Each part can be a string with or without slashes.\n * @returns The joined URL string, with normalized slashes.\n *\n * @example\n * ```js\n * joinUrlParts('path/', '/to/resource'); // '/path/to/resource'\n * joinUrlParts('/path/', 'to/resource'); // '/path/to/resource'\n * ```\n */\nexport function joinUrlParts(...parts) {\n // Initialize an array with an empty string to always add a leading slash\n const normalizeParts = [''];\n for (const part of parts) {\n if (part === '') {\n // Skip any empty parts\n continue;\n }\n let normalizedPart = part;\n if (part[0] === '/') {\n normalizedPart = normalizedPart.slice(1);\n }\n if (part[part.length - 1] === '/') {\n normalizedPart = normalizedPart.slice(0, -1);\n }\n if (normalizedPart !== '') {\n normalizeParts.push(normalizedPart);\n }\n }\n return normalizeParts.join('/');\n}\n/**\n * Strips `/index.html` from the end of a URL's path, if present.\n *\n * This function is used to convert URLs pointing to an `index.html` file into their directory\n * equivalents. For example, it transforms a URL like `http://www.example.com/page/index.html`\n * into `http://www.example.com/page`.\n *\n * @param url - The URL object to process.\n * @returns A new URL object with `/index.html` removed from the path, if it was present.\n *\n * @example\n * ```typescript\n * const originalUrl = new URL('http://www.example.com/page/index.html');\n * const cleanedUrl = stripIndexHtmlFromURL(originalUrl);\n * console.log(cleanedUrl.href); // Output: 'http://www.example.com/page'\n * ```\n */\nexport function stripIndexHtmlFromURL(url) {\n if (url.pathname.endsWith('/index.html')) {\n const modifiedURL = new URL(url);\n // Remove '/index.html' from the pathname\n modifiedURL.pathname = modifiedURL.pathname.slice(0, /** '/index.html'.length */ -11);\n return modifiedURL;\n }\n return url;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\nimport { renderApplication, renderModule } from '@angular/platform-server';\nimport { stripIndexHtmlFromURL } from './url';\n/**\n * Renders an Angular application or module to an HTML string.\n *\n * This function determines whether the provided `bootstrap` value is an Angular module\n * or a bootstrap function and calls the appropriate rendering method (`renderModule` or\n * `renderApplication`) based on that determination.\n *\n * @param html - The HTML string to be used as the initial document content.\n * @param bootstrap - Either an Angular module type or a function that returns a promise\n * resolving to an `ApplicationRef`.\n * @param url - The URL of the application. This is used for server-side rendering to\n * correctly handle route-based rendering.\n * @param platformProviders - An array of platform providers to be used during the\n * rendering process.\n * @returns A promise that resolves to a string containing the rendered HTML.\n */\nexport function renderAngular(html, bootstrap, url, platformProviders) {\n // A request to `http://www.example.com/page/index.html` will render the Angular route corresponding to `http://www.example.com/page`.\n const urlToRender = stripIndexHtmlFromURL(url).toString();\n return isNgModule(bootstrap)\n ? renderModule(bootstrap, {\n url: urlToRender,\n document: html,\n extraProviders: platformProviders,\n })\n : renderApplication(bootstrap, {\n url: urlToRender,\n document: html,\n platformProviders,\n });\n}\n/**\n * Type guard to determine if a given value is an Angular module.\n * Angular modules are identified by the presence of the `ɵmod` static property.\n * This function helps distinguish between Angular modules and bootstrap functions.\n *\n * @param value - The value to be checked.\n * @returns True if the value is an Angular module (i.e., it has the `ɵmod` property), false otherwise.\n */\nexport function isNgModule(value) {\n return 'ɵmod' in value;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\nimport { APP_BASE_HREF, PlatformLocation } from '@angular/common';\nimport { ApplicationRef, Compiler, createPlatformFactory, platformCore, ɵwhenStable as whenStable, ɵConsole, ɵresetCompiledComponents, } from '@angular/core';\nimport { INITIAL_CONFIG, ɵINTERNAL_SERVER_PLATFORM_PROVIDERS as INTERNAL_SERVER_PLATFORM_PROVIDERS, } from '@angular/platform-server';\nimport { Router, ɵloadChildren as loadChildrenHelper } from '@angular/router';\nimport { Console } from '../console';\nimport { isNgModule } from '../utils/ng';\nimport { joinUrlParts } from '../utils/url';\n/**\n * Recursively traverses the Angular router configuration to retrieve routes.\n *\n * Iterates through the router configuration, yielding each route along with its potential\n * redirection or error status. Handles nested routes and lazy-loaded child routes.\n *\n * @param options - An object containing the parameters for traversing routes.\n * @returns An async iterator yielding `RouteResult` objects.\n */\nasync function* traverseRoutesConfig(options) {\n const { routes, compiler, parentInjector, parentRoute } = options;\n for (const route of routes) {\n const { path = '', redirectTo, loadChildren, children } = route;\n const currentRoutePath = joinUrlParts(parentRoute, path);\n yield {\n route: currentRoutePath,\n redirectTo: typeof redirectTo === 'string'\n ? resolveRedirectTo(currentRoutePath, redirectTo)\n : undefined,\n };\n if (children?.length) {\n // Recursively process child routes.\n yield* traverseRoutesConfig({\n routes: children,\n compiler,\n parentInjector,\n parentRoute: currentRoutePath,\n });\n }\n if (loadChildren) {\n // Load and process lazy-loaded child routes.\n const loadedChildRoutes = await loadChildrenHelper(route, compiler, parentInjector).toPromise();\n if (loadedChildRoutes) {\n const { routes: childRoutes, injector = parentInjector } = loadedChildRoutes;\n yield* traverseRoutesConfig({\n routes: childRoutes,\n compiler,\n parentInjector: injector,\n parentRoute: currentRoutePath,\n });\n }\n }\n }\n}\n/**\n * Resolves the `redirectTo` property for a given route.\n *\n * This function processes the `redirectTo` property to ensure that it correctly\n * resolves relative to the current route path. If `redirectTo` is an absolute path,\n * it is returned as is. If it is a relative path, it is resolved based on the current route path.\n *\n * @param routePath - The current route path.\n * @param redirectTo - The target path for redirection.\n * @returns The resolved redirect path as a string.\n */\nfunction resolveRedirectTo(routePath, redirectTo) {\n if (redirectTo[0] === '/') {\n // If the redirectTo path is absolute, return it as is.\n return redirectTo;\n }\n // Resolve relative redirectTo based on the current route path.\n const segments = routePath.split('/');\n segments.pop(); // Remove the last segment to make it relative.\n return joinUrlParts(...segments, redirectTo);\n}\n/**\n * Retrieves routes from the given Angular application.\n *\n * This function initializes an Angular platform, bootstraps the application or module,\n * and retrieves routes from the Angular router configuration. It handles both module-based\n * and function-based bootstrapping. It yields the resulting routes as `RouteResult` objects.\n *\n * @param bootstrap - A function that returns a promise resolving to an `ApplicationRef` or an Angular module to bootstrap.\n * @param document - The initial HTML document used for server-side rendering.\n * This document is necessary to render the application on the server.\n * @param url - The URL for server-side rendering. The URL is used to configure `ServerPlatformLocation`. This configuration is crucial\n * for ensuring that API requests for relative paths succeed, which is essential for accurate route extraction.\n * See:\n * - https://github.com/angular/angular/blob/d608b857c689d17a7ffa33bbb510301014d24a17/packages/platform-server/src/location.ts#L51\n * - https://github.com/angular/angular/blob/6882cc7d9eed26d3caeedca027452367ba25f2b9/packages/platform-server/src/http.ts#L44\n * @returns A promise that resolves to an object of type `AngularRouterConfigResult`.\n */\nexport async function getRoutesFromAngularRouterConfig(bootstrap, document, url) {\n // Need to clean up GENERATED_COMP_IDS map in `@angular/core`.\n // Otherwise an incorrect component ID generation collision detected warning will be displayed in development.\n // See: https://github.com/angular/angular-cli/issues/25924\n ɵresetCompiledComponents();\n const { protocol, host } = url;\n // Create and initialize the Angular platform for server-side rendering.\n const platformRef = createPlatformFactory(platformCore, 'server', [\n {\n provide: INITIAL_CONFIG,\n useValue: { document, url: `${protocol}//${host}/` },\n },\n {\n provide: ɵConsole,\n useFactory: () => new Console(),\n },\n ...INTERNAL_SERVER_PLATFORM_PROVIDERS,\n ])();\n try {\n let applicationRef;\n if (isNgModule(bootstrap)) {\n const moduleRef = await platformRef.bootstrapModule(bootstrap);\n applicationRef = moduleRef.injector.get(ApplicationRef);\n }\n else {\n applicationRef = await bootstrap();\n }\n // Wait until the application is stable.\n await whenStable(applicationRef);\n const injector = applicationRef.injector;\n const router = injector.get(Router);\n const routesResults = [];\n if (router.config.length) {\n const compiler = injector.get(Compiler);\n // Retrieve all routes from the Angular router configuration.\n const traverseRoutes = traverseRoutesConfig({\n routes: router.config,\n compiler,\n parentInjector: injector,\n parentRoute: '',\n });\n for await (const result of traverseRoutes) {\n routesResults.push(result);\n }\n }\n else {\n routesResults.push({ route: '' });\n }\n const baseHref = injector.get(APP_BASE_HREF, null, { optional: true }) ??\n injector.get(PlatformLocation).getBaseHrefFromDOM();\n return {\n baseHref,\n routes: routesResults,\n };\n }\n finally {\n platformRef.destroy();\n }\n}\n"],"names":["URL","ɵSERVER_CONTEXT","ɵConsole","loadChildrenHelper","ɵresetCompiledComponents","INTERNAL_SERVER_PLATFORM_PROVIDERS","whenStable"],"mappings":";;;;;;;;;;AASA;AACA;AACA;AACA,M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|
3
3
|
import { Type } from '@angular/core';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Represents the bootstrap mechanism for an Angular application.
|
|
7
|
+
*
|
|
8
|
+
* This type can either be:
|
|
9
|
+
* - A reference to an Angular component or module (`Type<unknown>`) that serves as the root of the application.
|
|
10
|
+
* - A function that returns a `Promise<ApplicationRef>`, which resolves with the root application reference.
|
|
11
|
+
*/
|
|
12
|
+
declare type AngularBootstrap = Type<unknown> | (() => Promise<ApplicationRef>);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Result of extracting routes from an Angular application.
|
|
16
|
+
*/
|
|
17
|
+
declare interface AngularRouterConfigResult {
|
|
18
|
+
/**
|
|
19
|
+
* The base URL for the application.
|
|
20
|
+
* This is the base href that is used for resolving relative paths within the application.
|
|
21
|
+
*/
|
|
22
|
+
baseHref: string;
|
|
23
|
+
/**
|
|
24
|
+
* An array of `RouteResult` objects representing the application's routes.
|
|
25
|
+
*
|
|
26
|
+
* Each `RouteResult` contains details about a specific route, such as its path and any
|
|
27
|
+
* associated redirection targets. This array is asynchronously generated and
|
|
28
|
+
* provides information on how routes are structured and resolved.
|
|
29
|
+
*
|
|
30
|
+
* Example:
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const result: AngularRouterConfigResult = {
|
|
33
|
+
* baseHref: '/app/',
|
|
34
|
+
* routes: [
|
|
35
|
+
* { route: '/home', redirectTo: '/welcome' },
|
|
36
|
+
* { route: '/about' },
|
|
37
|
+
* ],
|
|
38
|
+
* };
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
routes: RouteResult[];
|
|
42
|
+
}
|
|
43
|
+
|
|
5
44
|
/**
|
|
6
45
|
* A common engine to use to server render an application.
|
|
7
46
|
*/
|
|
@@ -52,4 +91,43 @@ export declare interface CommonEngineRenderOptions {
|
|
|
52
91
|
publicPath?: string;
|
|
53
92
|
}
|
|
54
93
|
|
|
94
|
+
/**
|
|
95
|
+
* Represents the result of processing a route.
|
|
96
|
+
*/
|
|
97
|
+
declare interface RouteResult {
|
|
98
|
+
/**
|
|
99
|
+
* The resolved path of the route.
|
|
100
|
+
*
|
|
101
|
+
* This string represents the complete URL path for the route after it has been
|
|
102
|
+
* resolved, including any parent routes or path segments that have been joined.
|
|
103
|
+
*/
|
|
104
|
+
route: string;
|
|
105
|
+
/**
|
|
106
|
+
* The target path for route redirection, if applicable.
|
|
107
|
+
*
|
|
108
|
+
* If this route has a `redirectTo` property in the configuration, this field will
|
|
109
|
+
* contain the full resolved URL path that the route should redirect to.
|
|
110
|
+
*/
|
|
111
|
+
redirectTo?: string;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Retrieves routes from the given Angular application.
|
|
116
|
+
*
|
|
117
|
+
* This function initializes an Angular platform, bootstraps the application or module,
|
|
118
|
+
* and retrieves routes from the Angular router configuration. It handles both module-based
|
|
119
|
+
* and function-based bootstrapping. It yields the resulting routes as `RouteResult` objects.
|
|
120
|
+
*
|
|
121
|
+
* @param bootstrap - A function that returns a promise resolving to an `ApplicationRef` or an Angular module to bootstrap.
|
|
122
|
+
* @param document - The initial HTML document used for server-side rendering.
|
|
123
|
+
* This document is necessary to render the application on the server.
|
|
124
|
+
* @param url - The URL for server-side rendering. The URL is used to configure `ServerPlatformLocation`. This configuration is crucial
|
|
125
|
+
* for ensuring that API requests for relative paths succeed, which is essential for accurate route extraction.
|
|
126
|
+
* See:
|
|
127
|
+
* - https://github.com/angular/angular/blob/d608b857c689d17a7ffa33bbb510301014d24a17/packages/platform-server/src/location.ts#L51
|
|
128
|
+
* - https://github.com/angular/angular/blob/6882cc7d9eed26d3caeedca027452367ba25f2b9/packages/platform-server/src/http.ts#L44
|
|
129
|
+
* @returns A promise that resolves to an object of type `AngularRouterConfigResult`.
|
|
130
|
+
*/
|
|
131
|
+
export declare function ɵgetRoutesFromAngularRouterConfig(bootstrap: AngularBootstrap, document: string, url: URL): Promise<AngularRouterConfigResult>;
|
|
132
|
+
|
|
55
133
|
export { }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/ssr",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "19.0.0-next.0",
|
|
4
4
|
"description": "Angular server side rendering utilities",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/angular/angular-cli",
|
|
@@ -17,8 +17,18 @@
|
|
|
17
17
|
"tslib": "^2.3.0"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"@angular/common": "^
|
|
21
|
-
"@angular/core": "^
|
|
20
|
+
"@angular/common": "^19.0.0-next.0",
|
|
21
|
+
"@angular/core": "^19.0.0-next.0",
|
|
22
|
+
"@angular/router": "^19.0.0-next.0"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@angular/common": "19.0.0-next.0",
|
|
26
|
+
"@angular/compiler": "19.0.0-next.0",
|
|
27
|
+
"@angular/core": "19.0.0-next.0",
|
|
28
|
+
"@angular/platform-browser": "19.0.0-next.0",
|
|
29
|
+
"@angular/platform-server": "19.0.0-next.0",
|
|
30
|
+
"@angular/router": "19.0.0-next.0",
|
|
31
|
+
"zone.js": "^0.14.0"
|
|
22
32
|
},
|
|
23
33
|
"schematics": "./schematics/collection.json",
|
|
24
34
|
"repository": {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|