@dr.pogodin/react-utils 1.43.19 → 1.43.21

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.
@@ -29,6 +29,7 @@ export declare enum SCRIPT_LOCATIONS {
29
29
  export declare class ServerSsrContext<StateT> extends SsrContext<StateT> implements SsrContextT<StateT> {
30
30
  chunkGroups: ChunkGroupsT;
31
31
  chunks: string[];
32
+ redirectTo?: string;
32
33
  req: Request;
33
34
  status: number;
34
35
  constructor(req: Request, chunkGroups: ChunkGroupsT, initialState?: StateT);
@@ -15,6 +15,10 @@ declare global {
15
15
  export interface SsrContextT<StateT> extends SsrContext<StateT> {
16
16
  chunkGroups: ChunkGroupsT;
17
17
  chunks: string[];
18
+ /** If set at the end of SSR, the rendered will trigger
19
+ * server-side redirect to this URL (and use the status
20
+ * code). */
21
+ redirectTo?: string;
18
22
  req: Request;
19
23
  status: number;
20
24
  }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.43.19",
2
+ "version": "1.43.21",
3
3
  "bin": {
4
4
  "react-utils-build": "bin/build.js",
5
5
  "react-utils-setup": "bin/setup.js"
@@ -16,7 +16,7 @@
16
16
  "@dr.pogodin/react-helmet": "^3.0.2",
17
17
  "@dr.pogodin/react-themes": "^1.9.1",
18
18
  "@jest/environment": "^30.0.0",
19
- "axios": "^1.9.0",
19
+ "axios": "^1.10.0",
20
20
  "commander": "^14.0.0",
21
21
  "compression": "^1.8.0",
22
22
  "config": "^4.0.0",
@@ -35,7 +35,7 @@
35
35
  "raf": "^3.4.1",
36
36
  "react": "^19.1.0",
37
37
  "react-dom": "^19.1.0",
38
- "react-router": "^7.6.2",
38
+ "react-router": "^7.6.3",
39
39
  "request-ip": "^3.3.0",
40
40
  "rimraf": "^6.0.0",
41
41
  "serialize-javascript": "^6.0.2",
@@ -47,7 +47,7 @@
47
47
  "description": "Collection of generic ReactJS components and utils",
48
48
  "devDependencies": {
49
49
  "@babel/cli": "^7.27.2",
50
- "@babel/core": "^7.27.4",
50
+ "@babel/core": "^7.27.7",
51
51
  "@babel/node": "^7.27.1",
52
52
  "@babel/plugin-transform-runtime": "^7.27.4",
53
53
  "@babel/preset-env": "^7.27.2",
@@ -56,19 +56,19 @@
56
56
  "@babel/register": "^7.27.1",
57
57
  "@dr.pogodin/babel-plugin-transform-assets": "^1.2.5",
58
58
  "@dr.pogodin/babel-preset-svgr": "^1.9.1",
59
- "@dr.pogodin/eslint-configs": "^0.0.7",
60
- "@pmmmwh/react-refresh-webpack-plugin": "^0.6.0",
59
+ "@dr.pogodin/eslint-configs": "^0.0.8",
60
+ "@pmmmwh/react-refresh-webpack-plugin": "^0.6.1",
61
61
  "@testing-library/dom": "^10.4.0",
62
62
  "@testing-library/react": "^16.3.0",
63
63
  "@testing-library/user-event": "^14.6.1",
64
- "@tsconfig/recommended": "^1.0.8",
64
+ "@tsconfig/recommended": "^1.0.10",
65
65
  "@types/compression": "^1.8.1",
66
66
  "@types/config": "^3.3.5",
67
67
  "@types/cookie": "^0.6.0",
68
68
  "@types/cookie-parser": "^1.4.9",
69
69
  "@types/express": "^5.0.3",
70
- "@types/jest": "^29.5.14",
71
- "@types/lodash": "^4.17.17",
70
+ "@types/jest": "^30.0.0",
71
+ "@types/lodash": "^4.17.19",
72
72
  "@types/morgan": "^1.9.10",
73
73
  "@types/node-forge": "^1.3.11",
74
74
  "@types/pretty": "^2.0.3",
@@ -81,20 +81,20 @@
81
81
  "@types/webpack": "^5.28.5",
82
82
  "@types/webpack-hot-middleware": "^2.25.9",
83
83
  "autoprefixer": "^10.4.21",
84
- "babel-jest": "^30.0.0",
84
+ "babel-jest": "^30.0.2",
85
85
  "babel-loader": "^10.0.0",
86
86
  "babel-plugin-module-resolver": "^5.0.2",
87
87
  "core-js": "^3.43.0",
88
88
  "css-loader": "^7.1.2",
89
89
  "css-minimizer-webpack-plugin": "^7.0.2",
90
90
  "identity-obj-proxy": "^3.0.0",
91
- "jest": "^30.0.0",
92
- "jest-environment-jsdom": "^30.0.0",
91
+ "jest": "^30.0.3",
92
+ "jest-environment-jsdom": "^30.0.2",
93
93
  "memfs": "^4.17.2",
94
94
  "mini-css-extract-plugin": "^2.9.2",
95
95
  "mockdate": "^3.0.5",
96
96
  "nodelist-foreach-polyfill": "^1.2.0",
97
- "postcss": "^8.5.5",
97
+ "postcss": "^8.5.6",
98
98
  "postcss-loader": "^8.1.1",
99
99
  "postcss-scss": "^4.0.9",
100
100
  "pretty": "^2.0.0",
@@ -105,11 +105,11 @@
105
105
  "sass-loader": "^16.0.5",
106
106
  "sitemap": "^8.0.0",
107
107
  "source-map-loader": "^5.0.0",
108
- "stylelint": "^16.20.0",
108
+ "stylelint": "^16.21.0",
109
109
  "stylelint-config-standard-scss": "^15.0.1",
110
110
  "supertest": "^7.1.1",
111
111
  "tsc-alias": "1.8.16",
112
- "tstyche": "^4.0.0",
112
+ "tstyche": "^4.1.0",
113
113
  "typed-scss-modules": "^8.1.1",
114
114
  "typescript": "^5.8.3",
115
115
  "webpack": "^5.99.9",
@@ -77,6 +77,8 @@ export class ServerSsrContext<StateT>
77
77
 
78
78
  chunks: string[] = [];
79
79
 
80
+ redirectTo?: string;
81
+
80
82
  req: Request;
81
83
 
82
84
  status: number = 200;
@@ -517,6 +519,11 @@ export default function factory(
517
519
 
518
520
  ops.logger!.log(ssrContext.dirty ? 'warn' : 'info', logMsg);
519
521
 
522
+ if (ssrContext.redirectTo) {
523
+ res.redirect(ssrContext.status, ssrContext.redirectTo);
524
+ return;
525
+ }
526
+
520
527
  await new Promise((ready) => {
521
528
  stream!.pipe(new Writable({
522
529
  destroy: ready,
@@ -25,6 +25,12 @@ declare global {
25
25
  export interface SsrContextT<StateT> extends SsrContext<StateT> {
26
26
  chunkGroups: ChunkGroupsT;
27
27
  chunks: string[];
28
+
29
+ /** If set at the end of SSR, the rendered will trigger
30
+ * server-side redirect to this URL (and use the status
31
+ * code). */
32
+ redirectTo?: string;
33
+
28
34
  req: Request;
29
35
  status: number;
30
36
  }