@angular/ssr 19.1.4 → 19.1.5
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/node.mjs +4 -1
- package/fesm2022/node.mjs.map +1 -1
- package/fesm2022/ssr.mjs +142 -64
- package/fesm2022/ssr.mjs.map +1 -1
- package/index.d.ts +69 -39
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { ApplicationRef } from '@angular/core';
|
|
2
2
|
import { default as default_2 } from 'beasties';
|
|
3
|
+
import { DefaultExport } from '@angular/router';
|
|
3
4
|
import { EnvironmentProviders } from '@angular/core';
|
|
4
|
-
import
|
|
5
|
+
import { Provider } from '@angular/core';
|
|
6
|
+
import { Type } from '@angular/core';
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* Angular server application engine.
|
|
@@ -533,13 +535,31 @@ export declare enum PrerenderFallback {
|
|
|
533
535
|
*
|
|
534
536
|
* @see {@link ServerRoute}
|
|
535
537
|
* @see {@link ServerRoutesConfigOptions}
|
|
538
|
+
* @see {@link provideServerRouting}
|
|
539
|
+
* @deprecated use `provideServerRouting`. This will be removed in version 20.
|
|
536
540
|
* @developerPreview
|
|
537
541
|
*/
|
|
538
542
|
export declare function provideServerRoutesConfig(routes: ServerRoute[], options?: ServerRoutesConfigOptions): EnvironmentProviders;
|
|
539
543
|
|
|
544
|
+
/**
|
|
545
|
+
* Sets up the necessary providers for configuring server routes.
|
|
546
|
+
* This function accepts an array of server routes and optional configuration
|
|
547
|
+
* options, returning an `EnvironmentProviders` object that encapsulates
|
|
548
|
+
* the server routes and configuration settings.
|
|
549
|
+
*
|
|
550
|
+
* @param routes - An array of server routes to be provided.
|
|
551
|
+
* @param features - (Optional) server routes features.
|
|
552
|
+
* @returns An `EnvironmentProviders` instance with the server routes configuration.
|
|
553
|
+
*
|
|
554
|
+
* @see {@link ServerRoute}
|
|
555
|
+
* @see {@link withAppShell}
|
|
556
|
+
* @developerPreview
|
|
557
|
+
*/
|
|
558
|
+
export declare function provideServerRouting(routes: ServerRoute[], ...features: ServerRoutesFeature<ServerRoutesFeatureKind>[]): EnvironmentProviders;
|
|
559
|
+
|
|
540
560
|
/**
|
|
541
561
|
* Different rendering modes for server routes.
|
|
542
|
-
* @see {@link
|
|
562
|
+
* @see {@link provideServerRouting}
|
|
543
563
|
* @see {@link ServerRoute}
|
|
544
564
|
* @developerPreview
|
|
545
565
|
*/
|
|
@@ -576,12 +596,6 @@ declare class RouteTree<AdditionalMetadata extends Record<string, unknown> = {}>
|
|
|
576
596
|
* All routes are stored and accessed relative to this root node.
|
|
577
597
|
*/
|
|
578
598
|
private readonly root;
|
|
579
|
-
/**
|
|
580
|
-
* A counter that tracks the order of route insertion.
|
|
581
|
-
* This ensures that routes are matched in the order they were defined,
|
|
582
|
-
* with earlier routes taking precedence.
|
|
583
|
-
*/
|
|
584
|
-
private insertionIndexCounter;
|
|
585
599
|
/**
|
|
586
600
|
* Inserts a new route into the route tree.
|
|
587
601
|
* The route is broken down into segments, and each segment is added to the tree.
|
|
@@ -641,26 +655,18 @@ declare class RouteTree<AdditionalMetadata extends Record<string, unknown> = {}>
|
|
|
641
655
|
* This function prioritizes exact segment matches first, followed by wildcard matches (`*`),
|
|
642
656
|
* and finally deep wildcard matches (`**`) that consume all segments.
|
|
643
657
|
*
|
|
644
|
-
* @param
|
|
645
|
-
* @param node - The current node in the route tree to start traversal from.
|
|
658
|
+
* @param segments - The array of route path segments to match against the route tree.
|
|
659
|
+
* @param node - The current node in the route tree to start traversal from. Defaults to the root node.
|
|
660
|
+
* @param currentIndex - The index of the segment in `remainingSegments` currently being matched.
|
|
661
|
+
* Defaults to `0` (the first segment).
|
|
646
662
|
*
|
|
647
663
|
* @returns The node that best matches the remaining segments or `undefined` if no match is found.
|
|
648
664
|
*/
|
|
649
665
|
private traverseBySegments;
|
|
650
666
|
/**
|
|
651
|
-
*
|
|
652
|
-
* A node with a lower insertion index is prioritized as it was defined earlier.
|
|
653
|
-
*
|
|
654
|
-
* @param currentBestMatchNode - The current best match node.
|
|
655
|
-
* @param candidateNode - The node being evaluated for higher priority based on insertion index.
|
|
656
|
-
* @returns The node with higher priority (i.e., lower insertion index). If one of the nodes is `undefined`, the other node is returned.
|
|
657
|
-
*/
|
|
658
|
-
private getHigherPriorityNode;
|
|
659
|
-
/**
|
|
660
|
-
* Creates an empty route tree node with the specified segment.
|
|
667
|
+
* Creates an empty route tree node.
|
|
661
668
|
* This helper function is used during the tree construction.
|
|
662
669
|
*
|
|
663
|
-
* @param segment - The route segment that this node represents.
|
|
664
670
|
* @returns A new, empty route tree node.
|
|
665
671
|
*/
|
|
666
672
|
private createEmptyRouteTreeNode;
|
|
@@ -672,19 +678,6 @@ declare class RouteTree<AdditionalMetadata extends Record<string, unknown> = {}>
|
|
|
672
678
|
* The `AdditionalMetadata` type parameter allows for extending the node metadata with custom data.
|
|
673
679
|
*/
|
|
674
680
|
declare interface RouteTreeNode<AdditionalMetadata extends Record<string, unknown>> {
|
|
675
|
-
/**
|
|
676
|
-
* The segment value associated with this node.
|
|
677
|
-
* A segment is a single part of a route path, typically delimited by slashes (`/`).
|
|
678
|
-
* For example, in the route `/users/:id/profile`, the segments are `users`, `:id`, and `profile`.
|
|
679
|
-
* Segments can also be wildcards (`*`), which match any segment in that position of the route.
|
|
680
|
-
*/
|
|
681
|
-
segment: string;
|
|
682
|
-
/**
|
|
683
|
-
* The index indicating the order in which the route was inserted into the tree.
|
|
684
|
-
* This index helps determine the priority of routes during matching, with lower indexes
|
|
685
|
-
* indicating earlier inserted routes.
|
|
686
|
-
*/
|
|
687
|
-
insertionIndex: number;
|
|
688
681
|
/**
|
|
689
682
|
* A map of child nodes, keyed by their corresponding route segment or wildcard.
|
|
690
683
|
*/
|
|
@@ -775,7 +768,7 @@ declare interface ServerAsset {
|
|
|
775
768
|
|
|
776
769
|
/**
|
|
777
770
|
* Server route configuration.
|
|
778
|
-
* @see {@link
|
|
771
|
+
* @see {@link provideServerRouting}
|
|
779
772
|
* @developerPreview
|
|
780
773
|
*/
|
|
781
774
|
export declare type ServerRoute = ServerRouteClient | ServerRoutePrerender | ServerRoutePrerenderWithParams | ServerRouteServer;
|
|
@@ -867,16 +860,15 @@ export declare interface ServerRoutePrerenderWithParams extends Omit<ServerRoute
|
|
|
867
860
|
* This interface defines the optional settings available for configuring server routes
|
|
868
861
|
* in the server-side environment, such as specifying a path to the app shell route.
|
|
869
862
|
*
|
|
870
|
-
*
|
|
871
|
-
* @
|
|
863
|
+
*
|
|
864
|
+
* @see {@link provideServerRouting}
|
|
865
|
+
* @deprecated use `provideServerRouting`. This will be removed in version 20.
|
|
872
866
|
*/
|
|
873
867
|
export declare interface ServerRoutesConfigOptions {
|
|
874
868
|
/**
|
|
875
869
|
* Defines the route to be used as the app shell, which serves as the main entry
|
|
876
870
|
* point for the application. This route is often used to enable server-side rendering
|
|
877
871
|
* of the application shell for requests that do not match any specific server route.
|
|
878
|
-
*
|
|
879
|
-
* @see {@link https://angular.dev/ecosystem/service-workers/app-shell | App shell pattern on Angular.dev}
|
|
880
872
|
*/
|
|
881
873
|
appShellRoute?: string;
|
|
882
874
|
}
|
|
@@ -891,6 +883,44 @@ export declare interface ServerRouteServer extends ServerRouteCommon {
|
|
|
891
883
|
renderMode: RenderMode.Server;
|
|
892
884
|
}
|
|
893
885
|
|
|
886
|
+
/**
|
|
887
|
+
* Helper type to represent a server routes feature.
|
|
888
|
+
* @see {@link ServerRoutesFeatureKind}
|
|
889
|
+
* @developerPreview
|
|
890
|
+
*/
|
|
891
|
+
declare interface ServerRoutesFeature<FeatureKind extends ServerRoutesFeatureKind> {
|
|
892
|
+
ɵkind: FeatureKind;
|
|
893
|
+
ɵproviders: Provider[];
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
/**
|
|
897
|
+
* Identifies a particular kind of `ServerRoutesFeatureKind`.
|
|
898
|
+
* @see {@link ServerRoutesFeature}
|
|
899
|
+
* @developerPreview
|
|
900
|
+
*/
|
|
901
|
+
declare enum ServerRoutesFeatureKind {
|
|
902
|
+
AppShell = 0
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
/**
|
|
906
|
+
* Configures the app shell route with the provided component.
|
|
907
|
+
*
|
|
908
|
+
* The app shell serves as the main entry point for the application and is commonly used
|
|
909
|
+
* to enable server-side rendering (SSR) of the application shell. It handles requests
|
|
910
|
+
* that do not match any specific server route, providing a fallback mechanism and improving
|
|
911
|
+
* perceived performance during navigation.
|
|
912
|
+
*
|
|
913
|
+
* This configuration is particularly useful in applications leveraging Progressive Web App (PWA)
|
|
914
|
+
* patterns, such as service workers, to deliver a seamless user experience.
|
|
915
|
+
*
|
|
916
|
+
* @param component The Angular component to render for the app shell route.
|
|
917
|
+
* @returns A server routes feature configuration for the app shell.
|
|
918
|
+
*
|
|
919
|
+
* @see {@link provideServerRouting}
|
|
920
|
+
* @see {@link https://angular.dev/ecosystem/service-workers/app-shell | App shell pattern on Angular.dev}
|
|
921
|
+
*/
|
|
922
|
+
export declare function withAppShell(component: Type<unknown> | (() => Promise<Type<unknown> | DefaultExport<Type<unknown>>>)): ServerRoutesFeature<ServerRoutesFeatureKind.AppShell>;
|
|
923
|
+
|
|
894
924
|
/**
|
|
895
925
|
* Destroys the existing `AngularServerApp` instance, releasing associated resources and resetting the
|
|
896
926
|
* reference to `undefined`.
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/ssr",
|
|
3
|
-
"version": "19.1.
|
|
3
|
+
"version": "19.1.5",
|
|
4
4
|
"description": "Angular server side rendering utilities",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"license": "MIT",
|
|
6
7
|
"homepage": "https://github.com/angular/angular-cli",
|
|
7
8
|
"keywords": [
|
|
@@ -43,7 +44,6 @@
|
|
|
43
44
|
},
|
|
44
45
|
"module": "./fesm2022/ssr.mjs",
|
|
45
46
|
"typings": "./index.d.ts",
|
|
46
|
-
"type": "module",
|
|
47
47
|
"exports": {
|
|
48
48
|
"./package.json": {
|
|
49
49
|
"default": "./package.json"
|