@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/runtime",
3
- "version": "0.29.4",
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/theming": "^0.2.0",
40
- "@uniweb/core": "^0.38.0"
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.79.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(redirectLocation)) {
195
- window.location.replace(redirectLocation)
200
+ if (/^[a-z][a-z0-9+.-]*:/i.test(to)) {
201
+ window.location.replace(to)
196
202
  } else {
197
- navigate(redirectLocation, { replace: true })
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
- * Template main.js calls this with config + foundation/styles promises:
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, the foundation/styles promises resolve to noop modules
198
- * (configured by the site Vite plugin) and are ignored.
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 - Promise from import('#foundation/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)