@angular/ssr 19.1.6 → 19.2.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/index.d.ts CHANGED
@@ -1,9 +1,7 @@
1
1
  import type { ApplicationRef } from '@angular/core';
2
2
  import { default as default_2 } from 'beasties';
3
- import { DefaultExport } from '@angular/router';
4
3
  import { EnvironmentProviders } from '@angular/core';
5
- import { Provider } from '@angular/core';
6
- import { Type } from '@angular/core';
4
+ import type { Type } from '@angular/core';
7
5
 
8
6
  /**
9
7
  * Angular server application engine.
@@ -535,31 +533,13 @@ export declare enum PrerenderFallback {
535
533
  *
536
534
  * @see {@link ServerRoute}
537
535
  * @see {@link ServerRoutesConfigOptions}
538
- * @see {@link provideServerRouting}
539
- * @deprecated use `provideServerRouting`. This will be removed in version 20.
540
536
  * @developerPreview
541
537
  */
542
538
  export declare function provideServerRoutesConfig(routes: ServerRoute[], options?: ServerRoutesConfigOptions): EnvironmentProviders;
543
539
 
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
-
560
540
  /**
561
541
  * Different rendering modes for server routes.
562
- * @see {@link provideServerRouting}
542
+ * @see {@link provideServerRoutesConfig}
563
543
  * @see {@link ServerRoute}
564
544
  * @developerPreview
565
545
  */
@@ -596,6 +576,12 @@ declare class RouteTree<AdditionalMetadata extends Record<string, unknown> = {}>
596
576
  * All routes are stored and accessed relative to this root node.
597
577
  */
598
578
  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;
599
585
  /**
600
586
  * Inserts a new route into the route tree.
601
587
  * The route is broken down into segments, and each segment is added to the tree.
@@ -655,14 +641,21 @@ declare class RouteTree<AdditionalMetadata extends Record<string, unknown> = {}>
655
641
  * This function prioritizes exact segment matches first, followed by wildcard matches (`*`),
656
642
  * and finally deep wildcard matches (`**`) that consume all segments.
657
643
  *
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).
644
+ * @param remainingSegments - The remaining segments of the route path to match.
645
+ * @param node - The current node in the route tree to start traversal from.
662
646
  *
663
647
  * @returns The node that best matches the remaining segments or `undefined` if no match is found.
664
648
  */
665
649
  private traverseBySegments;
650
+ /**
651
+ * Compares two nodes and returns the node with higher priority based on insertion index.
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;
666
659
  /**
667
660
  * Creates an empty route tree node.
668
661
  * This helper function is used during the tree construction.
@@ -678,6 +671,12 @@ declare class RouteTree<AdditionalMetadata extends Record<string, unknown> = {}>
678
671
  * The `AdditionalMetadata` type parameter allows for extending the node metadata with custom data.
679
672
  */
680
673
  declare interface RouteTreeNode<AdditionalMetadata extends Record<string, unknown>> {
674
+ /**
675
+ * The index indicating the order in which the route was inserted into the tree.
676
+ * This index helps determine the priority of routes during matching, with lower indexes
677
+ * indicating earlier inserted routes.
678
+ */
679
+ insertionIndex: number;
681
680
  /**
682
681
  * A map of child nodes, keyed by their corresponding route segment or wildcard.
683
682
  */
@@ -768,7 +767,7 @@ declare interface ServerAsset {
768
767
 
769
768
  /**
770
769
  * Server route configuration.
771
- * @see {@link provideServerRouting}
770
+ * @see {@link provideServerRoutesConfig}
772
771
  * @developerPreview
773
772
  */
774
773
  export declare type ServerRoute = ServerRouteClient | ServerRoutePrerender | ServerRoutePrerenderWithParams | ServerRouteServer;
@@ -860,15 +859,16 @@ export declare interface ServerRoutePrerenderWithParams extends Omit<ServerRoute
860
859
  * This interface defines the optional settings available for configuring server routes
861
860
  * in the server-side environment, such as specifying a path to the app shell route.
862
861
  *
863
- *
864
- * @see {@link provideServerRouting}
865
- * @deprecated use `provideServerRouting`. This will be removed in version 20.
862
+ * @see {@link provideServerRoutesConfig}
863
+ * @developerPreview
866
864
  */
867
865
  export declare interface ServerRoutesConfigOptions {
868
866
  /**
869
867
  * Defines the route to be used as the app shell, which serves as the main entry
870
868
  * point for the application. This route is often used to enable server-side rendering
871
869
  * of the application shell for requests that do not match any specific server route.
870
+ *
871
+ * @see {@link https://angular.dev/ecosystem/service-workers/app-shell | App shell pattern on Angular.dev}
872
872
  */
873
873
  appShellRoute?: string;
874
874
  }
@@ -883,44 +883,6 @@ export declare interface ServerRouteServer extends ServerRouteCommon {
883
883
  renderMode: RenderMode.Server;
884
884
  }
885
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
-
924
886
  /**
925
887
  * Destroys the existing `AngularServerApp` instance, releasing associated resources and resetting the
926
888
  * reference to `undefined`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/ssr",
3
- "version": "19.1.6",
3
+ "version": "19.2.0-next.0",
4
4
  "description": "Angular server side rendering utilities",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -17,10 +17,10 @@
17
17
  "tslib": "^2.3.0"
18
18
  },
19
19
  "peerDependencies": {
20
- "@angular/common": "^19.0.0",
21
- "@angular/core": "^19.0.0",
22
- "@angular/platform-server": "^19.0.0",
23
- "@angular/router": "^19.0.0"
20
+ "@angular/common": "^19.0.0 || ^19.2.0-next.0",
21
+ "@angular/core": "^19.0.0 || ^19.2.0-next.0",
22
+ "@angular/platform-server": "^19.0.0 || ^19.2.0-next.0",
23
+ "@angular/router": "^19.0.0 || ^19.2.0-next.0"
24
24
  },
25
25
  "peerDependenciesMeta": {
26
26
  "@angular/platform-server": {
@@ -28,13 +28,13 @@
28
28
  }
29
29
  },
30
30
  "devDependencies": {
31
- "@angular/common": "19.1.0-rc.0",
32
- "@angular/compiler": "19.1.0-rc.0",
33
- "@angular/core": "19.1.0-rc.0",
34
- "@angular/platform-browser": "19.1.0-rc.0",
35
- "@angular/platform-server": "19.1.0-rc.0",
36
- "@angular/router": "19.1.0-rc.0",
37
- "@bazel/runfiles": "^5.8.1"
31
+ "@angular/common": "19.2.0-next.0",
32
+ "@angular/compiler": "19.2.0-next.0",
33
+ "@angular/core": "19.2.0-next.0",
34
+ "@angular/platform-browser": "19.2.0-next.0",
35
+ "@angular/platform-server": "19.2.0-next.0",
36
+ "@angular/router": "19.2.0-next.0",
37
+ "@bazel/runfiles": "^6.0.0"
38
38
  },
39
39
  "sideEffects": false,
40
40
  "schematics": "./schematics/collection.json",
@@ -1198,9 +1198,12 @@ function requireNode$1 () {
1198
1198
  if (opts.index) {
1199
1199
  pos = this.positionInside(opts.index);
1200
1200
  } else if (opts.word) {
1201
- let stringRepresentation = this.source.input.css.slice(
1202
- sourceOffset(this.source.input.css, this.source.start),
1203
- sourceOffset(this.source.input.css, this.source.end)
1201
+ let inputString = ('document' in this.source.input)
1202
+ ? this.source.input.document
1203
+ : this.source.input.css;
1204
+ let stringRepresentation = inputString.slice(
1205
+ sourceOffset(inputString, this.source.start),
1206
+ sourceOffset(inputString, this.source.end)
1204
1207
  );
1205
1208
  let index = stringRepresentation.indexOf(opts.word);
1206
1209
  if (index !== -1) pos = this.positionInside(index);
@@ -1211,11 +1214,14 @@ function requireNode$1 () {
1211
1214
  positionInside(index) {
1212
1215
  let column = this.source.start.column;
1213
1216
  let line = this.source.start.line;
1214
- let offset = sourceOffset(this.source.input.css, this.source.start);
1217
+ let inputString = ('document' in this.source.input)
1218
+ ? this.source.input.document
1219
+ : this.source.input.css;
1220
+ let offset = sourceOffset(inputString, this.source.start);
1215
1221
  let end = offset + index;
1216
1222
 
1217
1223
  for (let i = offset; i < end; i++) {
1218
- if (this.source.input.css[i] === '\n') {
1224
+ if (inputString[i] === '\n') {
1219
1225
  column = 1;
1220
1226
  line += 1;
1221
1227
  } else {
@@ -1248,9 +1254,12 @@ function requireNode$1 () {
1248
1254
  };
1249
1255
 
1250
1256
  if (opts.word) {
1251
- let stringRepresentation = this.source.input.css.slice(
1252
- sourceOffset(this.source.input.css, this.source.start),
1253
- sourceOffset(this.source.input.css, this.source.end)
1257
+ let inputString = ('document' in this.source.input)
1258
+ ? this.source.input.document
1259
+ : this.source.input.css;
1260
+ let stringRepresentation = inputString.slice(
1261
+ sourceOffset(inputString, this.source.start),
1262
+ sourceOffset(inputString, this.source.end)
1254
1263
  );
1255
1264
  let index = stringRepresentation.indexOf(opts.word);
1256
1265
  if (index !== -1) {
@@ -2232,6 +2241,9 @@ function requireInput () {
2232
2241
  this.hasBOM = false;
2233
2242
  }
2234
2243
 
2244
+ this.document = this.css;
2245
+ if (opts.document) this.document = opts.document.toString();
2246
+
2235
2247
  if (opts.from) {
2236
2248
  if (
2237
2249
  !pathAvailable ||
@@ -4832,7 +4844,7 @@ function requireProcessor () {
4832
4844
 
4833
4845
  class Processor {
4834
4846
  constructor(plugins = []) {
4835
- this.version = '8.4.49';
4847
+ this.version = '8.5.1';
4836
4848
  this.plugins = this.normalize(plugins);
4837
4849
  }
4838
4850