@uniweb/runtime 0.29.4 → 0.29.6
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/package.json +4 -4
- package/src/components/PageRenderer.jsx +10 -4
- package/src/index.jsx +10 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniweb/runtime",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.6",
|
|
4
4
|
"description": "Minimal runtime for loading Uniweb foundations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -36,15 +36,15 @@
|
|
|
36
36
|
"node": ">=20.19"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@uniweb/
|
|
40
|
-
"@uniweb/
|
|
39
|
+
"@uniweb/core": "^0.38.1",
|
|
40
|
+
"@uniweb/theming": "^0.2.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@vitejs/plugin-react": "^4.5.2",
|
|
44
44
|
"esbuild": "^0.21.0 || ^0.23.0 || ^0.24.0 || ^0.25.0 || ^0.27.0",
|
|
45
45
|
"vite": "^7.3.1",
|
|
46
46
|
"vitest": "^4.1.7",
|
|
47
|
-
"@uniweb/build": "0.
|
|
47
|
+
"@uniweb/build": "0.80.3"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"react": "^19.0.0",
|
|
@@ -13,6 +13,7 @@ import Layout from './Layout.jsx'
|
|
|
13
13
|
import { useHeadMeta } from '../hooks/useHeadMeta.js'
|
|
14
14
|
import { useSectionViews } from '../hooks/useSectionViews.js'
|
|
15
15
|
import { buildSectionOverrides } from '@uniweb/theming'
|
|
16
|
+
import { carryQuery } from '@uniweb/core/resolve-route'
|
|
16
17
|
import { Default404 } from '../default-404.js'
|
|
17
18
|
|
|
18
19
|
/**
|
|
@@ -190,13 +191,18 @@ export default function PageRenderer() {
|
|
|
190
191
|
|
|
191
192
|
useEffect(() => {
|
|
192
193
|
if (!redirectLocation) return
|
|
194
|
+
// ⭐ The query and fragment the visitor arrived with ride along, unless the destination names
|
|
195
|
+
// its own — a token a site's backend mails to the root (`/?verify=…`) reaches the page the root
|
|
196
|
+
// sends them to — and never onto another origin (`carryQuery`). ⛔ Until 2026-10-11 they were
|
|
197
|
+
// dropped here, before any code could read them.
|
|
198
|
+
const to = carryQuery(redirectLocation, { search: location.search, hash: location.hash }, window.location.origin)
|
|
193
199
|
// A URL with a scheme leaves the app — another site, or a locale's own domain.
|
|
194
|
-
if (/^[a-z][a-z0-9+.-]*:/i.test(
|
|
195
|
-
window.location.replace(
|
|
200
|
+
if (/^[a-z][a-z0-9+.-]*:/i.test(to)) {
|
|
201
|
+
window.location.replace(to)
|
|
196
202
|
} else {
|
|
197
|
-
navigate(
|
|
203
|
+
navigate(to, { replace: true })
|
|
198
204
|
}
|
|
199
|
-
}, [redirectLocation, navigate])
|
|
205
|
+
}, [redirectLocation, location.search, location.hash, navigate])
|
|
200
206
|
|
|
201
207
|
useHeadMeta(headMeta, { siteName })
|
|
202
208
|
|
package/src/index.jsx
CHANGED
|
@@ -186,21 +186,26 @@ async function initRuntime(foundationSource, options = {}) {
|
|
|
186
186
|
/**
|
|
187
187
|
* Simplified entry point for sites
|
|
188
188
|
*
|
|
189
|
-
*
|
|
189
|
+
* A scaffolded site's entry.js imports the foundation's styles, then calls
|
|
190
|
+
* this with the build-time config and the foundation promise:
|
|
191
|
+
*
|
|
192
|
+
* import '#foundation/styles'
|
|
193
|
+
* import { start } from '@uniweb/runtime'
|
|
190
194
|
*
|
|
191
195
|
* start({
|
|
192
196
|
* config: __FOUNDATION_CONFIG__,
|
|
193
|
-
* styles: import('#foundation/styles'),
|
|
194
197
|
* foundation: import('#foundation')
|
|
195
198
|
* })
|
|
196
199
|
*
|
|
197
|
-
* In runtime mode,
|
|
198
|
-
* (configured by the site Vite plugin) and
|
|
200
|
+
* In runtime mode, `#foundation` and `#foundation/styles` resolve to noop
|
|
201
|
+
* modules (configured by the site Vite plugin), and the foundation is loaded
|
|
202
|
+
* by URL instead. `styles` is optional: in bundled mode a promise passed there
|
|
203
|
+
* is awaited along with the foundation.
|
|
199
204
|
*
|
|
200
205
|
* @param {Object} options
|
|
201
206
|
* @param {Object} options.config - Build-time config from __FOUNDATION_CONFIG__
|
|
202
207
|
* @param {Promise} options.foundation - Promise from import('#foundation')
|
|
203
|
-
* @param {Promise} options.styles -
|
|
208
|
+
* @param {Promise} [options.styles] - Optional promise, e.g. import('#foundation/styles')
|
|
204
209
|
*/
|
|
205
210
|
async function start({ config, foundation, styles } = {}) {
|
|
206
211
|
// Try __DATA__ first (dynamic backends inject combined config + content)
|