uniweb 1.34.8 → 1.34.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 +4 -4
- package/partials/guides/content.md +1 -1
- package/partials/guides/ship.md +1 -1
- package/src/backend/site-sync.js +15 -3
- package/src/commands/doctor.js +51 -0
- package/src/commands/pull.js +66 -13
- package/src/commands/status.js +4 -2
- package/src/framework-index.json +2 -2
- package/src/index.js +7 -0
- package/src/utils/site-roots.js +34 -4
- package/src/utils/sync-point.js +18 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uniweb",
|
|
3
|
-
"version": "1.34.
|
|
3
|
+
"version": "1.34.9",
|
|
4
4
|
"description": "Create structured Vite + React sites with content/code separation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
"js-yaml": "^4.3.2",
|
|
42
42
|
"prompts": "^2.4.2",
|
|
43
43
|
"tar": "^7.5.21",
|
|
44
|
+
"@uniweb/schemas": "~1.7.4",
|
|
44
45
|
"@uniweb/content-writer": "~1.3.2",
|
|
45
|
-
"@uniweb/semantic-parser": "~1.13.5",
|
|
46
46
|
"@uniweb/core": "~1.6.13",
|
|
47
|
-
"@uniweb/
|
|
47
|
+
"@uniweb/semantic-parser": "~1.13.5"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@uniweb/build": "~1.23.
|
|
50
|
+
"@uniweb/build": "~1.23.8",
|
|
51
51
|
"@uniweb/content-reader": "~1.5.10",
|
|
52
52
|
"@uniweb/semantic-parser": "~1.13.5"
|
|
53
53
|
},
|
|
@@ -131,7 +131,7 @@ Image attributes: `{width=800 height=600 loading=lazy fit=cover position=center
|
|
|
131
131
|
|
|
132
132
|
**Section links:** `page:about#team` → `/about#section-team`; `page:/#features` → a homepage section. The id is the file name without its number (`2-features.md` → `features`) or `id:` in frontmatter.
|
|
133
133
|
|
|
134
|
-
**Where media lives.** `./x` is beside the page, `/x` is in `public/`; both reach a static build and a published site. Keep a page's media beside it, and in `public/` what belongs to the whole site: the favicon, fonts. **Only a static host gives a file a fixed address** at the site root. A site published with Uniweb serves a file that something names from an address the upload gives it, and nothing at `/x` — so for a file other sites or scripts fetch by URL, keep it somewhere with its own address and add a page whose `redirect:` goes there. A static build copies `public/` whole, a photo's location included, and adds its own copy of each file a page names there: keep a phone's photos beside their page. **A picture is made ready before it is stored or shipped:** `uniweb push` and `uniweb publish` upload, and a static build copies, a PNG, JPEG or GIF as a WebP when that is at least 10% smaller (a TIFF or HEIC always), turned upright and without its location and camera data; a WebP stays one, without that data. The favicon, the touch icon, the site's card and its social images go up in their own format, without their location and camera data; a static build serves them from `public/` as they are. **A video** goes up as H.264 and AAC in an MP4, at most 1920 on its long edge and about 5 Mbps at 1080p, when ffmpeg with libx264 is installed (one already within that is only repackaged). It loses its location and camera data either way, an HDR video goes up as it is with a note, and a static build copies videos as they are. A picture keeps its pixels, so add one no wider than a page shows it; a HEIC from a phone that can't be converted here goes up
|
|
134
|
+
**Where media lives.** `./x` is beside the page, `/x` is in `public/`; both reach a static build and a published site. Keep a page's media beside it, and in `public/` what belongs to the whole site: the favicon, fonts. **Only a static host gives a file a fixed address** at the site root. A site published with Uniweb serves a file that something names from an address the upload gives it, and nothing at `/x` — so for a file other sites or scripts fetch by URL, keep it somewhere with its own address and add a page whose `redirect:` goes there. A static build copies `public/` whole, a photo's location included, and adds its own copy of each file a page names there: keep a phone's photos beside their page. **A picture is made ready before it is stored or shipped:** `uniweb push` and `uniweb publish` upload, and a static build copies, a PNG, JPEG or GIF as a WebP when that is at least 10% smaller (a TIFF or HEIC always), turned upright and without its location and camera data; a WebP stays one, without that data. The favicon, the touch icon, the site's card and its social images go up in their own format, without their location and camera data; a static build serves them from `public/` as they are. **A video** goes up as H.264 and AAC in an MP4, at most 1920 on its long edge and about 5 Mbps at 1080p, when ffmpeg with libx264 is installed (one already within that is only repackaged). It loses its location and camera data either way, an HDR video goes up as it is with a note, and a static build copies videos as they are. A picture keeps its pixels, so add one no wider than a page shows it; a HEIC from a phone that can't be converted here goes up without its location, with a note: export it as JPEG. An AVIF stays one, without that data. `uniweb push` uploads a file beside a page wherever the page is (mounted directories included); a file outside the site and its mounts is not uploaded — put that in `public/`. There is no `assets/` directory for media; a build stops on a `/x` only `assets/` holds.
|
|
135
135
|
|
|
136
136
|
**Placement** (`{placement=left|right|wide|full}`) on an image or video, or on a table's caption line, which follows the table after a blank line (`: Plans and prices {placement=wide #tbl-plans}`, which also sets caption and id; with no blank line it becomes a row). It's the author's intent, honoured by kit's `<Render>`, `<Prose>` and `<Article>` and ignored by other components; a section type declares which it honours in `meta.js` (`sequence: { placement: true }`) and the build warns on a mismatch.
|
|
137
137
|
|
package/partials/guides/ship.md
CHANGED
|
@@ -68,7 +68,7 @@ A site can be in more than one place. `publish` makes a change live on Cloud, `g
|
|
|
68
68
|
|
|
69
69
|
**Sync is developer-only and one-sided.** The app is the live source of truth for content; git is the reviewed, durable record. Authors never push or pull.
|
|
70
70
|
|
|
71
|
-
**Nobody's work is overwritten without asking.** `push` is refused if the site changed on the backend since your last pull, and reports what changed. In a git repository `pull` merges like `git pull`: it commits the backend's content (*"The site's content on …"*) and merges into your branch against the last shared state. Your work and a teammate's are kept; a file the backend never had is never deleted; only a genuine overlap leaves conflict markers and a non-zero exit — settle it as in any merge, then `git commit` (where your uncommitted changes overlap, settle, `git add`, then `git stash drop`). A push or publish is refused while a file is in conflict. **In a repository a push sends what you have committed**: uncommitted site content is refused before anything is sent — commit, or `uniweb push --commit -m "…"` (commits the site's content only; `publish` and `sync` take `--commit` too). The ids the backend assigns are committed by the push itself, as `uniweb`. A push is also refused when your branch doesn't hold what this copy last took from the backend (after `git merge --abort`, or a fresh clone) — pull, then push. Outside git (including a directory the surrounding repo ignores), `pull` takes the backend's version over your files, asking first. `--force` is the deliberate overwrite in either direction. `sync` is `refresh` then `push`; neither publishes.
|
|
71
|
+
**Nobody's work is overwritten without asking.** `push` is refused if the site changed on the backend since your last pull, and reports what changed. In a git repository `pull` merges like `git pull`: it commits the backend's content (*"The site's content on …"*) and merges into your branch against the last shared state. Your work and a teammate's are kept; a file the backend never had is never deleted; what the app removed — a page, a section, a record — is removed here too unless you changed it, and the pull names each record it removes (restored from history and pushed, one goes up as a new record); only a genuine overlap leaves conflict markers and a non-zero exit — settle it as in any merge, then `git commit` (where your uncommitted changes overlap, settle, `git add`, then `git stash drop`). A push or publish is refused while a file is in conflict. **In a repository a push sends what you have committed**: uncommitted site content is refused before anything is sent — commit, or `uniweb push --commit -m "…"` (commits the site's content only; `publish` and `sync` take `--commit` too). The ids the backend assigns are committed by the push itself, as `uniweb`. A push is also refused when your branch doesn't hold what this copy last took from the backend (after `git merge --abort`, or a fresh clone) — pull, then push. Outside git (including a directory the surrounding repo ignores), `pull` takes the backend's version over your files, asking first. `--force` is the deliberate overwrite in either direction. `sync` is `refresh` then `push`; neither publishes.
|
|
72
72
|
|
|
73
73
|
**Working on a site others edit:** `status` when you begin, when you come back, before push/publish/deploy, after any refusal. It reads the backend without taking anything: what changed file by file, what you hold that it lacks, who has a page open in the app right now, what in the project is uncommitted (an update, foundation source — a push neither sends nor waits for that, but a push or publish releases a changed foundation from the files). Take what changed (`pull` or `refresh`) before you edit; when someone has a page open in the app, tell the person before changing that page.
|
|
74
74
|
|
package/src/backend/site-sync.js
CHANGED
|
@@ -1422,10 +1422,24 @@ export function writeQueryUuids(siteDir, backend, map) {
|
|
|
1422
1422
|
if (!map || !Object.keys(map).length) return
|
|
1423
1423
|
updateBackendMap(siteDir, backend, 'queries', map)
|
|
1424
1424
|
}
|
|
1425
|
+
// Placements a recovery found missing, beside the ones this copy holds (`recoverRecordsIdentity`).
|
|
1425
1426
|
export function writeFolderItemUuids(siteDir, backend, map) {
|
|
1426
1427
|
if (!map || !Object.keys(map).length) return
|
|
1427
1428
|
updateBackendMap(siteDir, backend, 'folders', map)
|
|
1428
1429
|
}
|
|
1430
|
+
/**
|
|
1431
|
+
* The placements of a folder the backend handed back — a pull's, or the one a push stored — written
|
|
1432
|
+
* WHOLE, as its record types are (`writeHeldTypes`), so they name exactly the entries it holds.
|
|
1433
|
+
*
|
|
1434
|
+
* ⛔ Until 2026-11-13 each answer was merged into the ones before, so an entry the app removed kept its
|
|
1435
|
+
* `$uuid` here, and the next push stamped it on the record's entry again, which the backend re-created:
|
|
1436
|
+
* a record an author had removed from the site in the app came back with a teammate's push from a copy
|
|
1437
|
+
* that still held its file (measured on a site, 2026-11-10). A removed entry's `$uuid` leaves with it
|
|
1438
|
+
* now, so a record whose file is brought back goes up in an entry of its own.
|
|
1439
|
+
*/
|
|
1440
|
+
export function writeFolderPlacements(siteDir, backend, folderDoc) {
|
|
1441
|
+
setBackendMap(siteDir, backend, 'folders', collectFolderItemUuids(folderDoc))
|
|
1442
|
+
}
|
|
1429
1443
|
/**
|
|
1430
1444
|
* What the backend holds each record as — its uuid → the data schema its folder entry names —
|
|
1431
1445
|
* banked wherever placements are, from the same folder document. A push reads it to tell a record
|
|
@@ -3092,9 +3106,7 @@ export async function pushSyncPackages({
|
|
|
3092
3106
|
// live manor 2026-08-27; the identities were on the wire all along.
|
|
3093
3107
|
const folderDoc = finalized.find((f) => f?.document?.contents)?.document
|
|
3094
3108
|
if (folderDoc) {
|
|
3095
|
-
|
|
3096
|
-
if (Object.keys(placements).length)
|
|
3097
|
-
writeFolderItemUuids(siteDir, client.origin, placements)
|
|
3109
|
+
writeFolderPlacements(siteDir, client.origin, folderDoc)
|
|
3098
3110
|
// What the folder places now, and so which records this push took out of it.
|
|
3099
3111
|
retireUnplaced(siteDir, client.origin, writeHeldTypes(siteDir, client.origin, folderDoc), { ownedBefore })
|
|
3100
3112
|
// ⭐ A LINK RECORD'S IDENTITY is its folder entry's `$uuid`, banked as a record's is: into
|
package/src/commands/doctor.js
CHANGED
|
@@ -41,6 +41,7 @@ import { discoverFoundations, discoverSites } from '../utils/discover.js'
|
|
|
41
41
|
import { siteAround } from '../utils/pick-site.js'
|
|
42
42
|
import { workspaceTypesDefinedTwice } from '../utils/workspace-types.js'
|
|
43
43
|
import { checkSiteInstall } from '../utils/install-integrity.js'
|
|
44
|
+
import { findVideoTools } from '../backend/prepare-video.js'
|
|
44
45
|
import { editWorkspaceFilePackages } from '../utils/workspace-packages.js'
|
|
45
46
|
import { findWorkspaceRoot } from '../utils/workspace.js'
|
|
46
47
|
import { ignoredByRepo } from '../utils/git.js'
|
|
@@ -1364,6 +1365,54 @@ function listSome(items, n = 5) {
|
|
|
1364
1365
|
if (items.length > n) log(` ${colors.dim}…and ${items.length - n} more${colors.reset}`)
|
|
1365
1366
|
}
|
|
1366
1367
|
|
|
1368
|
+
/** A site's local video references: `/x.mp4`, `./x.mov` and the like, in its pages, layout and records. */
|
|
1369
|
+
function localVideoRefs(sitePath) {
|
|
1370
|
+
const refs = new Set()
|
|
1371
|
+
const ref = /(?:\]\(|:\s*['"]?|\s)(\.{0,2}\/(?!\/)[^\s)'"\]]+\.(?:mp4|m4v|mov|webm))\b/gi
|
|
1372
|
+
const walk = (dir) => {
|
|
1373
|
+
let entries
|
|
1374
|
+
try {
|
|
1375
|
+
entries = readdirSync(dir, { withFileTypes: true })
|
|
1376
|
+
} catch {
|
|
1377
|
+
return
|
|
1378
|
+
}
|
|
1379
|
+
for (const entry of entries) {
|
|
1380
|
+
if (entry.name.startsWith('.') || entry.name === 'node_modules') continue
|
|
1381
|
+
const path = join(dir, entry.name)
|
|
1382
|
+
if (entry.isDirectory()) walk(path)
|
|
1383
|
+
else if (/\.(md|ya?ml|json)$/.test(entry.name)) {
|
|
1384
|
+
for (const match of readFileSync(path, 'utf8').matchAll(ref)) refs.add(match[1])
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
for (const dir of ['pages', 'layout', 'records']) walk(join(sitePath, dir))
|
|
1389
|
+
return [...refs]
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
/**
|
|
1393
|
+
* Whether a push can make the site's videos smaller. `uniweb push` and `uniweb publish` prepare a
|
|
1394
|
+
* video a page plays with this machine's `ffmpeg`, when it has `libx264`; with none, a video goes up
|
|
1395
|
+
* as it is, without its location. Said only where the site has videos, and only when there is no
|
|
1396
|
+
* such `ffmpeg`: the CLI ships no encoder [Diego, 2026-11-12: "Clearly we are not going to ship
|
|
1397
|
+
* ffmpeg inside the CLI. That's out of the question. The cli help or `doctor` command can suggest
|
|
1398
|
+
* installing it, and it can check if it's already available and use it."].
|
|
1399
|
+
*
|
|
1400
|
+
* @param {{ sitePath: string, siteName: string, issues: object[], tools?: object|null }} options
|
|
1401
|
+
* `tools`: what `findVideoTools` found, for a test to say
|
|
1402
|
+
*/
|
|
1403
|
+
export async function checkVideoTools({ sitePath, siteName, issues, tools }) {
|
|
1404
|
+
const videos = localVideoRefs(sitePath)
|
|
1405
|
+
if (videos.length === 0) return
|
|
1406
|
+
const found = tools === undefined ? await findVideoTools() : tools
|
|
1407
|
+
if (found) return
|
|
1408
|
+
const id = 'video-encoder-none'
|
|
1409
|
+
const n = videos.length
|
|
1410
|
+
const message = `A push uploads this site's ${n === 1 ? 'video' : `${n} videos`} as ${n === 1 ? 'it is' : 'they are'}: this machine has no ffmpeg with libx264`
|
|
1411
|
+
issues.push({ id, type: 'info', site: siteName, message })
|
|
1412
|
+
info(`[${id}] ${message}`)
|
|
1413
|
+
log(` Install ffmpeg (on a Mac: ${colors.green}brew install ffmpeg${colors.reset}), and a push makes a new or changed video smaller before it goes up: H.264 at most 1920 on its long edge, about 5 Mbps at 1080p. A video already stored stays as it is.`)
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1367
1416
|
/**
|
|
1368
1417
|
* What a link to the site shows. A chat, a feed or a search result draws a card from a page's head
|
|
1369
1418
|
* tags (`Page#getHeadMeta`): its image — the page's `seo.image`, else the site's — its title and its
|
|
@@ -2336,6 +2385,8 @@ async function runDoctor(args = []) {
|
|
|
2336
2385
|
await checkLinkPreviews({ sitePath, siteName, issues })
|
|
2337
2386
|
await checkFavicon({ sitePath, siteName, siteYml, issues, shouldFix, fixed })
|
|
2338
2387
|
await checkTouchIcon({ sitePath, siteName, siteYml, issues, shouldFix, fixed })
|
|
2388
|
+
// Whether a push can make its videos smaller.
|
|
2389
|
+
await checkVideoTools({ sitePath, siteName, issues })
|
|
2339
2390
|
|
|
2340
2391
|
// Forms need a destination, and having none is only visible on the page.
|
|
2341
2392
|
await checkFormSubmitTarget({ sitePath, siteName, siteYml, issues })
|
package/src/commands/pull.js
CHANGED
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
* the backend's version whole, and leaves a sync point.
|
|
37
37
|
*
|
|
38
38
|
* Outside a repository there is nothing to merge against: a pull reconciles the files to
|
|
39
|
-
* the backend — section bodies rewritten, pages and
|
|
40
|
-
* DELETED (`--no-delete` keeps them; an empty or partial payload never wipes the tree) —
|
|
39
|
+
* the backend — section bodies rewritten, pages, sections and records the backend no longer
|
|
40
|
+
* has DELETED (`--no-delete` keeps them; an empty or partial payload never wipes the tree) —
|
|
41
41
|
* and asks first, unless nothing there is the author's (`pull-written.js`).
|
|
42
42
|
*
|
|
43
43
|
* `uniweb login && uniweb pull`. Run from a site, or a workspace with one site.
|
|
@@ -71,7 +71,7 @@ import {
|
|
|
71
71
|
statSync
|
|
72
72
|
} from 'node:fs'
|
|
73
73
|
import { createInterface } from 'node:readline/promises'
|
|
74
|
-
import { join, dirname, relative, resolve, posix } from 'node:path'
|
|
74
|
+
import { join, dirname, relative, resolve, posix, sep } from 'node:path'
|
|
75
75
|
import { execFileSync } from 'node:child_process'
|
|
76
76
|
import yaml from 'js-yaml'
|
|
77
77
|
import { downloadMissingAssets, downloadFileRecords } from '../backend/asset-download.js'
|
|
@@ -87,7 +87,6 @@ import {
|
|
|
87
87
|
computeUnitHashes,
|
|
88
88
|
collectUnitUuids,
|
|
89
89
|
collectQueryUuids,
|
|
90
|
-
collectFolderItemUuids,
|
|
91
90
|
documentSchema
|
|
92
91
|
} from '@uniweb/build/uwx'
|
|
93
92
|
import {
|
|
@@ -112,12 +111,13 @@ import {
|
|
|
112
111
|
commitWriteBacks,
|
|
113
112
|
reportWriteBacks,
|
|
114
113
|
writeItemUuids,
|
|
115
|
-
|
|
114
|
+
writeFolderPlacements,
|
|
116
115
|
writeHeldTypes,
|
|
117
116
|
readItemBaseVersions
|
|
118
117
|
} from '../backend/site-sync.js'
|
|
119
118
|
import { resolveWorkspace } from '../backend/workspace.js'
|
|
120
|
-
import { siteRoots, sentRoots, laneRoots, writableMounts, refusedMountLines, heldMountLines, levelsAboveRepository } from '../utils/site-roots.js'
|
|
119
|
+
import { siteRoots, sentRoots, laneRoots, unsentPaths, pageRoots, writableMounts, refusedMountLines, heldMountLines, levelsAboveRepository } from '../utils/site-roots.js'
|
|
120
|
+
import { sectionFilesNamedTwice, describeSectionsNamedTwice } from '@uniweb/build/site'
|
|
121
121
|
import {
|
|
122
122
|
repoOf,
|
|
123
123
|
mergeInProgress,
|
|
@@ -259,7 +259,12 @@ function pullCachePath(siteDir) {
|
|
|
259
259
|
// ⛔ VERSION 3 DISOWNS THOSE OF A PULL THAT READ NOTHING OF `@`. Before 2026-10-31 a pull took a
|
|
260
260
|
// translation the app had flagged for current, and kept nothing of `@`. A site that has not moved
|
|
261
261
|
// since would answer 304, and its next push would remove what the app keeps there.
|
|
262
|
-
|
|
262
|
+
// ⛔ VERSION 4 DISOWNS THOSE OF A PULL THAT KEPT A REMOVED RECORD'S FILE. Before 2026-11-13 a pull took
|
|
263
|
+
// a folder without a record this copy had pushed, and left the record's file and its mapping, and the
|
|
264
|
+
// `$uuid` of the entry the app removed, which the next push stamped back on. A folder that has not
|
|
265
|
+
// moved since would answer 304, and neither would ever go (`recordsToProject`'s `prune`,
|
|
266
|
+
// `writeFolderPlacements`).
|
|
267
|
+
const PULL_CACHE_VERSION = 4
|
|
263
268
|
export function readPullCache(siteDir) {
|
|
264
269
|
try {
|
|
265
270
|
const obj = JSON.parse(readFileSync(pullCachePath(siteDir), 'utf8'))
|
|
@@ -381,6 +386,30 @@ export function describeUnplacedRecords({ docs, taken, skipped }) {
|
|
|
381
386
|
// `readZip` reads both); the entity files ARE the documents. Falls back to a JSON body (a raw doc, a `{document}`/`{entity}` envelope,
|
|
382
387
|
// or a list) so the lane survives a future envelope change. Returns an array (possibly
|
|
383
388
|
// empty).
|
|
389
|
+
/**
|
|
390
|
+
* Each page directory of the site that holds a section in more than one file, said as the build says
|
|
391
|
+
* it (`sectionFilesNamedTwice`, `@uniweb/build/site`).
|
|
392
|
+
*
|
|
393
|
+
* @param {string} siteDir
|
|
394
|
+
* @returns {string[]}
|
|
395
|
+
*/
|
|
396
|
+
function sectionsNamedTwiceIn(siteDir) {
|
|
397
|
+
const found = []
|
|
398
|
+
const walk = (dir) => {
|
|
399
|
+
let entries
|
|
400
|
+
try {
|
|
401
|
+
entries = readdirSync(dir, { withFileTypes: true })
|
|
402
|
+
} catch {
|
|
403
|
+
return
|
|
404
|
+
}
|
|
405
|
+
const twice = sectionFilesNamedTwice(entries.filter((e) => e.isFile()).map((e) => e.name))
|
|
406
|
+
if (twice.length) found.push(describeSectionsNamedTwice(relative(siteDir, dir).split(sep).join('/') || '.', twice))
|
|
407
|
+
for (const e of entries) if (e.isDirectory() && !e.name.startsWith('.') && e.name !== 'node_modules') walk(join(dir, e.name))
|
|
408
|
+
}
|
|
409
|
+
for (const root of pageRoots(siteDir)) walk(join(siteDir, root))
|
|
410
|
+
return found
|
|
411
|
+
}
|
|
412
|
+
|
|
384
413
|
export function readPullDocuments(buf) {
|
|
385
414
|
// `.uwx` ZIP — the local-file signature is "PK\x03\x04".
|
|
386
415
|
if (buf.length >= 2 && buf[0] === 0x50 && buf[1] === 0x4b) {
|
|
@@ -983,6 +1012,8 @@ export async function pull(args = [], deps = {}) {
|
|
|
983
1012
|
let sections = 0
|
|
984
1013
|
let records = 0
|
|
985
1014
|
let deleted = 0
|
|
1015
|
+
// The records the app removed, which this pull removes from the files (`recordsToProject`'s `prune`).
|
|
1016
|
+
let recordsRemoved = []
|
|
986
1017
|
// The pages a pull does not write — a mount's, a folder-mode `.md` page given what its file cannot
|
|
987
1018
|
// hold, a route the files give two pages for (`@uniweb/build`'s `page-files.js`). Said, since an app
|
|
988
1019
|
// edit to one does not come back; each `.md` page with what it could not hold.
|
|
@@ -1189,7 +1220,9 @@ export async function pull(args = [], deps = {}) {
|
|
|
1189
1220
|
...(taken(folderLane) ? [{ source: folderLane.source, roots: rootsOfLanes.records }] : [])
|
|
1190
1221
|
],
|
|
1191
1222
|
origin: client.origin,
|
|
1192
|
-
siteUuid: siteContentUuid
|
|
1223
|
+
siteUuid: siteContentUuid,
|
|
1224
|
+
// Files a push never sends: a commit that changed only those holds what the backend does.
|
|
1225
|
+
unsent: unsentPaths(siteDir)
|
|
1193
1226
|
})
|
|
1194
1227
|
// A probe with no base cannot tell the backend's changes from this copy's: onto HEAD, it says
|
|
1195
1228
|
// what differs, and which way is the person's to read (`noBase`, below). ⛔ Until 2026-10-26
|
|
@@ -1341,15 +1374,22 @@ export async function pull(args = [], deps = {}) {
|
|
|
1341
1374
|
// back in `records/article/` — see `pullScope`.
|
|
1342
1375
|
scope: pullScope,
|
|
1343
1376
|
// What the foundation declares, read again now the site's content (its `site.yml`) is in.
|
|
1344
|
-
foundation: await readSiteFoundationDeclarations(projDir)
|
|
1377
|
+
foundation: await readSiteFoundationDeclarations(projDir),
|
|
1378
|
+
// ⭐ A record the app removed is removed here, as a page is: onto the stand-in in a
|
|
1379
|
+
// repository, where git merges it, and where this pull's outside-git consent says so.
|
|
1380
|
+
// `--no-delete` keeps its file, as it keeps a page's.
|
|
1381
|
+
prune
|
|
1345
1382
|
}
|
|
1346
1383
|
})
|
|
1384
|
+
recordsRemoved = (report.removed || []).map((p) => relative(projDir, p).split(sep).join('/'))
|
|
1385
|
+
removed.push(...(report.removed || []))
|
|
1347
1386
|
// ⭐ THE FOLDER'S PLACEMENT IDENTITY, from the folder this pull took — as a push banks
|
|
1348
1387
|
// it from the folder it sent. ⛔ Only a push banked it until 2026-09-25, so a copy that
|
|
1349
1388
|
// had never pushed (every clone) sent its first folder with its placements uuid-less,
|
|
1350
1389
|
// and the backend refused that push (`identity_required`, section `contents`) —
|
|
1351
1390
|
// measured on a template clone's first edit.
|
|
1352
|
-
|
|
1391
|
+
// Whole, so an entry the app removed leaves with it (`writeFolderPlacements`).
|
|
1392
|
+
if (folderDoc) writeFolderPlacements(projDir, client.origin, folderDoc)
|
|
1353
1393
|
// …and what each record is held as, so a push can tell a record whose file moved schema.
|
|
1354
1394
|
if (folderDoc) writeHeldTypes(projDir, client.origin, folderDoc)
|
|
1355
1395
|
// The folder's organization, `folder.yml` in the records directory — named as
|
|
@@ -1683,9 +1723,14 @@ export async function pull(args = [], deps = {}) {
|
|
|
1683
1723
|
|
|
1684
1724
|
const summary =
|
|
1685
1725
|
`Pulled — ${pages} page(s), ${sections} section(s), ${records} record(s)` +
|
|
1686
|
-
(deleted ? `, ${deleted} deleted` : '')
|
|
1726
|
+
(deleted ? `, ${deleted} deleted` : '') +
|
|
1727
|
+
(recordsRemoved.length ? `, ${recordsRemoved.length} record(s) removed in the app` : '')
|
|
1687
1728
|
if (notTaken || recordsNotPlaced) info(summary)
|
|
1688
1729
|
else success(summary)
|
|
1730
|
+
// ⭐ Each record the app removed, by its file: one a person meant to keep is brought back by restoring
|
|
1731
|
+
// the file and pushing it, when it goes up as a new record.
|
|
1732
|
+
for (const p of recordsRemoved.slice(0, 12)) note(` removed in the app: ${p}`)
|
|
1733
|
+
if (recordsRemoved.length > 12) note(` … and ${recordsRemoved.length - 12} more`)
|
|
1689
1734
|
// ⭐ Said, since it edits `site.yml`: the route is the mount's key there, and its local folder.
|
|
1690
1735
|
if (!notTaken) {
|
|
1691
1736
|
for (const { from, to } of mountRoutes) {
|
|
@@ -1746,7 +1791,7 @@ export async function pull(args = [], deps = {}) {
|
|
|
1746
1791
|
// ⛔ Nothing changed in the files is not the files holding what the backend has: what
|
|
1747
1792
|
// this copy changed since the base, the backend lacks. Until 2026-10-18 it said they
|
|
1748
1793
|
// held it either way — measured over a revert the backend did not have yet.
|
|
1749
|
-
const ahead = merge.theirs ? filesDifferFrom(repo, merge.theirs, roots) : []
|
|
1794
|
+
const ahead = merge.theirs ? filesDifferFrom(repo, merge.theirs, roots, unsentPaths(siteDir)) : []
|
|
1750
1795
|
if (!ahead.length) note(`Your files already hold what ${client.origin} has.`)
|
|
1751
1796
|
else {
|
|
1752
1797
|
note(`Nothing new from ${client.origin}. ${ahead.length} file(s) here hold changes it does not have yet — \`uniweb push\` sends them:`)
|
|
@@ -1759,6 +1804,14 @@ export async function pull(args = [], deps = {}) {
|
|
|
1759
1804
|
for (const p of merge.keptAsWritten.slice(0, 12)) note(` ${repo.prefix}${p}`)
|
|
1760
1805
|
if (merge.keptAsWritten.length > 12) note(` … and ${merge.keptAsWritten.length - 12} more`)
|
|
1761
1806
|
}
|
|
1807
|
+
// ⛔ ONE SECTION, ONE FILE. Each side adding a section under its own name — `1-lost.md` here, the
|
|
1808
|
+
// backend's `lost.md` — merges without a conflict, and the page would show it twice (2026-11-12).
|
|
1809
|
+
merge.namedTwice = sectionsNamedTwiceIn(siteDir)
|
|
1810
|
+
if (merge.namedTwice.length) {
|
|
1811
|
+
error(`${merge.namedTwice.length} page(s) hold a section in two files, which the merge left side by side:`)
|
|
1812
|
+
for (const line of merge.namedTwice) note(` ${line}`)
|
|
1813
|
+
note('A number orders a section and never names it, so each pair is one section. Keep one file of each, then `git commit`.')
|
|
1814
|
+
}
|
|
1762
1815
|
if (merge.conflicted.length) {
|
|
1763
1816
|
error(`${merge.conflicted.length} file(s) have conflicts to resolve:`)
|
|
1764
1817
|
for (const f of merge.conflicted) note(` ${f}`)
|
|
@@ -1827,7 +1880,7 @@ export async function pull(args = [], deps = {}) {
|
|
|
1827
1880
|
// all in the files — a chained push must not go on as if it were. And a merge that
|
|
1828
1881
|
// could not be made took nothing.
|
|
1829
1882
|
return {
|
|
1830
|
-
exitCode: merge.conflicted.length || recordsNotPlaced || notTaken ? 1 : 0,
|
|
1883
|
+
exitCode: merge.conflicted.length || merge.namedTwice?.length || recordsNotPlaced || notTaken ? 1 : 0,
|
|
1831
1884
|
merge
|
|
1832
1885
|
}
|
|
1833
1886
|
}
|
package/src/commands/status.js
CHANGED
|
@@ -81,7 +81,7 @@ import {
|
|
|
81
81
|
siteTreeIn,
|
|
82
82
|
unmergedPaths
|
|
83
83
|
} from '../utils/sync-point.js'
|
|
84
|
-
import { submoduleMountRoots, writableMounts, refusedMountLines, heldMountLines } from '../utils/site-roots.js'
|
|
84
|
+
import { submoduleMountRoots, writableMounts, refusedMountLines, heldMountLines, unsentPaths } from '../utils/site-roots.js'
|
|
85
85
|
import { aheadBehind, remoteMoved, upstreamOf } from '../utils/git.js'
|
|
86
86
|
import { mountedRepositories, askRemote, standing, mountName, short } from '../utils/mounted-repositories.js'
|
|
87
87
|
import { getLatestVersion, isBehind } from '../utils/update-check.js'
|
|
@@ -401,7 +401,9 @@ async function gitChecks(siteDir, { offline, origin, mounts = [] }) {
|
|
|
401
401
|
let localFiles = null
|
|
402
402
|
const point = readSyncPoint(siteDir, origin)
|
|
403
403
|
if (repo.head && point && isAncestor(repo, point) && siteTreeIn(repo, point)) {
|
|
404
|
-
|
|
404
|
+
// ⛔ Not the files a push never sends, which no backend can lack: a refreshed translation list was
|
|
405
|
+
// counted among "changes the backend does not have yet" until 2026-11-13.
|
|
406
|
+
localFiles = filesDifferFrom(repo, point, [...sentRoots(siteDir), ...submoduleMountRoots(siteDir)], unsentPaths(siteDir))
|
|
405
407
|
}
|
|
406
408
|
|
|
407
409
|
const upstream = upstreamOf(siteDir)
|
package/src/framework-index.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"generatedAt": "2026-11-
|
|
3
|
+
"generatedAt": "2026-11-13T06:00:46.139Z",
|
|
4
4
|
"packages": {
|
|
5
5
|
"@uniweb/api": {
|
|
6
6
|
"version": "1.7.0"
|
|
7
7
|
},
|
|
8
8
|
"@uniweb/build": {
|
|
9
|
-
"version": "1.23.
|
|
9
|
+
"version": "1.23.8"
|
|
10
10
|
},
|
|
11
11
|
"@uniweb/content-reader": {
|
|
12
12
|
"version": "1.5.10"
|
package/src/index.js
CHANGED
|
@@ -1568,6 +1568,9 @@ package.json it writes), syncs content, settles payment when go-live needs it
|
|
|
1568
1568
|
(a browser handoff), and goes live. A published-registry foundation needs no
|
|
1569
1569
|
release; an already-paid site opens no browser.
|
|
1570
1570
|
|
|
1571
|
+
Its pictures and videos are made ready as \`uniweb push\` makes them: a video is
|
|
1572
|
+
made smaller only with ffmpeg installed, with libx264 (\`uniweb doctor\` says).
|
|
1573
|
+
|
|
1571
1574
|
For a third-party host use \`uniweb deploy --host=<name>\`; to register a
|
|
1572
1575
|
FOUNDATION on its own use \`uniweb register\` (alias \`uniweb release\`).
|
|
1573
1576
|
|
|
@@ -2093,6 +2096,10 @@ In a git repository a push sends what is committed. It is refused, with nothing
|
|
|
2093
2096
|
written, if the site changed in the app since your last pull: run \`uniweb pull\` to
|
|
2094
2097
|
merge those changes with yours, then push again.
|
|
2095
2098
|
|
|
2099
|
+
Pictures and videos are made ready before they go up, without their location. A
|
|
2100
|
+
video is made smaller only with ffmpeg installed, with libx264: \`uniweb doctor\`
|
|
2101
|
+
says whether this machine has it.
|
|
2102
|
+
|
|
2096
2103
|
${colors.bright}Options:${colors.reset}
|
|
2097
2104
|
--commit In a git repository, commit the site's content first (-m <message>)
|
|
2098
2105
|
--mounts-as-is Send page folders mounted from other repositories as they are,
|
package/src/utils/site-roots.js
CHANGED
|
@@ -50,20 +50,50 @@ export function siteRoots(siteDir, { media = true } = {}) {
|
|
|
50
50
|
/** What a push sends from the files: the site's roots, its media among them. */
|
|
51
51
|
export const sentRoots = (siteDir) => siteRoots(siteDir)
|
|
52
52
|
|
|
53
|
+
/** The directories a site's pages are read from: its pages root, and each mount its repository holds. */
|
|
54
|
+
export function pageRoots(siteDir) {
|
|
55
|
+
return rootsOf(siteDir)
|
|
56
|
+
.filter((r) => r.kind === 'pages' || (r.kind === 'mount' && mountHolding(siteDir, r.abs).kind === 'site'))
|
|
57
|
+
.map((r) => r.path)
|
|
58
|
+
}
|
|
59
|
+
|
|
53
60
|
/**
|
|
54
61
|
* What each lane of a push carries, as roots: the folder lane the records — their files, and their
|
|
55
62
|
* translations — and the content lane everything else a pull writes, media (`public/`) and the
|
|
56
|
-
* mounts the site's repository holds included.
|
|
57
|
-
* translations with it
|
|
63
|
+
* mounts the site's repository holds included. `locales` stays whole on the content side, record
|
|
64
|
+
* translations with it. ⛔ A root too many there is NOT harmless: a pull's base is a lane's commit only
|
|
65
|
+
* where every lane's roots hold the same in both, so a root too many takes an older base, and an older
|
|
66
|
+
* base can merge a person's own pushed work back as the app's, or drop a change they took back
|
|
67
|
+
* (`utils/sync-point.js`). So compare these with `unsentPaths` left out.
|
|
58
68
|
*/
|
|
59
69
|
export function laneRoots(siteDir) {
|
|
60
|
-
const
|
|
70
|
+
const roots = rootsOf(siteDir)
|
|
71
|
+
const records = roots.find((r) => r.kind === 'records').path
|
|
72
|
+
const translations = roots.find((r) => r.kind === 'translations').path
|
|
61
73
|
return {
|
|
62
74
|
content: siteRoots(siteDir).filter((r) => r !== records),
|
|
63
|
-
records: [records,
|
|
75
|
+
records: [records, `${translations}/records`],
|
|
64
76
|
}
|
|
65
77
|
}
|
|
66
78
|
|
|
79
|
+
/**
|
|
80
|
+
* The files under the site's roots that a push never sends — its translation tools' own, such as the
|
|
81
|
+
* list `i18n extract` refreshes (`unsentTranslationFiles`, `@uniweb/build`) — as paths from the site,
|
|
82
|
+
* `*` for one directory. Left out wherever a copy is compared with what the backend holds: the base a
|
|
83
|
+
* pull merges from, what `uniweb status` says waits to be pushed, and what a pull says it kept.
|
|
84
|
+
*
|
|
85
|
+
* ⛔ Until 2026-11-13 they counted. A teammate's commit that only refreshed
|
|
86
|
+
* `locales/records/manifest.json` read as a records change, so the next pull merged from an older sync
|
|
87
|
+
* point than the one the backend named, and their own published work came back as the app's: three
|
|
88
|
+
* conflicts and a section twice (measured on a site's pull, 2026-11-12).
|
|
89
|
+
*
|
|
90
|
+
* @param {string} siteDir
|
|
91
|
+
* @returns {string[]}
|
|
92
|
+
*/
|
|
93
|
+
export function unsentPaths(siteDir) {
|
|
94
|
+
return rootsOf(siteDir).flatMap((r) => r.unsent || [])
|
|
95
|
+
}
|
|
96
|
+
|
|
67
97
|
/**
|
|
68
98
|
* ⭐ HOW FAR ABOVE ITS REPOSITORY THE SITE REACHES: the most directories above the repository's top
|
|
69
99
|
* that one of the site's relative paths climbs, `site.yml`'s `paths:` and its `file:` and `link:`
|
package/src/utils/sync-point.js
CHANGED
|
@@ -365,7 +365,8 @@ export function newestBase(repo, candidates) {
|
|
|
365
365
|
* second-guessed here.
|
|
366
366
|
*
|
|
367
367
|
* ⛔ ONE MERGE TAKES ONE BASE FOR EVERY LANE, and what the backend names is exact for its own
|
|
368
|
-
* lane only.
|
|
368
|
+
* lane only. Lanes are compared by what a push sends: `unsent` (`utils/site-roots.js::unsentPaths`)
|
|
369
|
+
* names the files it never does, a translation tool's list among them. A commit one lane names that is newer than another lane's, with that lane's files
|
|
369
370
|
* different, would read what that lane lacks — a push of it the backend refused while it took the
|
|
370
371
|
* other — as the backend's removal, and the merge would drop it. So it is not a base. A lane is
|
|
371
372
|
* held to the commit it names, read through the commit its push made of what it wrote back
|
|
@@ -377,7 +378,7 @@ export function newestBase(repo, candidates) {
|
|
|
377
378
|
* it, and each was dropped: a pull merged from the site's first push, measured by flows against a
|
|
378
379
|
* real backend — a reverted change came back (A18), a re-wrap and six pushed edits conflicted.
|
|
379
380
|
*/
|
|
380
|
-
export function baseFor(repo, { known = [], lanes = [], origin, siteUuid }) {
|
|
381
|
+
export function baseFor(repo, { known = [], lanes = [], origin, siteUuid, unsent = [] }) {
|
|
381
382
|
const held = (s) => Boolean(s) && canBeBase(repo, s)
|
|
382
383
|
const fallback = newestBase(repo, known)
|
|
383
384
|
const refs = lanes.map(({ source, roots }) => ({
|
|
@@ -386,7 +387,7 @@ export function baseFor(repo, { known = [], lanes = [], origin, siteUuid }) {
|
|
|
386
387
|
}))
|
|
387
388
|
const named = lanes.flatMap(({ source }) => (held(source) ? [source, recordedAfter(repo, source, { origin, siteUuid })] : []))
|
|
388
389
|
const taken = named.filter(Boolean).filter((s) =>
|
|
389
|
-
refs.every(({ ref, roots }) => Boolean(ref) && (s === ref || isAncestor(repo, s, ref) || !differsIn(repo, ref, s, roots)))
|
|
390
|
+
refs.every(({ ref, roots }) => Boolean(ref) && (s === ref || isAncestor(repo, s, ref) || !differsIn(repo, ref, s, roots, unsent)))
|
|
390
391
|
)
|
|
391
392
|
return newestBase(repo, [...known, ...taken])
|
|
392
393
|
}
|
|
@@ -410,10 +411,18 @@ export function recordedAfter(repo, sha, { origin, siteUuid }) {
|
|
|
410
411
|
return null
|
|
411
412
|
}
|
|
412
413
|
|
|
414
|
+
/**
|
|
415
|
+
* The pathspecs for the roots, from the repository's top, with the files a push never sends left out
|
|
416
|
+
* (`unsent`, paths from the site, `*` for one directory).
|
|
417
|
+
*/
|
|
418
|
+
function pathspecs(repo, roots, unsent = []) {
|
|
419
|
+
return [...roots.map((r) => underTop(repo, r)), ...unsent.map((u) => `:(exclude,glob)${underTop(repo, u)}`)]
|
|
420
|
+
}
|
|
421
|
+
|
|
413
422
|
/** Does the content under `roots` differ between two commits? Anything but "no" counts as yes. */
|
|
414
|
-
function differsIn(repo, a, b, roots) {
|
|
423
|
+
function differsIn(repo, a, b, roots, unsent = []) {
|
|
415
424
|
try {
|
|
416
|
-
git(repo.top, ['diff', '--quiet', a, b, '--', ...
|
|
425
|
+
git(repo.top, ['diff', '--quiet', a, b, '--', ...pathspecs(repo, roots, unsent)])
|
|
417
426
|
return false
|
|
418
427
|
} catch {
|
|
419
428
|
return true
|
|
@@ -1063,10 +1072,11 @@ export function fileAt(repo, rev, path) {
|
|
|
1063
1072
|
|
|
1064
1073
|
/**
|
|
1065
1074
|
* The files under the roots that differ from what `rev` holds there — changed, deleted, or
|
|
1066
|
-
* new and not ignored — relative to the site, one outside it (a mounted folder's) included.
|
|
1075
|
+
* new and not ignored — relative to the site, one outside it (a mounted folder's) included. `unsent`:
|
|
1076
|
+
* files a push never sends (`unsentPaths`), which no backend can lack.
|
|
1067
1077
|
*/
|
|
1068
|
-
export function filesDifferFrom(repo, rev, roots) {
|
|
1069
|
-
const full =
|
|
1078
|
+
export function filesDifferFrom(repo, rev, roots, unsent = []) {
|
|
1079
|
+
const full = pathspecs(repo, roots, unsent)
|
|
1070
1080
|
try {
|
|
1071
1081
|
const changed = zlist(git(repo.top, ['diff', '--name-only', '-z', '--no-renames', rev, '--', ...full]))
|
|
1072
1082
|
const added = zlist(git(repo.top, ['ls-files', '--others', '--exclude-standard', '-z', '--', ...full]))
|