uniweb 1.24.18 → 1.24.20

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.24.18",
3
+ "version": "1.24.20",
4
4
  "description": "Create structured Vite + React sites with content/code separation",
5
5
  "type": "module",
6
6
  "bin": {
@@ -47,7 +47,7 @@
47
47
  "@uniweb/content-writer": "~1.3.1"
48
48
  },
49
49
  "peerDependencies": {
50
- "@uniweb/build": "~1.13.10",
50
+ "@uniweb/build": "~1.13.11",
51
51
  "@uniweb/semantic-parser": "~1.13.2",
52
52
  "@uniweb/content-reader": "~1.5.8"
53
53
  },
@@ -552,7 +552,7 @@ A link to a section names its page and its id: `page:about#team` goes to `/about
552
552
 
553
553
  Sizing and loading ride on the image: `{width=800 height=600 loading=lazy fit=cover position=center}`, and its credit as `{author="Jane Doe"}`. A video adds `{poster=./thumb.jpg autoplay muted loop controls}`; a `{role=pdf}` document adds `{preview=./cover.jpg author=… description=…}` and arrives in `content.documents` — `{ url, name, mime, size?, alt, caption, … }` — declare it in `content:` as `documents`. Name a video's poster: a static build makes one from the video only when none is named and ffmpeg is installed, and `uniweb publish` sends only the poster you name.
554
554
 
555
- **Where media lives.** `./x` names a file beside the page, `/x` a file in `public/`, and both reach a static build and a site published with Uniweb. Keep a page's media beside it, and keep in `public/` what needs a fixed address: the favicon, fonts, a file other sites link to. A static build copies `public/` whole and adds its own copy of each file a page names there, so a video only a page shows is in `dist/` twice from `public/` and once from beside the page. `uniweb push` uploads a file beside a page wherever the page is, in a folder `paths:` mounts too; a file outside the site and the folders it mounts is not uploaded, so put that in `public/`. A site has no `assets/` folder for media: a build stops on a `/x` only `assets/` holds.
555
+ **Where media lives.** `./x` names a file beside the page, `/x` a file in `public/`, and both reach a static build and a site published with Uniweb. 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 and adds its own copy of each file a page names there, so a video only a page shows is in `dist/` twice from `public/` and once from beside the page. `uniweb push` uploads a file beside a page wherever the page is, in a folder `paths:` mounts too; a file outside the site and the folders it mounts is not uploaded, so put that in `public/`. A site has no `assets/` folder for media: a build stops on a `/x` only `assets/` holds.
556
556
 
557
557
  **Placement — where a block sits in a section rendered in order.** `{placement=left}` (or `right`, `wide`, `full`) on an image or a video; a table takes it on its **caption line**, the paragraph after the table, after a blank line — `: Plans and prices {placement=wide #tbl-plans}`, which also gives the table a caption and a cross-reference id. It is the author's intent, not a size: kit's `<Render>`, `<Prose>` and `<Article>` lay all four out (`data-placement`, styled by `prose-tokens.css`), and any other component ignores it. A section type says which it honours in `meta.js` — `sequence: { label, placement: true }` — and the build warns when a file asks for one its type does not offer.
558
558
 
@@ -1613,6 +1613,8 @@ The build auto-adds preconnect hints for imports, emits `@font-face` + preload f
1613
1613
  }
1614
1614
  ```
1615
1615
 
1616
+ **Name every folder that writes classes.** The foundation's own build finds them all, but a site build and `uniweb dev` read only what these lines name, so a class in a folder left out is in one CSS and missing from the other. `uniweb dev`, a site build and `uniweb doctor` (`unread-folder`) give the line to add.
1617
+
1616
1618
  Semantic tokens come from `theme-tokens.css` (populated from `theme.yml`). It also tells Tailwind to read kit's source, so kit's own classes reach your CSS wherever your package manager put kit. A foundation that skips the import names kit itself, by where kit is: `./node_modules/@uniweb/kit/src/**` under pnpm, `../node_modules/@uniweb/kit/src/**` under npm. Use `@theme` only for values tokens don't cover. **Custom CSS is expected alongside Tailwind** — shadow systems, border hierarchies, gradients, glassmorphism. Tailwind handles layout; tokens handle context; `styles.css` handles everything else.
1617
1619
 
1618
1620
  **Tokens are a floor, not a ceiling.** They solve context adaptation — the hard problem. A great foundation adds design vocabulary on top:
@@ -3179,7 +3181,7 @@ Loud failures:
3179
3181
 
3180
3182
  **Component not appearing** — verify `meta.js` exists; check for `hidden: true`; rebuild the foundation.
3181
3183
 
3182
- **Styles not applying** — verify `@source` in `styles.css` includes your component paths.
3184
+ **Styles not applying** — verify `@source` in `styles.css` includes your component paths; `uniweb doctor` names a folder it misses.
3183
3185
 
3184
3186
  **Prerender warnings about hooks** — components with `useState`/`useEffect` show SSG warnings during build in local symlinked mode. Expected and harmless.
3185
3187
 
@@ -282,7 +282,8 @@ export async function bringFoundationAlong({
282
282
  confirm,
283
283
  cliBin,
284
284
  dryRun = false,
285
- verb = 'publish'
285
+ verb = 'publish',
286
+ commits = []
286
287
  }) {
287
288
  const local = resolveLocalFoundation(siteDir, siteYml)
288
289
  if (!local) {
@@ -300,7 +301,8 @@ export async function bringFoundationAlong({
300
301
  confirm,
301
302
  cliBin,
302
303
  dryRun,
303
- verb
304
+ verb,
305
+ committed: commits.includes(relative(siteDir, join(local.dir, 'package.json')))
304
306
  })
305
307
  }
306
308
 
@@ -312,6 +314,7 @@ export async function bringFoundationAlong({
312
314
  * @param {object} o
313
315
  * @param {{dir: string, version: string|null}} o.local
314
316
  * @param {'foundation'|'extension'} o.kind
317
+ * @param {boolean} [o.committed] - the push commits this package's package.json (`filesAReleaseWrites`)
315
318
  * @returns {Promise<{ released: boolean, proceed: boolean, ref: string|null, bumped?: string }>}
316
319
  * `bumped` is the version written into package.json when changed code was released
317
320
  * under the next version.
@@ -325,7 +328,8 @@ async function bringLocalCodeAlong({
325
328
  confirm,
326
329
  cliBin,
327
330
  dryRun = false,
328
- verb = 'publish'
331
+ verb = 'publish',
332
+ committed = false
329
333
  }) {
330
334
  const Kind = kind === 'extension' ? 'Extension ' : 'Foundation'
331
335
  const scopedName = await foundationScopedName(local.dir)
@@ -473,7 +477,7 @@ async function bringLocalCodeAlong({
473
477
  writePkgVersion(local.dir, bumpTo)
474
478
  say.info(`Releasing the ${kind} ${scopedName || kind} as ${bumpTo} — ${why}…`)
475
479
  const released = await release()
476
- say.dim(`The ${kind}'s package.json now says ${bumpTo} — commit it.`)
480
+ say.dim(`The ${kind}'s package.json now says ${bumpTo}${committed ? '' : ' — commit it'}.`)
477
481
  if (optOut) say.dim('To send content without releasing code, pass `--no-release`.')
478
482
  return { released, proceed: true, bumped: bumpTo, ref: await pinnedRef() }
479
483
  }
@@ -704,7 +708,8 @@ export async function bringExtensionsAlong({
704
708
  say,
705
709
  confirm,
706
710
  cliBin,
707
- dryRun = false
711
+ dryRun = false,
712
+ commits = []
708
713
  }) {
709
714
  const locals = resolveLocalExtensions(siteDir, siteYml)
710
715
  const pins = {}
@@ -718,7 +723,8 @@ export async function bringExtensionsAlong({
718
723
  say,
719
724
  confirm,
720
725
  cliBin,
721
- dryRun
726
+ dryRun,
727
+ committed: commits.includes(relative(siteDir, join(local.dir, 'package.json')))
722
728
  })
723
729
  // A declined prompt aborts the whole publish, exactly as it does for the
724
730
  // primary — a site live against half its code is worse than not shipping.
@@ -383,6 +383,43 @@ export function unitFilesOf(siteDir, unitPath) {
383
383
  return []
384
384
  }
385
385
 
386
+ /** Unit paths → the files the author keeps them in, as a pull writes them back. */
387
+ export function filesOfUnits(siteDir, units) {
388
+ return units.map((u) => (u === 'site.yml' ? 'site.yml' : unitFilesOf(siteDir, u)[0] ?? u))
389
+ }
390
+
391
+ // How many files a push names before it says how many more.
392
+ const MOVED_SHOWN = 12
393
+
394
+ /**
395
+ * What a site-content push moved, file by file. The lane sends one entity, the site's whole
396
+ * document, so the backend's `changed` flag counts to 1 however much moved. ⛔ Until 2026-11-01
397
+ * that was all it said, and a publish of the hero and ten pages read `site-content: 1 changed`.
398
+ *
399
+ * @param {string} siteDir
400
+ * @param {object} sent - the document this push sent
401
+ * @param {Record<string,string>} base - each unit's hash at the last sync (`readUnitBases().local`)
402
+ * @returns {string[]} the lines to print
403
+ */
404
+ export function describeContentMoved(siteDir, sent, base) {
405
+ // Nothing to compare with, so the backend's word is all there is.
406
+ if (!Object.keys(base).length) return ['site-content: changed']
407
+ const hashes = computeUnitHashes(sent)
408
+ const units = Object.keys(hashes)
409
+ const files = [
410
+ ...filesOfUnits(siteDir, units.filter((u) => u in base && base[u] !== hashes[u])),
411
+ ...filesOfUnits(siteDir, units.filter((u) => !(u in base))).map((f) => `${f} (new)`),
412
+ ...filesOfUnits(siteDir, Object.keys(base).filter((u) => !(u in hashes))).map((f) => `${f} (removed)`)
413
+ ].sort()
414
+ // The document moved and no unit did: what moved is outside the pages (`contentChanges`).
415
+ if (!files.length) return ["site-content: the site's settings changed — its services, languages or queries"]
416
+ return [
417
+ `site-content: ${files.length} file${files.length === 1 ? '' : 's'} changed`,
418
+ ...files.slice(0, MOVED_SHOWN).map((f) => ` ${f}`),
419
+ ...(files.length > MOVED_SHOWN ? [` … and ${files.length - MOVED_SHOWN} more`] : [])
420
+ ]
421
+ }
422
+
386
423
  // Pull the finalized entities out of the restore response. The backend returns
387
424
  // `{ report: { finalized: [ { index, uuid, changed, document }, … ] } }` — each entry
388
425
  // carries its position in the SUBMITTED sequence (`index`, the correlation key — `$id`
@@ -1121,9 +1158,11 @@ export function commitSiteContent(siteDir, { message }) {
1121
1158
  * @param {string[]} [o.released] - what the release wrote into local code (`filesAReleaseWrites`)
1122
1159
  * @param {string[]} [o.only] - these files alone, for a pull or a publish's record: what else
1123
1160
  * differs under the site is the person's, not a push's
1161
+ * @param {boolean} [o.published] - this is a publish's record, the step after its push's write-backs.
1162
+ * It says so, since a log can't otherwise tell the two commits of one publish apart
1124
1163
  * @returns {{ commit: string, paths: string[] } | { error: string } | null}
1125
1164
  */
1126
- export function commitWriteBacks(siteDir, backend, { complete = false, released = [], only = null } = {}) {
1165
+ export function commitWriteBacks(siteDir, backend, { complete = false, released = [], only = null, published = false } = {}) {
1127
1166
  const repo = repoOf(siteDir)
1128
1167
  if (!repo?.head || mergeInProgress(repo)) return null
1129
1168
  let host = 'backend'
@@ -1144,8 +1183,9 @@ export function commitWriteBacks(siteDir, backend, { complete = false, released
1144
1183
  const site = readBackendState(siteDir, backend).site?.uuid
1145
1184
  // In a repo of several sites, the log says which one moved.
1146
1185
  const named = repo.prefix ? repo.prefix.replace(/\/$/, '') : 'the site'
1186
+ const subject = published ? `Record the publish of ${named} on ${backend}` : `Record what ${backend} gave ${named}`
1147
1187
  const made = commitRoots(repo, only || [...sentRoots(siteDir), SYNC_STORE_FILE, ...released], {
1148
- message: `Record what ${backend} gave ${named}${site ? `\n\n${RECORDED_TRAILER}: ${backend} ${site}` : ''}`,
1188
+ message: `${subject}${site ? `\n\n${RECORDED_TRAILER}: ${backend} ${site}` : ''}`,
1149
1189
  identity
1150
1190
  })
1151
1191
  if (made && complete) writeSyncPoint(siteDir, backend, made.commit)
@@ -2519,8 +2559,12 @@ export async function pushSyncPackages({
2519
2559
  note(JSON.stringify(payload).slice(0, 800))
2520
2560
  return null
2521
2561
  }
2522
- const summary = changedSummary(finalized)
2523
- if (summary) note(`${label}: ${summary}`)
2562
+ const moved = opts?.describeMoved && finalized.some((f) => f.changed === true) ? opts.describeMoved() : null
2563
+ if (moved) moved.forEach((line) => note(line))
2564
+ else {
2565
+ const summary = changedSummary(finalized)
2566
+ if (summary) note(`${label}: ${summary}`)
2567
+ }
2524
2568
  return finalized
2525
2569
  }
2526
2570
 
@@ -2702,7 +2746,15 @@ export async function pushSyncPackages({
2702
2746
  localBuffer: siteContent.buffer,
2703
2747
  uuid: siteContentUuid
2704
2748
  }),
2705
- { boundUuid: siteContentUuid, reportTemplate: true, sent: siteContent.buffer }
2749
+ {
2750
+ boundUuid: siteContentUuid,
2751
+ reportTemplate: true,
2752
+ sent: siteContent.buffer,
2753
+ // Read before `settleSiteContent` moves the bases on to this push.
2754
+ describeMoved: sentSiteDoc
2755
+ ? () => describeContentMoved(siteDir, sentSiteDoc, readUnitBases(siteDir, client.origin).local)
2756
+ : null
2757
+ }
2706
2758
  )
2707
2759
  if (!finalized) {
2708
2760
  mergeHarvested()
@@ -833,6 +833,22 @@ export async function checkStaleSources({ foundationName, srcDir, issues }) {
833
833
  log(` Paths are relative to styles.css.`)
834
834
  }
835
835
 
836
+ /**
837
+ * Code in a foundation that writes classes no `@source` reads (`unreadFolders`, `@uniweb/build`).
838
+ * Loaded here for the same reason. A project a template or an older scaffold started keeps its
839
+ * stylesheet through `uniweb update`, so this is how it hears.
840
+ */
841
+ export async function checkUnreadFolders({ foundationName, srcDir, issues }) {
842
+ const { unreadFolders } = await import('@uniweb/build')
843
+ const unread = unreadFolders?.(join(srcDir, 'styles.css')) || []
844
+ if (unread.length === 0) return
845
+ const id = 'unread-folder'
846
+ issues.push({ id, type: 'warn', foundation: foundationName, message: `${foundationName} writes classes where styles.css names no @source` })
847
+ warn(`[${id}] ${foundationName} writes classes where styles.css names no @source, so a site build and \`uniweb dev\` miss any class only used there`)
848
+ log(` Add to styles.css:`)
849
+ for (const { line } of unread) log(` ${line}`)
850
+ }
851
+
836
852
  /**
837
853
  * Source with its comments removed.
838
854
  *
@@ -1772,6 +1788,7 @@ async function runDoctor(args = []) {
1772
1788
  // only there. The build says so too; here it reaches `uniweb status`.
1773
1789
  for (const f of foundations) {
1774
1790
  await checkStaleSources({ foundationName: f.name, srcDir: resolveFoundationSrcPath(f.path), issues })
1791
+ await checkUnreadFolders({ foundationName: f.name, srcDir: resolveFoundationSrcPath(f.path), issues })
1775
1792
  }
1776
1793
 
1777
1794
  // A modifier kit's prose layer does not have — `prose-slate`, `prose-invert`
@@ -533,6 +533,7 @@ export async function publish(args = []) {
533
533
  args,
534
534
  say,
535
535
  confirm,
536
+ commits: released,
536
537
  cliBin: process.argv[1]
537
538
  })
538
539
  } catch (err) {
@@ -560,6 +561,7 @@ export async function publish(args = []) {
560
561
  args,
561
562
  say,
562
563
  confirm,
564
+ commits: released,
563
565
  cliBin: process.argv[1]
564
566
  })
565
567
  } catch (err) {
@@ -1131,7 +1133,7 @@ export async function publish(args = []) {
1131
1133
  // ⭐ The record is committed, as what a push writes is. ⛔ Until 2026-10-30 every publish left
1132
1134
  // `deploy.yml` changed, so a tree a person had committed was never clean after one.
1133
1135
  if (recordAtRest && saveDeploys) {
1134
- const recorded = commitWriteBacks(siteDir, client.origin, { only: ['deploy.yml'] })
1136
+ const recorded = commitWriteBacks(siteDir, client.origin, { only: ['deploy.yml'], published: true })
1135
1137
  if (recorded?.error) reportWriteBacks(recorded, { note: say.dim })
1136
1138
  }
1137
1139
 
@@ -310,6 +310,7 @@ export async function push(args = [], deps = {}) {
310
310
  args,
311
311
  say,
312
312
  confirm,
313
+ commits: released,
313
314
  cliBin: process.argv[1],
314
315
  // An offline emit reports what it WOULD do and touches no network; the ref
315
316
  // still comes back (read from the foundation's package.json) so the preview
@@ -48,6 +48,7 @@ import { basename, dirname, isAbsolute, join, posix, relative, resolve, sep } fr
48
48
  import yaml from 'js-yaml'
49
49
 
50
50
  import {
51
+ filesOfUnits,
51
52
  probeUnpushed,
52
53
  readItemUuids,
53
54
  readSiteWorkspace,
@@ -469,11 +470,6 @@ function loginCommand(siteDir, origin, uuid) {
469
470
  return `npx uniweb login --browser${server} ${ws ? `--org ${ws}` : '--personal'}`
470
471
  }
471
472
 
472
- /** Unit paths → the files the author keeps them in, as a pull writes them back. */
473
- function filesOfUnits(siteDir, units) {
474
- return units.map((u) => (u === 'site.yml' ? 'site.yml' : unitFilesOf(siteDir, u)[0] ?? u))
475
- }
476
-
477
473
  /**
478
474
  * The app: what the backend holds of this site, against this copy.
479
475
  * @returns {Promise<{ checks: object[], proposals: object[], backend: object }>}
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "generatedAt": "2026-11-01T03:46:59.682Z",
3
+ "generatedAt": "2026-11-01T17:22:45.141Z",
4
4
  "packages": {
5
5
  "@uniweb/api": {
6
6
  "version": "1.6.7"
7
7
  },
8
8
  "@uniweb/build": {
9
- "version": "1.13.10"
9
+ "version": "1.13.11"
10
10
  },
11
11
  "@uniweb/content-reader": {
12
12
  "version": "1.5.8"
@@ -24,19 +24,19 @@
24
24
  "version": "1.0.7"
25
25
  },
26
26
  "@uniweb/kit": {
27
- "version": "1.6.13"
27
+ "version": "1.6.15"
28
28
  },
29
29
  "@uniweb/loom": {
30
30
  "version": "1.1.2"
31
31
  },
32
32
  "@uniweb/press": {
33
- "version": "1.1.5"
33
+ "version": "1.1.6"
34
34
  },
35
35
  "@uniweb/projections": {
36
36
  "version": "1.2.9"
37
37
  },
38
38
  "@uniweb/runtime": {
39
- "version": "1.3.7"
39
+ "version": "1.3.8"
40
40
  },
41
41
  "@uniweb/scene": {
42
42
  "version": "1.0.1"
@@ -54,13 +54,13 @@
54
54
  "version": "1.1.2"
55
55
  },
56
56
  "@uniweb/templates": {
57
- "version": "1.1.12"
57
+ "version": "1.1.14"
58
58
  },
59
59
  "@uniweb/theming": {
60
60
  "version": "1.2.1"
61
61
  },
62
62
  "@uniweb/unipress": {
63
- "version": "1.1.23"
63
+ "version": "1.1.25"
64
64
  }
65
65
  },
66
66
  "templates": {