@uniweb/core 0.35.4 → 0.36.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/package.json +1 -1
- package/src/data-keys.js +18 -9
- package/src/fetcher-dispatcher.js +4 -4
- package/src/resolve-route.js +18 -7
- package/src/website.js +0 -7
package/package.json
CHANGED
package/src/data-keys.js
CHANGED
|
@@ -37,7 +37,14 @@ export const WHOLE_SUFFIX = '/*'
|
|
|
37
37
|
* 2026-09-27 [Diego]). The runtime asks each key's question accordingly; a key declared whole
|
|
38
38
|
* that its fetch cannot fill whole is `null`.
|
|
39
39
|
*
|
|
40
|
-
*
|
|
40
|
+
* Who passes what. The runtime: a section type's LEAN `data` — a ref string or null, from the
|
|
41
|
+
* runtime schema the build extracts (`@uniweb/build`'s `runtime-schema.js`) — and the foundation's
|
|
42
|
+
* own `main.js` `data:` as written. A build-time reader: a `meta.js` value as written, or a
|
|
43
|
+
* registered foundation schema's in its normalized form (`schemaFormat: 3`, `@uniweb/schemas`'s
|
|
44
|
+
* `normalizeFoundationSchema`), which writes every ref as `{ kind: 'schema', schema, whole }` — the
|
|
45
|
+
* ref qualified and `whole` said outright.
|
|
46
|
+
*
|
|
47
|
+
* @param {*} value - one `data:` entry's value, authored, leaned or normalized
|
|
41
48
|
* @returns {{ ref: string|null, whole: boolean }}
|
|
42
49
|
*/
|
|
43
50
|
export function dataRefOf(value) {
|
|
@@ -46,7 +53,7 @@ export function dataRefOf(value) {
|
|
|
46
53
|
: (value && typeof value === 'object' && typeof value.schema === 'string' ? value.schema : '')
|
|
47
54
|
if (!raw) return { ref: null, whole: false }
|
|
48
55
|
if (raw.endsWith(WHOLE_SUFFIX)) return { ref: raw.slice(0, -WHOLE_SUFFIX.length) || null, whole: true }
|
|
49
|
-
return { ref: raw, whole:
|
|
56
|
+
return { ref: raw, whole: typeof value === 'object' && value.whole === true }
|
|
50
57
|
}
|
|
51
58
|
|
|
52
59
|
/**
|
|
@@ -79,13 +86,15 @@ export function declaredKeys(componentData, foundationData = null) {
|
|
|
79
86
|
/**
|
|
80
87
|
* Do two schema refs name the same schema?
|
|
81
88
|
*
|
|
82
|
-
* ⭐ `@/<name>` is
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
* the
|
|
87
|
-
* (the plan's §7 left it
|
|
88
|
-
* `@std/person` and `@acme/person` do not.
|
|
89
|
+
* ⭐ `@/<name>` is `<name>` in the FOUNDATION's own scope — the one in its name
|
|
90
|
+
* (`@acme/marketing` → `@acme/member`) — in its `meta.js` and in a site's `queries.yml`
|
|
91
|
+
* alike. A push qualifies a site's `@/` refs with that scope (`@uniweb/build`'s
|
|
92
|
+
* `uwx/self-scope.js`, ruled 2026-09-22), never with the org that owns the site. This match
|
|
93
|
+
* does not know the scope, so a local ref matches a ref of ANY scope with the same name; two
|
|
94
|
+
* scoped refs match only when their scopes agree. Decided 2026-09-14 (the plan's §7 left it
|
|
95
|
+
* to framework): `@/member` and `@acme/member` match, `@std/person` and `@acme/person` do not.
|
|
96
|
+
* ⛔ Until 2026-10-01 this said a site's `@/` meant the site's own schema, qualified with the
|
|
97
|
+
* site's org — the rule before 2026-09-22 — which read as if `@/` had two meanings.
|
|
89
98
|
*
|
|
90
99
|
* @param {string|null|undefined} a
|
|
91
100
|
* @param {string|null|undefined} b
|
|
@@ -44,10 +44,10 @@ function collectTransports(decl, { source, dev }) {
|
|
|
44
44
|
|
|
45
45
|
let raw
|
|
46
46
|
try {
|
|
47
|
-
// A built foundation carries
|
|
48
|
-
// — framework/build/src/generate-entry.js
|
|
49
|
-
//
|
|
50
|
-
//
|
|
47
|
+
// A built foundation carries what the runtime reads of its `main.js` under
|
|
48
|
+
// `default.capabilities` — framework/build/src/generate-entry.js references
|
|
49
|
+
// the code keys there, `transports` among them — and `decl` here is that
|
|
50
|
+
// built `default` (= { meta, capabilities, layoutMeta }). Transports
|
|
51
51
|
// therefore live at `default.capabilities.transports`: a single direct
|
|
52
52
|
// read, no fallback chain (the runtime only ever sees the built shape).
|
|
53
53
|
raw = decl.capabilities?.transports
|
package/src/resolve-route.js
CHANGED
|
@@ -308,8 +308,10 @@ export function landingRoute(site, page, seen = new Set()) {
|
|
|
308
308
|
*
|
|
309
309
|
* In order:
|
|
310
310
|
* 1. **The locale served unprefixed, asked for with its prefix** — `/en/docs` where `en` is the
|
|
311
|
-
* default (or the host's own locale) — is a `301` to the path without it
|
|
312
|
-
*
|
|
311
|
+
* default (or the host's own locale) — is a `301` to the path without it, and when the rest names
|
|
312
|
+
* a page, to this locale's own URL for it: `/fr/about` on a French host is `/a-propos`, in one
|
|
313
|
+
* hop. Ruled 2026-09-30 [Diego]; until then no page matched it. ⛔ Until 2026-10-01 it went to the
|
|
314
|
+
* rest as written, and `/about` was a second `301`.
|
|
313
315
|
* 2. **The page** (`findPage`). None ⇒ `notFound`, with the site's not-found page: its
|
|
314
316
|
* `notFound` content, else the page at `/404`.
|
|
315
317
|
* 3. **An authored `redirect:`** ⇒ a `302` to it: a page of the site in this locale, anything
|
|
@@ -322,8 +324,9 @@ export function landingRoute(site, page, seen = new Set()) {
|
|
|
322
324
|
*
|
|
323
325
|
* ⭐ **One URL per page per language** (ruled 2026-10-01): a page asked for at another route than
|
|
324
326
|
* this locale shows it at — `/fr/blog` where French shows `/fr/blogue` — is a `301` there
|
|
325
|
-
* (`localeOwnUrl`), before 4 and 6. A redirect (3) and a container (5) already
|
|
326
|
-
* to this locale's URL for their destination, in one hop.
|
|
327
|
+
* (`localeOwnUrl`), before 4 and 6, and folded into 1. A redirect (3) and a container (5) already
|
|
328
|
+
* send the visitor to this locale's URL for their destination, in one hop. Only `301`s fold: a
|
|
329
|
+
* `302` is temporary, so a prefixed path to one is two hops, the `302` its own.
|
|
327
330
|
*
|
|
328
331
|
* `status` is what a host that sends one sends. A static host has its own ways to say each kind.
|
|
329
332
|
*
|
|
@@ -339,11 +342,19 @@ export function resolveRoute(site, path, context = {}) {
|
|
|
339
342
|
const defaultLocale = context.defaultLocale ?? index.defaultLocale
|
|
340
343
|
const raw = typeof path === 'string' && path ? path : '/'
|
|
341
344
|
|
|
342
|
-
// 1 · the unprefixed locale, asked for with its prefix
|
|
345
|
+
// 1 · the unprefixed locale, asked for with its prefix: to the locale's own URL for the page the
|
|
346
|
+
// rest of the path names, in ONE 301 — `/fr/about` on a French host is `/a-propos`, never `/about`
|
|
347
|
+
// first (ruled 2026-10-01 [Diego]: "fold them into a single 301"). The rest as written when it names
|
|
348
|
+
// no page. Only 301s fold: a container's or an authored 302 is temporary, and stays its own hop.
|
|
349
|
+
// The redirect names no page, as before.
|
|
343
350
|
if (defaultLocale) {
|
|
344
351
|
const prefix = `/${defaultLocale}`
|
|
345
|
-
|
|
346
|
-
if (
|
|
352
|
+
const rest = raw === prefix || raw === `${prefix}/` ? '/' : raw.startsWith(`${prefix}/`) ? raw.slice(prefix.length) : null
|
|
353
|
+
if (rest !== null) {
|
|
354
|
+
const ctx = { activeLocale, defaultLocale }
|
|
355
|
+
const own = findPage(index, rest, ctx) ? localeOwnUrl(index, rest, ctx) : null
|
|
356
|
+
return redirect(own || rest, RESOLUTION_STATUS.localeRedirect, 'locale')
|
|
357
|
+
}
|
|
347
358
|
}
|
|
348
359
|
|
|
349
360
|
// 2 · the page
|
package/src/website.js
CHANGED
|
@@ -772,13 +772,6 @@ export default class Website {
|
|
|
772
772
|
return globalThis.uniweb.foundationConfig?.viewTransitions !== false
|
|
773
773
|
}
|
|
774
774
|
|
|
775
|
-
/**
|
|
776
|
-
* Get remote props from foundation config
|
|
777
|
-
*/
|
|
778
|
-
getRemoteProps() {
|
|
779
|
-
return globalThis.uniweb?.foundationConfig?.props || null
|
|
780
|
-
}
|
|
781
|
-
|
|
782
775
|
/**
|
|
783
776
|
* Get routing components (Link, useNavigate, etc.)
|
|
784
777
|
*/
|