uniweb 1.31.11 → 1.31.12
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.31.
|
|
3
|
+
"version": "1.31.12",
|
|
4
4
|
"description": "Create structured Vite + React sites with content/code separation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -41,15 +41,15 @@
|
|
|
41
41
|
"js-yaml": "^4.3.2",
|
|
42
42
|
"prompts": "^2.4.2",
|
|
43
43
|
"tar": "^7.5.21",
|
|
44
|
-
"@uniweb/
|
|
45
|
-
"@uniweb/schemas": "~1.7.1",
|
|
44
|
+
"@uniweb/semantic-parser": "~1.13.3",
|
|
46
45
|
"@uniweb/core": "~1.6.12",
|
|
47
|
-
"@uniweb/
|
|
46
|
+
"@uniweb/schemas": "~1.7.1",
|
|
47
|
+
"@uniweb/content-writer": "~1.3.1"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@uniweb/
|
|
50
|
+
"@uniweb/semantic-parser": "~1.13.3",
|
|
51
51
|
"@uniweb/content-reader": "~1.5.9",
|
|
52
|
-
"@uniweb/
|
|
52
|
+
"@uniweb/build": "~1.20.9"
|
|
53
53
|
},
|
|
54
54
|
"peerDependenciesMeta": {
|
|
55
55
|
"@uniweb/build": {
|
package/partials/guides/data.md
CHANGED
|
@@ -136,7 +136,7 @@ data: {
|
|
|
136
136
|
|
|
137
137
|
`single`/`whole` are refused over a schema whose root is a list (`@std/nav`, `@std/form`). A `whole` key its source cannot answer whole is `null`. An optional `schemas.config.js` routes a scope to a directory: `export default { '@acme': '../shared/acme-schemas' }` — a routed scope wins, has no package fallback, and `@/`/`@uniweb` are never routable. Worked examples: `development/schemas-in-practice.md`.
|
|
138
138
|
|
|
139
|
-
**Any foundation can use a data schema another defines, by its full name** — `data: { members: '@acme/member' }`, `schema: '@acme/member'` in `queries.yml`. No backend is involved, and nothing to configure: a local build, `uniweb dev` included, reads the type from the package of the workspace that defines it (a foundation whose name gives the `@acme` scope, with the type in its own `schemas/`), or from a library the foundation bundles whose package.json gives that scope (`uniweb guide foundation` § Libraries). Two packages defining it stop the build, naming both. A type no such package defines comes from `schemas.config.js` (`'@acme/member': '../elsewhere/member.yml'`, or the scope's directory), which wins over both, or an installed `@acme/schemas` package. A scope is a namespace that keeps names from colliding, not a limit on who uses a type. So a type another foundation defines is named, never copied: a copy of its file is a second definition of the same type, which `doctor` points out where the two foundations' names give one scope (`type-defined-twice`). Registering, which only a site with a backend does, names such a type and sends no definition of it; a type a library defines is registered from the library, first (`uniweb guide foundation` § Libraries). A push also needs one of the site's foundations to declare the type, as a section type's data key or a schema of its own: the backend refuses a query whose type none of them declares, since nothing there would render it. A site can hold another site's records of a type too: `paths: { 'records/acme/member': '../../hub/site/records/acme/member' }` in its `site.yml` reads them as its own, a push adds them by reference rather than as copies once their own site has pushed them, and a pull leaves those files alone. Two sites whose `paths: { records: … }` name one folder are not that: each push sends the folder's records as its own, two of each on the backend. A site's records of it sit in `records/acme/member/`; in `records/member/` they'd be the foundation's own `@/member`.
|
|
139
|
+
**Any foundation can use a data schema another defines, by its full name** — `data: { members: '@acme/member' }`, `schema: '@acme/member'` in `queries.yml`. No backend is involved, and nothing to configure: a local build, `uniweb dev` included, reads the type from the package of the workspace that defines it (a foundation whose name gives the `@acme` scope, with the type in its own `schemas/`), or from a library the foundation bundles whose package.json gives that scope (`uniweb guide foundation` § Libraries). Two packages defining it stop the build, naming both. A type no such package defines comes from `schemas.config.js` (`'@acme/member': '../elsewhere/member.yml'`, or the scope's directory), which wins over both, or an installed `@acme/schemas` package. A scope is a namespace that keeps names from colliding, not a limit on who uses a type. So a type another foundation defines is named, never copied: a copy of its file is a second definition of the same type, which `doctor` points out where the two foundations' names give one scope (`type-defined-twice`). Registering, which only a site with a backend does, names such a type and sends no definition of it; a type a library defines is registered from the library, first (`uniweb guide foundation` § Libraries). A push also needs one of the site's foundations to declare the type, as a section type's data key or a schema of its own: the backend refuses a query whose type none of them declares, since nothing there would render it. A site can hold another site's records of a type too: `paths: { 'records/acme/member': '../../hub/site/records/acme/member' }` in its `site.yml` reads them as its own, a push adds them by reference rather than as copies once their own site has pushed them, and a pull leaves those files alone. That site can be in another repository checked out beside this one: the foundation then reads the type through `schemas.config.js` or a schemas package, and the push reads the records' ids from that site's committed `sync.json`. Two sites whose `paths: { records: … }` name one folder are not that: each push sends the folder's records as its own, two of each on the backend. A site's records of it sit in `records/acme/member/`; in `records/member/` they'd be the foundation's own `@/member`.
|
|
140
140
|
|
|
141
141
|
```jsx
|
|
142
142
|
function Article({ content, block }) { // data: { article: { schema: '@std/article', single: true } }
|
package/src/commands/pull.js
CHANGED
|
@@ -116,7 +116,7 @@ import {
|
|
|
116
116
|
readItemBaseVersions
|
|
117
117
|
} from '../backend/site-sync.js'
|
|
118
118
|
import { resolveWorkspace } from '../backend/workspace.js'
|
|
119
|
-
import { siteRoots, sentRoots, laneRoots, writableMounts, refusedMountLines, heldMountLines } from '../utils/site-roots.js'
|
|
119
|
+
import { siteRoots, sentRoots, laneRoots, writableMounts, refusedMountLines, heldMountLines, levelsAboveRepository } from '../utils/site-roots.js'
|
|
120
120
|
import {
|
|
121
121
|
repoOf,
|
|
122
122
|
mergeInProgress,
|
|
@@ -1201,7 +1201,8 @@ export async function pull(args = [], deps = {}) {
|
|
|
1201
1201
|
return { repo: m.repo, at: m.at, roots: [m.root], segment: m.segment, rev: force ? m.repo.head : own ?? m.repo.head, parent: force ? m.repo.head : own }
|
|
1202
1202
|
})
|
|
1203
1203
|
try {
|
|
1204
|
-
|
|
1204
|
+
// As far above the repository as the site's paths reach, so a mount beside it resolves there too.
|
|
1205
|
+
standIn = openStandIn(repo, { roots, rev: onto, nested, above: levelsAboveRepository(siteDir, repo, onto) })
|
|
1205
1206
|
} catch (err) {
|
|
1206
1207
|
error(`Could not merge the site: ${err.message}.`)
|
|
1207
1208
|
return { exitCode: 1 }
|
package/src/framework-index.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"generatedAt": "2026-11-
|
|
3
|
+
"generatedAt": "2026-11-11T02:16:44.434Z",
|
|
4
4
|
"packages": {
|
|
5
5
|
"@uniweb/api": {
|
|
6
6
|
"version": "1.7.0"
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"version": "1.2.16"
|
|
37
37
|
},
|
|
38
38
|
"@uniweb/runtime": {
|
|
39
|
-
"version": "1.5.
|
|
39
|
+
"version": "1.5.9"
|
|
40
40
|
},
|
|
41
41
|
"@uniweb/scene": {
|
|
42
42
|
"version": "1.0.1"
|
|
@@ -45,16 +45,16 @@
|
|
|
45
45
|
"version": "1.7.1"
|
|
46
46
|
},
|
|
47
47
|
"@uniweb/scholar": {
|
|
48
|
-
"version": "1.1.
|
|
48
|
+
"version": "1.1.1"
|
|
49
49
|
},
|
|
50
50
|
"@uniweb/semantic-parser": {
|
|
51
|
-
"version": "1.13.
|
|
51
|
+
"version": "1.13.3"
|
|
52
52
|
},
|
|
53
53
|
"@uniweb/snapshot": {
|
|
54
54
|
"version": "1.1.2"
|
|
55
55
|
},
|
|
56
56
|
"@uniweb/templates": {
|
|
57
|
-
"version": "1.2.
|
|
57
|
+
"version": "1.2.12"
|
|
58
58
|
},
|
|
59
59
|
"@uniweb/theming": {
|
|
60
60
|
"version": "1.3.2"
|
package/src/utils/site-roots.js
CHANGED
|
@@ -21,7 +21,7 @@ import yaml from 'js-yaml'
|
|
|
21
21
|
import { siteContentRoots } from '@uniweb/build/uwx'
|
|
22
22
|
import { mountEntriesOf } from '@uniweb/build/site'
|
|
23
23
|
import { mountHolding } from './mounted-repositories.js'
|
|
24
|
-
import { repoOf } from './sync-point.js'
|
|
24
|
+
import { fileAt, repoOf } from './sync-point.js'
|
|
25
25
|
|
|
26
26
|
function readSiteYml(siteDir) {
|
|
27
27
|
try {
|
|
@@ -64,6 +64,65 @@ export function laneRoots(siteDir) {
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
/**
|
|
68
|
+
* ⭐ HOW FAR ABOVE ITS REPOSITORY THE SITE REACHES: the most directories above the repository's top
|
|
69
|
+
* that one of the site's relative paths climbs, `site.yml`'s `paths:` and its `file:` and `link:`
|
|
70
|
+
* dependencies, as this copy holds them and as `rev` does. A pull's stand-in mirrors that far up
|
|
71
|
+
* (`openStandIn`), so a records or pages mount in a repository beside the site's resolves there as in
|
|
72
|
+
* the project. ⛔ Until 2026-11-10 none did: a records mount there stopped every pull, and `status`,
|
|
73
|
+
* with "not a directory here", and a pages mount there failed the pull's re-bank, so the next push
|
|
74
|
+
* sent the whole site again.
|
|
75
|
+
*
|
|
76
|
+
* @param {string} siteDir
|
|
77
|
+
* @param {object|null} repo - `repoOf(siteDir)`
|
|
78
|
+
* @param {string|null} [rev] - the commit the stand-in is filled from
|
|
79
|
+
* @returns {number}
|
|
80
|
+
*/
|
|
81
|
+
export function levelsAboveRepository(siteDir, repo, rev = null) {
|
|
82
|
+
if (!repo) return 0
|
|
83
|
+
const depth = repo.prefix.split('/').filter(Boolean).length
|
|
84
|
+
const climbOf = (path) => {
|
|
85
|
+
const p = typeof path === 'string' ? path.trim() : ''
|
|
86
|
+
if (!p || isAbsolute(p)) return 0
|
|
87
|
+
let level = depth
|
|
88
|
+
let low = depth
|
|
89
|
+
for (const segment of p.split(/[\\/]+/)) {
|
|
90
|
+
if (segment === '..') low = Math.min(low, --level)
|
|
91
|
+
else if (segment && segment !== '.') level++
|
|
92
|
+
}
|
|
93
|
+
return Math.max(0, -low)
|
|
94
|
+
}
|
|
95
|
+
const parsed = (text, parse) => {
|
|
96
|
+
try {
|
|
97
|
+
return text == null ? null : parse(String(text))
|
|
98
|
+
} catch {
|
|
99
|
+
return null // unreadable: it names no path
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
const here = (name) => {
|
|
103
|
+
try {
|
|
104
|
+
return readFileSync(join(siteDir, name), 'utf8')
|
|
105
|
+
} catch {
|
|
106
|
+
return null
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
const copies = [[here('site.yml'), here('package.json')]]
|
|
110
|
+
if (rev) copies.push([fileAt(repo, rev, 'site.yml'), fileAt(repo, rev, 'package.json')])
|
|
111
|
+
const paths = []
|
|
112
|
+
for (const [siteYml, packageJson] of copies) {
|
|
113
|
+
for (const value of Object.values(parsed(siteYml, (t) => yaml.load(t))?.paths || {})) {
|
|
114
|
+
paths.push(typeof value === 'string' ? value : value?.path)
|
|
115
|
+
}
|
|
116
|
+
const pkg = parsed(packageJson, (t) => JSON.parse(t))
|
|
117
|
+
for (const field of ['dependencies', 'devDependencies', 'optionalDependencies']) {
|
|
118
|
+
for (const spec of Object.values(pkg?.[field] || {})) {
|
|
119
|
+
if (typeof spec === 'string' && /^(file|link):/.test(spec)) paths.push(spec.replace(/^(file|link):/, ''))
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return Math.max(0, ...paths.map(climbOf))
|
|
124
|
+
}
|
|
125
|
+
|
|
67
126
|
/**
|
|
68
127
|
* The submodules that hold a mounted folder, each by its path relative to the site: the commit the
|
|
69
128
|
* site's repository records for one is the site's to commit, and `uniweb status` reads a pin that
|
package/src/utils/sync-point.js
CHANGED
|
@@ -42,6 +42,7 @@ import {
|
|
|
42
42
|
mkdtempSync,
|
|
43
43
|
readdirSync,
|
|
44
44
|
readFileSync,
|
|
45
|
+
realpathSync,
|
|
45
46
|
rmSync,
|
|
46
47
|
statSync,
|
|
47
48
|
symlinkSync,
|
|
@@ -49,7 +50,7 @@ import {
|
|
|
49
50
|
writeFileSync
|
|
50
51
|
} from 'node:fs'
|
|
51
52
|
import { tmpdir } from 'node:os'
|
|
52
|
-
import { join, dirname, posix } from 'node:path'
|
|
53
|
+
import { join, basename, dirname, posix, sep } from 'node:path'
|
|
53
54
|
|
|
54
55
|
export const SYNC_TRAILER = 'Uniweb-Sync'
|
|
55
56
|
export const SITE_TRAILER = 'Uniweb-Site'
|
|
@@ -460,6 +461,13 @@ export function nestedBase(repo, siteBase, { at, sub, roots }) {
|
|
|
460
461
|
* site's `sync.json` and `.uniweb/`, which are copies (written there, and taken back by the
|
|
461
462
|
* caller). The stand-in lives outside the project.
|
|
462
463
|
*
|
|
464
|
+
* ⭐ AND WHAT IS AROUND THE REPOSITORY, `above` directories up: the repository stands that deep,
|
|
465
|
+
* under directories named as its parents, each holding links to what is beside it there. So a path
|
|
466
|
+
* leading out of the repository, a records or pages mount in a repository beside it, resolves as in
|
|
467
|
+
* the project too. With `above` 0 the stand-in is the repository's alone. ⛔ Until 2026-11-10 it
|
|
468
|
+
* always was: such a path resolved under the temporary folder, which stopped every pull of a site
|
|
469
|
+
* mounting another repository's records ("not a directory here").
|
|
470
|
+
*
|
|
463
471
|
* ⛔ CLOSE IT. `close()` unlinks every link it made before removing the rest — a recursive
|
|
464
472
|
* remove that followed one would delete the project's own files.
|
|
465
473
|
*
|
|
@@ -481,9 +489,11 @@ export function nestedBase(repo, siteBase, { at, sub, roots }) {
|
|
|
481
489
|
* each submodule a writable mount is in: its `repoOf`, its path from the site repository's top,
|
|
482
490
|
* the mounted folders in it (relative to its own top), the commit they are filled from, and the
|
|
483
491
|
* one a commit of them is made onto (null: none, an unrelated history)
|
|
492
|
+
* @param {number} [opts.above] - how many directories above the repository's top to mirror: as far
|
|
493
|
+
* as the site's relative paths climb (`levelsAboveRepository`, `utils/site-roots.js`)
|
|
484
494
|
* @returns {{ siteDir: string, commit: Function, changes: Function, placeIgnored: Function, close: Function }}
|
|
485
495
|
*/
|
|
486
|
-
export function openStandIn(repo, { roots, rev, nested = [] }) {
|
|
496
|
+
export function openStandIn(repo, { roots, rev, nested = [], above = 0 }) {
|
|
487
497
|
// ⭐ A root is named relative to the site and held by the repository, so one outside the site's
|
|
488
498
|
// folder — a mounted folder elsewhere in the repository — is filled and committed like the rest.
|
|
489
499
|
// One outside the repository is in no commit of it. ⛔ Until 2026-11-04 every root leading out of
|
|
@@ -494,7 +504,19 @@ export function openStandIn(repo, { roots, rev, nested = [] }) {
|
|
|
494
504
|
throw new Error(`the content root \`${r}\` is outside the site's repository, so a pull cannot merge it`)
|
|
495
505
|
}
|
|
496
506
|
})
|
|
497
|
-
const
|
|
507
|
+
const base = mkdtempSync(join(tmpdir(), 'uniweb-stand-in-'))
|
|
508
|
+
// The directories above the repository the stand-in mirrors, nearest first, each with the name of
|
|
509
|
+
// the one below it on the way down; `base` stands for the farthest, and the repository's own stand-in
|
|
510
|
+
// is named as it is, under them.
|
|
511
|
+
const around = []
|
|
512
|
+
for (let real = repo.top; around.length < above && dirname(real) !== real; real = dirname(real)) {
|
|
513
|
+
around.push({ dir: dirname(real), child: basename(real) })
|
|
514
|
+
}
|
|
515
|
+
let root = base
|
|
516
|
+
for (let k = around.length - 1; k >= 0; k--) {
|
|
517
|
+
around[k].stand = root
|
|
518
|
+
root = join(root, around[k].child)
|
|
519
|
+
}
|
|
498
520
|
const indexDir = mkdtempSync(join(tmpdir(), 'uniweb-stand-in-index-'))
|
|
499
521
|
const env = { GIT_INDEX_FILE: join(indexDir, 'index') }
|
|
500
522
|
const at = (args, opts = {}) =>
|
|
@@ -523,7 +545,7 @@ export function openStandIn(repo, { roots, rev, nested = [] }) {
|
|
|
523
545
|
/* already gone */
|
|
524
546
|
}
|
|
525
547
|
}
|
|
526
|
-
rmSync(
|
|
548
|
+
rmSync(base, { recursive: true, force: true })
|
|
527
549
|
rmSync(indexDir, { recursive: true, force: true })
|
|
528
550
|
}
|
|
529
551
|
|
|
@@ -597,6 +619,34 @@ export function openStandIn(repo, { roots, rev, nested = [] }) {
|
|
|
597
619
|
} else link(real, stand, name)
|
|
598
620
|
}
|
|
599
621
|
}
|
|
622
|
+
// What is beside the repository, and beside each directory above it, as far up as `around` goes.
|
|
623
|
+
const realBase = realpathSync(base)
|
|
624
|
+
for (const { dir, child, stand } of around) {
|
|
625
|
+
mkdirSync(stand, { recursive: true })
|
|
626
|
+
let names = []
|
|
627
|
+
try {
|
|
628
|
+
names = readdirSync(dir)
|
|
629
|
+
} catch {
|
|
630
|
+
continue // unreadable: nothing resolves through it in the project either
|
|
631
|
+
}
|
|
632
|
+
for (const name of names) {
|
|
633
|
+
if (name === child) continue
|
|
634
|
+
let target
|
|
635
|
+
try {
|
|
636
|
+
target = realpathSync(join(dir, name))
|
|
637
|
+
} catch {
|
|
638
|
+
continue
|
|
639
|
+
}
|
|
640
|
+
// ⛔ Never the stand-in itself, nor a folder holding it: a link back into it is a loop.
|
|
641
|
+
if (target === realBase || realBase.startsWith(`${target}${sep}`)) continue
|
|
642
|
+
try {
|
|
643
|
+
link(join(dir, name), join(stand, name), name)
|
|
644
|
+
} catch {
|
|
645
|
+
// One the system will not link (macOS refuses a protected folder, `TemporaryItems`) is left
|
|
646
|
+
// out: only a path through it would miss it, as every such path did before.
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
}
|
|
600
650
|
mirror(repo.top, root, '')
|
|
601
651
|
if (sitePath) mkdirSync(join(root, sitePath), { recursive: true })
|
|
602
652
|
|