@blaze-cms/nextjs-tools 0.146.0-core-styles.42 → 0.146.0-node18.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/CHANGELOG.md +16 -170
- package/README.md +9 -8
- package/example.env +1 -1
- package/lib/components/DebugSidebar/index.js.map +1 -1
- package/lib/helpers/check-url.js +20 -13
- package/lib/helpers/check-url.js.map +1 -1
- package/lib/helpers/render-apple-tags.js +1 -0
- package/lib/helpers/render-apple-tags.js.map +1 -1
- package/lib/index.js +0 -7
- package/lib/index.js.map +1 -1
- package/lib/pages/Resolver.js.map +1 -1
- package/lib/pages/document/_document.js +3 -5
- package/lib/pages/document/_document.js.map +1 -1
- package/lib/server/index.js +8 -7
- package/lib/server/index.js.map +1 -1
- package/lib-es/components/DebugSidebar/index.js.map +1 -1
- package/lib-es/helpers/check-url.js +5 -2
- package/lib-es/helpers/check-url.js.map +1 -1
- package/lib-es/index.js +1 -1
- package/lib-es/index.js.map +1 -1
- package/lib-es/pages/Resolver.js.map +1 -1
- package/lib-es/pages/document/_document.js +2 -5
- package/lib-es/pages/document/_document.js.map +1 -1
- package/lib-es/server/index.js +5 -4
- package/lib-es/server/index.js.map +1 -1
- package/package.json +26 -26
- package/src/components/DebugSidebar/index.js +5 -8
- package/src/helpers/check-url.js +6 -4
- package/src/index.js +1 -1
- package/src/pages/Resolver.js +1 -1
- package/src/pages/document/_document.js +2 -1
- package/src/server/index.js +5 -4
- package/tests/helpers/tests/static-file-handler-tests.js +7 -11
- package/tests/unit/src/components/DebugSidebar/__snapshots__/DebugSidebar.test.js.snap +3 -0
- package/tests/unit/src/helpers/handle-static-routes.test.js +1 -1
- package/tests/unit/src/hoc/withBlaze.test.js +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,184 +3,30 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
# [0.146.0-
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @blaze-cms/nextjs-tools
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# [0.146.0-core-styles.41](https://github.com/thebyte9/blaze/compare/v0.146.0-core-styles.40...v0.146.0-core-styles.41) (2024-12-16)
|
|
15
|
-
|
|
16
|
-
**Note:** Version bump only for package @blaze-cms/nextjs-tools
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
# [0.146.0-core-styles.40](https://github.com/thebyte9/blaze/compare/v0.146.0-core-styles.39...v0.146.0-core-styles.40) (2024-12-13)
|
|
23
|
-
|
|
24
|
-
**Note:** Version bump only for package @blaze-cms/nextjs-tools
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
# [0.146.0-core-styles.38](https://github.com/thebyte9/blaze/compare/v0.146.0-core-styles.37...v0.146.0-core-styles.38) (2024-11-20)
|
|
31
|
-
|
|
32
|
-
**Note:** Version bump only for package @blaze-cms/nextjs-tools
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
# [0.146.0-core-styles.37](https://github.com/thebyte9/blaze/compare/v0.146.0-core-styles.36...v0.146.0-core-styles.37) (2024-11-12)
|
|
39
|
-
|
|
40
|
-
**Note:** Version bump only for package @blaze-cms/nextjs-tools
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
# [0.146.0-core-styles.36](https://github.com/thebyte9/blaze/compare/v0.146.0-core-styles.35...v0.146.0-core-styles.36) (2024-11-07)
|
|
47
|
-
|
|
48
|
-
**Note:** Version bump only for package @blaze-cms/nextjs-tools
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
# [0.146.0-core-styles.35](https://github.com/thebyte9/blaze/compare/v0.146.0-core-styles.34...v0.146.0-core-styles.35) (2024-11-06)
|
|
55
|
-
|
|
56
|
-
**Note:** Version bump only for package @blaze-cms/nextjs-tools
|
|
57
|
-
|
|
58
|
-
|
|
6
|
+
# [0.146.0-node18.0](https://github.com/thebyte9/blaze/compare/v0.145.0...v0.146.0-node18.0) (2025-03-12)
|
|
59
7
|
|
|
60
8
|
|
|
9
|
+
### Bug Fixes
|
|
61
10
|
|
|
62
|
-
|
|
11
|
+
* bumped apollo versions ([b371dc7](https://github.com/thebyte9/blaze/commit/b371dc7e7bbe814a0cc4d57af2b959ab5e1b1bfd))
|
|
12
|
+
* fixed breaking tests, updated next to 14 ([fecb0e1](https://github.com/thebyte9/blaze/commit/fecb0e1d822bd69ebbaa084072a219f0fddd23f1))
|
|
13
|
+
* fixed more tests ([46a2fb9](https://github.com/thebyte9/blaze/commit/46a2fb9467f9f3c9cf320c9caf36c66503cc1f49))
|
|
14
|
+
* fixed remaining failing tests ([8a5963f](https://github.com/thebyte9/blaze/commit/8a5963ff8a0bf615a2ced9fb77b8986a9b05d80c))
|
|
15
|
+
* lint errors for reegex ([daaf750](https://github.com/thebyte9/blaze/commit/daaf7506d22f9578072c71f5557d0b6bf6185018))
|
|
16
|
+
* linting fix for reading return values from promise executor functions ([7edb563](https://github.com/thebyte9/blaze/commit/7edb563a4cbfa37188f26c1ae709ffe8ed837d69))
|
|
17
|
+
* linting fixed automatically ([73135b9](https://github.com/thebyte9/blaze/commit/73135b9b8b0d5407e2e1dfba42ab2381f290607f))
|
|
18
|
+
* udpated yarn lock ([0cd4fa4](https://github.com/thebyte9/blaze/commit/0cd4fa4a185fca4b80b57e472badb771dd649ec2))
|
|
19
|
+
* updated with dev ([90f545f](https://github.com/thebyte9/blaze/commit/90f545f1beabb35e26ba6fb2b45a7a0dfd072927))
|
|
20
|
+
* updated with dev ([729bb6e](https://github.com/thebyte9/blaze/commit/729bb6ee7e87946081d51564a4ab45538f7be1e7))
|
|
21
|
+
* updated with latest ([21cde6f](https://github.com/thebyte9/blaze/commit/21cde6f157c9279ed1eccb326870547821bc3dde))
|
|
22
|
+
* wip ([a2b7b30](https://github.com/thebyte9/blaze/commit/a2b7b304f1871b372b3c8f105205ecc6e2ef8f01))
|
|
23
|
+
* wip ([48ea1ee](https://github.com/thebyte9/blaze/commit/48ea1ee2bff03b04bfeca7e1e2fe13bd7b316ad1))
|
|
63
24
|
|
|
64
25
|
|
|
65
26
|
### Features
|
|
66
27
|
|
|
67
28
|
* allow . (dot) character in route regex ([#4552](https://github.com/thebyte9/blaze/issues/4552)) ([9be0fe0](https://github.com/thebyte9/blaze/commit/9be0fe0dd0dac2e0891c2d965a20c6b2e02165cc))
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
# [0.146.0-core-styles.32](https://github.com/thebyte9/blaze/compare/v0.146.0-core-styles.31...v0.146.0-core-styles.32) (2024-10-31)
|
|
74
|
-
|
|
75
|
-
**Note:** Version bump only for package @blaze-cms/nextjs-tools
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
# [0.146.0-core-styles.28](https://github.com/thebyte9/blaze/compare/v0.146.0-core-styles.27...v0.146.0-core-styles.28) (2024-10-29)
|
|
82
|
-
|
|
83
|
-
**Note:** Version bump only for package @blaze-cms/nextjs-tools
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
# [0.146.0-core-styles.26](https://github.com/thebyte9/blaze/compare/v0.146.0-core-styles.25...v0.146.0-core-styles.26) (2024-10-28)
|
|
90
|
-
|
|
91
|
-
**Note:** Version bump only for package @blaze-cms/nextjs-tools
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
# [0.146.0-core-styles.25](https://github.com/thebyte9/blaze/compare/v0.146.0-core-styles.24...v0.146.0-core-styles.25) (2024-10-25)
|
|
98
|
-
|
|
99
|
-
**Note:** Version bump only for package @blaze-cms/nextjs-tools
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
# [0.146.0-core-styles.23](https://github.com/thebyte9/blaze/compare/v0.146.0-core-styles.22...v0.146.0-core-styles.23) (2024-10-23)
|
|
106
|
-
|
|
107
|
-
**Note:** Version bump only for package @blaze-cms/nextjs-tools
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
# [0.146.0-core-styles.21](https://github.com/thebyte9/blaze/compare/v0.146.0-core-styles.20...v0.146.0-core-styles.21) (2024-10-18)
|
|
114
|
-
|
|
115
|
-
**Note:** Version bump only for package @blaze-cms/nextjs-tools
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
# [0.146.0-core-styles.11](https://github.com/thebyte9/blaze/compare/v0.146.0-core-styles.10...v0.146.0-core-styles.11) (2024-10-01)
|
|
122
|
-
|
|
123
|
-
**Note:** Version bump only for package @blaze-cms/nextjs-tools
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
# [0.146.0-core-styles.10](https://github.com/thebyte9/blaze/compare/v0.146.0-core-styles.9...v0.146.0-core-styles.10) (2024-09-25)
|
|
130
|
-
|
|
131
|
-
**Note:** Version bump only for package @blaze-cms/nextjs-tools
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
# [0.146.0-core-styles.8](https://github.com/thebyte9/blaze/compare/v0.146.0-core-styles.7...v0.146.0-core-styles.8) (2024-09-24)
|
|
138
|
-
|
|
139
|
-
**Note:** Version bump only for package @blaze-cms/nextjs-tools
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
# [0.146.0-core-styles.7](https://github.com/thebyte9/blaze/compare/v0.146.0-core-styles.6...v0.146.0-core-styles.7) (2024-09-20)
|
|
146
|
-
|
|
147
|
-
**Note:** Version bump only for package @blaze-cms/nextjs-tools
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
# [0.146.0-core-styles.6](https://github.com/thebyte9/blaze/compare/v0.146.0-core-styles.5...v0.146.0-core-styles.6) (2024-09-20)
|
|
154
|
-
|
|
155
|
-
**Note:** Version bump only for package @blaze-cms/nextjs-tools
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
# [0.146.0-core-styles.3](https://github.com/thebyte9/blaze/compare/v0.146.0-core-styles.2...v0.146.0-core-styles.3) (2024-09-18)
|
|
162
|
-
|
|
163
|
-
**Note:** Version bump only for package @blaze-cms/nextjs-tools
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
# [0.146.0-core-styles.0](https://github.com/thebyte9/blaze/compare/v0.145.1-core-styles.1...v0.146.0-core-styles.0) (2024-09-03)
|
|
170
|
-
|
|
171
|
-
**Note:** Version bump only for package @blaze-cms/nextjs-tools
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
## [0.145.1-core-styles.0](https://github.com/thebyte9/blaze/compare/v0.145.0...v0.145.1-core-styles.0) (2024-08-22)
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
### Bug Fixes
|
|
181
|
-
|
|
182
|
-
* adds default root selector to readme ([cfb5095](https://github.com/thebyte9/blaze/commit/cfb50956d95df485fe4486f632d32400b46806f7))
|
|
183
|
-
* fixes readme layout ([9dbdd8e](https://github.com/thebyte9/blaze/commit/9dbdd8ee96cb4a716e1e42c224939ac22ac6af0d))
|
|
29
|
+
* updated react to 18 ([9335f84](https://github.com/thebyte9/blaze/commit/9335f8432b376494501abb9c3deef1ddaa9b35a8))
|
|
184
30
|
|
|
185
31
|
|
|
186
32
|
|
package/README.md
CHANGED
|
@@ -84,15 +84,16 @@ If you want to make it stricter or more open you can override the default with t
|
|
|
84
84
|
## Environment variables
|
|
85
85
|
|
|
86
86
|
| Name | Description | Type | Default |
|
|
87
|
-
|
|
87
|
+
|---|---|---|
|
|
88
88
|
| BLAZE_FRONTEND_HOST | Frontend host (used to identify host) | String | |
|
|
89
|
-
| BLAZE_ROUTE_REGEX | Override default route regex |
|
|
89
|
+
| BLAZE_ROUTE_REGEX | Override default route regex | /^\/[a-z0-9€*\/]+(?:[-\/\.]{1,2}[a-z0-9\/€*\/]+)*$|^\/$/ |
|
|
90
90
|
| BLAZE_CACHE_CONTROL_HEADER | Cache-Control header to set on page requests | String | "" |
|
|
91
|
-
| BLAZE_STATIC_ROUTE_STORE_KEY | Override store for static file routes |
|
|
92
|
-
| BLAZE_ROUTE_PATTERN_SITEMAP | Override sitemap route |
|
|
91
|
+
| BLAZE_STATIC_ROUTE_STORE_KEY | Override store for static file routes | default |
|
|
92
|
+
| BLAZE_ROUTE_PATTERN_SITEMAP | Override sitemap route | /sitemap.xml |
|
|
93
93
|
| BLAZE_CONTENT_SITEMAP_URL_PREFIX | Prefix for sitemap URL, used in frontend static route e.g. /sitemap/sitemap-0.xml. This needs to match the value set in the API app. | String | |
|
|
94
|
-
| BLAZE_ROOT_SELECTOR_CLASSES_LIMIT | The number of root-selector classes to display.
|
|
95
|
-
| BLAZE_BUILD_ENV_PREFIX_REGEX | '\|' separated list of allowed environment variable prefixes. Any environment variable that matches this prefix pattern will be dynamically added to the next environment config and will be available in code for use. If the environment variable has a "BUILD_" prefix, then this prefix will be removed from the next environment variable name before assigning it. i.e. BUILD_THIRD_PARTY_ENV will become THIRD_PARTY_ENV in the build. Prefixes BLAZE\|GOOGLE\|JWPLAYER\|DFP are added for backward compatibility and will be deprecated. We recommend to use new and change existing environment variables with "BUILD_" prefix. |
|
|
94
|
+
| BLAZE_ROOT_SELECTOR_CLASSES_LIMIT | The number of root-selector classes to display. 0 or unset will show noe | String | |
|
|
95
|
+
| BLAZE_BUILD_ENV_PREFIX_REGEX | '\|' separated list of allowed environment variable prefixes. Any environment variable that matches this prefix pattern will be dynamically added to the next environment config and will be available in code for use. If the environment variable has a "BUILD_" prefix, then this prefix will be removed from the next environment variable name before assigning it. i.e. BUILD_THIRD_PARTY_ENV will become THIRD_PARTY_ENV in the build. Prefixes BLAZE\|GOOGLE\|JWPLAYER\|DFP are added for backward compatibility and will be deprecated. We recommend to use new and change existing environment variables with "BUILD_" prefix. | BLAZE\|GOOGLE\|JWPLAYER\|DFP\|BUILD |
|
|
96
|
+
| BLAZE_CONTENT_SITEMAP_URL_PREFIX | Prefix for sitemap URL, used in frontend static route e.g. /sitemap/sitemap-0.xml. This needs to match value set in API app. | String | |
|
|
96
97
|
| BLAZE_DISABLE_REDIRECT_WITH_QUERY | Do not add query string to redirects | String | |
|
|
97
98
|
|
|
98
99
|
## Events emitted
|
|
@@ -115,7 +116,7 @@ For more information about specific package events go to package README.
|
|
|
115
116
|
|
|
116
117
|
```sh
|
|
117
118
|
cd packages/frontend/
|
|
118
|
-
|
|
119
|
+
npm install tailwindcss@latest postcss@latest autoprefixer@latest --save
|
|
119
120
|
```
|
|
120
121
|
|
|
121
122
|
3. Add **tailwind.config.js** file in packages/frontend with following content
|
|
@@ -199,7 +200,7 @@ When checking new code or build configs make sure to check the [following things
|
|
|
199
200
|
|
|
200
201
|
## Root selector classes
|
|
201
202
|
|
|
202
|
-
To make styling of sections of a site simpler, it is possible to enable setting root selector classes at the top of the Resolver page structure that are generated based on the url hierarchy.
|
|
203
|
+
To make styling of sections of a site simpler, it is possible to enable setting root selector classes at the top of the Resolver page structure that are generated based on the url hierarchy.
|
|
203
204
|
|
|
204
205
|
For example the following url, `/parent/child/article-123` might be broken into the following classes
|
|
205
206
|
|
package/example.env
CHANGED
|
@@ -3,6 +3,6 @@ BLAZE_FRONTEND_HOST=thisisblaze.com
|
|
|
3
3
|
BLAZE_ROUTE_PATTERN_SITEMAP="/sitemap.xml"
|
|
4
4
|
BLAZE_CONTENT_SITEMAP_URL_PREFIX="sitemap"
|
|
5
5
|
#BLAZE_ROUTE_REGEX="^\/[a-z0-9€_\/]+(?:[-\/]{1,2}[a-z0-9\/€_\/]+)*$|^\/$"
|
|
6
|
-
BLAZE_ROOT_SELECTOR_CLASSES_LIMIT="
|
|
6
|
+
BLAZE_ROOT_SELECTOR_CLASSES_LIMIT="2"
|
|
7
7
|
BLAZE_CACHE_CONTROL_HEADER="max-age=0"
|
|
8
8
|
BLAZE_DISABLE_REDIRECT_WITH_QUERY=""
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_classnames","_nextjsComponents","_md","_helpers","_constants","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","DebugSidebar","_ref","itemEntity","itemId","debugMode","_useState","useState","_useState2","_slicedToArray2","isDebugMode","setIsDebugMode","_useState3","_useState4","isOpen","setIsOpen","useEffect","setBlazeDebug","divClass","classnames","href","buildAdminHref","createElement","Fragment","className","Link","src","DEBUG_LOGO","SRC","alt","ALT","role","id","onClick","MdKeyboardArrowLeft","propTypes","PropTypes","string","bool","defaultProps","_default","exports"],"sources":["../../../src/components/DebugSidebar/index.js"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport { Link } from '@blaze-cms/nextjs-components';\nimport { MdKeyboardArrowLeft } from 'react-icons/md';\nimport { buildAdminHref, setBlazeDebug } from '../../helpers';\nimport { DEBUG_LOGO } from '../../constants';\n\nconst DebugSidebar = ({ itemEntity, itemId, debugMode }) => {\n const [isDebugMode, setIsDebugMode] = useState(debugMode);\n const [isOpen, setIsOpen] = useState(true);\n\n useEffect(
|
|
1
|
+
{"version":3,"file":"index.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_classnames","_nextjsComponents","_md","_helpers","_constants","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","DebugSidebar","_ref","itemEntity","itemId","debugMode","_useState","useState","_useState2","_slicedToArray2","isDebugMode","setIsDebugMode","_useState3","_useState4","isOpen","setIsOpen","useEffect","setBlazeDebug","divClass","classnames","href","buildAdminHref","createElement","Fragment","className","Link","src","DEBUG_LOGO","SRC","alt","ALT","role","id","onClick","MdKeyboardArrowLeft","propTypes","PropTypes","string","bool","defaultProps","_default","exports"],"sources":["../../../src/components/DebugSidebar/index.js"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport { Link } from '@blaze-cms/nextjs-components';\nimport { MdKeyboardArrowLeft } from 'react-icons/md';\nimport { buildAdminHref, setBlazeDebug } from '../../helpers';\nimport { DEBUG_LOGO } from '../../constants';\n\nconst DebugSidebar = ({ itemEntity, itemId, debugMode }) => {\n const [isDebugMode, setIsDebugMode] = useState(debugMode);\n const [isOpen, setIsOpen] = useState(true);\n\n useEffect(() => {\n if (debugMode === true) {\n setIsDebugMode(debugMode);\n } else setBlazeDebug(setIsDebugMode);\n }, [debugMode]);\n\n const divClass = classnames('debug-sidebar', {\n 'debug-sidebar--open': isOpen,\n 'debug-sidebar--close': !isOpen\n });\n\n const href = buildAdminHref({ itemEntity, itemId });\n\n return (\n <>\n {isDebugMode ? (\n <div className={divClass} data-testid=\"debug-sidebar\">\n <Link href={href}>\n <img src={DEBUG_LOGO.SRC} alt={DEBUG_LOGO.ALT} />\n <span>Blaze admin</span>\n </Link>\n <div\n role=\"button\"\n className=\"debug-sidebar__button open\"\n data-testid=\"debug-sidebar-button\"\n id=\"debug-sidebar-button\"\n onClick={() => setIsOpen(!isOpen)}>\n <i>\n <MdKeyboardArrowLeft />\n </i>\n </div>\n </div>\n ) : null}\n </>\n );\n};\n\nDebugSidebar.propTypes = {\n itemEntity: PropTypes.string,\n itemId: PropTypes.string,\n debugMode: PropTypes.bool\n};\n\nDebugSidebar.defaultProps = {\n itemEntity: '',\n itemId: '',\n debugMode: false\n};\n\nexport default DebugSidebar;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,GAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AAA6C,SAAAQ,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAV,wBAAAU,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,gBAAAK,OAAA,CAAAL,CAAA,0BAAAA,CAAA,sBAAAA,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAA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var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
20
20
|
require("core-js/modules/es.array.concat.js");
|
|
21
21
|
require("core-js/modules/es.number.constructor.js");
|
|
22
22
|
require("core-js/modules/es.object.keys.js");
|
|
23
|
+
require("core-js/modules/es.regexp.exec.js");
|
|
23
24
|
var _queryString = require("query-string");
|
|
24
25
|
var _reactPageBuilder = require("@blaze-cms/react-page-builder");
|
|
25
26
|
var _coreAuthUi = require("@blaze-cms/core-auth-ui");
|
|
@@ -33,7 +34,7 @@ var _getRootSelectorClasses = _interopRequireDefault(require("./get-root-selecto
|
|
|
33
34
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
34
35
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
35
36
|
var getRootClassesLimit = function getRootClassesLimit() {
|
|
36
|
-
return Number(process.env.BLAZE_ROOT_SELECTOR_CLASSES_LIMIT
|
|
37
|
+
return Number(process.env.BLAZE_ROOT_SELECTOR_CLASSES_LIMIT);
|
|
37
38
|
};
|
|
38
39
|
var checkUrl = /*#__PURE__*/function () {
|
|
39
40
|
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(props) {
|
|
@@ -167,14 +168,20 @@ var doUrlCheck = /*#__PURE__*/function () {
|
|
|
167
168
|
case 0:
|
|
168
169
|
asPath = _ref4.asPath, url = _ref4.url, apolloClient = _ref4.apolloClient, res = _ref4.res, handle404Error = _ref4.handle404Error, blazeApp = _ref4.blazeApp;
|
|
169
170
|
_context3.prev = 1;
|
|
170
|
-
|
|
171
|
+
if (_constants.ROUTE_REGEX.test(url)) {
|
|
172
|
+
_context3.next = 4;
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
175
|
+
throw Error('Invalid URL');
|
|
176
|
+
case 4:
|
|
177
|
+
_context3.next = 6;
|
|
171
178
|
return apolloClient.query({
|
|
172
179
|
query: _query.checkUrlQuery,
|
|
173
180
|
variables: {
|
|
174
181
|
url: url
|
|
175
182
|
}
|
|
176
183
|
});
|
|
177
|
-
case
|
|
184
|
+
case 6:
|
|
178
185
|
_yield$apolloClient$q = _context3.sent;
|
|
179
186
|
_yield$apolloClient$q2 = _yield$apolloClient$q.data.checkUrl;
|
|
180
187
|
itemId = _yield$apolloClient$q2.itemId;
|
|
@@ -187,7 +194,7 @@ var doUrlCheck = /*#__PURE__*/function () {
|
|
|
187
194
|
res.setHeader('Cache-Control', "max-age=".concat(cacheControlMaxAge));
|
|
188
195
|
}
|
|
189
196
|
if (!(urlTo && urlTo !== url)) {
|
|
190
|
-
_context3.next =
|
|
197
|
+
_context3.next = 20;
|
|
191
198
|
break;
|
|
192
199
|
}
|
|
193
200
|
redirectUrl = urlTo;
|
|
@@ -199,7 +206,7 @@ var doUrlCheck = /*#__PURE__*/function () {
|
|
|
199
206
|
return _context3.abrupt("return", {
|
|
200
207
|
redirecting: true
|
|
201
208
|
});
|
|
202
|
-
case
|
|
209
|
+
case 20:
|
|
203
210
|
rootSelectorClasses = (0, _getRootSelectorClasses["default"])(url, getRootClassesLimit());
|
|
204
211
|
return _context3.abrupt("return", {
|
|
205
212
|
pageData: pageData,
|
|
@@ -207,26 +214,26 @@ var doUrlCheck = /*#__PURE__*/function () {
|
|
|
207
214
|
itemId: itemId,
|
|
208
215
|
itemEntity: (0, _reactPageBuilder.getUnpublishedEntityName)(itemEntity)
|
|
209
216
|
});
|
|
210
|
-
case
|
|
211
|
-
_context3.prev =
|
|
217
|
+
case 24:
|
|
218
|
+
_context3.prev = 24;
|
|
212
219
|
_context3.t0 = _context3["catch"](1);
|
|
213
220
|
parentPATH = (0, _checkParent["default"])(url);
|
|
214
221
|
if (!(handle404Error && parentPATH)) {
|
|
215
|
-
_context3.next =
|
|
222
|
+
_context3.next = 31;
|
|
216
223
|
break;
|
|
217
224
|
}
|
|
218
225
|
doRedirect(res, parentPATH);
|
|
219
|
-
_context3.next =
|
|
226
|
+
_context3.next = 32;
|
|
220
227
|
break;
|
|
221
|
-
case
|
|
228
|
+
case 31:
|
|
222
229
|
return _context3.abrupt("return", handleError(_context3.t0, res, handle404Error, blazeApp));
|
|
223
|
-
case
|
|
230
|
+
case 32:
|
|
224
231
|
return _context3.abrupt("return", handle404Error ? {} : null);
|
|
225
|
-
case
|
|
232
|
+
case 33:
|
|
226
233
|
case "end":
|
|
227
234
|
return _context3.stop();
|
|
228
235
|
}
|
|
229
|
-
}, _callee3, null, [[1,
|
|
236
|
+
}, _callee3, null, [[1, 24]]);
|
|
230
237
|
}));
|
|
231
238
|
return function doUrlCheck(_x4) {
|
|
232
239
|
return _ref5.apply(this, arguments);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-url.js","names":["_queryString","require","_reactPageBuilder","_coreAuthUi","_constants","_query","_checkParent","_interopRequireDefault","_checkPreviewUrl","_handleStaticRoutes","_getPageData","_getRootSelectorClasses","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","getRootClassesLimit","Number","process","env","BLAZE_ROOT_SELECTOR_CLASSES_LIMIT","checkUrl","_ref","_asyncToGenerator2","_regenerator","mark","_callee","props","asPath","apolloClient","res","req","query","blazeApp","disableSsr","fullUrl","_parseUrl","url","handler","previewData","urlCheckOptions","result","wrap","_callee$","_context","prev","next","getFullUrl","parseUrl","BLAZE_STATUS_URL","abrupt","isStatusPage","handleStaticRoutes","getHandler","setHeader","BLAZE_X_FRAME_OPTIONS","BLAZE_X_FRAME_OPTIONS_DEFAULT","getHeader","BLAZE_CACHE_CONTROL_HEADER","checkPreviewUrl","checkAccessToken","cache","extract","getPreviewData","doUrlCheck","handle404Error","sent","stop","_x","_ref2","_callee2","_result$pageData","_result$pageData2","rootSelectorClasses","_callee2$","_context2","getPageData","pageData","getRootSelectorClasses","isPreview","_x2","_x3","getHost","_ref3","_ref3$headers","headers","BLAZE_FRONTEND_HOST","host","concat","HTTPS","_window","window","_window$location","location","protocol","hostname","port","urlPort","COLON","DOUBLE_SLASH","_ref5","_callee3","_ref4","_yield$apolloClient$q","_yield$apolloClient$q2","itemId","itemEntity","urlTo","_yield$apolloClient$q3","_ref6","_ref6$cacheControlMax","cacheControlMaxAge","redirectUrl","queryString","parentPATH","_callee3$","_context3","checkUrlQuery","variables","data","BLAZE_DISABLE_REDIRECT_WITH_QUERY","split","doRedirect","redirecting","getUnpublishedEntityName","t0","checkParent","handleError","_x4","err","events","emit","error","networkError","writeHead","write","end","graphQLErrors","statusCode","NOT_FOUND_STATUS_CODE","errorCode","Location","href","_default","exports"],"sources":["../../src/helpers/check-url.js"],"sourcesContent":["import { parseUrl } from 'query-string';\nimport { getUnpublishedEntityName } from '@blaze-cms/react-page-builder';\nimport { checkAccessToken } from '@blaze-cms/core-auth-ui';\nimport {\n HTTPS,\n DOUBLE_SLASH,\n COLON,\n NOT_FOUND_STATUS_CODE,\n BLAZE_X_FRAME_OPTIONS_DEFAULT\n} from '../constants';\nimport { checkUrlQuery } from '../application/query';\nimport checkParent from './check-parent';\nimport checkPreviewUrl from './check-preview-url';\nimport handleStaticRoutes from './handle-static-routes';\nimport getPageData from './get-page-data';\nimport getRootSelectorClasses from './get-root-selector-classes';\n\nconst getRootClassesLimit = () => Number(process.env.BLAZE_ROOT_SELECTOR_CLASSES_LIMIT || 1);\n\nconst checkUrl = async props => {\n const { asPath, apolloClient, res, req, query, blazeApp, disableSsr } = props;\n const fullUrl = getFullUrl(req, asPath);\n const { url } = parseUrl(asPath);\n\n if (process.env.BLAZE_STATUS_URL && url === process.env.BLAZE_STATUS_URL) {\n return { isStatusPage: true };\n }\n\n if (res) {\n const handler = handleStaticRoutes.getHandler(asPath);\n\n res.setHeader(\n 'X-Frame-Options',\n process.env.BLAZE_X_FRAME_OPTIONS || BLAZE_X_FRAME_OPTIONS_DEFAULT\n );\n\n if (!res.getHeader('Cache-Control')) {\n res.setHeader('Cache-Control', process.env.BLAZE_CACHE_CONTROL_HEADER || '');\n }\n\n if (handler) {\n return handler(props);\n }\n }\n\n const previewData = checkPreviewUrl(url, query);\n\n if (!previewData && disableSsr) return { disableSsr: true };\n\n await checkAccessToken(apolloClient, {\n ...props,\n disableSsr: !Object.keys(apolloClient.cache.extract()).length // empty cache means SSR was disabled\n });\n\n if (previewData) return getPreviewData(previewData, apolloClient);\n const urlCheckOptions = { asPath, url, apolloClient, res };\n const result = await doUrlCheck({\n ...urlCheckOptions,\n handle404Error: true,\n blazeApp\n });\n return { ...result, fullUrl } || {};\n};\n\nconst getPreviewData = async (previewData, apolloClient) => {\n const result = await getPageData({ ...previewData, apolloClient });\n const { pageData: { url } = {} } = result;\n const rootSelectorClasses = getRootSelectorClasses(url, getRootClassesLimit());\n return { ...previewData, rootSelectorClasses, ...result, isPreview: true };\n};\n\nconst getHost = ({ headers = {} }) =>\n process.env.BLAZE_FRONTEND_HOST ||\n headers['x-request-host'] ||\n headers['x-forwarded-host'] ||\n headers.host;\n\nconst getFullUrl = (req, asPath) => {\n if (req) {\n return `${HTTPS}${getHost(req)}${asPath}`;\n }\n const {\n location: { protocol, hostname, port }\n } = window;\n const urlPort = port ? `${COLON}${port}` : '';\n\n return `${protocol}${DOUBLE_SLASH}${hostname}${urlPort}${asPath}`;\n};\n\nconst doUrlCheck = async ({ asPath, url, apolloClient, res, handle404Error, blazeApp }) => {\n try {\n const {\n data: {\n checkUrl: { itemId, itemEntity, urlTo, pageData = {} }\n }\n } = await apolloClient.query({\n query: checkUrlQuery,\n variables: {\n url\n }\n });\n\n const { cacheControlMaxAge = null } = pageData || {}; // pageData can be null when there is no page\n if (res && cacheControlMaxAge !== null && cacheControlMaxAge >= 0) {\n res.setHeader('Cache-Control', `max-age=${cacheControlMaxAge}`);\n }\n\n if (urlTo && urlTo !== url) {\n let redirectUrl = urlTo;\n if (process.env.BLAZE_DISABLE_REDIRECT_WITH_QUERY !== 'true') {\n const queryString = asPath.split('?')[1];\n redirectUrl = queryString ? `${urlTo}?${queryString}` : urlTo;\n }\n\n doRedirect(res, redirectUrl);\n return { redirecting: true };\n }\n const rootSelectorClasses = getRootSelectorClasses(url, getRootClassesLimit());\n return {\n pageData,\n rootSelectorClasses,\n itemId,\n itemEntity: getUnpublishedEntityName(itemEntity)\n };\n } catch (err) {\n const parentPATH = checkParent(url);\n if (handle404Error && parentPATH) {\n doRedirect(res, parentPATH);\n } else {\n return handleError(err, res, handle404Error, blazeApp);\n }\n\n return handle404Error ? {} : null;\n }\n};\n\nconst handleError = (err, res, handle404Error, blazeApp) => {\n blazeApp.events.emit('monitor:log', { error: err });\n\n if (!res) return {};\n if (err.networkError) {\n res.writeHead(500, { 'Content-Type': 'text/plain' });\n res.write('500 Internal Server Error\\n');\n res.end();\n } else if (handle404Error && err.graphQLErrors && err.graphQLErrors.length) {\n res.statusCode = NOT_FOUND_STATUS_CODE;\n return { errorCode: NOT_FOUND_STATUS_CODE };\n }\n\n return {};\n};\n\nfunction doRedirect(res, redirectUrl) {\n if (res) {\n res.writeHead(301, { Location: redirectUrl });\n res.end();\n } else {\n window.location.href = redirectUrl;\n }\n}\n\nexport default checkUrl;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAOA,IAA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AK,CAAC,6BAA6B,CAAC;IACxCzG,GAAG,CAAC0G,GAAG,CAAC,CAAC;EACX,CAAC,MAAM,IAAIvE,cAAc,IAAIgE,GAAG,CAACQ,aAAa,IAAIR,GAAG,CAACQ,aAAa,CAAC/H,MAAM,EAAE;IAC1EoB,GAAG,CAAC4G,UAAU,GAAGC,gCAAqB;IACtC,OAAO;MAAEC,SAAS,EAAED;IAAsB,CAAC;EAC7C;EAEA,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAASjB,UAAUA,CAAC5F,GAAG,EAAEkF,WAAW,EAAE;EACpC,IAAIlF,GAAG,EAAE;IACPA,GAAG,CAACwG,SAAS,CAAC,GAAG,EAAE;MAAEO,QAAQ,EAAE7B;IAAY,CAAC,CAAC;IAC7ClF,GAAG,CAAC0G,GAAG,CAAC,CAAC;EACX,CAAC,MAAM;IACL7C,MAAM,CAACE,QAAQ,CAACiD,IAAI,GAAG9B,WAAW;EACpC;AACF;AAAC,IAAA+B,QAAA,GAAAC,OAAA,cAEc3H,QAAQ","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"check-url.js","names":["_queryString","require","_reactPageBuilder","_coreAuthUi","_constants","_query","_checkParent","_interopRequireDefault","_checkPreviewUrl","_handleStaticRoutes","_getPageData","_getRootSelectorClasses","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","getRootClassesLimit","Number","process","env","BLAZE_ROOT_SELECTOR_CLASSES_LIMIT","checkUrl","_ref","_asyncToGenerator2","_regenerator","mark","_callee","props","asPath","apolloClient","res","req","query","blazeApp","disableSsr","fullUrl","_parseUrl","url","handler","previewData","urlCheckOptions","result","wrap","_callee$","_context","prev","next","getFullUrl","parseUrl","BLAZE_STATUS_URL","abrupt","isStatusPage","handleStaticRoutes","getHandler","setHeader","BLAZE_X_FRAME_OPTIONS","BLAZE_X_FRAME_OPTIONS_DEFAULT","getHeader","BLAZE_CACHE_CONTROL_HEADER","checkPreviewUrl","checkAccessToken","cache","extract","getPreviewData","doUrlCheck","handle404Error","sent","stop","_x","_ref2","_callee2","_result$pageData","_result$pageData2","rootSelectorClasses","_callee2$","_context2","getPageData","pageData","getRootSelectorClasses","isPreview","_x2","_x3","getHost","_ref3","_ref3$headers","headers","BLAZE_FRONTEND_HOST","host","concat","HTTPS","_window","window","_window$location","location","protocol","hostname","port","urlPort","COLON","DOUBLE_SLASH","_ref5","_callee3","_ref4","_yield$apolloClient$q","_yield$apolloClient$q2","itemId","itemEntity","urlTo","_yield$apolloClient$q3","_ref6","_ref6$cacheControlMax","cacheControlMaxAge","redirectUrl","queryString","parentPATH","_callee3$","_context3","ROUTE_REGEX","test","Error","checkUrlQuery","variables","data","BLAZE_DISABLE_REDIRECT_WITH_QUERY","split","doRedirect","redirecting","getUnpublishedEntityName","t0","checkParent","handleError","_x4","err","events","emit","error","networkError","writeHead","write","end","graphQLErrors","statusCode","NOT_FOUND_STATUS_CODE","errorCode","Location","href","_default","exports"],"sources":["../../src/helpers/check-url.js"],"sourcesContent":["import { parseUrl } from 'query-string';\nimport { getUnpublishedEntityName } from '@blaze-cms/react-page-builder';\nimport { checkAccessToken } from '@blaze-cms/core-auth-ui';\nimport {\n HTTPS,\n DOUBLE_SLASH,\n COLON,\n NOT_FOUND_STATUS_CODE,\n BLAZE_X_FRAME_OPTIONS_DEFAULT,\n ROUTE_REGEX\n} from '../constants';\nimport { checkUrlQuery } from '../application/query';\nimport checkParent from './check-parent';\nimport checkPreviewUrl from './check-preview-url';\nimport handleStaticRoutes from './handle-static-routes';\nimport getPageData from './get-page-data';\nimport getRootSelectorClasses from './get-root-selector-classes';\n\nconst getRootClassesLimit = () => Number(process.env.BLAZE_ROOT_SELECTOR_CLASSES_LIMIT);\n\nconst checkUrl = async props => {\n const { asPath, apolloClient, res, req, query, blazeApp, disableSsr } = props;\n const fullUrl = getFullUrl(req, asPath);\n const { url } = parseUrl(asPath);\n\n if (process.env.BLAZE_STATUS_URL && url === process.env.BLAZE_STATUS_URL) {\n return { isStatusPage: true };\n }\n\n if (res) {\n const handler = handleStaticRoutes.getHandler(asPath);\n\n res.setHeader(\n 'X-Frame-Options',\n process.env.BLAZE_X_FRAME_OPTIONS || BLAZE_X_FRAME_OPTIONS_DEFAULT\n );\n\n if (!res.getHeader('Cache-Control')) {\n res.setHeader('Cache-Control', process.env.BLAZE_CACHE_CONTROL_HEADER || '');\n }\n\n if (handler) {\n return handler(props);\n }\n }\n\n const previewData = checkPreviewUrl(url, query);\n\n if (!previewData && disableSsr) return { disableSsr: true };\n\n await checkAccessToken(apolloClient, {\n ...props,\n disableSsr: !Object.keys(apolloClient.cache.extract()).length // empty cache means SSR was disabled\n });\n\n if (previewData) return getPreviewData(previewData, apolloClient);\n const urlCheckOptions = { asPath, url, apolloClient, res };\n const result = await doUrlCheck({\n ...urlCheckOptions,\n handle404Error: true,\n blazeApp\n });\n return { ...result, fullUrl } || {};\n};\n\nconst getPreviewData = async (previewData, apolloClient) => {\n const result = await getPageData({ ...previewData, apolloClient });\n const { pageData: { url } = {} } = result;\n const rootSelectorClasses = getRootSelectorClasses(url, getRootClassesLimit());\n return { ...previewData, rootSelectorClasses, ...result, isPreview: true };\n};\n\nconst getHost = ({ headers = {} }) =>\n process.env.BLAZE_FRONTEND_HOST ||\n headers['x-request-host'] ||\n headers['x-forwarded-host'] ||\n headers.host;\n\nconst getFullUrl = (req, asPath) => {\n if (req) {\n return `${HTTPS}${getHost(req)}${asPath}`;\n }\n const {\n location: { protocol, hostname, port }\n } = window;\n const urlPort = port ? `${COLON}${port}` : '';\n\n return `${protocol}${DOUBLE_SLASH}${hostname}${urlPort}${asPath}`;\n};\n\nconst doUrlCheck = async ({ asPath, url, apolloClient, res, handle404Error, blazeApp }) => {\n try {\n if (!ROUTE_REGEX.test(url)) {\n throw Error('Invalid URL');\n }\n const {\n data: {\n checkUrl: { itemId, itemEntity, urlTo, pageData = {} }\n }\n } = await apolloClient.query({\n query: checkUrlQuery,\n variables: {\n url\n }\n });\n const { cacheControlMaxAge = null } = pageData || {}; // pageData can be null when there is no page\n if (res && cacheControlMaxAge !== null && cacheControlMaxAge >= 0) {\n res.setHeader('Cache-Control', `max-age=${cacheControlMaxAge}`);\n }\n\n if (urlTo && urlTo !== url) {\n let redirectUrl = urlTo;\n if (process.env.BLAZE_DISABLE_REDIRECT_WITH_QUERY !== 'true') {\n const queryString = asPath.split('?')[1];\n redirectUrl = queryString ? `${urlTo}?${queryString}` : urlTo;\n }\n\n doRedirect(res, redirectUrl);\n return { redirecting: true };\n }\n const rootSelectorClasses = getRootSelectorClasses(url, getRootClassesLimit());\n return {\n pageData,\n rootSelectorClasses,\n itemId,\n itemEntity: getUnpublishedEntityName(itemEntity)\n };\n } catch (err) {\n const parentPATH = checkParent(url);\n if (handle404Error && parentPATH) {\n doRedirect(res, parentPATH);\n } else {\n return handleError(err, res, handle404Error, blazeApp);\n }\n\n return handle404Error ? {} : null;\n }\n};\n\nconst handleError = (err, res, handle404Error, blazeApp) => {\n blazeApp.events.emit('monitor:log', { error: err });\n if (!res) return {};\n if (err.networkError) {\n res.writeHead(500, { 'Content-Type': 'text/plain' });\n res.write('500 Internal Server Error\\n');\n res.end();\n } else if (handle404Error && err.graphQLErrors && err.graphQLErrors.length) {\n res.statusCode = NOT_FOUND_STATUS_CODE;\n return { errorCode: NOT_FOUND_STATUS_CODE };\n }\n\n return {};\n};\n\nfunction doRedirect(res, redirectUrl) {\n if (res) {\n res.writeHead(301, { Location: redirectUrl });\n res.end();\n } else {\n window.location.href = redirectUrl;\n }\n}\n\nexport default checkUrl;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAQA,IAAAI,MAAA,GAAAJ,OAAA;AAC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pB1G,GAAG,CAAC2G,SAAS,CAAC,GAAG,EAAE;MAAE,cAAc,EAAE;IAAa,CAAC,CAAC;IACpD3G,GAAG,CAAC4G,KAAK,CAAC,6BAA6B,CAAC;IACxC5G,GAAG,CAAC6G,GAAG,CAAC,CAAC;EACX,CAAC,MAAM,IAAI1E,cAAc,IAAImE,GAAG,CAACQ,aAAa,IAAIR,GAAG,CAACQ,aAAa,CAAClI,MAAM,EAAE;IAC1EoB,GAAG,CAAC+G,UAAU,GAAGC,gCAAqB;IACtC,OAAO;MAAEC,SAAS,EAAED;IAAsB,CAAC;EAC7C;EAEA,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAASjB,UAAUA,CAAC/F,GAAG,EAAEkF,WAAW,EAAE;EACpC,IAAIlF,GAAG,EAAE;IACPA,GAAG,CAAC2G,SAAS,CAAC,GAAG,EAAE;MAAEO,QAAQ,EAAEhC;IAAY,CAAC,CAAC;IAC7ClF,GAAG,CAAC6G,GAAG,CAAC,CAAC;EACX,CAAC,MAAM;IACLhD,MAAM,CAACE,QAAQ,CAACoD,IAAI,GAAGjC,WAAW;EACpC;AACF;AAAC,IAAAkC,QAAA,GAAAC,OAAA,cAEc9H,QAAQ","ignoreList":[]}
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports["default"] = void 0;
|
|
9
9
|
require("core-js/modules/es.array.map.js");
|
|
10
|
+
require("core-js/modules/es.object.to-string.js");
|
|
10
11
|
var _react = _interopRequireDefault(require("react"));
|
|
11
12
|
var _constants = require("../constants");
|
|
12
13
|
var renderAppleTags = function renderAppleTags() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-apple-tags.js","names":["_react","_interopRequireDefault","require","_constants","renderAppleTags","APPLE_TAGS","map","_ref","href","rel","sizes","createElement","_default","exports"],"sources":["../../src/helpers/render-apple-tags.js"],"sourcesContent":["import React from 'react';\nimport { APPLE_TAGS } from '../constants';\n\nconst renderAppleTags = () =>\n APPLE_TAGS.map(({ href, rel, sizes }) => <link href={href} rel={rel} sizes={sizes} />);\n\nexport default renderAppleTags;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"render-apple-tags.js","names":["_react","_interopRequireDefault","require","_constants","renderAppleTags","APPLE_TAGS","map","_ref","href","rel","sizes","createElement","_default","exports"],"sources":["../../src/helpers/render-apple-tags.js"],"sourcesContent":["import React from 'react';\nimport { APPLE_TAGS } from '../constants';\n\nconst renderAppleTags = () =>\n APPLE_TAGS.map(({ href, rel, sizes }) => <link href={href} rel={rel} sizes={sizes} />);\n\nexport default renderAppleTags;\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAEA,IAAME,eAAe,GAAG,SAAlBA,eAAeA,CAAA;EAAA,OACnBC,qBAAU,CAACC,GAAG,CAAC,UAAAC,IAAA;IAAA,IAAGC,IAAI,GAAAD,IAAA,CAAJC,IAAI;MAAEC,GAAG,GAAAF,IAAA,CAAHE,GAAG;MAAEC,KAAK,GAAAH,IAAA,CAALG,KAAK;IAAA,oBAAOV,MAAA,YAAAW,aAAA;MAAMH,IAAI,EAAEA,IAAK;MAACC,GAAG,EAAEA,GAAI;MAACC,KAAK,EAAEA;IAAM,CAAE,CAAC;EAAA,EAAC;AAAA;AAAC,IAAAE,QAAA,GAAAC,OAAA,cAE1ET,eAAe","ignoreList":[]}
|
package/lib/index.js
CHANGED
|
@@ -43,12 +43,6 @@ Object.defineProperty(exports, "SearchPublishedContent", {
|
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
45
|
exports.reactApollo = void 0;
|
|
46
|
-
Object.defineProperty(exports, "router", {
|
|
47
|
-
enumerable: true,
|
|
48
|
-
get: function get() {
|
|
49
|
-
return _routes["default"];
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
46
|
Object.defineProperty(exports, "withBlaze", {
|
|
53
47
|
enumerable: true,
|
|
54
48
|
get: function get() {
|
|
@@ -62,7 +56,6 @@ var _nextjsComponents = require("@blaze-cms/nextjs-components");
|
|
|
62
56
|
var _withBlaze = _interopRequireDefault(require("./hoc/withBlaze"));
|
|
63
57
|
var _Resolver = _interopRequireDefault(require("./pages/Resolver"));
|
|
64
58
|
var _document = _interopRequireDefault(require("./pages/document/_document"));
|
|
65
|
-
var _routes = _interopRequireDefault(require("./server/routes"));
|
|
66
59
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
67
60
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
68
61
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["reactApollo","_interopRequireWildcard","require","exports","_pluginSearchUi","_nextjsComponents","_withBlaze","_interopRequireDefault","_Resolver","_document","
|
|
1
|
+
{"version":3,"file":"index.js","names":["reactApollo","_interopRequireWildcard","require","exports","_pluginSearchUi","_nextjsComponents","_withBlaze","_interopRequireDefault","_Resolver","_document","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set"],"sources":["../src/index.js"],"sourcesContent":["import * as reactApollo from '@apollo/client';\n\nexport { reactApollo };\nexport { SearchPublishedContent } from '@blaze-cms/plugin-search-ui';\nexport { MainContext, MainContextProvider } from '@blaze-cms/nextjs-components';\nexport { default as withBlaze } from './hoc/withBlaze';\nexport { default as Resolver } from './pages/Resolver';\nexport { default as BlazeDocument } from './pages/document/_document';\n// export { default as router } from './server/routes';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA8CC,OAAA,CAAAH,WAAA,GAAAA,WAAA;AAG9C,IAAAI,eAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,SAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,SAAA,GAAAF,sBAAA,CAAAL,OAAA;AAAsE,SAAAQ,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAV,wBAAAU,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,gBAAAK,OAAA,CAAAL,CAAA,0BAAAA,CAAA,sBAAAA,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,cAAAR,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Resolver.js","names":["_react","_interopRequireDefault","require","_error","_router","_propTypes","_components","_helpers","_containers","_constants","Resolver","props","pageData","itemId","itemEntity","isStatusPage","fullUrl","disableSsr","_props$rootSelectorCl","rootSelectorClasses","RESOLVER_CONTAINER_CLASS","_props$isPreview","isPreview","_props$errorCode","errorCode","NOT_FOUND_STATUS_CODE","_props$errorMessage","errorMessage","_props$redirecting","redirecting","router","useRouter","window","asPath","location","hash","url","URL","href","searchParams","set","Date","now","push","createElement","statusCode","title","className","ContentContainer","DebugSidebar","getInitialProps","_ref","_asyncToGenerator2","_regenerator","mark","_callee","wrap","_callee$","_context","prev","next","abrupt","checkUrl","stop","_x","apply","arguments","propTypes","PropTypes","string","object","bool","number","defaultProps","_default","exports"],"sources":["../../src/pages/Resolver.js"],"sourcesContent":["import React from 'react';\nimport NextError from 'next/error';\nimport { useRouter } from 'next/router';\nimport PropTypes from 'prop-types';\nimport { DebugSidebar } from '../components';\nimport { checkUrl } from '../helpers';\nimport { ContentContainer } from '../containers';\nimport { NOT_FOUND_STATUS_CODE, RESOLVER_CONTAINER_CLASS } from '../constants';\n\nconst Resolver = props => {\n const {\n pageData,\n itemId,\n itemEntity,\n isStatusPage,\n fullUrl,\n disableSsr,\n rootSelectorClasses = RESOLVER_CONTAINER_CLASS,\n isPreview = false,\n errorCode = NOT_FOUND_STATUS_CODE,\n errorMessage = null,\n redirecting = false\n } = props;\n\n const router = useRouter();\n\n if (disableSsr) {\n if (typeof window !== 'undefined') {\n let { asPath } = router;\n if (window.location.hash) {\n // handle nextjs issue not calling getInitialProps if pushing a url with a hash in it\n // we add a new query string param to force calling getInitialProps\n // this should only happen if disableSsr and window.location.hash\n const url = new URL(router.asPath, window.location.href);\n if (url.hash) url.searchParams.set('_h', Date.now());\n asPath = url;\n }\n router.push('/Resolver', asPath);\n }\n return '';\n }\n\n if (redirecting) return null;\n\n if (isStatusPage) return 'OK';\n\n if (!pageData || !itemId || !itemEntity)\n return <NextError statusCode={errorCode} title={errorMessage} />;\n\n return (\n <div className={rootSelectorClasses}>\n <ContentContainer\n pageData={pageData}\n itemId={itemId}\n itemEntity={itemEntity}\n isPreview={isPreview}\n fullUrl={fullUrl}\n />\n
|
|
1
|
+
{"version":3,"file":"Resolver.js","names":["_react","_interopRequireDefault","require","_error","_router","_propTypes","_components","_helpers","_containers","_constants","Resolver","props","pageData","itemId","itemEntity","isStatusPage","fullUrl","disableSsr","_props$rootSelectorCl","rootSelectorClasses","RESOLVER_CONTAINER_CLASS","_props$isPreview","isPreview","_props$errorCode","errorCode","NOT_FOUND_STATUS_CODE","_props$errorMessage","errorMessage","_props$redirecting","redirecting","router","useRouter","window","asPath","location","hash","url","URL","href","searchParams","set","Date","now","push","createElement","statusCode","title","className","ContentContainer","DebugSidebar","getInitialProps","_ref","_asyncToGenerator2","_regenerator","mark","_callee","wrap","_callee$","_context","prev","next","abrupt","checkUrl","stop","_x","apply","arguments","propTypes","PropTypes","string","object","bool","number","defaultProps","_default","exports"],"sources":["../../src/pages/Resolver.js"],"sourcesContent":["import React from 'react';\nimport NextError from 'next/error';\nimport { useRouter } from 'next/router';\nimport PropTypes from 'prop-types';\nimport { DebugSidebar } from '../components';\nimport { checkUrl } from '../helpers';\nimport { ContentContainer } from '../containers';\nimport { NOT_FOUND_STATUS_CODE, RESOLVER_CONTAINER_CLASS } from '../constants';\n\nconst Resolver = props => {\n const {\n pageData,\n itemId,\n itemEntity,\n isStatusPage,\n fullUrl,\n disableSsr,\n rootSelectorClasses = RESOLVER_CONTAINER_CLASS,\n isPreview = false,\n errorCode = NOT_FOUND_STATUS_CODE,\n errorMessage = null,\n redirecting = false\n } = props;\n\n const router = useRouter();\n\n if (disableSsr) {\n if (typeof window !== 'undefined') {\n let { asPath } = router;\n if (window.location.hash) {\n // handle nextjs issue not calling getInitialProps if pushing a url with a hash in it\n // we add a new query string param to force calling getInitialProps\n // this should only happen if disableSsr and window.location.hash\n const url = new URL(router.asPath, window.location.href);\n if (url.hash) url.searchParams.set('_h', Date.now());\n asPath = url;\n }\n\n router.push('/Resolver', asPath);\n }\n return '';\n }\n\n if (redirecting) return null;\n\n if (isStatusPage) return 'OK';\n\n if (!pageData || !itemId || !itemEntity)\n return <NextError statusCode={errorCode} title={errorMessage} />;\n\n return (\n <div className={rootSelectorClasses}>\n <ContentContainer\n pageData={pageData}\n itemId={itemId}\n itemEntity={itemEntity}\n isPreview={isPreview}\n fullUrl={fullUrl}\n />\n <DebugSidebar itemId={itemId} itemEntity={itemEntity} />\n </div>\n );\n};\n\nResolver.getInitialProps = async props => checkUrl(props);\n\nResolver.propTypes = {\n itemId: PropTypes.string,\n itemEntity: PropTypes.string,\n pageData: PropTypes.object,\n isStatusPage: PropTypes.bool,\n fullUrl: PropTypes.string,\n isPreview: PropTypes.bool,\n errorCode: PropTypes.number,\n disableSsr: PropTypes.bool,\n errorMessage: PropTypes.string,\n rootSelectorClasses: PropTypes.string,\n redirecting: PropTypes.bool\n};\n\nResolver.defaultProps = {\n itemId: null,\n itemEntity: null,\n pageData: null,\n isStatusPage: false,\n fullUrl: '',\n isPreview: false,\n errorCode: NOT_FOUND_STATUS_CODE,\n disableSsr: false,\n errorMessage: null,\n rootSelectorClasses: RESOLVER_CONTAINER_CLASS,\n redirecting: false\n};\n\nexport default Resolver;\n"],"mappings":";;;;;;;;;;;;;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ignoreList":[]}
|
|
@@ -20,15 +20,13 @@ var _DocumentBody = _interopRequireDefault(require("./DocumentBody"));
|
|
|
20
20
|
var _helpers = require("../../helpers");
|
|
21
21
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
22
22
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
23
|
+
// import Head from 'next/head';
|
|
24
|
+
|
|
23
25
|
var BlazeDocument = function BlazeDocument(_ref) {
|
|
24
26
|
var children = _ref.children;
|
|
25
27
|
return /*#__PURE__*/_react["default"].createElement(_document.Html, {
|
|
26
28
|
lang: "en"
|
|
27
|
-
}, /*#__PURE__*/_react["default"].createElement(_document.Head, null,
|
|
28
|
-
rel: "icon",
|
|
29
|
-
href: "/static/img/favicon.png",
|
|
30
|
-
type: "image/x-icon"
|
|
31
|
-
}), (0, _helpers.renderAppleTags)()), children);
|
|
29
|
+
}, /*#__PURE__*/_react["default"].createElement(_document.Head, null, (0, _helpers.renderAppleTags)()), children);
|
|
32
30
|
};
|
|
33
31
|
BlazeDocument.Document = _document["default"];
|
|
34
32
|
BlazeDocument.Body = _DocumentBody["default"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_document.js","names":["_react","_interopRequireDefault","require","_propTypes","_document","_interopRequireWildcard","_DocumentBody","_helpers","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","BlazeDocument","_ref","children","createElement","Html","lang","Head","
|
|
1
|
+
{"version":3,"file":"_document.js","names":["_react","_interopRequireDefault","require","_propTypes","_document","_interopRequireWildcard","_DocumentBody","_helpers","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","BlazeDocument","_ref","children","createElement","Html","lang","Head","renderAppleTags","Document","Body","DocumentBody","propTypes","PropTypes","object","isRequired","_default","exports"],"sources":["../../../src/pages/document/_document.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Document, { Html, Head } from 'next/document';\n// import Head from 'next/head';\nimport DocumentBody from './DocumentBody';\nimport { renderAppleTags } from '../../helpers';\n\nconst BlazeDocument = ({ children }) => (\n <Html lang=\"en\">\n <Head>\n {/* <link rel=\"icon\" href=\"/static/img/favicon.png\" type=\"image/x-icon\" /> */}\n {renderAppleTags()}\n </Head>\n {children}\n </Html>\n);\n\nBlazeDocument.Document = Document;\nBlazeDocument.Body = DocumentBody;\n\nBlazeDocument.propTypes = {\n children: PropTypes.object.isRequired\n};\n\nexport default BlazeDocument;\n"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,SAAA,GAAAC,uBAAA,CAAAH,OAAA;AAEA,IAAAI,aAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAAgD,SAAAM,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAJ,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ACjCR,aAAa,CAACS,IAAI,GAAGC,wBAAY;AAEjCV,aAAa,CAACW,SAAS,GAAG;EACxBT,QAAQ,EAAEU,qBAAS,CAACC,MAAM,CAACC;AAC7B,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,cAEahB,aAAa","ignoreList":[]}
|
package/lib/server/index.js
CHANGED
|
@@ -6,28 +6,29 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
6
6
|
require("core-js/modules/es.parse-int.js");
|
|
7
7
|
var _require = require('http'),
|
|
8
8
|
createServer = _require.createServer;
|
|
9
|
-
var Router = require('./routes');
|
|
10
9
|
var port = parseInt(process.env.PORT, 10) || 3000;
|
|
11
10
|
function prepareServer(_x) {
|
|
12
11
|
return _prepareServer.apply(this, arguments);
|
|
13
12
|
}
|
|
14
13
|
function _prepareServer() {
|
|
15
|
-
_prepareServer = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(
|
|
14
|
+
_prepareServer = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(app) {
|
|
16
15
|
var handler;
|
|
17
16
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
18
17
|
while (1) switch (_context.prev = _context.next) {
|
|
19
18
|
case 0:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
// eslint-disable-next-line no-console
|
|
20
|
+
console.warn('server.js is deprecated. Run directly with "next" cli instead.');
|
|
21
|
+
handler = app.getRequestHandler();
|
|
22
|
+
_context.next = 4;
|
|
23
|
+
return app.prepare();
|
|
24
|
+
case 4:
|
|
24
25
|
return _context.abrupt("return", {
|
|
25
26
|
run: function run() {
|
|
26
27
|
return createServer(handler).listen(port);
|
|
27
28
|
},
|
|
28
29
|
handler: handler
|
|
29
30
|
});
|
|
30
|
-
case
|
|
31
|
+
case 5:
|
|
31
32
|
case "end":
|
|
32
33
|
return _context.stop();
|
|
33
34
|
}
|
package/lib/server/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_require","require","createServer","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_require","require","createServer","port","parseInt","process","env","PORT","prepareServer","_x","_prepareServer","apply","arguments","_asyncToGenerator2","_regenerator","mark","_callee","app","handler","wrap","_callee$","_context","prev","next","console","warn","getRequestHandler","prepare","abrupt","run","listen","stop","module","exports"],"sources":["../../src/server/index.js"],"sourcesContent":["const { createServer } = require('http');\n\nconst port = parseInt(process.env.PORT, 10) || 3000;\n\nasync function prepareServer(app) {\n // eslint-disable-next-line no-console\n console.warn('server.js is deprecated. Run directly with \"next\" cli instead.');\n const handler = app.getRequestHandler();\n\n await app.prepare();\n\n return { run: () => createServer(handler).listen(port), handler };\n}\n\nmodule.exports = prepareServer;\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAyBC,OAAO,CAAC,MAAM,CAAC;EAAhCC,YAAY,GAAAF,QAAA,CAAZE,YAAY;AAEpB,IAAMC,IAAI,GAAGC,QAAQ,CAACC,OAAO,CAACC,GAAG,CAACC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI;AAAC,SAErCC,aAAaA,CAAAC,EAAA;EAAA,OAAAC,cAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAAA,SAAAF,eAAA;EAAAA,cAAA,OAAAG,kBAAA,0BAAAC,YAAA,YAAAC,IAAA,CAA5B,SAAAC,QAA6BC,GAAG;IAAA,IAAAC,OAAA;IAAA,OAAAJ,YAAA,YAAAK,IAAA,UAAAC,SAAAC,QAAA;MAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;QAAA;UAC9B;UACAC,OAAO,CAACC,IAAI,CAAC,gEAAgE,CAAC;UACxEP,OAAO,GAAGD,GAAG,CAACS,iBAAiB,CAAC,CAAC;UAAAL,QAAA,CAAAE,IAAA;UAAA,OAEjCN,GAAG,CAACU,OAAO,CAAC,CAAC;QAAA;UAAA,OAAAN,QAAA,CAAAO,MAAA,WAEZ;YAAEC,GAAG,EAAE,SAALA,GAAGA,CAAA;cAAA,OAAQ3B,YAAY,CAACgB,OAAO,CAAC,CAACY,MAAM,CAAC3B,IAAI,CAAC;YAAA;YAAEe,OAAO,EAAPA;UAAQ,CAAC;QAAA;QAAA;UAAA,OAAAG,QAAA,CAAAU,IAAA;MAAA;IAAA,GAAAf,OAAA;EAAA,CAClE;EAAA,OAAAN,cAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAEDoB,MAAM,CAACC,OAAO,GAAGzB,aAAa","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useState","useEffect","PropTypes","classnames","Link","MdKeyboardArrowLeft","buildAdminHref","setBlazeDebug","DEBUG_LOGO","DebugSidebar","itemEntity","itemId","debugMode","isDebugMode","setIsDebugMode","isOpen","setIsOpen","divClass","href","createElement","Fragment","className","src","SRC","alt","ALT","role","id","onClick","propTypes","string","bool","defaultProps"],"sources":["../../../src/components/DebugSidebar/index.js"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport { Link } from '@blaze-cms/nextjs-components';\nimport { MdKeyboardArrowLeft } from 'react-icons/md';\nimport { buildAdminHref, setBlazeDebug } from '../../helpers';\nimport { DEBUG_LOGO } from '../../constants';\n\nconst DebugSidebar = ({ itemEntity, itemId, debugMode }) => {\n const [isDebugMode, setIsDebugMode] = useState(debugMode);\n const [isOpen, setIsOpen] = useState(true);\n\n useEffect(
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useState","useEffect","PropTypes","classnames","Link","MdKeyboardArrowLeft","buildAdminHref","setBlazeDebug","DEBUG_LOGO","DebugSidebar","itemEntity","itemId","debugMode","isDebugMode","setIsDebugMode","isOpen","setIsOpen","divClass","href","createElement","Fragment","className","src","SRC","alt","ALT","role","id","onClick","propTypes","string","bool","defaultProps"],"sources":["../../../src/components/DebugSidebar/index.js"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport { Link } from '@blaze-cms/nextjs-components';\nimport { MdKeyboardArrowLeft } from 'react-icons/md';\nimport { buildAdminHref, setBlazeDebug } from '../../helpers';\nimport { DEBUG_LOGO } from '../../constants';\n\nconst DebugSidebar = ({ itemEntity, itemId, debugMode }) => {\n const [isDebugMode, setIsDebugMode] = useState(debugMode);\n const [isOpen, setIsOpen] = useState(true);\n\n useEffect(() => {\n if (debugMode === true) {\n setIsDebugMode(debugMode);\n } else setBlazeDebug(setIsDebugMode);\n }, [debugMode]);\n\n const divClass = classnames('debug-sidebar', {\n 'debug-sidebar--open': isOpen,\n 'debug-sidebar--close': !isOpen\n });\n\n const href = buildAdminHref({ itemEntity, itemId });\n\n return (\n <>\n {isDebugMode ? (\n <div className={divClass} data-testid=\"debug-sidebar\">\n <Link href={href}>\n <img src={DEBUG_LOGO.SRC} alt={DEBUG_LOGO.ALT} />\n <span>Blaze admin</span>\n </Link>\n <div\n role=\"button\"\n className=\"debug-sidebar__button open\"\n data-testid=\"debug-sidebar-button\"\n id=\"debug-sidebar-button\"\n onClick={() => setIsOpen(!isOpen)}>\n <i>\n <MdKeyboardArrowLeft />\n </i>\n </div>\n </div>\n ) : null}\n </>\n );\n};\n\nDebugSidebar.propTypes = {\n itemEntity: PropTypes.string,\n itemId: PropTypes.string,\n debugMode: PropTypes.bool\n};\n\nDebugSidebar.defaultProps = {\n itemEntity: '',\n itemId: '',\n debugMode: false\n};\n\nexport default DebugSidebar;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAClD,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,IAAI,QAAQ,8BAA8B;AACnD,SAASC,mBAAmB,QAAQ,gBAAgB;AACpD,SAASC,cAAc,EAAEC,aAAa,QAAQ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CAACD,MAAM;EAAE,gBAClChB,KAAA,CAAAoB,aAAA,yBACEpB,KAAA,CAAAoB,aAAA,CAACd,mBAAmB,MAAE,CACrB,CACA,CACF,CAAC,GACJ,IACJ,CAAC;AAEP,CAAC;AAEDI,YAAY,CAACoB,SAAS,GAAG;EACvBnB,UAAU,EAAER,SAAS,CAAC4B,MAAM;EAC5BnB,MAAM,EAAET,SAAS,CAAC4B,MAAM;EACxBlB,SAAS,EAAEV,SAAS,CAAC6B;AACvB,CAAC;AAEDtB,YAAY,CAACuB,YAAY,GAAG;EAC1BtB,UAAU,EAAE,EAAE;EACdC,MAAM,EAAE,EAAE;EACVC,SAAS,EAAE;AACb,CAAC;AAED,eAAeH,YAAY","ignoreList":[]}
|
|
@@ -4,14 +4,14 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import { parseUrl } from 'query-string';
|
|
5
5
|
import { getUnpublishedEntityName } from '@blaze-cms/react-page-builder';
|
|
6
6
|
import { checkAccessToken } from '@blaze-cms/core-auth-ui';
|
|
7
|
-
import { HTTPS, DOUBLE_SLASH, COLON, NOT_FOUND_STATUS_CODE, BLAZE_X_FRAME_OPTIONS_DEFAULT } from '../constants';
|
|
7
|
+
import { HTTPS, DOUBLE_SLASH, COLON, NOT_FOUND_STATUS_CODE, BLAZE_X_FRAME_OPTIONS_DEFAULT, ROUTE_REGEX } from '../constants';
|
|
8
8
|
import { checkUrlQuery } from '../application/query';
|
|
9
9
|
import checkParent from './check-parent';
|
|
10
10
|
import checkPreviewUrl from './check-preview-url';
|
|
11
11
|
import handleStaticRoutes from './handle-static-routes';
|
|
12
12
|
import getPageData from './get-page-data';
|
|
13
13
|
import getRootSelectorClasses from './get-root-selector-classes';
|
|
14
|
-
const getRootClassesLimit = () => Number(process.env.BLAZE_ROOT_SELECTOR_CLASSES_LIMIT
|
|
14
|
+
const getRootClassesLimit = () => Number(process.env.BLAZE_ROOT_SELECTOR_CLASSES_LIMIT);
|
|
15
15
|
const checkUrl = async props => {
|
|
16
16
|
const {
|
|
17
17
|
asPath,
|
|
@@ -105,6 +105,9 @@ const doUrlCheck = async ({
|
|
|
105
105
|
blazeApp
|
|
106
106
|
}) => {
|
|
107
107
|
try {
|
|
108
|
+
if (!ROUTE_REGEX.test(url)) {
|
|
109
|
+
throw Error('Invalid URL');
|
|
110
|
+
}
|
|
108
111
|
const {
|
|
109
112
|
data: {
|
|
110
113
|
checkUrl: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-url.js","names":["parseUrl","getUnpublishedEntityName","checkAccessToken","HTTPS","DOUBLE_SLASH","COLON","NOT_FOUND_STATUS_CODE","BLAZE_X_FRAME_OPTIONS_DEFAULT","checkUrlQuery","checkParent","checkPreviewUrl","handleStaticRoutes","getPageData","getRootSelectorClasses","getRootClassesLimit","Number","process","env","BLAZE_ROOT_SELECTOR_CLASSES_LIMIT","checkUrl","props","asPath","apolloClient","res","req","query","blazeApp","disableSsr","fullUrl","getFullUrl","url","BLAZE_STATUS_URL","isStatusPage","handler","getHandler","setHeader","BLAZE_X_FRAME_OPTIONS","getHeader","BLAZE_CACHE_CONTROL_HEADER","previewData","_objectSpread","Object","keys","cache","extract","length","getPreviewData","urlCheckOptions","result","doUrlCheck","handle404Error","pageData","rootSelectorClasses","isPreview","getHost","headers","BLAZE_FRONTEND_HOST","host","location","protocol","hostname","port","window","urlPort","data","itemId","itemEntity","urlTo","variables","cacheControlMaxAge","redirectUrl","BLAZE_DISABLE_REDIRECT_WITH_QUERY","queryString","split","doRedirect","redirecting","err","parentPATH","handleError","events","emit","error","networkError","writeHead","write","end","graphQLErrors","statusCode","errorCode","Location","href"],"sources":["../../src/helpers/check-url.js"],"sourcesContent":["import { parseUrl } from 'query-string';\nimport { getUnpublishedEntityName } from '@blaze-cms/react-page-builder';\nimport { checkAccessToken } from '@blaze-cms/core-auth-ui';\nimport {\n HTTPS,\n DOUBLE_SLASH,\n COLON,\n NOT_FOUND_STATUS_CODE,\n BLAZE_X_FRAME_OPTIONS_DEFAULT\n} from '../constants';\nimport { checkUrlQuery } from '../application/query';\nimport checkParent from './check-parent';\nimport checkPreviewUrl from './check-preview-url';\nimport handleStaticRoutes from './handle-static-routes';\nimport getPageData from './get-page-data';\nimport getRootSelectorClasses from './get-root-selector-classes';\n\nconst getRootClassesLimit = () => Number(process.env.BLAZE_ROOT_SELECTOR_CLASSES_LIMIT || 1);\n\nconst checkUrl = async props => {\n const { asPath, apolloClient, res, req, query, blazeApp, disableSsr } = props;\n const fullUrl = getFullUrl(req, asPath);\n const { url } = parseUrl(asPath);\n\n if (process.env.BLAZE_STATUS_URL && url === process.env.BLAZE_STATUS_URL) {\n return { isStatusPage: true };\n }\n\n if (res) {\n const handler = handleStaticRoutes.getHandler(asPath);\n\n res.setHeader(\n 'X-Frame-Options',\n process.env.BLAZE_X_FRAME_OPTIONS || BLAZE_X_FRAME_OPTIONS_DEFAULT\n );\n\n if (!res.getHeader('Cache-Control')) {\n res.setHeader('Cache-Control', process.env.BLAZE_CACHE_CONTROL_HEADER || '');\n }\n\n if (handler) {\n return handler(props);\n }\n }\n\n const previewData = checkPreviewUrl(url, query);\n\n if (!previewData && disableSsr) return { disableSsr: true };\n\n await checkAccessToken(apolloClient, {\n ...props,\n disableSsr: !Object.keys(apolloClient.cache.extract()).length // empty cache means SSR was disabled\n });\n\n if (previewData) return getPreviewData(previewData, apolloClient);\n const urlCheckOptions = { asPath, url, apolloClient, res };\n const result = await doUrlCheck({\n ...urlCheckOptions,\n handle404Error: true,\n blazeApp\n });\n return { ...result, fullUrl } || {};\n};\n\nconst getPreviewData = async (previewData, apolloClient) => {\n const result = await getPageData({ ...previewData, apolloClient });\n const { pageData: { url } = {} } = result;\n const rootSelectorClasses = getRootSelectorClasses(url, getRootClassesLimit());\n return { ...previewData, rootSelectorClasses, ...result, isPreview: true };\n};\n\nconst getHost = ({ headers = {} }) =>\n process.env.BLAZE_FRONTEND_HOST ||\n headers['x-request-host'] ||\n headers['x-forwarded-host'] ||\n headers.host;\n\nconst getFullUrl = (req, asPath) => {\n if (req) {\n return `${HTTPS}${getHost(req)}${asPath}`;\n }\n const {\n location: { protocol, hostname, port }\n } = window;\n const urlPort = port ? `${COLON}${port}` : '';\n\n return `${protocol}${DOUBLE_SLASH}${hostname}${urlPort}${asPath}`;\n};\n\nconst doUrlCheck = async ({ asPath, url, apolloClient, res, handle404Error, blazeApp }) => {\n try {\n const {\n data: {\n checkUrl: { itemId, itemEntity, urlTo, pageData = {} }\n }\n } = await apolloClient.query({\n query: checkUrlQuery,\n variables: {\n url\n }\n });\n\n const { cacheControlMaxAge = null } = pageData || {}; // pageData can be null when there is no page\n if (res && cacheControlMaxAge !== null && cacheControlMaxAge >= 0) {\n res.setHeader('Cache-Control', `max-age=${cacheControlMaxAge}`);\n }\n\n if (urlTo && urlTo !== url) {\n let redirectUrl = urlTo;\n if (process.env.BLAZE_DISABLE_REDIRECT_WITH_QUERY !== 'true') {\n const queryString = asPath.split('?')[1];\n redirectUrl = queryString ? `${urlTo}?${queryString}` : urlTo;\n }\n\n doRedirect(res, redirectUrl);\n return { redirecting: true };\n }\n const rootSelectorClasses = getRootSelectorClasses(url, getRootClassesLimit());\n return {\n pageData,\n rootSelectorClasses,\n itemId,\n itemEntity: getUnpublishedEntityName(itemEntity)\n };\n } catch (err) {\n const parentPATH = checkParent(url);\n if (handle404Error && parentPATH) {\n doRedirect(res, parentPATH);\n } else {\n return handleError(err, res, handle404Error, blazeApp);\n }\n\n return handle404Error ? {} : null;\n }\n};\n\nconst handleError = (err, res, handle404Error, blazeApp) => {\n blazeApp.events.emit('monitor:log', { error: err });\n\n if (!res) return {};\n if (err.networkError) {\n res.writeHead(500, { 'Content-Type': 'text/plain' });\n res.write('500 Internal Server Error\\n');\n res.end();\n } else if (handle404Error && err.graphQLErrors && err.graphQLErrors.length) {\n res.statusCode = NOT_FOUND_STATUS_CODE;\n return { errorCode: NOT_FOUND_STATUS_CODE };\n }\n\n return {};\n};\n\nfunction doRedirect(res, redirectUrl) {\n if (res) {\n res.writeHead(301, { Location: redirectUrl });\n res.end();\n } else {\n window.location.href = redirectUrl;\n }\n}\n\nexport default checkUrl;\n"],"mappings":";;;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,wBAAwB,QAAQ,+BAA+B;AACxE,SAASC,gBAAgB,QAAQ,yBAAyB;AAC1D,SACEC,KAAK,EACLC,YAAY,EACZC,KAAK,EACLC,qBAAqB,EACrBC,6BAA6B,QACxB,cAAc;AACrB,SAASC,aAAa,QAAQ,sBAAsB;AACpD,OAAOC,WAAW,MAAM,gBAAgB;AACxC,OAAOC,eAAe,MAAM,qBAAqB;AACjD,OAAOC,kBAAkB,MAAM,wBAAwB;AACvD,OAAOC,WAAW,MAAM,iBAAiB;AACzC,OAAOC,sBAAsB,MAAM,6BAA6B;AAEhE,MAAMC,mBAAmB,GAAGA,CAAA,KAAMC,MAAM,CAACC,OAAO,CAACC,GAAG,CAACC,iCAAiC,IAAI,CAAC,CAAC;AAE5F,MAAMC,QAAQ,GAAG,MAAMC,KAAK,IAAI;EAC9B,MAAM;IAAEC,MAAM;IAAEC,YAAY;IAAEC,GAAG;IAAEC,GAAG;IAAEC,KAAK;IAAEC,QAAQ;IAAEC;EAAW,CAAC,GAAGP,KAAK;EAC7E,MAAMQ,OAAO,GAAGC,UAAU,CAACL,GAAG,EAAEH,MAAM,CAAC;EACvC,MAAM;IAAES;EAAI,CAAC,GAAG9B,QAAQ,CAACqB,MAAM,CAAC;EAEhC,IAAIL,OAAO,CAACC,GAAG,CAACc,gBAAgB,IAAID,GAAG,KAAKd,OAAO,CAACC,GAAG,CAACc,gBAAgB,EAAE;IACxE,OAAO;MAAEC,YAAY,EAAE;IAAK,CAAC;EAC/B;EAEA,IAAIT,GAAG,EAAE;IACP,MAAMU,OAAO,GAAGtB,kBAAkB,CAACuB,UAAU,CAACb,MAAM,CAAC;IAErDE,GAAG,CAACY,SAAS,CACX,iBAAiB,EACjBnB,OAAO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AE2B,cAAc,EAAExB,QAAQ,CAAC;IACxD;IAEA,OAAOwB,cAAc,GAAG,CAAC,CAAC,GAAG,IAAI;EACnC;AACF,CAAC;AAED,MAAM4B,WAAW,GAAGA,CAACF,GAAG,EAAErD,GAAG,EAAE2B,cAAc,EAAExB,QAAQ,KAAK;EAC1DA,QAAQ,CAACqD,MAAM,CAACC,IAAI,CAAC,aAAa,EAAE;IAAEC,KAAK,EAAEL;EAAI,CAAC,CAAC;EAEnD,IAAI,CAACrD,GAAG,EAAE,OAAO,CAAC,CAAC;EACnB,IAAIqD,GAAG,CAACM,YAAY,EAAE;IACpB3D,GAAG,CAAC4D,SAAS,CAAC,GAAG,EAAE;MAAE,cAAc,EAAE;IAAa,CAAC,CAAC;IACpD5D,GAAG,CAAC6D,KAAK,CAAC,6BAA6B,CAAC;IACxC7D,GAAG,CAAC8D,GAAG,CAAC,CAAC;EACX,CAAC,MAAM,IAAInC,cAAc,IAAI0B,GAAG,CAACU,aAAa,IAAIV,GAAG,CAACU,aAAa,CAACzC,MAAM,EAAE;IAC1EtB,GAAG,CAACgE,UAAU,GAAGjF,qBAAqB;IACtC,OAAO;MAAEkF,SAAS,EAAElF;IAAsB,CAAC;EAC7C;EAEA,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAASoE,UAAUA,CAACnD,GAAG,EAAE+C,WAAW,EAAE;EACpC,IAAI/C,GAAG,EAAE;IACPA,GAAG,CAAC4D,SAAS,CAAC,GAAG,EAAE;MAAEM,QAAQ,EAAEnB;IAAY,CAAC,CAAC;IAC7C/C,GAAG,CAAC8D,GAAG,CAAC,CAAC;EACX,CAAC,MAAM;IACLvB,MAAM,CAACJ,QAAQ,CAACgC,IAAI,GAAGpB,WAAW;EACpC;AACF;AAEA,eAAenD,QAAQ","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"check-url.js","names":["parseUrl","getUnpublishedEntityName","checkAccessToken","HTTPS","DOUBLE_SLASH","COLON","NOT_FOUND_STATUS_CODE","BLAZE_X_FRAME_OPTIONS_DEFAULT","ROUTE_REGEX","checkUrlQuery","checkParent","checkPreviewUrl","handleStaticRoutes","getPageData","getRootSelectorClasses","getRootClassesLimit","Number","process","env","BLAZE_ROOT_SELECTOR_CLASSES_LIMIT","checkUrl","props","asPath","apolloClient","res","req","query","blazeApp","disableSsr","fullUrl","getFullUrl","url","BLAZE_STATUS_URL","isStatusPage","handler","getHandler","setHeader","BLAZE_X_FRAME_OPTIONS","getHeader","BLAZE_CACHE_CONTROL_HEADER","previewData","_objectSpread","Object","keys","cache","extract","length","getPreviewData","urlCheckOptions","result","doUrlCheck","handle404Error","pageData","rootSelectorClasses","isPreview","getHost","headers","BLAZE_FRONTEND_HOST","host","location","protocol","hostname","port","window","urlPort","test","Error","data","itemId","itemEntity","urlTo","variables","cacheControlMaxAge","redirectUrl","BLAZE_DISABLE_REDIRECT_WITH_QUERY","queryString","split","doRedirect","redirecting","err","parentPATH","handleError","events","emit","error","networkError","writeHead","write","end","graphQLErrors","statusCode","errorCode","Location","href"],"sources":["../../src/helpers/check-url.js"],"sourcesContent":["import { parseUrl } from 'query-string';\nimport { getUnpublishedEntityName } from '@blaze-cms/react-page-builder';\nimport { checkAccessToken } from '@blaze-cms/core-auth-ui';\nimport {\n HTTPS,\n DOUBLE_SLASH,\n COLON,\n NOT_FOUND_STATUS_CODE,\n BLAZE_X_FRAME_OPTIONS_DEFAULT,\n ROUTE_REGEX\n} from '../constants';\nimport { checkUrlQuery } from '../application/query';\nimport checkParent from './check-parent';\nimport checkPreviewUrl from './check-preview-url';\nimport handleStaticRoutes from './handle-static-routes';\nimport getPageData from './get-page-data';\nimport getRootSelectorClasses from './get-root-selector-classes';\n\nconst getRootClassesLimit = () => Number(process.env.BLAZE_ROOT_SELECTOR_CLASSES_LIMIT);\n\nconst checkUrl = async props => {\n const { asPath, apolloClient, res, req, query, blazeApp, disableSsr } = props;\n const fullUrl = getFullUrl(req, asPath);\n const { url } = parseUrl(asPath);\n\n if (process.env.BLAZE_STATUS_URL && url === process.env.BLAZE_STATUS_URL) {\n return { isStatusPage: true };\n }\n\n if (res) {\n const handler = handleStaticRoutes.getHandler(asPath);\n\n res.setHeader(\n 'X-Frame-Options',\n process.env.BLAZE_X_FRAME_OPTIONS || BLAZE_X_FRAME_OPTIONS_DEFAULT\n );\n\n if (!res.getHeader('Cache-Control')) {\n res.setHeader('Cache-Control', process.env.BLAZE_CACHE_CONTROL_HEADER || '');\n }\n\n if (handler) {\n return handler(props);\n }\n }\n\n const previewData = checkPreviewUrl(url, query);\n\n if (!previewData && disableSsr) return { disableSsr: true };\n\n await checkAccessToken(apolloClient, {\n ...props,\n disableSsr: !Object.keys(apolloClient.cache.extract()).length // empty cache means SSR was disabled\n });\n\n if (previewData) return getPreviewData(previewData, apolloClient);\n const urlCheckOptions = { asPath, url, apolloClient, res };\n const result = await doUrlCheck({\n ...urlCheckOptions,\n handle404Error: true,\n blazeApp\n });\n return { ...result, fullUrl } || {};\n};\n\nconst getPreviewData = async (previewData, apolloClient) => {\n const result = await getPageData({ ...previewData, apolloClient });\n const { pageData: { url } = {} } = result;\n const rootSelectorClasses = getRootSelectorClasses(url, getRootClassesLimit());\n return { ...previewData, rootSelectorClasses, ...result, isPreview: true };\n};\n\nconst getHost = ({ headers = {} }) =>\n process.env.BLAZE_FRONTEND_HOST ||\n headers['x-request-host'] ||\n headers['x-forwarded-host'] ||\n headers.host;\n\nconst getFullUrl = (req, asPath) => {\n if (req) {\n return `${HTTPS}${getHost(req)}${asPath}`;\n }\n const {\n location: { protocol, hostname, port }\n } = window;\n const urlPort = port ? `${COLON}${port}` : '';\n\n return `${protocol}${DOUBLE_SLASH}${hostname}${urlPort}${asPath}`;\n};\n\nconst doUrlCheck = async ({ asPath, url, apolloClient, res, handle404Error, blazeApp }) => {\n try {\n if (!ROUTE_REGEX.test(url)) {\n throw Error('Invalid URL');\n }\n const {\n data: {\n checkUrl: { itemId, itemEntity, urlTo, pageData = {} }\n }\n } = await apolloClient.query({\n query: checkUrlQuery,\n variables: {\n url\n }\n });\n const { cacheControlMaxAge = null } = pageData || {}; // pageData can be null when there is no page\n if (res && cacheControlMaxAge !== null && cacheControlMaxAge >= 0) {\n res.setHeader('Cache-Control', `max-age=${cacheControlMaxAge}`);\n }\n\n if (urlTo && urlTo !== url) {\n let redirectUrl = urlTo;\n if (process.env.BLAZE_DISABLE_REDIRECT_WITH_QUERY !== 'true') {\n const queryString = asPath.split('?')[1];\n redirectUrl = queryString ? `${urlTo}?${queryString}` : urlTo;\n }\n\n doRedirect(res, redirectUrl);\n return { redirecting: true };\n }\n const rootSelectorClasses = getRootSelectorClasses(url, getRootClassesLimit());\n return {\n pageData,\n rootSelectorClasses,\n itemId,\n itemEntity: getUnpublishedEntityName(itemEntity)\n };\n } catch (err) {\n const parentPATH = checkParent(url);\n if (handle404Error && parentPATH) {\n doRedirect(res, parentPATH);\n } else {\n return handleError(err, res, handle404Error, blazeApp);\n }\n\n return handle404Error ? {} : null;\n }\n};\n\nconst handleError = (err, res, handle404Error, blazeApp) => {\n blazeApp.events.emit('monitor:log', { error: err });\n if (!res) return {};\n if (err.networkError) {\n res.writeHead(500, { 'Content-Type': 'text/plain' });\n res.write('500 Internal Server Error\\n');\n res.end();\n } else if (handle404Error && err.graphQLErrors && err.graphQLErrors.length) {\n res.statusCode = NOT_FOUND_STATUS_CODE;\n return { errorCode: NOT_FOUND_STATUS_CODE };\n }\n\n return {};\n};\n\nfunction doRedirect(res, redirectUrl) {\n if (res) {\n res.writeHead(301, { Location: redirectUrl });\n res.end();\n } else {\n window.location.href = redirectUrl;\n }\n}\n\nexport default checkUrl;\n"],"mappings":";;;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,wBAAwB,QAAQ,+BAA+B;AACxE,SAASC,gBAAgB,QAAQ,yBAAyB;AAC1D,SACEC,KAAK,EACLC,YAAY,EACZC,KAAK,EACLC,qBAAqB,EACrBC,6BAA6B,EAC7BC,WAAW,QACN,cAAc;AACrB,SAASC,aAAa,QAA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AAa,EAAE;IAAEC,KAAK,EAAEL;EAAI,CAAC,CAAC;EACnD,IAAI,CAACvD,GAAG,EAAE,OAAO,CAAC,CAAC;EACnB,IAAIuD,GAAG,CAACM,YAAY,EAAE;IACpB7D,GAAG,CAAC8D,SAAS,CAAC,GAAG,EAAE;MAAE,cAAc,EAAE;IAAa,CAAC,CAAC;IACpD9D,GAAG,CAAC+D,KAAK,CAAC,6BAA6B,CAAC;IACxC/D,GAAG,CAACgE,GAAG,CAAC,CAAC;EACX,CAAC,MAAM,IAAIrC,cAAc,IAAI4B,GAAG,CAACU,aAAa,IAAIV,GAAG,CAACU,aAAa,CAAC3C,MAAM,EAAE;IAC1EtB,GAAG,CAACkE,UAAU,GAAGpF,qBAAqB;IACtC,OAAO;MAAEqF,SAAS,EAAErF;IAAsB,CAAC;EAC7C;EAEA,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAASuE,UAAUA,CAACrD,GAAG,EAAEiD,WAAW,EAAE;EACpC,IAAIjD,GAAG,EAAE;IACPA,GAAG,CAAC8D,SAAS,CAAC,GAAG,EAAE;MAAEM,QAAQ,EAAEnB;IAAY,CAAC,CAAC;IAC7CjD,GAAG,CAACgE,GAAG,CAAC,CAAC;EACX,CAAC,MAAM;IACLzB,MAAM,CAACJ,QAAQ,CAACkC,IAAI,GAAGpB,WAAW;EACpC;AACF;AAEA,eAAerD,QAAQ","ignoreList":[]}
|
package/lib-es/index.js
CHANGED
|
@@ -5,5 +5,5 @@ export { MainContext, MainContextProvider } from '@blaze-cms/nextjs-components';
|
|
|
5
5
|
export { default as withBlaze } from './hoc/withBlaze';
|
|
6
6
|
export { default as Resolver } from './pages/Resolver';
|
|
7
7
|
export { default as BlazeDocument } from './pages/document/_document';
|
|
8
|
-
export { default as router } from './server/routes';
|
|
8
|
+
// export { default as router } from './server/routes';
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
package/lib-es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["reactApollo","SearchPublishedContent","MainContext","MainContextProvider","default","withBlaze","Resolver","BlazeDocument"
|
|
1
|
+
{"version":3,"file":"index.js","names":["reactApollo","SearchPublishedContent","MainContext","MainContextProvider","default","withBlaze","Resolver","BlazeDocument"],"sources":["../src/index.js"],"sourcesContent":["import * as reactApollo from '@apollo/client';\n\nexport { reactApollo };\nexport { SearchPublishedContent } from '@blaze-cms/plugin-search-ui';\nexport { MainContext, MainContextProvider } from '@blaze-cms/nextjs-components';\nexport { default as withBlaze } from './hoc/withBlaze';\nexport { default as Resolver } from './pages/Resolver';\nexport { default as BlazeDocument } from './pages/document/_document';\n// export { default as router } from './server/routes';\n"],"mappings":"AAAA,OAAO,KAAKA,WAAW,MAAM,gBAAgB;AAE7C,SAASA,WAAW;AACpB,SAASC,sBAAsB,QAAQ,6BAA6B;AACpE,SAASC,WAAW,EAAEC,mBAAmB,QAAQ,8BAA8B;AAC/E,SAASC,OAAO,IAAIC,SAAS,QAAQ,iBAAiB;AACtD,SAASD,OAAO,IAAIE,QAAQ,QAAQ,kBAAkB;AACtD,SAASF,OAAO,IAAIG,aAAa,QAAQ,4BAA4B;AACrE","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Resolver.js","names":["React","NextError","useRouter","PropTypes","DebugSidebar","checkUrl","ContentContainer","NOT_FOUND_STATUS_CODE","RESOLVER_CONTAINER_CLASS","Resolver","props","pageData","itemId","itemEntity","isStatusPage","fullUrl","disableSsr","rootSelectorClasses","isPreview","errorCode","errorMessage","redirecting","router","window","asPath","location","hash","url","URL","href","searchParams","set","Date","now","push","createElement","statusCode","title","className","getInitialProps","propTypes","string","object","bool","number","defaultProps"],"sources":["../../src/pages/Resolver.js"],"sourcesContent":["import React from 'react';\nimport NextError from 'next/error';\nimport { useRouter } from 'next/router';\nimport PropTypes from 'prop-types';\nimport { DebugSidebar } from '../components';\nimport { checkUrl } from '../helpers';\nimport { ContentContainer } from '../containers';\nimport { NOT_FOUND_STATUS_CODE, RESOLVER_CONTAINER_CLASS } from '../constants';\n\nconst Resolver = props => {\n const {\n pageData,\n itemId,\n itemEntity,\n isStatusPage,\n fullUrl,\n disableSsr,\n rootSelectorClasses = RESOLVER_CONTAINER_CLASS,\n isPreview = false,\n errorCode = NOT_FOUND_STATUS_CODE,\n errorMessage = null,\n redirecting = false\n } = props;\n\n const router = useRouter();\n\n if (disableSsr) {\n if (typeof window !== 'undefined') {\n let { asPath } = router;\n if (window.location.hash) {\n // handle nextjs issue not calling getInitialProps if pushing a url with a hash in it\n // we add a new query string param to force calling getInitialProps\n // this should only happen if disableSsr and window.location.hash\n const url = new URL(router.asPath, window.location.href);\n if (url.hash) url.searchParams.set('_h', Date.now());\n asPath = url;\n }\n router.push('/Resolver', asPath);\n }\n return '';\n }\n\n if (redirecting) return null;\n\n if (isStatusPage) return 'OK';\n\n if (!pageData || !itemId || !itemEntity)\n return <NextError statusCode={errorCode} title={errorMessage} />;\n\n return (\n <div className={rootSelectorClasses}>\n <ContentContainer\n pageData={pageData}\n itemId={itemId}\n itemEntity={itemEntity}\n isPreview={isPreview}\n fullUrl={fullUrl}\n />\n
|
|
1
|
+
{"version":3,"file":"Resolver.js","names":["React","NextError","useRouter","PropTypes","DebugSidebar","checkUrl","ContentContainer","NOT_FOUND_STATUS_CODE","RESOLVER_CONTAINER_CLASS","Resolver","props","pageData","itemId","itemEntity","isStatusPage","fullUrl","disableSsr","rootSelectorClasses","isPreview","errorCode","errorMessage","redirecting","router","window","asPath","location","hash","url","URL","href","searchParams","set","Date","now","push","createElement","statusCode","title","className","getInitialProps","propTypes","string","object","bool","number","defaultProps"],"sources":["../../src/pages/Resolver.js"],"sourcesContent":["import React from 'react';\nimport NextError from 'next/error';\nimport { useRouter } from 'next/router';\nimport PropTypes from 'prop-types';\nimport { DebugSidebar } from '../components';\nimport { checkUrl } from '../helpers';\nimport { ContentContainer } from '../containers';\nimport { NOT_FOUND_STATUS_CODE, RESOLVER_CONTAINER_CLASS } from '../constants';\n\nconst Resolver = props => {\n const {\n pageData,\n itemId,\n itemEntity,\n isStatusPage,\n fullUrl,\n disableSsr,\n rootSelectorClasses = RESOLVER_CONTAINER_CLASS,\n isPreview = false,\n errorCode = NOT_FOUND_STATUS_CODE,\n errorMessage = null,\n redirecting = false\n } = props;\n\n const router = useRouter();\n\n if (disableSsr) {\n if (typeof window !== 'undefined') {\n let { asPath } = router;\n if (window.location.hash) {\n // handle nextjs issue not calling getInitialProps if pushing a url with a hash in it\n // we add a new query string param to force calling getInitialProps\n // this should only happen if disableSsr and window.location.hash\n const url = new URL(router.asPath, window.location.href);\n if (url.hash) url.searchParams.set('_h', Date.now());\n asPath = url;\n }\n\n router.push('/Resolver', asPath);\n }\n return '';\n }\n\n if (redirecting) return null;\n\n if (isStatusPage) return 'OK';\n\n if (!pageData || !itemId || !itemEntity)\n return <NextError statusCode={errorCode} title={errorMessage} />;\n\n return (\n <div className={rootSelectorClasses}>\n <ContentContainer\n pageData={pageData}\n itemId={itemId}\n itemEntity={itemEntity}\n isPreview={isPreview}\n fullUrl={fullUrl}\n />\n <DebugSidebar itemId={itemId} itemEntity={itemEntity} />\n </div>\n );\n};\n\nResolver.getInitialProps = async props => checkUrl(props);\n\nResolver.propTypes = {\n itemId: PropTypes.string,\n itemEntity: PropTypes.string,\n pageData: PropTypes.object,\n isStatusPage: PropTypes.bool,\n fullUrl: PropTypes.string,\n isPreview: PropTypes.bool,\n errorCode: PropTypes.number,\n disableSsr: PropTypes.bool,\n errorMessage: PropTypes.string,\n rootSelectorClasses: PropTypes.string,\n redirecting: PropTypes.bool\n};\n\nResolver.defaultProps = {\n itemId: null,\n itemEntity: null,\n pageData: null,\n isStatusPage: false,\n fullUrl: '',\n isPreview: false,\n errorCode: NOT_FOUND_STATUS_CODE,\n disableSsr: false,\n errorMessage: null,\n rootSelectorClasses: RESOLVER_CONTAINER_CLASS,\n redirecting: false\n};\n\nexport default Resolver;\n"],"mappings":"AAAA,OAAOA,KAAK,MAA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AO,EAAE,EAAE;EACXG,SAAS,EAAE,KAAK;EAChBC,SAAS,EAAEZ,qBAAqB;EAChCS,UAAU,EAAE,KAAK;EACjBI,YAAY,EAAE,IAAI;EAClBH,mBAAmB,EAAET,wBAAwB;EAC7Ca,WAAW,EAAE;AACf,CAAC;AAED,eAAeZ,QAAQ","ignoreList":[]}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import Document, { Html, Head } from 'next/document';
|
|
4
|
+
// import Head from 'next/head';
|
|
4
5
|
import DocumentBody from './DocumentBody';
|
|
5
6
|
import { renderAppleTags } from '../../helpers';
|
|
6
7
|
const BlazeDocument = ({
|
|
7
8
|
children
|
|
8
9
|
}) => /*#__PURE__*/React.createElement(Html, {
|
|
9
10
|
lang: "en"
|
|
10
|
-
}, /*#__PURE__*/React.createElement(Head, null,
|
|
11
|
-
rel: "icon",
|
|
12
|
-
href: "/static/img/favicon.png",
|
|
13
|
-
type: "image/x-icon"
|
|
14
|
-
}), renderAppleTags()), children);
|
|
11
|
+
}, /*#__PURE__*/React.createElement(Head, null, renderAppleTags()), children);
|
|
15
12
|
BlazeDocument.Document = Document;
|
|
16
13
|
BlazeDocument.Body = DocumentBody;
|
|
17
14
|
BlazeDocument.propTypes = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_document.js","names":["React","PropTypes","Document","Html","Head","DocumentBody","renderAppleTags","BlazeDocument","children","createElement","lang","
|
|
1
|
+
{"version":3,"file":"_document.js","names":["React","PropTypes","Document","Html","Head","DocumentBody","renderAppleTags","BlazeDocument","children","createElement","lang","Body","propTypes","object","isRequired"],"sources":["../../../src/pages/document/_document.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Document, { Html, Head } from 'next/document';\n// import Head from 'next/head';\nimport DocumentBody from './DocumentBody';\nimport { renderAppleTags } from '../../helpers';\n\nconst BlazeDocument = ({ children }) => (\n <Html lang=\"en\">\n <Head>\n {/* <link rel=\"icon\" href=\"/static/img/favicon.png\" type=\"image/x-icon\" /> */}\n {renderAppleTags()}\n </Head>\n {children}\n </Html>\n);\n\nBlazeDocument.Document = Document;\nBlazeDocument.Body = DocumentBody;\n\nBlazeDocument.propTypes = {\n children: PropTypes.object.isRequired\n};\n\nexport default BlazeDocument;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,QAAQ,IAAIC,IAAI,EAAEC,IAAI,QAAQ,eAAe;AACpD;AACA,OAAOC,YAAY,MAAM,gBAAgB;AACzC,SAASC,eAAe,QAAQ,eAAe;AAE/C,MAAMC,aAAa,GAAGA,CAAC;EAAEC;AAAS,CAAC,kBACjCR,KAAA,CAAAS,aAAA,CAACN,IAAI;EAACO,IAAI,EAAC;AAAI,gBACbV,KAAA,CAAAS,aAAA,CAACL,IAAI,QAEFE,eAAe,CAAC,CACb,CAAC,EACNE,QACG,CACP;AAEDD,aAAa,CAACL,QAAQ,GAAGA,QAAQ;AACjCK,aAAa,CAACI,IAAI,GAAGN,YAAY;AAEjCE,aAAa,CAACK,SAAS,GAAG;EACxBJ,QAAQ,EAAEP,SAAS,CAACY,MAAM,CAACC;AAC7B,CAAC;AAED,eAAeP,aAAa","ignoreList":[]}
|
package/lib-es/server/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
const {
|
|
2
2
|
createServer
|
|
3
3
|
} = require('http');
|
|
4
|
-
const Router = require('./routes');
|
|
5
4
|
const port = parseInt(process.env.PORT, 10) || 3000;
|
|
6
|
-
async function prepareServer(
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
async function prepareServer(app) {
|
|
6
|
+
// eslint-disable-next-line no-console
|
|
7
|
+
console.warn('server.js is deprecated. Run directly with "next" cli instead.');
|
|
8
|
+
const handler = app.getRequestHandler();
|
|
9
|
+
await app.prepare();
|
|
9
10
|
return {
|
|
10
11
|
run: () => createServer(handler).listen(port),
|
|
11
12
|
handler
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["createServer","require","
|
|
1
|
+
{"version":3,"file":"index.js","names":["createServer","require","port","parseInt","process","env","PORT","prepareServer","app","console","warn","handler","getRequestHandler","prepare","run","listen","module","exports"],"sources":["../../src/server/index.js"],"sourcesContent":["const { createServer } = require('http');\n\nconst port = parseInt(process.env.PORT, 10) || 3000;\n\nasync function prepareServer(app) {\n // eslint-disable-next-line no-console\n console.warn('server.js is deprecated. Run directly with \"next\" cli instead.');\n const handler = app.getRequestHandler();\n\n await app.prepare();\n\n return { run: () => createServer(handler).listen(port), handler };\n}\n\nmodule.exports = prepareServer;\n"],"mappings":"AAAA,MAAM;EAAEA;AAAa,CAAC,GAAGC,OAAO,CAAC,MAAM,CAAC;AAExC,MAAMC,IAAI,GAAGC,QAAQ,CAACC,OAAO,CAACC,GAAG,CAACC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI;AAEnD,eAAeC,aAAaA,CAACC,GAAG,EAAE;EAChC;EACAC,OAAO,CAACC,IAAI,CAAC,gEAAgE,CAAC;EAC9E,MAAMC,OAAO,GAAGH,GAAG,CAACI,iBAAiB,CAAC,CAAC;EAEvC,MAAMJ,GAAG,CAACK,OAAO,CAAC,CAAC;EAEnB,OAAO;IAAEC,GAAG,EAAEA,CAAA,KAAMd,YAAY,CAACW,OAAO,CAAC,CAACI,MAAM,CAACb,IAAI,CAAC;IAAES;EAAQ,CAAC;AACnE;AAEAK,MAAM,CAACC,OAAO,GAAGV,aAAa","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cms/nextjs-tools",
|
|
3
|
-
"version": "0.146.0-
|
|
3
|
+
"version": "0.146.0-node18.0",
|
|
4
4
|
"description": "Blaze nextjs tools",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-es/index.js",
|
|
@@ -10,15 +10,15 @@
|
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
12
|
"test": "jest",
|
|
13
|
-
"lint": "
|
|
13
|
+
"lint": "npm run lint:js",
|
|
14
14
|
"lint:js": "eslint .",
|
|
15
15
|
"clean": "rm -Rf ./lib/ && rm -Rf ./lib-es/",
|
|
16
16
|
"build:cjs": "BABEL_ENV=cjs ../../node_modules/.bin/babel ./src --out-dir ./lib --source-maps --root-mode upward",
|
|
17
17
|
"build:esm": "BABEL_ENV=esm ../../node_modules/.bin/babel ./src --out-dir ./lib-es --source-maps --root-mode upward",
|
|
18
|
-
"build": "
|
|
19
|
-
"build:clean": "
|
|
20
|
-
"prepublishOnly": "
|
|
21
|
-
"postpublish": "
|
|
18
|
+
"build": "npm run build:cjs && npm run build:esm",
|
|
19
|
+
"build:clean": "npm run clean && npm run build",
|
|
20
|
+
"prepublishOnly": "npm run build:clean",
|
|
21
|
+
"postpublish": "npm run clean"
|
|
22
22
|
},
|
|
23
23
|
"author": {
|
|
24
24
|
"email": "hello@thebyte9.com",
|
|
@@ -27,26 +27,26 @@
|
|
|
27
27
|
},
|
|
28
28
|
"license": "GPL-3.0",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@apollo/client": "3.
|
|
31
|
-
"@blaze-cms/core-auth-ui": "0.146.0-
|
|
32
|
-
"@blaze-cms/core-errors": "0.146.0-
|
|
33
|
-
"@blaze-cms/core-errors-ui": "0.
|
|
34
|
-
"@blaze-cms/core-ui": "0.146.0-
|
|
35
|
-
"@blaze-cms/nextjs-components": "0.146.0-
|
|
36
|
-
"@blaze-cms/plugin-auth-fe": "0.146.0-
|
|
37
|
-
"@blaze-cms/plugin-auth-local-fe": "0.146.0-
|
|
38
|
-
"@blaze-cms/plugin-google-maps-fe": "0.146.0-
|
|
39
|
-
"@blaze-cms/plugin-gtm-fe": "0.146.0-
|
|
40
|
-
"@blaze-cms/plugin-page-builder-fe": "0.146.0-
|
|
41
|
-
"@blaze-cms/plugin-preview-fe": "0.146.0-
|
|
42
|
-
"@blaze-cms/plugin-search-ui": "0.146.0-
|
|
43
|
-
"@blaze-cms/plugin-structured-data-fe": "0.
|
|
44
|
-
"@blaze-cms/react-page-builder": "0.146.0-
|
|
45
|
-
"@blaze-cms/setup-ui": "0.
|
|
30
|
+
"@apollo/client": "^3.9.2",
|
|
31
|
+
"@blaze-cms/core-auth-ui": "0.146.0-node18.0",
|
|
32
|
+
"@blaze-cms/core-errors": "0.146.0-node18.0",
|
|
33
|
+
"@blaze-cms/core-errors-ui": "0.146.0-node18.0",
|
|
34
|
+
"@blaze-cms/core-ui": "0.146.0-node18.0",
|
|
35
|
+
"@blaze-cms/nextjs-components": "0.146.0-node18.0",
|
|
36
|
+
"@blaze-cms/plugin-auth-fe": "0.146.0-node18.0",
|
|
37
|
+
"@blaze-cms/plugin-auth-local-fe": "0.146.0-node18.0",
|
|
38
|
+
"@blaze-cms/plugin-google-maps-fe": "0.146.0-node18.0",
|
|
39
|
+
"@blaze-cms/plugin-gtm-fe": "0.146.0-node18.0",
|
|
40
|
+
"@blaze-cms/plugin-page-builder-fe": "0.146.0-node18.0",
|
|
41
|
+
"@blaze-cms/plugin-preview-fe": "0.146.0-node18.0",
|
|
42
|
+
"@blaze-cms/plugin-search-ui": "0.146.0-node18.0",
|
|
43
|
+
"@blaze-cms/plugin-structured-data-fe": "0.146.0-node18.0",
|
|
44
|
+
"@blaze-cms/react-page-builder": "0.146.0-node18.0",
|
|
45
|
+
"@blaze-cms/setup-ui": "0.146.0-node18.0",
|
|
46
46
|
"autoprefixer": "^10.2.3",
|
|
47
47
|
"core-js": "^3.2.1",
|
|
48
48
|
"cross-fetch": "^3.0.2",
|
|
49
|
-
"graphql": "^
|
|
49
|
+
"graphql": "^15.2.0",
|
|
50
50
|
"jsonwebtoken": "^8.5.1",
|
|
51
51
|
"nextjs-dynamic-routes": "^2.5.1",
|
|
52
52
|
"postcss": "8.2.8",
|
|
@@ -58,9 +58,9 @@
|
|
|
58
58
|
"sass": "1.32.8"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"next": "
|
|
61
|
+
"next": "14.1.0",
|
|
62
62
|
"prop-types": "^15.7.2",
|
|
63
|
-
"react": "^
|
|
63
|
+
"react": "^18.2.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"nock": "^13.0.5"
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"lib/*",
|
|
70
70
|
"lib-es/*"
|
|
71
71
|
],
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "c60370714e89e0c96f2169d61e4c56bc542f7686"
|
|
73
73
|
}
|
|
@@ -10,14 +10,11 @@ const DebugSidebar = ({ itemEntity, itemId, debugMode }) => {
|
|
|
10
10
|
const [isDebugMode, setIsDebugMode] = useState(debugMode);
|
|
11
11
|
const [isOpen, setIsOpen] = useState(true);
|
|
12
12
|
|
|
13
|
-
useEffect(
|
|
14
|
-
()
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
[debugMode]
|
|
20
|
-
);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (debugMode === true) {
|
|
15
|
+
setIsDebugMode(debugMode);
|
|
16
|
+
} else setBlazeDebug(setIsDebugMode);
|
|
17
|
+
}, [debugMode]);
|
|
21
18
|
|
|
22
19
|
const divClass = classnames('debug-sidebar', {
|
|
23
20
|
'debug-sidebar--open': isOpen,
|
package/src/helpers/check-url.js
CHANGED
|
@@ -6,7 +6,8 @@ import {
|
|
|
6
6
|
DOUBLE_SLASH,
|
|
7
7
|
COLON,
|
|
8
8
|
NOT_FOUND_STATUS_CODE,
|
|
9
|
-
BLAZE_X_FRAME_OPTIONS_DEFAULT
|
|
9
|
+
BLAZE_X_FRAME_OPTIONS_DEFAULT,
|
|
10
|
+
ROUTE_REGEX
|
|
10
11
|
} from '../constants';
|
|
11
12
|
import { checkUrlQuery } from '../application/query';
|
|
12
13
|
import checkParent from './check-parent';
|
|
@@ -15,7 +16,7 @@ import handleStaticRoutes from './handle-static-routes';
|
|
|
15
16
|
import getPageData from './get-page-data';
|
|
16
17
|
import getRootSelectorClasses from './get-root-selector-classes';
|
|
17
18
|
|
|
18
|
-
const getRootClassesLimit = () => Number(process.env.BLAZE_ROOT_SELECTOR_CLASSES_LIMIT
|
|
19
|
+
const getRootClassesLimit = () => Number(process.env.BLAZE_ROOT_SELECTOR_CLASSES_LIMIT);
|
|
19
20
|
|
|
20
21
|
const checkUrl = async props => {
|
|
21
22
|
const { asPath, apolloClient, res, req, query, blazeApp, disableSsr } = props;
|
|
@@ -89,6 +90,9 @@ const getFullUrl = (req, asPath) => {
|
|
|
89
90
|
|
|
90
91
|
const doUrlCheck = async ({ asPath, url, apolloClient, res, handle404Error, blazeApp }) => {
|
|
91
92
|
try {
|
|
93
|
+
if (!ROUTE_REGEX.test(url)) {
|
|
94
|
+
throw Error('Invalid URL');
|
|
95
|
+
}
|
|
92
96
|
const {
|
|
93
97
|
data: {
|
|
94
98
|
checkUrl: { itemId, itemEntity, urlTo, pageData = {} }
|
|
@@ -99,7 +103,6 @@ const doUrlCheck = async ({ asPath, url, apolloClient, res, handle404Error, blaz
|
|
|
99
103
|
url
|
|
100
104
|
}
|
|
101
105
|
});
|
|
102
|
-
|
|
103
106
|
const { cacheControlMaxAge = null } = pageData || {}; // pageData can be null when there is no page
|
|
104
107
|
if (res && cacheControlMaxAge !== null && cacheControlMaxAge >= 0) {
|
|
105
108
|
res.setHeader('Cache-Control', `max-age=${cacheControlMaxAge}`);
|
|
@@ -136,7 +139,6 @@ const doUrlCheck = async ({ asPath, url, apolloClient, res, handle404Error, blaz
|
|
|
136
139
|
|
|
137
140
|
const handleError = (err, res, handle404Error, blazeApp) => {
|
|
138
141
|
blazeApp.events.emit('monitor:log', { error: err });
|
|
139
|
-
|
|
140
142
|
if (!res) return {};
|
|
141
143
|
if (err.networkError) {
|
|
142
144
|
res.writeHead(500, { 'Content-Type': 'text/plain' });
|
package/src/index.js
CHANGED
|
@@ -6,4 +6,4 @@ export { MainContext, MainContextProvider } from '@blaze-cms/nextjs-components';
|
|
|
6
6
|
export { default as withBlaze } from './hoc/withBlaze';
|
|
7
7
|
export { default as Resolver } from './pages/Resolver';
|
|
8
8
|
export { default as BlazeDocument } from './pages/document/_document';
|
|
9
|
-
export { default as router } from './server/routes';
|
|
9
|
+
// export { default as router } from './server/routes';
|
package/src/pages/Resolver.js
CHANGED
|
@@ -35,6 +35,7 @@ const Resolver = props => {
|
|
|
35
35
|
if (url.hash) url.searchParams.set('_h', Date.now());
|
|
36
36
|
asPath = url;
|
|
37
37
|
}
|
|
38
|
+
|
|
38
39
|
router.push('/Resolver', asPath);
|
|
39
40
|
}
|
|
40
41
|
return '';
|
|
@@ -56,7 +57,6 @@ const Resolver = props => {
|
|
|
56
57
|
isPreview={isPreview}
|
|
57
58
|
fullUrl={fullUrl}
|
|
58
59
|
/>
|
|
59
|
-
|
|
60
60
|
<DebugSidebar itemId={itemId} itemEntity={itemEntity} />
|
|
61
61
|
</div>
|
|
62
62
|
);
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import Document, { Html, Head } from 'next/document';
|
|
4
|
+
// import Head from 'next/head';
|
|
4
5
|
import DocumentBody from './DocumentBody';
|
|
5
6
|
import { renderAppleTags } from '../../helpers';
|
|
6
7
|
|
|
7
8
|
const BlazeDocument = ({ children }) => (
|
|
8
9
|
<Html lang="en">
|
|
9
10
|
<Head>
|
|
10
|
-
<link rel="icon" href="/static/img/favicon.png" type="image/x-icon" />
|
|
11
|
+
{/* <link rel="icon" href="/static/img/favicon.png" type="image/x-icon" /> */}
|
|
11
12
|
{renderAppleTags()}
|
|
12
13
|
</Head>
|
|
13
14
|
{children}
|
package/src/server/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
const { createServer } = require('http');
|
|
2
|
-
const Router = require('./routes');
|
|
3
2
|
|
|
4
3
|
const port = parseInt(process.env.PORT, 10) || 3000;
|
|
5
4
|
|
|
6
|
-
async function prepareServer(
|
|
7
|
-
|
|
5
|
+
async function prepareServer(app) {
|
|
6
|
+
// eslint-disable-next-line no-console
|
|
7
|
+
console.warn('server.js is deprecated. Run directly with "next" cli instead.');
|
|
8
|
+
const handler = app.getRequestHandler();
|
|
8
9
|
|
|
9
|
-
await
|
|
10
|
+
await app.prepare();
|
|
10
11
|
|
|
11
12
|
return { run: () => createServer(handler).listen(port), handler };
|
|
12
13
|
}
|
|
@@ -39,14 +39,12 @@ export const getStaticFileHandlerTests = (staticHandler, asPath, getVariables) =
|
|
|
39
39
|
});
|
|
40
40
|
|
|
41
41
|
describe('Standard', () => {
|
|
42
|
-
const scope = nock(host)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
'other-header': 'header'
|
|
49
|
-
});
|
|
42
|
+
const scope = nock(host).get(path).reply(200, responseText, {
|
|
43
|
+
etag,
|
|
44
|
+
'content-length': contentLength,
|
|
45
|
+
'last-modified': lastModified,
|
|
46
|
+
'other-header': 'header'
|
|
47
|
+
});
|
|
50
48
|
|
|
51
49
|
beforeAll(async () => {
|
|
52
50
|
await handler({ apolloClient, res, asPath });
|
|
@@ -82,9 +80,7 @@ export const getStaticFileHandlerTests = (staticHandler, asPath, getVariables) =
|
|
|
82
80
|
});
|
|
83
81
|
|
|
84
82
|
it('should not set headers if not present in file request', async () => {
|
|
85
|
-
const scopeNoHeaders = nock(host)
|
|
86
|
-
.get(path)
|
|
87
|
-
.reply(200, responseText);
|
|
83
|
+
const scopeNoHeaders = nock(host).get(path).reply(200, responseText);
|
|
88
84
|
res.setHeader.mockClear();
|
|
89
85
|
await handler({ apolloClient, res, asPath });
|
|
90
86
|
expect(scopeNoHeaders.isDone()).toEqual(true);
|
|
@@ -5,7 +5,7 @@ import { ROUTE_PATTERN_SITEMAP } from '../../../../src/constants';
|
|
|
5
5
|
import { handler } from '../../../../src/helpers/static-route-handlers/sitemap';
|
|
6
6
|
|
|
7
7
|
jest.mock('../../../../src/helpers/static-route-handlers/sitemap', () => ({
|
|
8
|
-
pattern:
|
|
8
|
+
pattern: /\/sitemap.xml/,
|
|
9
9
|
handler: jest.fn(async () => 'Sitemap content')
|
|
10
10
|
}));
|
|
11
11
|
|
|
@@ -29,7 +29,12 @@ jest.mock('@blaze-cms/core-ui', () => {
|
|
|
29
29
|
error: jest.fn()
|
|
30
30
|
},
|
|
31
31
|
openQueryChecker: {
|
|
32
|
-
checkOpenQueries: jest.fn(
|
|
32
|
+
checkOpenQueries: jest.fn(
|
|
33
|
+
() =>
|
|
34
|
+
new Promise(resolve => {
|
|
35
|
+
setTimeout(resolve, 1000);
|
|
36
|
+
})
|
|
37
|
+
)
|
|
33
38
|
}
|
|
34
39
|
};
|
|
35
40
|
return jest.fn(() => mockBlaze);
|
|
@@ -77,17 +82,12 @@ describe('withBlaze HOC', () => {
|
|
|
77
82
|
context.ctx.res = { ...defaultRes };
|
|
78
83
|
});
|
|
79
84
|
|
|
80
|
-
it('should be defined', () => {
|
|
81
|
-
expect(withBlaze).toBeDefined();
|
|
82
|
-
});
|
|
83
|
-
|
|
84
85
|
it('should wrap component and use buildConfig function', async () => {
|
|
85
86
|
const AppWithBlaze = withBlaze(App);
|
|
86
87
|
const { asFragment, queryByText } = render(<AppWithBlaze {...props} />);
|
|
87
88
|
|
|
88
89
|
await waitFor(() => expect(queryByText(appString)).toBeDefined());
|
|
89
90
|
|
|
90
|
-
expect(App).toHaveBeenCalledWith(...expectedProps);
|
|
91
91
|
expect(blazeMock.init).toHaveBeenCalledTimes(1);
|
|
92
92
|
expect(blazeMock.initComplete).toHaveBeenCalledTimes(2);
|
|
93
93
|
|