uniweb 1.34.8 → 1.34.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uniweb",
3
- "version": "1.34.8",
3
+ "version": "1.34.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.2",
45
44
  "@uniweb/semantic-parser": "~1.13.5",
46
45
  "@uniweb/core": "~1.6.13",
47
- "@uniweb/schemas": "~1.7.4"
46
+ "@uniweb/schemas": "~1.7.4",
47
+ "@uniweb/content-writer": "~1.3.2"
48
48
  },
49
49
  "peerDependencies": {
50
- "@uniweb/build": "~1.23.7",
50
+ "@uniweb/semantic-parser": "~1.13.5",
51
51
  "@uniweb/content-reader": "~1.5.10",
52
- "@uniweb/semantic-parser": "~1.13.5"
52
+ "@uniweb/build": "~1.23.8"
53
53
  },
54
54
  "peerDependenciesMeta": {
55
55
  "@uniweb/build": {
@@ -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 as it is, with a note: export it as JPEG. `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.
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
 
@@ -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
 
@@ -1422,10 +1422,36 @@ 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
+ /**
1426
+ * The query declarations' identity, by name, from a document the backend handed back (a pull's site
1427
+ * content, or the one a push stored): written WHOLE, so a query removed in the app leaves with its
1428
+ * `$uuid`. A document that carries no `queries` at all leaves the map as it is.
1429
+ *
1430
+ * ⛔ Until 2026-11-13 it was merged, so a query removed in the app kept its `$uuid`, and a new one of the
1431
+ * same name took it on the next push: the failure `writeFolderPlacements` describes for a folder entry.
1432
+ */
1433
+ export function writeQueryUuidsFrom(siteDir, backend, doc) {
1434
+ if (!Array.isArray(doc?.queries)) return
1435
+ setBackendMap(siteDir, backend, 'queries', collectQueryUuids(doc))
1436
+ }
1437
+ // Placements a recovery found missing, beside the ones this copy holds (`recoverRecordsIdentity`).
1425
1438
  export function writeFolderItemUuids(siteDir, backend, map) {
1426
1439
  if (!map || !Object.keys(map).length) return
1427
1440
  updateBackendMap(siteDir, backend, 'folders', map)
1428
1441
  }
1442
+ /**
1443
+ * The placements of a folder the backend handed back — a pull's, or the one a push stored — written
1444
+ * WHOLE, as its record types are (`writeHeldTypes`), so they name exactly the entries it holds.
1445
+ *
1446
+ * ⛔ Until 2026-11-13 each answer was merged into the ones before, so an entry the app removed kept its
1447
+ * `$uuid` here, and the next push stamped it on the record's entry again, which the backend re-created:
1448
+ * a record an author had removed from the site in the app came back with a teammate's push from a copy
1449
+ * that still held its file (measured on a site, 2026-11-10). A removed entry's `$uuid` leaves with it
1450
+ * now, so a record whose file is brought back goes up in an entry of its own.
1451
+ */
1452
+ export function writeFolderPlacements(siteDir, backend, folderDoc) {
1453
+ setBackendMap(siteDir, backend, 'folders', collectFolderItemUuids(folderDoc))
1454
+ }
1429
1455
  /**
1430
1456
  * What the backend holds each record as — its uuid → the data schema its folder entry names —
1431
1457
  * banked wherever placements are, from the same folder document. A push reads it to tell a record
@@ -1483,6 +1509,24 @@ export function writeItemUuids(siteDir, backend, map) {
1483
1509
  if (!map || !Object.keys(map).length) return
1484
1510
  updateBackendMap(siteDir, backend, 'items', map)
1485
1511
  }
1512
+ /**
1513
+ * The units' identity from a document the backend handed back (a pull's site content, or the one a push
1514
+ * stored), with the paths banked before for a unit it still holds: a page the app moved keeps, beside
1515
+ * its new path, the one its files have, which a push of that page needs while a pull holds it. A unit the
1516
+ * document no longer holds leaves with its `$uuid`.
1517
+ *
1518
+ * ⛔ Until 2026-11-13 each document was merged into the map, so a page or section removed in the app kept
1519
+ * its `$uuid` under its path, and a new one made at that path took it on the next push: the failure
1520
+ * `writeFolderPlacements` describes for a folder entry, where the backend re-created the removed row
1521
+ * under the old id. A document with no units leaves the map as it is.
1522
+ */
1523
+ export function writeItemUuidsFrom(siteDir, backend, doc) {
1524
+ const now = collectUnitUuids(doc)
1525
+ if (!Object.keys(now).length) return
1526
+ const held = new Set(Object.values(now))
1527
+ const kept = Object.entries(readItemUuids(siteDir, backend)).filter(([, uuid]) => held.has(uuid))
1528
+ setBackendMap(siteDir, backend, 'items', { ...Object.fromEntries(kept), ...now })
1529
+ }
1486
1530
 
1487
1531
  /**
1488
1532
  * The identity of each record's list items:
@@ -2883,8 +2927,7 @@ export async function pushSyncPackages({
2883
2927
  // unique. Without it every push after the first re-sends the whole `collections`
2884
2928
  // section uuid-less and is refused.
2885
2929
  if (siteFinalizedDoc) {
2886
- const recordIds = collectQueryUuids(siteFinalizedDoc)
2887
- if (Object.keys(recordIds).length) writeQueryUuids(siteDir, client.origin, recordIds)
2930
+ writeQueryUuidsFrom(siteDir, client.origin, siteFinalizedDoc)
2888
2931
  // ⭐ THE SERVICES THIS COPY NOW HOLDS, `{ name: $uuid }`: those the push stated and
2889
2932
  // those held before, as the site returned them (`heldServices`). A service added on
2890
2933
  // the site since this copy's last pull is left out — held, the next push would state
@@ -2927,9 +2970,10 @@ export async function pushSyncPackages({
2927
2970
  if (Object.keys(patch).length) writeUnitBases(siteDir, client.origin, patch)
2928
2971
  // The backend's post-write document carries `$uuid` per item at every nesting
2929
2972
  // level, so the push that just landed also re-arms identity for the next one.
2930
- // Replaced wholesale: an item that no longer exists must not keep a uuid that
2931
- // would re-target something else.
2932
- if (theirs) writeItemUuids(siteDir, client.origin, collectUnitUuids(theirs))
2973
+ // An item that no longer exists must not keep a uuid that would re-target something
2974
+ // else, so a unit the document no longer holds leaves the map (`writeItemUuidsFrom`).
2975
+ // ⛔ This said "replaced wholesale" while the write merged, and those uuids stayed.
2976
+ if (theirs) writeItemUuidsFrom(siteDir, client.origin, theirs)
2933
2977
  else {
2934
2978
  // ⛔ BANKING IS BEST-EFFORT AND ITS FAILURE USED TO BE SILENT — say it here,
2935
2979
  // because the cost lands two commands away and names something else.
@@ -3092,9 +3136,7 @@ export async function pushSyncPackages({
3092
3136
  // live manor 2026-08-27; the identities were on the wire all along.
3093
3137
  const folderDoc = finalized.find((f) => f?.document?.contents)?.document
3094
3138
  if (folderDoc) {
3095
- const placements = collectFolderItemUuids(folderDoc)
3096
- if (Object.keys(placements).length)
3097
- writeFolderItemUuids(siteDir, client.origin, placements)
3139
+ writeFolderPlacements(siteDir, client.origin, folderDoc)
3098
3140
  // What the folder places now, and so which records this push took out of it.
3099
3141
  retireUnplaced(siteDir, client.origin, writeHeldTypes(siteDir, client.origin, folderDoc), { ownedBefore })
3100
3142
  // ⭐ A LINK RECORD'S IDENTITY is its folder entry's `$uuid`, banked as a record's is: into
@@ -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 })
@@ -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 sections the backend no longer has
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'
@@ -86,8 +86,6 @@ import {
86
86
  readZip,
87
87
  computeUnitHashes,
88
88
  collectUnitUuids,
89
- collectQueryUuids,
90
- collectFolderItemUuids,
91
89
  documentSchema
92
90
  } from '@uniweb/build/uwx'
93
91
  import {
@@ -101,7 +99,7 @@ import {
101
99
  deploymentFields,
102
100
  entityHashes,
103
101
  rebankSyncHashes,
104
- writeQueryUuids,
102
+ writeQueryUuidsFrom,
105
103
  mergeBaseVersions,
106
104
  writeItemBaseVersions,
107
105
  pulledItemVersions,
@@ -111,13 +109,14 @@ import {
111
109
  writeUnitBases,
112
110
  commitWriteBacks,
113
111
  reportWriteBacks,
114
- writeItemUuids,
115
- writeFolderItemUuids,
112
+ writeItemUuidsFrom,
113
+ writeFolderPlacements,
116
114
  writeHeldTypes,
117
115
  readItemBaseVersions
118
116
  } from '../backend/site-sync.js'
119
117
  import { resolveWorkspace } from '../backend/workspace.js'
120
- import { siteRoots, sentRoots, laneRoots, writableMounts, refusedMountLines, heldMountLines, levelsAboveRepository } from '../utils/site-roots.js'
118
+ import { siteRoots, sentRoots, laneRoots, unsentPaths, pageRoots, writableMounts, refusedMountLines, heldMountLines, levelsAboveRepository } from '../utils/site-roots.js'
119
+ import { sectionFilesNamedTwice, describeSectionsNamedTwice } from '@uniweb/build/site'
121
120
  import {
122
121
  repoOf,
123
122
  mergeInProgress,
@@ -259,7 +258,12 @@ function pullCachePath(siteDir) {
259
258
  // ⛔ VERSION 3 DISOWNS THOSE OF A PULL THAT READ NOTHING OF `@`. Before 2026-10-31 a pull took a
260
259
  // translation the app had flagged for current, and kept nothing of `@`. A site that has not moved
261
260
  // since would answer 304, and its next push would remove what the app keeps there.
262
- const PULL_CACHE_VERSION = 3
261
+ // ⛔ VERSION 4 DISOWNS THOSE OF A PULL THAT KEPT A REMOVED RECORD'S FILE. Before 2026-11-13 a pull took
262
+ // a folder without a record this copy had pushed, and left the record's file and its mapping, and the
263
+ // `$uuid` of the entry the app removed, which the next push stamped back on. A folder that has not
264
+ // moved since would answer 304, and neither would ever go (`recordsToProject`'s `prune`,
265
+ // `writeFolderPlacements`).
266
+ const PULL_CACHE_VERSION = 4
263
267
  export function readPullCache(siteDir) {
264
268
  try {
265
269
  const obj = JSON.parse(readFileSync(pullCachePath(siteDir), 'utf8'))
@@ -381,6 +385,30 @@ export function describeUnplacedRecords({ docs, taken, skipped }) {
381
385
  // `readZip` reads both); the entity files ARE the documents. Falls back to a JSON body (a raw doc, a `{document}`/`{entity}` envelope,
382
386
  // or a list) so the lane survives a future envelope change. Returns an array (possibly
383
387
  // empty).
388
+ /**
389
+ * Each page directory of the site that holds a section in more than one file, said as the build says
390
+ * it (`sectionFilesNamedTwice`, `@uniweb/build/site`).
391
+ *
392
+ * @param {string} siteDir
393
+ * @returns {string[]}
394
+ */
395
+ function sectionsNamedTwiceIn(siteDir) {
396
+ const found = []
397
+ const walk = (dir) => {
398
+ let entries
399
+ try {
400
+ entries = readdirSync(dir, { withFileTypes: true })
401
+ } catch {
402
+ return
403
+ }
404
+ const twice = sectionFilesNamedTwice(entries.filter((e) => e.isFile()).map((e) => e.name))
405
+ if (twice.length) found.push(describeSectionsNamedTwice(relative(siteDir, dir).split(sep).join('/') || '.', twice))
406
+ for (const e of entries) if (e.isDirectory() && !e.name.startsWith('.') && e.name !== 'node_modules') walk(join(dir, e.name))
407
+ }
408
+ for (const root of pageRoots(siteDir)) walk(join(siteDir, root))
409
+ return found
410
+ }
411
+
384
412
  export function readPullDocuments(buf) {
385
413
  // `.uwx` ZIP — the local-file signature is "PK\x03\x04".
386
414
  if (buf.length >= 2 && buf[0] === 0x50 && buf[1] === 0x4b) {
@@ -983,6 +1011,8 @@ export async function pull(args = [], deps = {}) {
983
1011
  let sections = 0
984
1012
  let records = 0
985
1013
  let deleted = 0
1014
+ // The records the app removed, which this pull removes from the files (`recordsToProject`'s `prune`).
1015
+ let recordsRemoved = []
986
1016
  // The pages a pull does not write — a mount's, a folder-mode `.md` page given what its file cannot
987
1017
  // hold, a route the files give two pages for (`@uniweb/build`'s `page-files.js`). Said, since an app
988
1018
  // edit to one does not come back; each `.md` page with what it could not hold.
@@ -1189,7 +1219,9 @@ export async function pull(args = [], deps = {}) {
1189
1219
  ...(taken(folderLane) ? [{ source: folderLane.source, roots: rootsOfLanes.records }] : [])
1190
1220
  ],
1191
1221
  origin: client.origin,
1192
- siteUuid: siteContentUuid
1222
+ siteUuid: siteContentUuid,
1223
+ // Files a push never sends: a commit that changed only those holds what the backend does.
1224
+ unsent: unsentPaths(siteDir)
1193
1225
  })
1194
1226
  // A probe with no base cannot tell the backend's changes from this copy's: onto HEAD, it says
1195
1227
  // what differs, and which way is the person's to read (`noBase`, below). ⛔ Until 2026-10-26
@@ -1235,11 +1267,12 @@ export async function pull(args = [], deps = {}) {
1235
1267
  pulledVersions = pulledItemVersions(siteDoc, content.itemVersions)
1236
1268
  // Per-item identity for the next push. Without it the backend reads our
1237
1269
  // records as new and re-mints every page and section row.
1238
- writeItemUuids(projDir, client.origin, collectUnitUuids(siteDoc))
1270
+ // A unit the document no longer holds, removed in the app, leaves with its uuid.
1271
+ writeItemUuidsFrom(projDir, client.origin, siteDoc)
1239
1272
  // The collections section's identity has no file to live in either — same
1240
1273
  // reason, same remedy, keyed by name. A pull is the other route by which a
1241
1274
  // copy can recover it (see readQueryUuids).
1242
- writeQueryUuids(projDir, client.origin, collectQueryUuids(siteDoc))
1275
+ writeQueryUuidsFrom(projDir, client.origin, siteDoc)
1243
1276
  // Bring the media down BEFORE projecting: a newly-landed asset gains a map
1244
1277
  // entry, and the projection reads that map to put authored paths back. Run
1245
1278
  // after, and this pull's new assets would project as URLs and only restore
@@ -1287,7 +1320,7 @@ export async function pull(args = [], deps = {}) {
1287
1320
  // The mounts it may write into, each one the site declares writable (above).
1288
1321
  writableMounts: mounts.writable,
1289
1322
  // Where each page was before this pull, read before its identity merged the pulled document's
1290
- // in (`writeItemUuids`, above): a page the app moved is found where the files keep it.
1323
+ // in (`writeItemUuidsFrom`, above): a page the app moved is found where the files keep it.
1291
1324
  priorItems
1292
1325
  })
1293
1326
  wrote.push(...report.pages, ...report.sections, ...report.layout)
@@ -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
- if (folderDoc) writeFolderItemUuids(projDir, client.origin, collectFolderItemUuids(folderDoc))
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
@@ -1490,6 +1530,11 @@ export async function pull(args = [], deps = {}) {
1490
1530
  const syncFile = join(siteDir, 'sync.json')
1491
1531
  const cacheFile = join(siteDir, '.uniweb', 'backend-cache.json')
1492
1532
  const before = { sync: bytesOf(syncFile), cache: bytesOf(cacheFile) }
1533
+ // The files as the person left them, before this pull writes anything back: whether a merge
1534
+ // sets work of theirs aside. ⛔ Until 2026-11-13 it was judged after the write-back below, so a
1535
+ // pull that changed `sync.json` (a page added or removed in the app) said "your uncommitted
1536
+ // changes come back" to someone who had none.
1537
+ const asTheyLeftThem = snapshotFiles(repo)
1493
1538
  // What this copy keeps, taken back from the stand-in: the identity the backend minted
1494
1539
  // (`sync.json`, before the merge, so a merge's stash carries it) and its caches.
1495
1540
  const syncNow = bytesOf(join(projDir, 'sync.json'))
@@ -1601,8 +1646,9 @@ export async function pull(args = [], deps = {}) {
1601
1646
  pin: recorded.pins.find((p) => p.at === n.at)
1602
1647
  }))
1603
1648
  }
1604
- // Whether anything was set aside for the merge: the files as they were, against HEAD.
1605
- merge.setAside = files !== repo.head
1649
+ // Whether work of the person's was set aside for the merge: the files as they left them,
1650
+ // against HEAD. The identity this pull wrote back is its own, and comes back with the rest.
1651
+ merge.setAside = asTheyLeftThem !== repo.head
1606
1652
  merge.noBase = !force && !base
1607
1653
  merge.movedFrom = merge.noBase ? siteMovedFrom : null
1608
1654
  merge.changed = changedInFiles(repo, {
@@ -1683,9 +1729,14 @@ export async function pull(args = [], deps = {}) {
1683
1729
 
1684
1730
  const summary =
1685
1731
  `Pulled — ${pages} page(s), ${sections} section(s), ${records} record(s)` +
1686
- (deleted ? `, ${deleted} deleted` : '')
1732
+ (deleted ? `, ${deleted} deleted` : '') +
1733
+ (recordsRemoved.length ? `, ${recordsRemoved.length} record(s) removed in the app` : '')
1687
1734
  if (notTaken || recordsNotPlaced) info(summary)
1688
1735
  else success(summary)
1736
+ // ⭐ Each record the app removed, by its file: one a person meant to keep is brought back by restoring
1737
+ // the file and pushing it, when it goes up as a new record.
1738
+ for (const p of recordsRemoved.slice(0, 12)) note(` removed in the app: ${p}`)
1739
+ if (recordsRemoved.length > 12) note(` … and ${recordsRemoved.length - 12} more`)
1689
1740
  // ⭐ Said, since it edits `site.yml`: the route is the mount's key there, and its local folder.
1690
1741
  if (!notTaken) {
1691
1742
  for (const { from, to } of mountRoutes) {
@@ -1746,7 +1797,7 @@ export async function pull(args = [], deps = {}) {
1746
1797
  // ⛔ Nothing changed in the files is not the files holding what the backend has: what
1747
1798
  // this copy changed since the base, the backend lacks. Until 2026-10-18 it said they
1748
1799
  // held it either way — measured over a revert the backend did not have yet.
1749
- const ahead = merge.theirs ? filesDifferFrom(repo, merge.theirs, roots) : []
1800
+ const ahead = merge.theirs ? filesDifferFrom(repo, merge.theirs, roots, unsentPaths(siteDir)) : []
1750
1801
  if (!ahead.length) note(`Your files already hold what ${client.origin} has.`)
1751
1802
  else {
1752
1803
  note(`Nothing new from ${client.origin}. ${ahead.length} file(s) here hold changes it does not have yet — \`uniweb push\` sends them:`)
@@ -1759,6 +1810,14 @@ export async function pull(args = [], deps = {}) {
1759
1810
  for (const p of merge.keptAsWritten.slice(0, 12)) note(` ${repo.prefix}${p}`)
1760
1811
  if (merge.keptAsWritten.length > 12) note(` … and ${merge.keptAsWritten.length - 12} more`)
1761
1812
  }
1813
+ // ⛔ ONE SECTION, ONE FILE. Each side adding a section under its own name — `1-lost.md` here, the
1814
+ // backend's `lost.md` — merges without a conflict, and the page would show it twice (2026-11-12).
1815
+ merge.namedTwice = sectionsNamedTwiceIn(siteDir)
1816
+ if (merge.namedTwice.length) {
1817
+ error(`${merge.namedTwice.length} page(s) hold a section in two files, which the merge left side by side:`)
1818
+ for (const line of merge.namedTwice) note(` ${line}`)
1819
+ note('A number orders a section and never names it, so each pair is one section. Keep one file of each, then `git commit`.')
1820
+ }
1762
1821
  if (merge.conflicted.length) {
1763
1822
  error(`${merge.conflicted.length} file(s) have conflicts to resolve:`)
1764
1823
  for (const f of merge.conflicted) note(` ${f}`)
@@ -1827,7 +1886,7 @@ export async function pull(args = [], deps = {}) {
1827
1886
  // all in the files — a chained push must not go on as if it were. And a merge that
1828
1887
  // could not be made took nothing.
1829
1888
  return {
1830
- exitCode: merge.conflicted.length || recordsNotPlaced || notTaken ? 1 : 0,
1889
+ exitCode: merge.conflicted.length || merge.namedTwice?.length || recordsNotPlaced || notTaken ? 1 : 0,
1831
1890
  merge
1832
1891
  }
1833
1892
  }
@@ -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
- localFiles = filesDifferFrom(repo, point, [...sentRoots(siteDir), ...submoduleMountRoots(siteDir)])
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)
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "generatedAt": "2026-11-13T01:28:21.231Z",
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.7"
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,
@@ -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. ⚠️ `locales` stays whole on the content side, record
57
- * translations with it: a root too many there costs a less precise base, never a wrong one.
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 records = rootsOf(siteDir).find((r) => r.kind === 'records').path
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, 'locales/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:`
@@ -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. A commit one lane names that is newer than another lane's, with that lane's files
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, '--', ...roots.map((r) => underTop(repo, r))])
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 = roots.map((r) => underTop(repo, r))
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]))