@uniweb/build 1.21.0 → 1.23.0

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.
@@ -404,9 +404,11 @@ export function localizeScalar(value, sourceLocale, translations, context = null
404
404
  * @returns {string|undefined}
405
405
  */
406
406
  export function translationFor(entry, context) {
407
- if (typeof entry === 'string') return entry
407
+ if (typeof entry === 'string') return context?.placeOnly ? undefined : entry
408
408
  if (!entry || typeof entry !== 'object') return undefined
409
409
  const override = context ? entry.overrides?.[contextKey(context)] : undefined
410
+ // ⭐ On a page the site doesn't translate, only an override naming this place (`translationContext`).
411
+ if (context?.placeOnly) return typeof override === 'string' ? override : undefined
410
412
  return typeof override === 'string' ? override : typeof entry.default === 'string' ? entry.default : undefined
411
413
  }
412
414
 
@@ -495,6 +497,8 @@ export function createTranslationCollector(sourceLocale, { siteRoot = null, lang
495
497
  const kept = {} // { place: { '@'?, languages? } }, what `readKept` gives back
496
498
  const keptRead = new Set() // the places read, whether or not they keep anything
497
499
  const marks = { cleared: {}, outdated: {} } // what `addStructuralMap` was told of each row beyond its value
500
+ // The places read on a page the site doesn't translate, which only an override says (`translationContext`).
501
+ marks.placeOnly = new Set()
498
502
 
499
503
  function keepMeta(place, at) {
500
504
  keptRead.add(place)
@@ -528,6 +532,7 @@ export function createTranslationCollector(sourceLocale, { siteRoot = null, lang
528
532
  // says it.
529
533
  function add(localizedValue, context = null, { plainText = false } = {}) {
530
534
  if (!isLocalizedMap(localizedValue)) return
535
+ if (context?.placeOnly) marks.placeOnly.add(contextKey(context))
531
536
  const source = localizedValue[sourceLocale]
532
537
  if (typeof source !== 'string' || source.length === 0) return
533
538
  const hash = computeHash(source)
@@ -558,6 +563,7 @@ export function createTranslationCollector(sourceLocale, { siteRoot = null, lang
558
563
  function addStructuralMap(locale, map, context = null, checks = null, notes = null) {
559
564
  if (locale === sourceLocale || !map || typeof map !== 'object' || Array.isArray(map) || !has(locale)) return
560
565
  const place = context ? contextKey(context) : ''
566
+ if (context?.placeOnly) marks.placeOnly.add(place)
561
567
  for (const [src, row] of Object.entries(notes?.cleared || {})) {
562
568
  ;((marks.cleared[locale] ||= {})[computeHash(src)] ||= {})[place] = row
563
569
  }
@@ -908,18 +914,22 @@ class SeenInContexts {
908
914
  // ⛔ Until 2026-10-17 values agreed only when spelled alike, and a pull rewrote an entry that says the
909
915
  // same thing another way: `[Faire un don](/contact)` to its label, a string a heading and a link
910
916
  // share into per-place overrides, a page title's `[Se connecter](/sign-in)` to its words.
911
- function reconcileTranslation(existing, seen, check = null) {
917
+ // ⭐ A PLACE ON A PAGE THE SITE DOESN'T TRANSLATE (`placeOnly`) IS SAID BY ITS OWN OVERRIDE ALONE, as a
918
+ // build and a push read it (`translationContext`): it never takes the default, nor decides it. So what an
919
+ // author translated there in the app comes back as an override for that place, and reaches no other.
920
+ function reconcileTranslation(existing, seen, check = null, placeOnly = null) {
912
921
  const own = existing && typeof existing === 'object' && existing.overrides && typeof existing.overrides === 'object' ? existing.overrides : {}
913
922
  const authoredDefault = typeof existing === 'string' ? existing : existing && typeof existing === 'object' ? existing.default : undefined
923
+ const only = (k) => k !== null && !!placeOnly?.has(k)
914
924
  // Each place read: its context's key (null where it has none), what it read, and what says that.
915
925
  const places = [
916
926
  ...(seen.plain !== undefined ? [[null, seen.plain, check?.plain ?? saysAsIs(seen.plain)]] : []),
917
927
  ...Object.entries(seen.values).map(([k, v]) => [k, v, check?.values?.[k] ?? saysAsIs(v)]),
918
928
  ]
919
- const at = (k) => (k !== null && k in own ? own[k] : authoredDefault)
929
+ const at = (k) => (k !== null && k in own ? own[k] : only(k) ? undefined : authoredDefault)
920
930
  if (existing !== undefined && places.length && places.every(([k, , says]) => says(at(k)))) return existing
921
931
  // The places the default speaks for: those with no override of the author's own.
922
- const free = places.filter(([k]) => k === null || !(k in own))
932
+ const free = places.filter(([k]) => k === null || (!(k in own) && !only(k)))
923
933
  let def = authoredDefault
924
934
  if (free.length) {
925
935
  let most = -1
@@ -928,15 +938,16 @@ function reconcileTranslation(existing, seen, check = null) {
928
938
  if (agree > most) [def, most] = [candidate, agree]
929
939
  }
930
940
  } else if (def === undefined) {
931
- def = places.find(([k]) => k !== null)?.[1]
941
+ def = places.find(([k]) => k !== null && !only(k))?.[1]
932
942
  }
933
943
  const overrides = { ...own }
934
944
  for (const [k, read, says] of places) {
935
945
  if (k === null) continue
936
- if (says(def)) delete overrides[k]
946
+ if (!only(k) && says(def)) delete overrides[k]
937
947
  else if (!(k in own && says(own[k]))) overrides[k] = read
938
948
  }
939
- return Object.keys(overrides).length ? { default: def, overrides } : def
949
+ if (!Object.keys(overrides).length) return def
950
+ return def === undefined ? { overrides } : { default: def, overrides }
940
951
  }
941
952
 
942
953
  /**
@@ -1067,13 +1078,17 @@ function jsonObjectText(entries) {
1067
1078
  *
1068
1079
  * @returns {string|object|undefined} undefined: no entry
1069
1080
  */
1070
- function settleEntry(existing, seen, check, cleared, outdated) {
1081
+ function settleEntry(existing, seen, check, cleared, outdated, placeOnly = null) {
1071
1082
  let own = existing
1072
1083
  if (own && typeof own === 'object' && 'outdated' in own) {
1073
1084
  const { outdated: _flag, ...rest } = own
1074
1085
  own = rest
1075
1086
  }
1076
- const rows = Object.entries(cleared || {})
1087
+ // ⭐ A row on a page the site doesn't translate holds its source whatever the entry's default says
1088
+ // (`translationContext`), so clearing it ends only an override naming its place, below.
1089
+ const only = (place) => !!place && !!placeOnly?.has(place)
1090
+ const rows = Object.entries(cleared || {}).filter(([place]) => !only(place))
1091
+ const placeOnlyRows = Object.entries(cleared || {}).filter(([place]) => only(place))
1077
1092
  const places = rows.map(([place]) => place).filter(Boolean)
1078
1093
  const reads = seen instanceof SeenInContexts ? seen : seen === undefined ? new SeenInContexts() : new SeenInContexts(seen)
1079
1094
  // Whether the author's entry, pushed to these rows, gives them what they hold: their source. That is
@@ -1081,9 +1096,10 @@ function settleEntry(existing, seen, check, cleared, outdated) {
1081
1096
  const ownSaysThem = (value) => typeof value === 'string' && rows.every(([, row]) => row.says(value))
1082
1097
  let entry
1083
1098
  if (reads.plain !== undefined || Object.keys(reads.values).length > 0) {
1084
- entry = reconcileTranslation(own, reads, check)
1099
+ entry = reconcileTranslation(own, reads, check, placeOnly)
1085
1100
  const readsElsewhere = typeof entry === 'string' ? entry : entry?.default
1086
- if (places.length && !ownSaysThem(readsElsewhere)) {
1101
+ // With no default, a row holding its source is said already: nothing gives it a translation.
1102
+ if (places.length && readsElsewhere !== undefined && !ownSaysThem(readsElsewhere)) {
1087
1103
  const overrides = { ...(entry && typeof entry === 'object' ? entry.overrides : {}) }
1088
1104
  for (const [place, row] of rows) if (place) overrides[place] = row.markdown
1089
1105
  entry = { default: readsElsewhere, overrides }
@@ -1096,6 +1112,13 @@ function settleEntry(existing, seen, check, cleared, outdated) {
1096
1112
  const defaultStays = typeof own.default === 'string' && ownSaysThem(own.default)
1097
1113
  entry = defaultStays || Object.keys(rest).length ? { ...(defaultStays ? { default: own.default } : {}), ...(Object.keys(rest).length ? { overrides: rest } : {}) } : undefined
1098
1114
  }
1115
+ for (const [place, row] of placeOnlyRows) {
1116
+ const override = entry && typeof entry === 'object' ? entry.overrides?.[place] : undefined
1117
+ if (typeof override !== 'string' || row.says(override)) continue
1118
+ const { [place]: _cleared, ...overrides } = entry.overrides
1119
+ const { overrides: _all, ...rest } = entry
1120
+ entry = Object.keys(overrides).length ? { ...rest, overrides } : Object.keys(rest).length ? rest : undefined
1121
+ }
1099
1122
  if (entry === undefined) return undefined
1100
1123
  if (outdated && Object.keys(outdated).length) {
1101
1124
  entry = { ...(typeof entry === 'string' ? { default: entry } : entry), outdated }
@@ -1174,7 +1197,7 @@ export function writeLocaleTranslations(siteRoot, byLocale, subdir = '', says =
1174
1197
  for (const key of new Set([...Object.keys(read), ...Object.keys(cleared)])) {
1175
1198
  // Nothing to say of a row that holds its source where the file has no entry for it, and no place reads one.
1176
1199
  if (!(key in read) && !(key in existing)) continue
1177
- entries[key] = settleEntry(existing[key], read[key], says?.[locale]?.[key], cleared[key], outdated[key])
1200
+ entries[key] = settleEntry(existing[key], read[key], says?.[locale]?.[key], cleared[key], outdated[key], marks?.placeOnly)
1178
1201
  }
1179
1202
  const fresh = Object.keys(entries).filter((key) => !(key in existing) && entries[key] !== undefined).sort()
1180
1203
  const same = (key) => (entries[key] === undefined ? !(key in existing) : canonicalJson(existing[key]) === canonicalJson(entries[key]))
@@ -740,7 +740,7 @@ function siteQueries(declarations) {
740
740
  // those files, and on every push once every file in the directory is placed.
741
741
  //
742
742
  // ⚠️ A file that produced nothing is dropped WITHOUT a warning here: its schema did
743
- // not resolve (reported as schemaless), or its records were skipped (reported while
743
+ // not resolve (refused, `noDataSchema`), or its records were skipped (reported while
744
744
  // reading them). Saying it a second time, as a folder problem, names the wrong cause.
745
745
  function placeProducedRecords(nodes, producedBy) {
746
746
  const out = []
@@ -869,12 +869,9 @@ function resolveDeclaration(schema, modelName) {
869
869
  * Defaults to the site's foundation's (`siteSelfScope`); a caller that has it
870
870
  * already passes it, so one emit reads it once.
871
871
  * @returns {Promise<{ entities: object[], index: object[], warnings: string[],
872
- * refusals: string[], schemaless: Array<{name: string, model: string}>,
873
- * colConfig: object, folder: object, recordsDirExists: boolean }>}
874
- * `refusals` — records that cannot be sent as written (`recordsToEntities`).
875
- * `schemaless` lists the QUERIES whose schema resolved to nothing (the
876
- * convention-default soft-skip) — their records are not pushed as entities, and
877
- * the composite deploy delivers those queries statically instead.
872
+ * refusals: string[], colConfig: object, folder: object, recordsDirExists: boolean }>}
873
+ * `refusals` — records that cannot be sent as written (`recordsToEntities`), and the
874
+ * folders and queries whose data schema resolves to nothing (`noDataSchema`).
878
875
  * `recordsDirExists` is false for a site with no records directory at all.
879
876
  * `sendFolder` is whether a push sends the folder — see `sendsFolder`.
880
877
  */
@@ -922,7 +919,6 @@ export async function buildRecordEntities(siteRoot, opts = {}) {
922
919
  index: [],
923
920
  warnings,
924
921
  refusals,
925
- schemaless: [],
926
922
  colConfig,
927
923
  folder: { ...folder, nodes: [] },
928
924
  recordsDirExists: pool.exists,
@@ -941,8 +937,8 @@ export async function buildRecordEntities(siteRoot, opts = {}) {
941
937
  const resolveModel = typeof opts.resolveModel === 'function' ? opts.resolveModel : null
942
938
  // The local foundation is REQUIRED only when a query asked for a schema
943
939
  // EXPLICITLY (and there's no remote resolver). A schema that only a folder name
944
- // or a query name supplied soft-skips when nothing resolves, so a delivery-only
945
- // site with no foundation must not be forced to have one.
940
+ // or a query name supplied and that nothing resolves is refused per folder and per
941
+ // query below (`noDataSchema`), which says which records it is about.
946
942
  const explicitBy = new Map() // schema (as written) → the first query that asked for it
947
943
  for (const { name, decl } of queries) {
948
944
  if (decl.schemaExplicit && !explicitBy.has(decl.schema)) explicitBy.set(decl.schema, name)
@@ -1005,6 +1001,21 @@ export async function buildRecordEntities(siteRoot, opts = {}) {
1005
1001
  return modelName
1006
1002
  }
1007
1003
 
1004
+ // ⭐ EVERY RECORD HAS A DATA SCHEMA [Diego, 2026-11-11]. A schema only a folder's name or a
1005
+ // query's name supplied, which resolves to nothing, is refused, one line per folder and per
1006
+ // query that reads no folder: the push sends nothing, and says what to write. ⛔ Until
1007
+ // 2026-11-11 it was a soft skip: the records were not sent, a publish uploaded their compiled
1008
+ // files instead, in the site's own language only, and the app could not edit them.
1009
+ const noDataSchema = (where, modelName) =>
1010
+ `${where}: no data schema resolves for ${modelName}` +
1011
+ (resolveModel?.offline === true
1012
+ ? ' here (this run does not ask the backend)'
1013
+ : resolveModel
1014
+ ? ', in the foundation or on the backend'
1015
+ : '') +
1016
+ ', and every record needs one. Define it in the foundation (`schemas/<name>.yml`), or name a ' +
1017
+ 'registered one on the query (`schema:` in queries.yml) — `uniweb guide data`.'
1018
+
1008
1019
  // ⚠️ AN EXPLICIT SCHEMA THAT RESOLVES TO NOTHING IS THE AUTHOR'S ERROR — and a
1009
1020
  // depth-2 folder has two readings worth naming. `records/person/2024/ada.md`
1010
1021
  // resolves as `@person/2024` — the rule is total, so it is not ambiguous — but an
@@ -1103,7 +1114,7 @@ export async function buildRecordEntities(siteRoot, opts = {}) {
1103
1114
  const index = []
1104
1115
  // pool id (the FILE) → the records it produced, so the folder places records.
1105
1116
  const producedBy = new Map()
1106
- // Schemas (as written) whose Model resolved to nothing — soft-skipped.
1117
+ // Schemas (as written) whose Model resolved to nothing — refused (`noDataSchema`).
1107
1118
  const unresolved = new Set()
1108
1119
  // The sync response is keyed per ($schema, $id), so the pair must be unique
1109
1120
  // within one submission.
@@ -1188,9 +1199,10 @@ export async function buildRecordEntities(siteRoot, opts = {}) {
1188
1199
  const declaration = (await declarationFor(modelName)) || (await typedFor(schema))
1189
1200
  if (!declaration) {
1190
1201
  // An explicit schema the author asked for is a hard error; one only the
1191
- // folder's name supplied is a soft skip, reported below.
1202
+ // folder's name supplied is refused for the folder, with the rest of the push.
1192
1203
  if (explicitBy.has(schema)) throw unresolvedExplicit(modelName, explicitBy.get(schema))
1193
1204
  unresolved.add(schema)
1205
+ refusals.push(noDataSchema(`${pool.dir}/${label}/`, modelName))
1194
1206
  continue
1195
1207
  }
1196
1208
 
@@ -1342,18 +1354,10 @@ export async function buildRecordEntities(siteRoot, opts = {}) {
1342
1354
  refusals.push(...mappedOut.refusals)
1343
1355
  }
1344
1356
 
1345
- // Queries whose schema resolved to nothing — not pushed as entities. Their compiled
1346
- // data is delivered as static files instead (`site/schemaless-data.js`), so the caller
1347
- // can route it there; and their declarations are sent naming no Model
1348
- // (`site.js::queriesNested`).
1349
- //
1350
- // ⛔ Deliberately NOT a `warnings` string. This is a product decision the author
1351
- // is making — entities or static files — and it needs to be reported at a
1352
- // prominence a prose warning cannot carry. Callers get the structured entry and
1353
- // say it themselves (`cli/src/commands/{publish,push}.js`). It used to push
1354
- // `"… — not synced"`, printed dim among everything else, and an author read that
1355
- // as "my data did not upload" when it is delivered, as static files.
1356
- const schemaless = []
1357
+ // A query reads records of one data schema, so its schema must resolve too. A query over a
1358
+ // folder whose schema resolved to nothing is refused with the folder, above; one that reads no
1359
+ // folder is refused here (`noDataSchema`). ⛔ Until 2026-11-11 such a query was "schema-less":
1360
+ // its declaration went up naming no Model and a publish uploaded its compiled files.
1357
1361
  for (const { name, decl } of queries) {
1358
1362
  const schema = decl.schema || decl.model
1359
1363
  const hasRecords = poolBySchema.has(schema)
@@ -1363,7 +1367,7 @@ export async function buildRecordEntities(siteRoot, opts = {}) {
1363
1367
  : Boolean((await declarationFor(modelFor(schema, `query "${name}"`))) || (await typedFor(schema))))
1364
1368
  if (!resolved) {
1365
1369
  if (decl.schemaExplicit) throw unresolvedExplicit(qualifyRef(schema, scope), name)
1366
- schemaless.push({ name, model: qualifyRef(schema, scope) })
1370
+ if (!hasRecords) refusals.push(noDataSchema(`query "${name}"`, qualifyRef(schema, scope)))
1367
1371
  continue
1368
1372
  }
1369
1373
  if (!hasRecords) {
@@ -1375,16 +1379,6 @@ export async function buildRecordEntities(siteRoot, opts = {}) {
1375
1379
  )
1376
1380
  }
1377
1381
  }
1378
- // Records whose schema resolved to nothing and that no query reads: they are not
1379
- // pushed, and no static file carries them either — say so, once per folder.
1380
- for (const schema of unresolved) {
1381
- if (queries.some(({ decl }) => (decl.schema || decl.model) === schema)) continue
1382
- const n = poolBySchema.get(schema).length
1383
- warnings.push(
1384
- `${pool.dir}/${poolBySchema.get(schema)[0].dirs.join('/')}/: no data schema resolves for ${schema}, ` +
1385
- `and no query reads ${n === 1 ? 'this record' : `these ${n} records`} — not pushed.`
1386
- )
1387
- }
1388
1382
 
1389
1383
  const nodes = placeProducedRecords(folder.nodes, producedBy)
1390
1384
 
@@ -1393,7 +1387,6 @@ export async function buildRecordEntities(siteRoot, opts = {}) {
1393
1387
  index,
1394
1388
  warnings,
1395
1389
  refusals,
1396
- schemaless,
1397
1390
  colConfig,
1398
1391
  folder: { ...folder, nodes },
1399
1392
  recordsDirExists: pool.exists,
@@ -1419,10 +1412,12 @@ export async function buildRecordEntities(siteRoot, opts = {}) {
1419
1412
  // the records directory is there and holds nothing at all (the deliberate empty,
1420
1413
  // which removes what the backend has — the CLI asks first).
1421
1414
  //
1422
- // ⛔ NOT when every record's schema resolved to nothing, nor when the directory
1423
- // holds only files that are not records (warned). Neither is an author emptying
1424
- // the folder, and sending one would remove the backend's records — including any
1425
- // authored there — for a state nobody chose. Inert instead, like no directory.
1415
+ // ⛔ NOT when the directory holds only files that are not records (warned), nor when
1416
+ // every record's schema resolved to nothing — which a push refuses (`noDataSchema`),
1417
+ // and which a comparison that does not stop on refusals (`status`) must not read as
1418
+ // an emptied folder. Neither is an author emptying the folder, and sending one would
1419
+ // remove the backend's records — including any authored there — for a state nobody
1420
+ // chose. Inert instead, like no directory.
1426
1421
  function sendsFolder(pool, entities, links = []) {
1427
1422
  if (!pool.exists) return false
1428
1423
  if (entities.length > 0 || links.length > 0) return true
@@ -180,8 +180,8 @@ function buildDataSchemaEntities(dataSchemas, scope) {
180
180
  * One `@uniweb/mapping-schema` entity per mapping the foundation defines (`schema._mappings`,
181
181
  * `foundation/mappings.js`): its identity flat, as a data schema's is, and the rest of the file under
182
182
  * `rules` — the envelope's `model:` names the exchange type, so the mapping's own `model:` cannot sit
183
- * beside it. `rules.model` and `rules.keys_from` are named in full; nothing else in `rules` is
184
- * touched, since a backend judges it. A mapping another one names in `keys_from` comes first.
183
+ * beside it. `rules.model`, `rules.keys_from` and a reverse `follow` line's `model` are named in
184
+ * full; nothing else in `rules` is touched, since a backend judges it. A mapping another one names in `keys_from` comes first.
185
185
  *
186
186
  * @param {Object<string, object>} mappings - `{ '@/<name>': declaration }`
187
187
  * @param {(ref: string) => string} scoped - `@/x` → the registration scope's name
@@ -195,6 +195,7 @@ function buildMappingEntities(mappings, scoped) {
195
195
  const { label, description, ...rules } = decl
196
196
  if (typeof rules.model === 'string') rules.model = scoped(rules.model)
197
197
  if (typeof rules.keys_from === 'string') rules.keys_from = scoped(rules.keys_from)
198
+ if (Array.isArray(rules.follow)) rules.follow = rules.follow.map((line) => followNamed(line, scoped))
198
199
  return {
199
200
  model: MAPPING_SCHEMA,
200
201
  name: scoped(ref),
@@ -217,6 +218,18 @@ function buildMappingEntities(mappings, scoped) {
217
218
  return ordered
218
219
  }
219
220
 
221
+ /** One `follow` line, `{ alias: { model?, … } }`, with each `model` named in full; a copy, never the file's. */
222
+ function followNamed(line, scoped) {
223
+ if (line === null || typeof line !== 'object' || Array.isArray(line)) return line
224
+ return Object.fromEntries(
225
+ Object.entries(line).map(([alias, spec]) =>
226
+ spec && typeof spec === 'object' && !Array.isArray(spec) && typeof spec.model === 'string'
227
+ ? [alias, { ...spec, model: scoped(spec.model) }]
228
+ : [alias, spec]
229
+ )
230
+ )
231
+ }
232
+
220
233
  /**
221
234
  * The data schemas in an order a backend can install one at a time: a schema another one in
222
235
  * the package references comes BEFORE it — alphabetical otherwise, so the order is stable.
@@ -7,8 +7,8 @@
7
7
  * site needs it is what its published pages fetch — never whether it has records to sync.
8
8
  * A query counts when a page, a section or the site fetches it, and its records have a
9
9
  * data schema (the declaration names one) and come from the site's own folder (no `url:`).
10
- * A schema-less query's records are delivered as static files, which `records` does not
11
- * touch; an external query is fetched from its own address.
10
+ * Every such query names one, since every record has a data schema [Diego, 2026-11-11];
11
+ * an external query is fetched from its own address.
12
12
  *
13
13
  * @module
14
14
  */
@@ -57,7 +57,7 @@ import { buildRouteOf } from './site.js'
57
57
  import { ATOMIC_PARENT, knownMode } from './route-mode.js'
58
58
  import { fileLinkTargets } from '../site/file-links.js'
59
59
  import { DEFAULT_SECTION_TYPE } from '@uniweb/core/section-type'
60
- import { translationContext, SITE_META_CONTEXT } from '../i18n/extract.js'
60
+ import { translationContext, pageMetaContext, SITE_META_CONTEXT } from '../i18n/extract.js'
61
61
  import { authorableDeclaration, DECLARATION_KEYS } from '../site/fetch-shapes.js'
62
62
  import { createTranslationCollector, writeLocaleTranslations, writeFreeformTranslations, writeKept, unwrapLocalizedContent, isProseMirrorDoc } from './locale-sync.js'
63
63
  import { unwritableNodes } from '@uniweb/content-writer'
@@ -663,7 +663,7 @@ export function pageSectionsToFiles({ pageDir, pageSections, ctx, pageContext })
663
663
  freeformRelPath,
664
664
  freeformCandidates,
665
665
  writeId: fileSectionName(filePath) !== stableId,
666
- context: pageContext ? translationContext({ stableId }, pageContext.route) : null,
666
+ context: pageContext ? translationContext({ stableId }, pageContext.route, ctx?.exclude) : null,
667
667
  media: ctx?.media ?? null,
668
668
  sameFile: ctx?.sameFile ?? null,
669
669
  fileLinks: ctx?.fileLinks ?? null,
@@ -1138,7 +1138,7 @@ function writeMdPage({ record, place, route, ctx, report, pageContext, sourceLoc
1138
1138
  freeformRelPath: buildFreeformPath({ stableId }, pageContext),
1139
1139
  freeformCandidates: freeformPathsFor({ stableId }, pageContext),
1140
1140
  writeId: stableId !== name,
1141
- context: translationContext({ stableId }, pageContext.route),
1141
+ context: translationContext({ stableId }, pageContext.route, ctx?.exclude),
1142
1142
  media: ctx?.media ?? null,
1143
1143
  sameFile: ctx?.sameFile ?? null,
1144
1144
  fileLinks: ctx?.fileLinks ?? null,
@@ -1220,7 +1220,7 @@ function writePagesTree(pages, pagesDir, sourceLocale, report, ctx, routePrefix
1220
1220
  // source value goes inline into page.yml below (pageRecordToYml unwraps it). In the page's
1221
1221
  // context, as the build translates them (`<route>:_meta`), so an override for one page comes back.
1222
1222
  // Each a plain-text field: the push sends a translation's words (`site.js::localizePageMeta`).
1223
- const meta = { page: canon, section: '_meta' }
1223
+ const meta = pageMetaContext(canon, ctx.exclude)
1224
1224
  const text = { plainText: true }
1225
1225
  ctx.collector?.add(record.title, meta, text)
1226
1226
  ctx.collector?.add(record.label, meta, text)
@@ -2047,6 +2047,8 @@ export function siteContentDocumentToProject({ document, siteRoot, backend = nul
2047
2047
  const mountRoutes = followMountRoutes({ siteRoot, siteYml, pagesDir, document, backend, sourceLocale, prune, report })
2048
2048
  siteYml = mountRoutes.siteYml
2049
2049
  ctx.heldMounts = mountRoutes.held
2050
+ // The branches the site doesn't translate: a translation read there comes back for its place alone (`translationContext`).
2051
+ ctx.exclude = siteYml?.i18n?.exclude ?? null
2050
2052
  // A writable mount stays one under its new name.
2051
2053
  const writable = (writableMounts || []).map((segment) => mountRoutes.renamed.get(segment) ?? segment)
2052
2054
  // ⭐ WHERE EACH PAGE IS KEPT — found in the files by the build's rules (`page-files.js`), so a page
package/src/uwx/site.js CHANGED
@@ -93,7 +93,7 @@ import { readKept, restoreKept, contextKey, loadLocaleTranslations, localizeScal
93
93
  import { unwrapLocalized } from './backfill.js'
94
94
  import { loadFreeformTranslation } from '../i18n/freeform.js'
95
95
  import { resolveLocaleList } from '../i18n/locales.js'
96
- import { translationContext, SITE_META_CONTEXT, blockElements, elementText } from '../i18n/extract.js'
96
+ import { translationContext, pageMetaContext, SITE_META_CONTEXT, blockElements, elementText } from '../i18n/extract.js'
97
97
  import { documentSourceLocale } from './source-locale.js'
98
98
  import { splitOpenGraph, openGraphValue, seoBesideOpenGraph } from './open-graph.js'
99
99
  import { isAuthoredPreview } from './authored-preview.js'
@@ -216,21 +216,22 @@ export function buildRouteOf(record, parentRoute, sourceLocale) {
216
216
  // either a STRUCTURAL map (from locales/{locale}.json, via localizeContentDoc) or,
217
217
  // when a FREE-FORM override file exists for that section+locale, the full body
218
218
  // (loadFreeformTranslation) — the override wins. Async because the free-form read
219
- // hits the filesystem.
220
- async function localizeContentTree(pages, layoutSections, sourceLocale, targetLocales, translations, siteRoot) {
219
+ // hits the filesystem. A page in a branch `exclude` names (the site's `i18n.exclude`) takes only a
220
+ // translation written for its place, as the build gives it (`translationContext`).
221
+ async function localizeContentTree(pages, layoutSections, sourceLocale, targetLocales, translations, siteRoot, exclude = null) {
221
222
  const freeformBase = localesDir(siteRoot)
222
223
  // What a pull kept for this push to send back (`readKept`).
223
224
  const kept = readKept(siteRoot)
224
225
  // What each section type declares its data blocks are, so a block is pushed as the build translates it.
225
226
  const dataModel = await dataBlockModels(siteRoot)
226
227
 
227
- const localizeSection = async (record, page) => {
228
+ const localizeSection = async (record, page, exclude = null) => {
228
229
  if (!record.content) return
229
230
  const stableId = record.stable_id || record.$id
230
231
  // Resolved in the section's context, as the build resolves it (`translationContext`): a
231
232
  // context-specific override applies here and nowhere else. ⛔ Until 2026-09-26 every section was
232
233
  // resolved with none, so an override never reached a backend.
233
- const context = translationContext({ stableId }, page?.route)
234
+ const context = translationContext({ stableId }, page?.route, exclude)
234
235
  let localized = localizeContentDoc(record.content, sourceLocale, targetLocales, translations, context, (tag) => dataModel(record.type, tag))
235
236
  const freeform = new Set()
236
237
  if (page) {
@@ -251,7 +252,7 @@ async function localizeContentTree(pages, layoutSections, sourceLocale, targetLo
251
252
 
252
253
  const visitSections = async (sections, page) => {
253
254
  for (const s of sections || []) {
254
- await localizeSection(s, page)
255
+ await localizeSection(s, page, exclude)
255
256
  if (Array.isArray(s.$children)) await visitSections(s.$children, page)
256
257
  }
257
258
  }
@@ -262,7 +263,7 @@ async function localizeContentTree(pages, layoutSections, sourceLocale, targetLo
262
263
  for (const p of pgs || []) {
263
264
  const route = buildRouteOf(p, parentRoute, sourceLocale)
264
265
  const page = { route, id: p.stable_id }
265
- localizePageMeta(p, route, sourceLocale, translations)
266
+ localizePageMeta(p, route, sourceLocale, translations, exclude)
266
267
  if (Array.isArray(p.page_sections)) await visitSections(p.page_sections, page)
267
268
  if (Array.isArray(p.$children)) await visitPages(p.$children, route)
268
269
  }
@@ -316,8 +317,8 @@ export function documentRows(doc, sourceLocale = documentSourceLocale(doc), only
316
317
  // override never reached a backend — nor, until the same day, an entry's default.
317
318
  // ⭐ Each is a plain-text slot, so a translation reaches it as text, as the build renders it
318
319
  // (`plainTextTargets`).
319
- function localizePageMeta(page, route, sourceLocale, translations) {
320
- const context = { page: route, section: '_meta' }
320
+ function localizePageMeta(page, route, sourceLocale, translations, exclude = null) {
321
+ const context = pageMetaContext(route, exclude)
321
322
  const again = (value) =>
322
323
  value && typeof value === 'object' && typeof value[sourceLocale] === 'string'
323
324
  ? plainTextTargets(localizeScalar(value[sourceLocale], sourceLocale, translations, context), sourceLocale)
@@ -1161,7 +1162,7 @@ function externalSource(d) {
1161
1162
  return source
1162
1163
  }
1163
1164
 
1164
- function queriesNested(declarations, uuids = null, scope = null, keyTyped = null, queryFields = null, schemaless = null) {
1165
+ function queriesNested(declarations, uuids = null, scope = null, keyTyped = null, queryFields = null) {
1165
1166
  const out = []
1166
1167
  for (const [name, d] of Object.entries(declarations)) {
1167
1168
  refuseUnder(d.where, `queries.${name}`)
@@ -1182,14 +1183,11 @@ function queriesNested(declarations, uuids = null, scope = null, keyTyped = null
1182
1183
  // names that type — the data schema its records are sent as (`data-key-types.js`).
1183
1184
  const typed = (!d.schemaExplicit && keyTyped?.get(d.schema)) || null
1184
1185
  const schema = typed || d.schema
1185
- // ⛔ NO MODEL FOR A QUERY WHOSE RECORDS RESOLVED NONE (`schemaless`, decided by the records
1186
- // lane — `records.js`). Its name-defaulted `schema` names a Model nothing declares, its records
1187
- // are not pushed, and its compiled data travels as static files — so the declaration goes up
1188
- // with no `schema`. ⛔ Until 2026-09-28 it named that Model anyway (`videos` → `@std/videos`),
1189
- // and a store that checks a query's `schema` against the site's declared types refused the
1190
- // whole content push for it. An explicit `schema:` that does not resolve never reaches here:
1191
- // the records lane refuses it.
1192
- if (!schemaless?.has(name)) setIf(data, 'schema', qualifyRef(schema, scope))
1186
+ // ⭐ EVERY RECORD QUERY NAMES ITS MODEL. One whose schema resolves to nothing never reaches a
1187
+ // backend: the records lane refuses it (`records.js::noDataSchema`), since every record has a
1188
+ // data schema [Diego, 2026-11-11]. ⛔ Until then such a query was "schema-less" and went up
1189
+ // naming no `schema` here, while a publish uploaded its compiled files.
1190
+ setIf(data, 'schema', qualifyRef(schema, scope))
1193
1191
  // ⭐ …AND SAYS SO, so a pull can tell the author's form (`team:`, no schema) from an explicit
1194
1192
  // one — sent only where the deployment's `queries` Section declares the key (`GET /dev/config`
1195
1193
  // → `siteContent.queryFields`), since one that does not refuses a push carrying it.
@@ -1536,8 +1534,6 @@ function touchIconValue(named, settingsFields) {
1536
1534
  * resolves into (`@/x` → `@scope/x`): the site's foundation's. Defaults to
1537
1535
  * `siteSelfScope`; pass the scope the records are emitted with. With none
1538
1536
  * known, `@/x` ships as written.
1539
- * @param {string[]} [opts.schemaless] - the queries whose records resolved no data schema
1540
- * (the records lane's `schemaless`): their declarations name no `schema`.
1541
1537
  * @param {object} [opts.media] - a push's sink for the sections' co-located media
1542
1538
  * (`located-media.js::locatedMediaSink`): each file to upload, and — where its upload
1543
1539
  * map names the file — the reference replaced by the file's key. Absent, nothing is located.
@@ -1778,7 +1774,7 @@ export async function siteProjectToDocument(siteRoot, opts = {}) {
1778
1774
  // language count. Guarding this on `targetLocales.length` is what used to send
1779
1775
  // a bare doc from single-locale sites — see localizeContentDoc for why one
1780
1776
  // field with two shapes is a store that cannot validate its own declaration.
1781
- await localizeContentTree(pages, layoutSections, sourceLocale, targetLocales, translations, siteRoot)
1777
+ await localizeContentTree(pages, layoutSections, sourceLocale, targetLocales, translations, siteRoot, siteYml.i18n?.exclude)
1782
1778
 
1783
1779
  // ⭐ A link to a page is stored by the page's id where it has one (`page-refs.js`), so it
1784
1780
  // survives a rename in an editor, and a pull writes it back as the path a file shows.
@@ -1825,8 +1821,7 @@ export async function siteProjectToDocument(siteRoot, opts = {}) {
1825
1821
  opts.queryUuids,
1826
1822
  scope,
1827
1823
  opts.keyTyped,
1828
- opts.queryFields,
1829
- Array.isArray(opts.schemaless) ? new Set(opts.schemaless) : null
1824
+ opts.queryFields
1830
1825
  )
1831
1826
  // Emitted only when there is something to state — see the header above
1832
1827
  // `serviceRecords`. ⭐ What this copy holds is per backend — a service is bought on
@@ -295,8 +295,7 @@ function rewriteEntityAssets(node, map, ids, bare = null) {
295
295
  * siteContent: { buffer, entityCount, index, models }|null,
296
296
  * records: { buffer, entityCount, index, models, links }|null,
297
297
  * hashes: Object<string,string>, warnings: string[], refusals: string[],
298
- * skipped: number, schemaless: Array<{name: string, model: string}>,
299
- * localAssets: string[], applied: object, namesNew: string[],
298
+ * skipped: number, localAssets: string[], applied: object, namesNew: string[],
300
299
  * recordItemIdentity: { stamped: number, unknown: number, unbanked: string[] } }>}
301
300
  * Each record entry of `records.index` carries `lists`: the record's list items as
302
301
  * sent (`record-items.js::recordItemLists`), for the caller to bank against the
@@ -305,11 +304,11 @@ function rewriteEntityAssets(node, map, ids, bare = null) {
305
304
  * creates — by `$ref`, where the next push will send a uuid — as keys of `hashes`. A
306
305
  * caller that banks `hashes` re-banks these once the push is applied.
307
306
  * `refusals` names the records that cannot be sent as written, one line each
308
- * (`records.js::recordsToEntities`). A caller that submits must not submit while
309
- * any is present: the backend would refuse the records lane — or, for a record
310
- * written by section whose brief requires nothing, store it empty.
311
- * `schemaless` lists queries that resolved no data schema (soft-skipped from
312
- * the sync) — the composite deploy delivers these statically via the data ball.
307
+ * (`records.js::recordsToEntities`), and each folder or query whose data schema
308
+ * resolves to nothing, since every record needs one (`records.js::noDataSchema`). A
309
+ * caller that submits must not submit while any is present: the backend would refuse
310
+ * the records lane — or, for a record written by section whose brief requires nothing,
311
+ * store it empty.
313
312
  * `localAssets` lists the site-root local media refs (`/images/x.png`) the deploy
314
313
  * must upload + rewrite to serve URLs. A section's co-located files ride `localFiles`,
315
314
  * under their keys from the site root (`located-media.js`); any other co-located ref is
@@ -420,8 +419,6 @@ export async function emitSyncPackages(siteRoot, opts = {}) {
420
419
  // …and the same data schema, where a name stands for the type of its data key
421
420
  // (`@/team` → `@/member`, `data-key-types.js`): decided once, by the records.
422
421
  keyTyped: col.keyTyped,
423
- // …and which queries resolved NO data schema — their declarations go up naming none.
424
- schemaless: col.schemaless.map((q) => q.name),
425
422
  // …and whether this deployment takes the key that says so (`siteContent.queryFields`) —
426
423
  // and the page and `settings` keys that carry Open Graph texts per language.
427
424
  ...(Array.isArray(opts.queryFields) ? { queryFields: opts.queryFields } : {}),
@@ -722,7 +719,7 @@ export async function emitSyncPackages(siteRoot, opts = {}) {
722
719
  // Records that name a record this push creates — see `namesNew` above.
723
720
  namesNew,
724
721
  refusals,
725
- schemaless: col.schemaless, localAssets, applied,
722
+ localAssets, applied,
726
723
  // The files a push uploads for its file records, each `{ ref, path, contentType }` — the file, and
727
724
  // a PDF's preview — and for its sections' co-located media, each `{ ref, path }`. Uploaded through
728
725
  // the media lane; `ref` is the key the second emit rewrites.