@sequencemedia/react-router-redux-render 2.2.0 → 2.2.2
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/babel.config.cjs +2 -1
- package/package.json +1 -1
- package/src/index.mjs +11 -3
- package/src/react-dom-server.cjs +3 -1
- package/src/react-dom-server.jsx +11 -2
package/babel.config.cjs
CHANGED
package/package.json
CHANGED
package/src/index.mjs
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('redux').Store} Store
|
|
3
|
+
*/
|
|
4
|
+
|
|
1
5
|
import debug from 'debug'
|
|
2
6
|
|
|
3
7
|
import Boom from '@hapi/boom'
|
|
@@ -11,10 +15,14 @@ const log = debug('@sequencemedia/react-router-redux-render')
|
|
|
11
15
|
|
|
12
16
|
log('`react-router-redux-render` is awake')
|
|
13
17
|
|
|
18
|
+
/**
|
|
19
|
+
* @param {Object.<string, any>} data
|
|
20
|
+
* @returns A boom object
|
|
21
|
+
*/
|
|
14
22
|
const notFound = (data) => Boom.notFound('Routing exception', data)
|
|
15
23
|
|
|
16
24
|
/**
|
|
17
|
-
* @param {
|
|
25
|
+
* @param {Store} store
|
|
18
26
|
* @param {Object.<string, any>} routerProps
|
|
19
27
|
* @param {Object.<string, any>} routes
|
|
20
28
|
* @returns {string}
|
|
@@ -27,7 +35,7 @@ export function renderToString (store, { location, context = {}, ...router } = {
|
|
|
27
35
|
}
|
|
28
36
|
|
|
29
37
|
/**
|
|
30
|
-
* @param {
|
|
38
|
+
* @param {Store} store
|
|
31
39
|
* @param {Object.<string, any>} routerProps
|
|
32
40
|
* @param {Object.<string, any>} routes
|
|
33
41
|
* @returns {string}
|
|
@@ -40,7 +48,7 @@ export function renderToStaticMarkup (store, { location, context = {}, ...router
|
|
|
40
48
|
}
|
|
41
49
|
|
|
42
50
|
/**
|
|
43
|
-
* @param {
|
|
51
|
+
* @param {Store} store
|
|
44
52
|
* @param {Object.<string, any>} routerProps
|
|
45
53
|
* @param {Object.<string, any>} routes
|
|
46
54
|
* @returns {Promise<string>}
|
package/src/react-dom-server.cjs
CHANGED
package/src/react-dom-server.jsx
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('redux').Store} Store
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import debug from 'debug'
|
|
1
6
|
import React from 'react'
|
|
2
7
|
import ReactDOMServer from 'react-dom/server'
|
|
3
8
|
import { Provider } from 'react-redux'
|
|
4
9
|
import { StaticRouter as Router } from 'react-router-dom/server'
|
|
5
10
|
import Boom from '@hapi/boom'
|
|
6
11
|
|
|
12
|
+
const log = debug('@sequencemedia/react-redux-render')
|
|
13
|
+
|
|
14
|
+
log('`react-redux-render` is awake')
|
|
15
|
+
|
|
7
16
|
/**
|
|
8
17
|
* @param {Error} e
|
|
9
18
|
* @param {{props: Object.<string, any>}} data
|
|
@@ -12,7 +21,7 @@ import Boom from '@hapi/boom'
|
|
|
12
21
|
const badImplementation = (e, data) => Boom.boomify(e, { statusCode: 500, message: 'Rendering exception', data })
|
|
13
22
|
|
|
14
23
|
/**
|
|
15
|
-
* @param {
|
|
24
|
+
* @param {Store} store
|
|
16
25
|
* @param {Object.<string, any>} routerProps
|
|
17
26
|
* @param {Object.<string, any>} routes
|
|
18
27
|
* @returns {string}
|
|
@@ -34,7 +43,7 @@ export function getReactDOMServerRenderToString (store, routerProps, routes) {
|
|
|
34
43
|
}
|
|
35
44
|
|
|
36
45
|
/**
|
|
37
|
-
* @param {
|
|
46
|
+
* @param {Store} store
|
|
38
47
|
* @param {Object.<string, any>} routerProps
|
|
39
48
|
* @param {Object.<string, any>} routes
|
|
40
49
|
* @returns {string}
|