@uniweb/build 1.15.5 → 1.16.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 +4 -4
- package/src/content/index.js +3 -0
- package/src/site/add-version.js +44 -7
- package/src/site/content-collector.js +93 -69
- package/src/site/file-links.js +91 -26
- package/src/site/mount-entries.js +29 -0
- package/src/utils/numeric-prefix.js +7 -3
- package/src/uwx/body-splice.js +85 -0
- package/src/uwx/data-schema.js +4 -0
- package/src/uwx/emit-surface.json +0 -3
- package/src/uwx/held-units.js +94 -0
- package/src/uwx/index.js +5 -0
- package/src/uwx/page-files.js +255 -0
- package/src/uwx/project-writer.js +32 -5
- package/src/uwx/route-mode.js +18 -0
- package/src/uwx/same-content.js +7 -4
- package/src/uwx/site-diff.js +7 -2
- package/src/uwx/site-dirs.js +50 -6
- package/src/uwx/site-project.js +561 -60
- package/src/uwx/site.js +20 -12
- package/src/uwx/sync-package.js +36 -5
- package/src/uwx/git-authored.js +0 -85
package/src/uwx/site-dirs.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
// Where a site's
|
|
2
|
-
//
|
|
3
|
-
// (`site-
|
|
1
|
+
// Where a site's content lives — ONE definition for the push, which reads the tree from here
|
|
2
|
+
// (`site.js`), the pull, which writes it back here (`site-project.js`), and every check that asks
|
|
3
|
+
// what a push would send or a pull would merge (the CLI's `utils/site-roots.js`). A leaf module so the
|
|
4
|
+
// pull does not import the push.
|
|
4
5
|
|
|
5
|
-
import { join, resolve } from 'node:path'
|
|
6
|
+
import { join, relative, resolve, sep } from 'node:path'
|
|
7
|
+
import { mountEntriesOf } from '../site/mount-entries.js'
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* `site.yml::paths.pages` / `paths.layout`, else `pages/` and `layout/` — resolved
|
|
@@ -16,8 +18,8 @@ import { join, resolve } from 'node:path'
|
|
|
16
18
|
* current.
|
|
17
19
|
*
|
|
18
20
|
* ⭐ Reading `site.yml` rather than the document is the fix, not a detour: it is the
|
|
19
|
-
* file both readers use
|
|
20
|
-
*
|
|
21
|
+
* file both readers use. And it is the project's own: no document carries `paths` since
|
|
22
|
+
* 2026-11-04, so a pull never moves where a project keeps its files.
|
|
21
23
|
*
|
|
22
24
|
* @param {string} siteRoot
|
|
23
25
|
* @param {object|null} siteYml - the parsed `site.yml`
|
|
@@ -30,3 +32,45 @@ export function siteContentDirs(siteRoot, siteYml) {
|
|
|
30
32
|
layoutDir: paths?.layout ? resolve(siteRoot, paths.layout) : join(siteRoot, 'layout'),
|
|
31
33
|
}
|
|
32
34
|
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Every place a push reads the site's content from, each relative to the site in POSIX form — a
|
|
38
|
+
* mount's may lead out of it (`../docs`):
|
|
39
|
+
*
|
|
40
|
+
* - `config`: `site.yml`, `theme.yml`, `head.html`, `queries.yml`;
|
|
41
|
+
* - `translations`: `locales`;
|
|
42
|
+
* - `pages`, `layout`, `records`: where `paths:` puts them, else their own names;
|
|
43
|
+
* - `media`: `public`, where the files a page names are kept;
|
|
44
|
+
* - `mount`: each `paths: { pages/<segment>: <dir> }` folder, with its `segment` and `abs`.
|
|
45
|
+
*
|
|
46
|
+
* ⭐ ONE ANSWER, and the readers that kept their own drifted (2026-11-04): the push's
|
|
47
|
+
* committed-content check named no mount, so it let a mounted folder's uncommitted edits go out,
|
|
48
|
+
* while `uniweb status` counted that folder among what waits to be pushed. Which repository holds a
|
|
49
|
+
* mount — the site's own, one of its own, or none — is git's question, and the CLI's to ask.
|
|
50
|
+
*
|
|
51
|
+
* ⛔ What the walk reads and this lists must not part: `tests/site-content-roots.test.js` changes
|
|
52
|
+
* every file outside these roots and asks whether the push's document moved.
|
|
53
|
+
*
|
|
54
|
+
* @param {string} siteRoot
|
|
55
|
+
* @param {object|null} siteYml - the parsed `site.yml`
|
|
56
|
+
* @returns {Array<{ path: string, kind: 'config'|'translations'|'pages'|'layout'|'records'|'media'|'mount', segment?: string, abs: string }>}
|
|
57
|
+
*/
|
|
58
|
+
export function siteContentRoots(siteRoot, siteYml) {
|
|
59
|
+
const paths = siteYml?.paths
|
|
60
|
+
const at = (dir) => {
|
|
61
|
+
const abs = resolve(siteRoot, String(dir))
|
|
62
|
+
return { abs, path: relative(siteRoot, abs).split(sep).join('/') || '.' }
|
|
63
|
+
}
|
|
64
|
+
const roots = []
|
|
65
|
+
for (const file of ['site.yml', 'theme.yml', 'head.html', 'queries.yml']) roots.push({ ...at(file), kind: 'config' })
|
|
66
|
+
roots.push({ ...at('locales'), kind: 'translations' })
|
|
67
|
+
roots.push({ ...at(paths?.pages || 'pages'), kind: 'pages' })
|
|
68
|
+
roots.push({ ...at(paths?.layout || 'layout'), kind: 'layout' })
|
|
69
|
+
roots.push({ ...at(paths?.records || 'records'), kind: 'records' })
|
|
70
|
+
roots.push({ ...at('public'), kind: 'media' })
|
|
71
|
+
for (const [segment, dir] of mountEntriesOf(paths)) {
|
|
72
|
+
if (typeof dir !== 'string' || !dir) continue
|
|
73
|
+
roots.push({ ...at(dir), kind: 'mount', segment })
|
|
74
|
+
}
|
|
75
|
+
return roots
|
|
76
|
+
}
|