uniweb 1.24.8 → 1.24.9
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 +3 -3
- package/partials/agents.md +1 -1
- 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 +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uniweb",
|
|
3
|
-
"version": "1.24.
|
|
3
|
+
"version": "1.24.9",
|
|
4
4
|
"description": "Create structured Vite + React sites with content/code separation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"prompts": "^2.4.2",
|
|
43
43
|
"tar": "^7.5.21",
|
|
44
44
|
"@uniweb/content-writer": "~1.3.1",
|
|
45
|
-
"@uniweb/core": "~1.5.1",
|
|
46
45
|
"@uniweb/schemas": "~1.6.7",
|
|
46
|
+
"@uniweb/core": "~1.5.1",
|
|
47
47
|
"@uniweb/semantic-parser": "~1.13.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@uniweb/build": "~1.13.
|
|
50
|
+
"@uniweb/build": "~1.13.5",
|
|
51
51
|
"@uniweb/content-reader": "~1.5.7",
|
|
52
52
|
"@uniweb/semantic-parser": "~1.13.0"
|
|
53
53
|
},
|
package/partials/agents.md
CHANGED
|
@@ -3078,7 +3078,7 @@ Running `extract` before a build is the usual first mistake — it reads the com
|
|
|
3078
3078
|
|
|
3079
3079
|
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
3080
|
|
|
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,
|
|
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, 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
3082
|
|
|
3083
3083
|
*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
3084
|
|
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-31T14:53:03.601Z",
|
|
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"
|