uniweb 1.24.8 → 1.24.10
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/partials/agents.md +4 -2
- package/src/backend/client.js +16 -0
- package/src/backend/site-media.js +13 -4
- package/src/commands/publish.js +2 -2
- package/src/commands/push.js +2 -2
- package/src/framework-index.json +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uniweb",
|
|
3
|
-
"version": "1.24.
|
|
3
|
+
"version": "1.24.10",
|
|
4
4
|
"description": "Create structured Vite + React sites with content/code separation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -41,15 +41,15 @@
|
|
|
41
41
|
"js-yaml": "^4.3.2",
|
|
42
42
|
"prompts": "^2.4.2",
|
|
43
43
|
"tar": "^7.5.21",
|
|
44
|
-
"@uniweb/content-writer": "~1.3.1",
|
|
45
44
|
"@uniweb/core": "~1.5.1",
|
|
45
|
+
"@uniweb/content-writer": "~1.3.1",
|
|
46
46
|
"@uniweb/schemas": "~1.6.7",
|
|
47
47
|
"@uniweb/semantic-parser": "~1.13.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@uniweb/build": "~1.13.4",
|
|
51
50
|
"@uniweb/content-reader": "~1.5.7",
|
|
52
|
-
"@uniweb/semantic-parser": "~1.13.0"
|
|
51
|
+
"@uniweb/semantic-parser": "~1.13.0",
|
|
52
|
+
"@uniweb/build": "~1.13.5"
|
|
53
53
|
},
|
|
54
54
|
"peerDependenciesMeta": {
|
|
55
55
|
"@uniweb/build": {
|
package/partials/agents.md
CHANGED
|
@@ -1619,7 +1619,7 @@ Semantic tokens come from `theme-tokens.css` (populated from `theme.yml`). Use `
|
|
|
1619
1619
|
|
|
1620
1620
|
These compose with tokens — they adapt per context because they reference token variables — while adding nuance the token set doesn't provide. Use palette shades directly (`var(--primary-300)`, `bg-neutral-200`) for fine-grained control. **The priority: design quality > portability > configurability.** A beautiful foundation for one site is worth more than a generic one that looks flat.
|
|
1621
1621
|
|
|
1622
|
-
|
|
1622
|
+
Four things a ported design will try to bring with it, each of which breaks something:
|
|
1623
1623
|
|
|
1624
1624
|
> **Don't set `scroll-behavior: smooth` globally.** The runtime owns scrolling: it already smooth-scrolls anchor targets itself (`scrollIntoView({ behavior: 'smooth' })`), so the CSS adds nothing there — but it resets and restores scroll on route changes with the two-argument `scrollTo(x, y)`, which *inherits* the property. Route changes then animate their scroll-to-top, and back-button restoration (which scrolls, checks the position on the next frame, and retries) keeps interrupting its own animation. Scope it to a specific scrollable element if you need it; never to `html` or `body`.
|
|
1625
1625
|
|
|
@@ -1627,6 +1627,8 @@ Three lines a ported design will try to bring with it, each of which breaks some
|
|
|
1627
1627
|
|
|
1628
1628
|
> **Font smoothing is a per-scheme decision, not a reset.** `-webkit-font-smoothing: antialiased` (macOS only) forces grayscale rasterization, which thins strokes. On dark surfaces that usefully counteracts the bloom of light text on near-black; on light surfaces it costs contrast and makes body text spindly. Scope it — `.scheme-dark { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }` — rather than putting it on `html`.
|
|
1629
1629
|
|
|
1630
|
+
> **Write an entrance animation in CSS, not in JavaScript.** A CSS animation on a prerendered page starts at first paint and carries on when the browser renders over that page, so a hero fades in once. One a component starts when it mounts (a motion library, a `useEffect`) can only start when the page boots. Until then the visitor sees its first frame, which for a fade is nothing, or the finished section, which then animates in. `uniweb dev` does not prerender, so only a built site shows this.
|
|
1631
|
+
|
|
1630
1632
|
### Composition: items, child sections, insets
|
|
1631
1633
|
|
|
1632
1634
|
Pages are sequences of sections — the obvious layer. The framework also supports real nesting, without leaving markdown.
|
|
@@ -3078,7 +3080,7 @@ Running `extract` before a build is the usual first mistake — it reads the com
|
|
|
3078
3080
|
|
|
3079
3081
|
An override key is the page's route and the section's id (`cta` for `2-cta.md`); a page's own title, label, description and keywords are `/pricing:_meta`, and in `locales/records/` a record is named by its manifest context (`std/article/launch`).
|
|
3080
3082
|
|
|
3081
|
-
**An entry can be flagged `outdated`:** `{ "default": "Acerca de PandaWatch", "outdated": { "/about:hero": "About PandaWatch" } }`. The source was edited a little, and the old translation stays until someone reviews it, so it still shows, and `uniweb i18n status` lists it. An edit in the Uniweb app does this, and so does one in a file, at `uniweb i18n sync` or at the push. To finish it,
|
|
3083
|
+
**An entry can be flagged `outdated`:** `{ "default": "Acerca de PandaWatch", "outdated": { "/about:hero": "About PandaWatch" } }`. The source was edited a little, and the old translation stays until someone reviews it, so it still shows, and `uniweb i18n status` lists it. An edit in the Uniweb app does this, and so does one in a file, at `uniweb i18n sync` or at the push. To finish it, write the new translation in the entry: new words end the flag, whatever is left beside them. If the words still hold, make the entry a plain string of them. An edit that shares under half its words with the old text keeps nothing, and neither does a page title, an image's alt text or a data block's string: those show the source until they are translated. **`locales/_kept.json`** holds what the app keeps for a section that no file has a place for. A pull writes it and a push sends it back, so commit it and leave it alone.
|
|
3082
3084
|
|
|
3083
3085
|
*Free-form bodies* — when a language needs different structure, different images, or copy rewritten rather than translated. The file replaces one section's content:
|
|
3084
3086
|
|
package/src/backend/client.js
CHANGED
|
@@ -834,6 +834,22 @@ export class BackendClient {
|
|
|
834
834
|
})
|
|
835
835
|
}
|
|
836
836
|
|
|
837
|
+
/**
|
|
838
|
+
* Whether this backend serves a file at a path of its own origin. The question is put to the host
|
|
839
|
+
* rather than read from the path's shape, since its routes are its own to lay out.
|
|
840
|
+
*
|
|
841
|
+
* @param {string} path - leading-slash path
|
|
842
|
+
* @returns {Promise<boolean>}
|
|
843
|
+
*/
|
|
844
|
+
async servesFile(path) {
|
|
845
|
+
try {
|
|
846
|
+
const res = await this.request(path, { method: 'HEAD' })
|
|
847
|
+
return res.ok && !String(res.headers?.get?.('content-type') || '').startsWith('text/html')
|
|
848
|
+
} catch {
|
|
849
|
+
return false
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
|
|
837
853
|
/**
|
|
838
854
|
* GET /dev/site/content/pull/{uuid} — the content lane document. Pass the
|
|
839
855
|
* last-seen ETag (opaque) to make it conditional: a match returns 304 (empty body).
|
|
@@ -31,13 +31,17 @@ import { humanBytes } from '../utils/bytes.js'
|
|
|
31
31
|
* `siteUuid` is the owner the uploaded bytes are charged to. Callers create the
|
|
32
32
|
* site before uploading precisely so this is set — an unowned upload is charged
|
|
33
33
|
* and cannot be freed, because freeing means deleting the owning entity.
|
|
34
|
-
* @returns {Promise<{ map: Record<string,string>, ids: Record<string,{id:string,ext:string}>, missing: string[], failed: Array<{path:string,status:number,detail?:string}> }>}
|
|
34
|
+
* @returns {Promise<{ map: Record<string,string>, ids: Record<string,{id:string,ext:string}>, missing: string[], served: string[], failed: Array<{path:string,status:number,detail?:string}> }>}
|
|
35
35
|
* `map` is ref → serve URL for refs that resolved AND uploaded. The two failure
|
|
36
36
|
* kinds are reported SEPARATELY because callers must treat them differently:
|
|
37
37
|
* `missing` is a ref with no file under the site — an authoring mistake, already
|
|
38
38
|
* broken before us, worth a warning; `failed` is a ref whose bytes we could not
|
|
39
39
|
* store — a transport or QUOTA refusal, and shipping content that still points at
|
|
40
40
|
* the local path would publish a broken image while only warning about it.
|
|
41
|
+
* ⭐ `served` is neither: an address the backend serves itself, which stays as written.
|
|
42
|
+
* A pull writes one where it has no file to put back, as a clone's favicon or a record's
|
|
43
|
+
* image on a backend whose addresses are paths of its own origin. ⛔ Until 2026-10-31
|
|
44
|
+
* these were warned about as missing files.
|
|
41
45
|
*/
|
|
42
46
|
export async function uploadSiteMedia(
|
|
43
47
|
client,
|
|
@@ -45,10 +49,11 @@ export async function uploadSiteMedia(
|
|
|
45
49
|
refs,
|
|
46
50
|
{ siteUuid = null, onProgress, warn } = {}
|
|
47
51
|
) {
|
|
48
|
-
if (!refs?.length) return { map: {}, ids: {}, missing: [], failed: [] }
|
|
52
|
+
if (!refs?.length) return { map: {}, ids: {}, missing: [], served: [], failed: [] }
|
|
49
53
|
|
|
50
54
|
const files = []
|
|
51
55
|
const missing = []
|
|
56
|
+
const served = []
|
|
52
57
|
// ⭐ A ref is a site-root media path (`/images/x.png`), resolved under the site — or a file the
|
|
53
58
|
// caller already located, `{ ref, path, contentType? }`: a file record's file and its preview, which
|
|
54
59
|
// live in the records directory and declare their own type (`@uniweb/file`, 2026-09-28), and a
|
|
@@ -60,6 +65,10 @@ export async function uploadSiteMedia(
|
|
|
60
65
|
keys.push(ref)
|
|
61
66
|
const resolved = typeof item === 'string' ? resolveAssetPath(ref, siteDir, siteDir).resolved : item.path
|
|
62
67
|
if (!resolved || !existsSync(resolved)) {
|
|
68
|
+
if (typeof item === 'string' && (await client.servesFile(ref))) {
|
|
69
|
+
served.push(ref)
|
|
70
|
+
continue
|
|
71
|
+
}
|
|
63
72
|
warn?.(`local-media: ${ref} not found under the site (skipped)`)
|
|
64
73
|
missing.push(ref)
|
|
65
74
|
continue
|
|
@@ -74,7 +83,7 @@ export async function uploadSiteMedia(
|
|
|
74
83
|
diskPath: resolved
|
|
75
84
|
})
|
|
76
85
|
}
|
|
77
|
-
if (!files.length) return { map: {}, ids: {}, missing, failed: [] }
|
|
86
|
+
if (!files.length) return { map: {}, ids: {}, missing, served, failed: [] }
|
|
78
87
|
|
|
79
88
|
const result = await client.uploadSiteAssets({ files, siteUuid, onProgress })
|
|
80
89
|
const failed = [...(result.failed || [])]
|
|
@@ -123,7 +132,7 @@ export async function uploadSiteMedia(
|
|
|
123
132
|
}
|
|
124
133
|
map[ref] = entry.serveUrl
|
|
125
134
|
}
|
|
126
|
-
return { map, ids, missing, failed }
|
|
135
|
+
return { map, ids, missing, served, failed }
|
|
127
136
|
}
|
|
128
137
|
|
|
129
138
|
// ─── Asset-plan refusals ──────────────────────────────────────────────────────
|
package/src/commands/publish.js
CHANGED
|
@@ -717,7 +717,7 @@ export async function publish(args = []) {
|
|
|
717
717
|
if (mediaRefs.length) {
|
|
718
718
|
say.info('Uploading media…')
|
|
719
719
|
try {
|
|
720
|
-
const { map, ids, failed } = await uploadSiteMedia(
|
|
720
|
+
const { map, ids, served, failed } = await uploadSiteMedia(
|
|
721
721
|
client,
|
|
722
722
|
siteDir,
|
|
723
723
|
mediaRefs,
|
|
@@ -750,7 +750,7 @@ export async function publish(args = []) {
|
|
|
750
750
|
}
|
|
751
751
|
if (ballAssets.length) ball = rewriteSchemalessDataAssets(ball, map)
|
|
752
752
|
say.dim(
|
|
753
|
-
`Media : ${Object.keys(map).length}/${mediaRefs.length} ref(s) → serve URL`
|
|
753
|
+
`Media : ${Object.keys(map).length}/${mediaRefs.length - served.length} ref(s) → serve URL`
|
|
754
754
|
)
|
|
755
755
|
} catch (err) {
|
|
756
756
|
// A typed plan refusal gets its own account (quota, per-file cap, plan caps);
|
package/src/commands/push.js
CHANGED
|
@@ -506,7 +506,7 @@ export async function push(args = [], deps = {}) {
|
|
|
506
506
|
}
|
|
507
507
|
info('Uploading media…')
|
|
508
508
|
try {
|
|
509
|
-
const { map, ids, failed } = await uploadSiteMedia(
|
|
509
|
+
const { map, ids, served, failed } = await uploadSiteMedia(
|
|
510
510
|
client,
|
|
511
511
|
siteDir,
|
|
512
512
|
mediaRefs,
|
|
@@ -531,7 +531,7 @@ export async function push(args = [], deps = {}) {
|
|
|
531
531
|
if (Object.keys(map).length) assetRewrite = map
|
|
532
532
|
if (Object.keys(ids).length) assetIds = ids
|
|
533
533
|
note(
|
|
534
|
-
`${Object.keys(map).length}/${mediaRefs.length} media ref(s) → serve URL`
|
|
534
|
+
`${Object.keys(map).length}/${mediaRefs.length - served.length} media ref(s) → serve URL`
|
|
535
535
|
)
|
|
536
536
|
// Record identity in the COMMITTED map. Merge, never replace: this push
|
|
537
537
|
// carries only the refs its content touched.
|
package/src/framework-index.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"generatedAt": "2026-10-
|
|
3
|
+
"generatedAt": "2026-10-31T15:45:04.675Z",
|
|
4
4
|
"packages": {
|
|
5
5
|
"@uniweb/api": {
|
|
6
6
|
"version": "1.6.7"
|
|
7
7
|
},
|
|
8
8
|
"@uniweb/build": {
|
|
9
|
-
"version": "1.13.
|
|
9
|
+
"version": "1.13.5"
|
|
10
10
|
},
|
|
11
11
|
"@uniweb/content-reader": {
|
|
12
12
|
"version": "1.5.7"
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"version": "1.2.8"
|
|
37
37
|
},
|
|
38
38
|
"@uniweb/runtime": {
|
|
39
|
-
"version": "1.3.
|
|
39
|
+
"version": "1.3.4"
|
|
40
40
|
},
|
|
41
41
|
"@uniweb/scene": {
|
|
42
42
|
"version": "1.0.1"
|