@angular/ssr 22.2.0-next.6 → 22.2.0-next.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/ssr",
3
- "version": "22.2.0-next.6",
3
+ "version": "22.2.0-next.7",
4
4
  "description": "Angular server side rendering utilities",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -22,6 +22,7 @@
22
22
  "save": "dependencies"
23
23
  },
24
24
  "dependencies": {
25
+ "beasties": "0.5.4",
25
26
  "tslib": "^2.3.0"
26
27
  },
27
28
  "peerDependencies": {
@@ -37,14 +38,13 @@
37
38
  },
38
39
  "devDependencies": {
39
40
  "@angular-devkit/schematics": "workspace:*",
40
- "@angular/common": "22.2.0-next.4",
41
- "@angular/compiler": "22.2.0-next.4",
42
- "@angular/core": "22.2.0-next.4",
43
- "@angular/platform-browser": "22.2.0-next.4",
44
- "@angular/platform-server": "22.2.0-next.4",
45
- "@angular/router": "22.2.0-next.4",
46
- "@schematics/angular": "workspace:*",
47
- "beasties": "0.4.3"
41
+ "@angular/common": "22.2.0-next.5",
42
+ "@angular/compiler": "22.2.0-next.5",
43
+ "@angular/core": "22.2.0-next.5",
44
+ "@angular/platform-browser": "22.2.0-next.5",
45
+ "@angular/platform-server": "22.2.0-next.5",
46
+ "@angular/router": "22.2.0-next.5",
47
+ "@schematics/angular": "workspace:*"
48
48
  },
49
49
  "sideEffects": false,
50
50
  "schematics": "./schematics/collection.json",
package/types/ssr.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { Provider, EnvironmentProviders, Type, ApplicationRef, InjectionToken } from '@angular/core';
2
+ import { CompactPlan } from 'beasties/runtime';
2
3
  import { DefaultExport } from '@angular/router';
3
4
  import { BootstrapContext } from '@angular/platform-browser';
4
5
  import { Hooks } from './_app-engine-chunk.js';
5
6
  export { AngularAppEngine, AngularAppEngineOptions } from './_app-engine-chunk.js';
6
- import Beasties from '../third_party/beasties';
7
7
 
8
8
  /**
9
9
  * Identifies a particular kind of `ServerRenderingFeatureKind`.
@@ -577,10 +577,13 @@ interface AngularAppManifest {
577
577
  */
578
578
  readonly bootstrap: () => Promise<AngularBootstrap>;
579
579
  /**
580
- * Indicates whether critical CSS should be inlined into the HTML.
581
- * If set to `true`, critical CSS will be inlined for faster page rendering.
580
+ * Pre-compiled critical CSS plans generated at build time.
582
581
  */
583
- readonly inlineCriticalCss?: boolean;
582
+ readonly criticalCssPlans?: readonly CompactPlan[];
583
+ /**
584
+ * Content Security Policy (CSP) nonce to be used for inlined critical CSS.
585
+ */
586
+ readonly nonce?: string;
584
587
  /**
585
588
  * The route tree representation for the routing configuration of the application.
586
589
  * This represents the routing information of the application, mapping route paths to their corresponding metadata.
@@ -779,22 +782,15 @@ declare class AngularServerApp {
779
782
  /**
780
783
  * The `inlineCriticalCssProcessor` is responsible for handling critical CSS inlining.
781
784
  */
782
- private inlineCriticalCssProcessor;
785
+ private inlineCriticalCssProcessor?;
783
786
  /**
784
787
  * The bootstrap mechanism for the server application.
785
788
  */
786
789
  private boostrap;
787
790
  /**
788
- * Decorder used to convert a string to a Uint8Array.
789
- */
790
- private readonly textDecoder;
791
- /**
792
- * A cache that stores critical CSS to avoid re-processing for every request, improving performance.
793
- * This cache uses a Least Recently Used (LRU) eviction policy.
794
- *
795
- * @see {@link MAX_INLINE_CSS_CACHE_ENTRIES} for the maximum number of entries this cache can hold.
791
+ * Encoder used to convert a string to a Uint8Array.
796
792
  */
797
- private readonly criticalCssLRUCache;
793
+ private readonly textEncoder;
798
794
  /**
799
795
  * Handles an incoming HTTP request by serving prerendered content, performing server-side rendering,
800
796
  * or delivering a static file for client-side rendered routes based on the `RenderMode` setting.
@@ -832,19 +828,9 @@ declare class AngularServerApp {
832
828
  * Inlines critical CSS into the given HTML content.
833
829
  *
834
830
  * @param html The HTML content to process.
835
- * @param url The URL associated with the request, for logging purposes.
836
- * @returns A promise that resolves to the HTML with inlined critical CSS.
831
+ * @returns The HTML with inlined critical CSS.
837
832
  */
838
833
  private inlineCriticalCss;
839
- /**
840
- * Inlines critical CSS into the given HTML content.
841
- * This method uses a cache to avoid reprocessing the same HTML content multiple times.
842
- *
843
- * @param html The HTML content to process.
844
- * @param url The URL associated with the request, for logging purposes.
845
- * @returns A promise that resolves to the HTML with inlined critical CSS.
846
- */
847
- private inlineCriticalCssWithCache;
848
834
  /**
849
835
  * Constructs the asset path on the server based on the provided HTTP request.
850
836
  *
@@ -885,55 +871,6 @@ declare function getOrCreateAngularServerApp(options?: Readonly<AngularServerApp
885
871
  */
886
872
  declare function destroyAngularServerApp(): void;
887
873
 
888
- /** Partial representation of an `HTMLElement`. */
889
- interface PartialHTMLElement {
890
- getAttribute(name: string): string | null;
891
- setAttribute(name: string, value: string): void;
892
- hasAttribute(name: string): boolean;
893
- removeAttribute(name: string): void;
894
- appendChild(child: PartialHTMLElement): void;
895
- insertBefore(newNode: PartialHTMLElement, referenceNode?: PartialHTMLElement): void;
896
- remove(): void;
897
- name: string;
898
- textContent: string;
899
- tagName: string | null;
900
- children: PartialHTMLElement[];
901
- next: PartialHTMLElement | null;
902
- prev: PartialHTMLElement | null;
903
- }
904
- /** Partial representation of an HTML `Document`. */
905
- interface PartialDocument {
906
- head: PartialHTMLElement;
907
- createElement(tagName: string): PartialHTMLElement;
908
- querySelector(selector: string): PartialHTMLElement | null;
909
- }
910
- interface BeastiesBase {
911
- embedLinkedStylesheet(link: PartialHTMLElement, document: PartialDocument): Promise<unknown>;
912
- }
913
- declare class BeastiesBase extends Beasties {
914
- }
915
- declare class InlineCriticalCssProcessor extends BeastiesBase {
916
- readFile: (path: string) => Promise<string>;
917
- readonly outputPath?: string | undefined;
918
- private addedCspScriptsDocuments;
919
- private documentNonces;
920
- constructor(readFile: (path: string) => Promise<string>, outputPath?: string | undefined);
921
- /**
922
- * Override of the Beasties `embedLinkedStylesheet` method
923
- * that makes it work with Angular's CSP APIs.
924
- */
925
- embedLinkedStylesheet(link: PartialHTMLElement, document: PartialDocument): Promise<unknown>;
926
- /**
927
- * Finds the CSP nonce for a specific document.
928
- */
929
- private findCspNonce;
930
- /**
931
- * Inserts the `script` tag that swaps the critical CSS at runtime,
932
- * if one hasn't been inserted into the document already.
933
- */
934
- private conditionallyInsertCspLoadingScript;
935
- }
936
-
937
874
  /**
938
875
  * Function for handling HTTP requests in a web environment.
939
876
  *
@@ -966,5 +903,5 @@ type RequestHandlerFunction = (request: Request) => Promise<Response | null> | n
966
903
  */
967
904
  declare function createRequestHandler(handler: RequestHandlerFunction): RequestHandlerFunction;
968
905
 
969
- export { IS_DISCOVERING_ROUTES, PrerenderFallback, RenderMode, createRequestHandler, provideServerRendering, withAppShell, withRoutes, InlineCriticalCssProcessor as ɵInlineCriticalCssProcessor, destroyAngularServerApp as ɵdestroyAngularServerApp, extractRoutesAndCreateRouteTree as ɵextractRoutesAndCreateRouteTree, getOrCreateAngularServerApp as ɵgetOrCreateAngularServerApp, getRoutesFromAngularRouterConfig as ɵgetRoutesFromAngularRouterConfig, setAngularAppEngineManifest as ɵsetAngularAppEngineManifest, setAngularAppManifest as ɵsetAngularAppManifest };
906
+ export { IS_DISCOVERING_ROUTES, PrerenderFallback, RenderMode, createRequestHandler, provideServerRendering, withAppShell, withRoutes, destroyAngularServerApp as ɵdestroyAngularServerApp, extractRoutesAndCreateRouteTree as ɵextractRoutesAndCreateRouteTree, getOrCreateAngularServerApp as ɵgetOrCreateAngularServerApp, getRoutesFromAngularRouterConfig as ɵgetRoutesFromAngularRouterConfig, setAngularAppEngineManifest as ɵsetAngularAppEngineManifest, setAngularAppManifest as ɵsetAngularAppManifest };
970
907
  export type { RequestHandlerFunction, ServerRenderingOptions, ServerRoute, ServerRouteClient, ServerRouteCommon, ServerRoutePrerender, ServerRoutePrerenderWithParams, ServerRouteServer };