@uniweb/build 1.13.10 → 1.14.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.
- package/package.json +8 -8
- package/src/foundation/stale-sources.js +115 -2
- package/src/index.js +1 -1
- package/src/prerender.js +5 -2
- package/src/site/add-version.js +385 -0
- package/src/site/config.js +6 -0
- package/src/site/content-collector.js +102 -209
- package/src/site/duplicate-page-ids.js +26 -0
- package/src/site/index.js +1 -0
- package/src/uwx/site-diff.js +11 -2
- package/src/uwx/site.js +16 -10
- package/src/uwx/sync-package.js +10 -1
- package/src/vite-foundation-plugin.js +4 -2
package/src/uwx/site.js
CHANGED
|
@@ -40,8 +40,7 @@
|
|
|
40
40
|
// they ride under their parent section's `$children` (page_sections is
|
|
41
41
|
// self_nesting), via the same `processNesting` the normal build uses.
|
|
42
42
|
//
|
|
43
|
-
// v0 scope (stated, not silent):
|
|
44
|
-
// (favicon/assets — carried out of band). Folder-mode `.md`-as-pages and
|
|
43
|
+
// v0 scope (stated, not silent): media/asset bytes (favicon/assets — carried out of band). Folder-mode `.md`-as-pages and
|
|
45
44
|
// `paths: { pages/<segment> }` mounts are carried since 2026-10-23, read by the
|
|
46
45
|
// build's own rules; a pull leaves those pages alone (`git-authored.js`).
|
|
47
46
|
|
|
@@ -68,6 +67,7 @@ import {
|
|
|
68
67
|
resolveMounts,
|
|
69
68
|
layerMountedFolder,
|
|
70
69
|
folderModePageFiles,
|
|
70
|
+
folderModeChildren,
|
|
71
71
|
rootOrderConfig,
|
|
72
72
|
composeLocalizedRoute,
|
|
73
73
|
isValidSlugSegment,
|
|
@@ -82,6 +82,7 @@ import { resolveDefaultLocale, validateLanguageConfig, queryDataUrl } from '@uni
|
|
|
82
82
|
import { emitEntitySyncPackage } from './entity-document.js'
|
|
83
83
|
import { locateSectionMedia, siteTree } from './located-media.js'
|
|
84
84
|
import { mapPageRefs, pageRefIndex, pageRefPages, storedPageRef } from './page-refs.js'
|
|
85
|
+
import { warnOfDuplicatePageIds } from '../site/duplicate-page-ids.js'
|
|
85
86
|
import { readKept, restoreKept, contextKey, loadLocaleTranslations, localizeScalar, localizeScalarList, localizeContentDoc, localesDir, isLocalizedContent, isProseMirrorDoc, plainTextTargets } from './locale-sync.js'
|
|
86
87
|
import { unwrapLocalized } from './backfill.js'
|
|
87
88
|
import { loadFreeformTranslation } from '../i18n/freeform.js'
|
|
@@ -541,8 +542,7 @@ const CATCH_ALL_MARKER = '...path'
|
|
|
541
542
|
// `multi` section is read as new (inserted, stored counterpart deleted). See
|
|
542
543
|
// the IDENTITY note in the file header and `site-diff.js`.
|
|
543
544
|
//
|
|
544
|
-
// v0
|
|
545
|
-
// out of band). `@`-prefix `nest:` hierarchy, folder-mode `.md`-as-pages and
|
|
545
|
+
// v0 deferral: media/asset bytes (favicon/assets, carried out of band). `@`-prefix `nest:` hierarchy, folder-mode `.md`-as-pages and
|
|
546
546
|
// `paths: { pages/<segment> }` mounts are NOT deferred — each is read here by the
|
|
547
547
|
// build's own rule (folder-mode pages and mounts since 2026-10-23).
|
|
548
548
|
// ===========================================================================
|
|
@@ -790,6 +790,8 @@ async function collectPageSectionsNested(pageDir, siteRoot, pageConfig, media =
|
|
|
790
790
|
// says `hidden: true`, slugged by the filename without its numeric prefix — and in the build's
|
|
791
791
|
// order (`folderModePageFiles`). ⛔ Until 2026-10-23 this lane sent none of them and warned instead;
|
|
792
792
|
// a documentation site — folder-mode pages in a mounted repo — published 2 of its 49 pages.
|
|
793
|
+
//
|
|
794
|
+
// Each comes with the name a `pages:` list knows it by.
|
|
793
795
|
async function folderModePageRecords(ctx, dirPath, orderConfig, isRoot) {
|
|
794
796
|
const { siteRoot, siteIndex, sourceLocale, translations, pageFields } = ctx
|
|
795
797
|
const { files } = folderModePageFiles(await readdir(dirPath), orderConfig)
|
|
@@ -813,17 +815,19 @@ async function folderModePageRecords(ctx, dirPath, orderConfig, isRoot) {
|
|
|
813
815
|
})
|
|
814
816
|
const record = withIdentity(data.stable_id || name, data)
|
|
815
817
|
record.page_sections = page.sections.map((s, i) => sectionToRecord(s, i))
|
|
816
|
-
records.push(record)
|
|
818
|
+
records.push({ name, record })
|
|
817
819
|
}
|
|
818
820
|
return records
|
|
819
821
|
}
|
|
820
822
|
|
|
821
823
|
// Recursively build the `pages` tree: each record carries its fields, its inline
|
|
822
824
|
// `page_sections` (page mode only), and its child pages under `$children`. A folder-mode level's
|
|
823
|
-
// own `.md` pages
|
|
825
|
+
// own `.md` pages and its folders are sent in one order, as the build lists them
|
|
826
|
+
// (`folderModeChildren`).
|
|
824
827
|
async function walkPagesNested(ctx, dirPath, parentSlugPath, inheritedMode, parentConfig, isRoot, mounts = null) {
|
|
825
828
|
const { siteRoot, siteIndex, sourceLocale, translations, pageFields } = ctx
|
|
826
|
-
const
|
|
829
|
+
const files = inheritedMode === 'pages' ? await folderModePageRecords(ctx, dirPath, parentConfig, isRoot) : []
|
|
830
|
+
const made = []
|
|
827
831
|
const folders = await orderedSubfolders(dirPath, inheritedMode, parentConfig, mounts)
|
|
828
832
|
// A folder inside a `[...path]` folder can never be reached, and `[dir]` /
|
|
829
833
|
// `[path]` would name a route variable — refused here as the collector refuses
|
|
@@ -881,9 +885,9 @@ async function walkPagesNested(ctx, dirPath, parentSlugPath, inheritedMode, pare
|
|
|
881
885
|
const children = await walkPagesNested(ctx, f.childrenPath, slugPath, f.childMode, f.config, false)
|
|
882
886
|
if (children.length > 0) record.$children = children
|
|
883
887
|
|
|
884
|
-
|
|
888
|
+
made.push({ name: f.name, record })
|
|
885
889
|
}
|
|
886
|
-
return
|
|
890
|
+
return folderModeChildren(files, made, parentConfig).map((child) => child.record)
|
|
887
891
|
}
|
|
888
892
|
|
|
889
893
|
// layout_sections: top-level self-nesting, keyed by (layout_name, area) in data —
|
|
@@ -1720,7 +1724,9 @@ export async function siteProjectToDocument(siteRoot, opts = {}) {
|
|
|
1720
1724
|
|
|
1721
1725
|
// ⭐ A link to a page is stored by the page's id where it has one (`page-refs.js`), so it
|
|
1722
1726
|
// survives a rename in an editor, and a pull writes it back as the path a file shows.
|
|
1723
|
-
const
|
|
1727
|
+
const refPages = pageRefPages(pages, sourceLocale, buildRouteOf)
|
|
1728
|
+
warnOfDuplicatePageIds(refPages)
|
|
1729
|
+
const refIndex = pageRefIndex(refPages)
|
|
1724
1730
|
mapPageRefs({ pages, layoutSections }, (ref) => storedPageRef(ref, refIndex))
|
|
1725
1731
|
|
|
1726
1732
|
// Collection DECLARATIONS — the merged collections.yml + site.yml::collections
|
package/src/uwx/sync-package.js
CHANGED
|
@@ -112,6 +112,12 @@ function collectReferencedModels(node, acc) {
|
|
|
112
112
|
// media extension) — so it covers PM image `src`, `background`/`params`, record
|
|
113
113
|
// media fields, and localized `{locale: doc}` maps uniformly and safely (non-media
|
|
114
114
|
// strings like `/data/x.json` never match). Mirrors the build's `walkDataAssets`.
|
|
115
|
+
//
|
|
116
|
+
// ⭐ A TEXT NODE'S TEXT IS WHAT A READER READS, never a reference, even when all of it is a path.
|
|
117
|
+
// ⛔ Until 2026-11-01 both walks took it for one: `/assets/front.jpg` in a code span in a guide was
|
|
118
|
+
// warned about as a missing file, and when the site had that file, the guide's words were replaced
|
|
119
|
+
// with its serve URL.
|
|
120
|
+
const isReadersText = (node, key) => key === 'text' && node.type === 'text'
|
|
115
121
|
|
|
116
122
|
// Invoke visitor(ref) for every local asset path string anywhere in the document.
|
|
117
123
|
function walkEntityAssets(node, visitor) {
|
|
@@ -124,7 +130,9 @@ function walkEntityAssets(node, visitor) {
|
|
|
124
130
|
return
|
|
125
131
|
}
|
|
126
132
|
if (node && typeof node === 'object') {
|
|
127
|
-
for (const v of Object.
|
|
133
|
+
for (const [key, v] of Object.entries(node)) {
|
|
134
|
+
if (!isReadersText(node, key)) walkEntityAssets(v, visitor)
|
|
135
|
+
}
|
|
128
136
|
}
|
|
129
137
|
}
|
|
130
138
|
|
|
@@ -211,6 +219,7 @@ function rewriteEntityAssets(node, map, ids, bare = null) {
|
|
|
211
219
|
}
|
|
212
220
|
}
|
|
213
221
|
for (const key of Object.keys(node)) {
|
|
222
|
+
if (isReadersText(node, key)) continue
|
|
214
223
|
const v = node[key]
|
|
215
224
|
if (typeof v === 'string') { if (map[v]) node[key] = map[v] }
|
|
216
225
|
else rewriteEntityAssets(v, map, ids, bare)
|
|
@@ -447,8 +447,10 @@ export function foundationBuildPlugin(options = {}) {
|
|
|
447
447
|
if (_buildingSSRBundle) return
|
|
448
448
|
|
|
449
449
|
// kit's <Prose> / <Article> with no prose styles in the CSS: correct markup, unstyled page,
|
|
450
|
-
// and nothing else says so (`foundation/prose-styles.js`).
|
|
451
|
-
//
|
|
450
|
+
// and nothing else says so (`foundation/prose-styles.js`). A dev rebuild says it too, when the
|
|
451
|
+
// foundation is linked at runtime. ⚠️ That is not the default: `uniweb dev` normally bundles the
|
|
452
|
+
// foundation's source into the site and runs no foundation build, so nothing here reaches it.
|
|
453
|
+
// A warning for that server belongs in the site's config (`site/config.js`).
|
|
452
454
|
if (!warnedProseWithoutStyles.has(resolvedSrcDir) && proseWithoutStyles(bundle)) {
|
|
453
455
|
warnedProseWithoutStyles.add(resolvedSrcDir)
|
|
454
456
|
console.warn(PROSE_WITHOUT_STYLES_WARNING)
|