@uniweb/build 0.51.0 → 0.52.1
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 +7 -7
- package/src/dev/api-mount.js +2 -1
- package/src/dev/plugin.js +15 -11
- package/src/generate-entry.js +29 -2
- package/src/i18n/freeform.js +116 -28
- package/src/i18n/index.js +11 -19
- package/src/i18n/records.js +144 -28
- package/src/prerender.js +10 -16
- package/src/resolve-data-schema.js +2 -1
- package/src/runtime-schema.js +3 -2
- package/src/schema.js +13 -3
- package/src/site/build-site-data.js +11 -5
- package/src/site/config.js +2 -1
- package/src/site/content-collector.js +17 -3
- package/src/site/data-fetcher.js +68 -144
- package/src/site/deploy-config.js +2 -1
- package/src/site/fetch-shapes.js +19 -7
- package/src/site/plugin.js +97 -41
- package/src/site/queries-config.js +15 -4
- package/src/site/query-processor.js +110 -62
- package/src/site/records-config.js +3 -2
- package/src/utils/frontmatter.js +2 -1
- package/src/utils/yaml-schema.js +44 -0
- package/src/uwx/backfill.js +3 -2
- package/src/uwx/entity-source.js +2 -1
- package/src/uwx/project-writer.js +3 -2
- package/src/uwx/records-project.js +9 -3
- package/src/uwx/records.js +7 -4
- package/src/uwx/site-project.js +2 -1
- package/src/uwx/site.js +6 -5
- package/src/validate-data.js +9 -8
package/src/uwx/site.js
CHANGED
|
@@ -75,13 +75,14 @@ function setIf(obj, key, value) {
|
|
|
75
75
|
if (value !== undefined) obj[key] = value
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
// A YAML scalar the author may have written unquoted: `20260910` loads as a number
|
|
79
|
-
//
|
|
80
|
-
//
|
|
78
|
+
// A YAML scalar the author may have written unquoted: `20260910` loads as a number.
|
|
79
|
+
// Carry it as the string it stands for; anything else that is not a string is not a
|
|
80
|
+
// value a string field can hold. (`2026-09-10` loads as the string it is written as —
|
|
81
|
+
// the build's YAML resolves no timestamps, `utils/yaml-schema.js` — so no Date arrives:
|
|
82
|
+
// it was carried re-rendered by `toISOString()` until 2026-09-14.)
|
|
81
83
|
function scalarString(value) {
|
|
82
84
|
if (typeof value === 'string') return value
|
|
83
85
|
if (typeof value === 'number') return String(value)
|
|
84
|
-
if (value instanceof Date) return value.toISOString()
|
|
85
86
|
return undefined
|
|
86
87
|
}
|
|
87
88
|
|
|
@@ -289,7 +290,7 @@ function buildPageData(config, ctx) {
|
|
|
289
290
|
// two data sources. The claim was here the whole time; the mirroring was not.
|
|
290
291
|
// ⭐ `query`, END TO END — no crossing. An earlier version emitted `collection`
|
|
291
292
|
// here on the belief that this field was the backend's to name. MEASURED
|
|
292
|
-
// otherwise: framework already
|
|
293
|
+
// otherwise: framework was already shipping `transform`, `detailPage`, `merge` and
|
|
293
294
|
// `prerender` inside this same `fetch` object, which no backend could be
|
|
294
295
|
// validating — so `fetch` is a blob they carry and framework owns its
|
|
295
296
|
// vocabulary. ⇒ There was nothing to coordinate, and inventing a coordination
|
package/src/validate-data.js
CHANGED
|
@@ -27,6 +27,7 @@ import { readFile } from 'node:fs/promises'
|
|
|
27
27
|
import { existsSync } from 'node:fs'
|
|
28
28
|
import { join, resolve, basename } from 'node:path'
|
|
29
29
|
import yaml from 'js-yaml'
|
|
30
|
+
import { YAML_OPTIONS } from './utils/yaml-schema.js'
|
|
30
31
|
import { queryNameFromUrl, siteReaches, declaredKeys, fillDeclaredKeys } from '@uniweb/core'
|
|
31
32
|
|
|
32
33
|
import { validateItem, isStaticallyCheckable, validateBound } from '@uniweb/schemas/conform'
|
|
@@ -541,13 +542,13 @@ async function resolveRecords(path, { byQuery, siteRoot }) {
|
|
|
541
542
|
try {
|
|
542
543
|
const text = await readFile(filePath, 'utf8')
|
|
543
544
|
if (path.endsWith('.json')) records = JSON.parse(text)
|
|
544
|
-
else if (path.endsWith('.yml') || path.endsWith('.yaml')) records = yaml.load(text)
|
|
545
|
+
else if (path.endsWith('.yml') || path.endsWith('.yaml')) records = yaml.load(text, YAML_OPTIONS)
|
|
545
546
|
else {
|
|
546
547
|
// Unknown extension — try JSON, then YAML.
|
|
547
548
|
try {
|
|
548
549
|
records = JSON.parse(text)
|
|
549
550
|
} catch {
|
|
550
|
-
records = yaml.load(text)
|
|
551
|
+
records = yaml.load(text, YAML_OPTIONS)
|
|
551
552
|
}
|
|
552
553
|
}
|
|
553
554
|
} catch (err) {
|
|
@@ -555,12 +556,12 @@ async function resolveRecords(path, { byQuery, siteRoot }) {
|
|
|
555
556
|
}
|
|
556
557
|
}
|
|
557
558
|
|
|
558
|
-
// Validate the shape that actually SHIPS. `/data/*.json` is JSON, so a
|
|
559
|
-
//
|
|
560
|
-
//
|
|
561
|
-
//
|
|
562
|
-
//
|
|
563
|
-
//
|
|
559
|
+
// Validate the shape that actually SHIPS. `/data/*.json` is JSON, so anything a
|
|
560
|
+
// JSON round trip changes is checked as it arrives, while booleans / numbers /
|
|
561
|
+
// nesting are unchanged. Checking the JSON-round-tripped form makes the checker
|
|
562
|
+
// agree with the serialized payload the runtime and backend receive — and with the
|
|
563
|
+
// prerendered HTML oracle. (A YAML date no longer needs it: the build's YAML
|
|
564
|
+
// resolves no timestamps, `utils/yaml-schema.js`, so it is the string as written.)
|
|
564
565
|
return { records: toShippedShape(records) }
|
|
565
566
|
}
|
|
566
567
|
|