uniweb 1.30.1 → 1.30.2

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.30.1",
3
+ "version": "1.30.2",
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/content-writer": "~1.3.1",
44
45
  "@uniweb/core": "~1.6.9",
45
46
  "@uniweb/semantic-parser": "~1.13.2",
46
- "@uniweb/schemas": "~1.6.11",
47
- "@uniweb/content-writer": "~1.3.1"
47
+ "@uniweb/schemas": "~1.6.11"
48
48
  },
49
49
  "peerDependencies": {
50
+ "@uniweb/build": "~1.19.2",
50
51
  "@uniweb/content-reader": "~1.5.9",
51
- "@uniweb/semantic-parser": "~1.13.2",
52
- "@uniweb/build": "~1.19.1"
52
+ "@uniweb/semantic-parser": "~1.13.2"
53
53
  },
54
54
  "peerDependenciesMeta": {
55
55
  "@uniweb/build": {
@@ -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 folder: `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 any registered data schema, by its full name** — `data: { members: '@acme/member' }`, `schema: '@acme/member'` in `queries.yml`. A scope is a namespace that keeps names from colliding, not a limit on who uses a type. So a type another foundation registers is named, never copied: a copy of its file is a second definition of the same type, which `doctor` points out (`type-defined-twice`). A register names such a type and sends no definition of it. A local build still needs the file: `schemas.config.js` routes that type, `'@acme/member': '../hub/src/schemas/member.yml'`, or its scope's folder. 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 any registered data schema, by its full name** — `data: { members: '@acme/member' }`, `schema: '@acme/member'` in `queries.yml`. A scope is a namespace that keeps names from colliding, not a limit on who uses a type. So a type another foundation registers 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`). A register names such a type and sends no definition of it. A local build still needs the file: `schemas.config.js` routes that type, `'@acme/member': '../hub/src/schemas/member.yml'`, or its scope's folder. 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 } }
@@ -73,7 +73,7 @@ Things you won't discover from exports:
73
73
  - **A reader can open a picture larger.** `components={{ image: EnlargeableImage }}` does it for an image in a page's body, and `Mermaid` does it on its own (`enlarge={false}` turns it off). `<Enlargeable>` goes around a picture a section draws itself. It's offered only when opening shows the picture noticeably larger, and the prerendered page doesn't change.
74
74
  - **Kit brings no words.** What a reader or a screen reader meets comes from your foundation, so `Media` takes `playLabel`, `Asset` `downloadLabel`, `Disclaimer` `closeLabel` (it has a button at its foot only with one), `Prose` `footnoteBackLabel` and `DataPlaceholder` `label`. Without one it uses what the author wrote, a role or a symbol: a play button with no caption or alt is named `▶`. `<Link>`'s own tooltip is only a social service's name, an address or a number, so a link holding only an icon needs a `title` or `aria-label` from you. Words your own section draws are content: *A section's own words*, below.
75
75
  - **A word wider than its box breaks**, so a long heading can't pan a phone's page (`overflow-wrap: break-word`, in kit's base). What must stay whole in a narrow box says `whitespace-nowrap`: a big numeral, a figure, a number with its unit. Without it, `10 min` in a tight box comes out as `10 mi / n`.
76
- - **Headings balance their lines and a paragraph's last line keeps company**, inside prose and out (`text-wrap: balance` on `h1`–`h6`, `pretty` on `p`, in kit's base, at no weight). A `text-wrap` or `text-*` class of your own wins; don't write the default again.
76
+ - **Headings balance their lines and a paragraph's last line keeps company**, inside prose and out (`text-wrap-style: balance` on `h1`–`h6`, `pretty` on `p`, in kit's base, at no weight). It sets only the style, so text in a `whitespace-nowrap` box stays on one line. A `text-wrap` or `text-*` class of your own wins; don't write the default again.
77
77
  - **Kit hooks are SSR-safe.** "document is not defined" → use the hook, don't add guards.
78
78
  - **`cn()` drops an earlier `leading-*` when a `text-<size>` follows**, since Tailwind's size classes set line height too: `cn('leading-[1.1] text-4xl')` → `text-4xl`. Put the size first, or fold the leading into it (`text-[clamp(2rem,5vw,4rem)]/[1.1]`).
79
79
  - **"3 of 12 pages didn't render"** means the build stopped, exit 1, because a section threw while rendering a page, and `dist/` isn't complete. It names the error, the section type and the pages. A section that only fails here reads something only a browser has; `uniweb dev` won't show that one.
@@ -1685,7 +1685,9 @@ export function checkGeneratedDataDir({ sitePath, siteName, siteYml, issues, sho
1685
1685
  /**
1686
1686
  * ⭐ WHAT DOCTOR CHECKS IS WHERE YOU STAND, by the rule `dev` and `status` read the folder you stand in
1687
1687
  * (`pick-site.js::siteAround`): in a site, that site and what it is built from, its foundation and its
1688
- * extensions; in a foundation with no site around it, that foundation; elsewhere, the whole workspace.
1688
+ * extensions; in a foundation, the site beside it when that site is built from it, else that foundation;
1689
+ * elsewhere, the whole workspace. ⛔ Until 2026-11-09 the site beside a foundation was checked whatever
1690
+ * it was built from, so in `shop/src` beside a site on another foundation, nothing checked `shop/src`.
1689
1691
  * ⛔ Until 2026-11-08 only the sites were narrowed: run in one site, doctor reported on every foundation
1690
1692
  * in the workspace before the site's own checks, which were hard to find among them.
1691
1693
  *
@@ -1693,20 +1695,24 @@ export function checkGeneratedDataDir({ sitePath, siteName, siteYml, issues, sho
1693
1695
  * null for the whole workspace
1694
1696
  */
1695
1697
  export function doctorFocus({ workspaceDir, projectDir, allSites, foundations, extensions }) {
1696
- const here = siteAround(allSites.map((s) => relative(workspaceDir, s.path)), workspaceDir, projectDir)
1697
- if (here) {
1698
- const site = allSites.find((s) => relative(workspaceDir, s.path) === here)
1699
- const used = siteBuiltFrom(site.path)
1700
- const isUsed = (f) => used.has(realOf(f.path))
1701
- return { site, sites: [site], foundations: foundations.filter(isUsed), extensions: extensions.filter(isUsed) }
1702
- }
1703
1698
  const inside = (dir) => {
1704
1699
  const rel = relative(dir, projectDir)
1705
1700
  return rel === '' || (rel !== '..' && !rel.startsWith(`..${sep}`) && !isAbsolute(rel))
1706
1701
  }
1707
1702
  const foundation = foundations.find((f) => inside(f.path))
1708
1703
  const extension = extensions.find((e) => inside(e.path))
1709
- if (!foundation && !extension) return null
1704
+ const standingIn = foundation || extension
1705
+ const here = siteAround(allSites.map((s) => relative(workspaceDir, s.path)), workspaceDir, projectDir)
1706
+ if (here) {
1707
+ const site = allSites.find((s) => relative(workspaceDir, s.path) === here)
1708
+ const used = siteBuiltFrom(site.path)
1709
+ // In a foundation the site beside it isn't built from, you mean the foundation.
1710
+ if (!standingIn || used.has(realOf(standingIn.path))) {
1711
+ const isUsed = (f) => used.has(realOf(f.path))
1712
+ return { site, sites: [site], foundations: foundations.filter(isUsed), extensions: extensions.filter(isUsed) }
1713
+ }
1714
+ }
1715
+ if (!standingIn) return null
1710
1716
  return {
1711
1717
  foundation: foundation || extension,
1712
1718
  sites: [],
@@ -2183,7 +2189,8 @@ async function runDoctor(args = []) {
2183
2189
  })
2184
2190
  }
2185
2191
 
2186
- // One name in a scope is one type: each defined by two packages here, among those checked.
2192
+ // A data schema two packages here each keep a file for, among those checked: one full name is one
2193
+ // type, so the second file is a copy.
2187
2194
  await checkTypesDefinedTwice({
2188
2195
  workspaceDir,
2189
2196
  checkedDirs: focus ? [...checkedFoundations, ...checkedExtensions].map((f) => f.path) : null,
@@ -2455,8 +2462,8 @@ async function runDoctor(args = []) {
2455
2462
  }
2456
2463
  }
2457
2464
 
2458
- // Check extensions
2459
- for (const ext of extensions) {
2465
+ // Check extensions: those `doctorFocus` chose, as with the foundations above.
2466
+ for (const ext of checkedExtensions) {
2460
2467
  log('')
2461
2468
  info(`Checking extension: ${ext.name}`)
2462
2469
 
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "generatedAt": "2026-11-09T01:10:38.607Z",
3
+ "generatedAt": "2026-11-09T02:11:16.418Z",
4
4
  "packages": {
5
5
  "@uniweb/api": {
6
6
  "version": "1.6.9"
7
7
  },
8
8
  "@uniweb/build": {
9
- "version": "1.19.1"
9
+ "version": "1.19.2"
10
10
  },
11
11
  "@uniweb/content-reader": {
12
12
  "version": "1.5.9"
@@ -24,7 +24,7 @@
24
24
  "version": "1.0.8"
25
25
  },
26
26
  "@uniweb/kit": {
27
- "version": "1.7.16"
27
+ "version": "1.7.17"
28
28
  },
29
29
  "@uniweb/loom": {
30
30
  "version": "1.1.3"
@@ -434,8 +434,18 @@ export async function updateRootScripts(rootDir, sites, pm = 'pnpm') {
434
434
  const newScripts = computeRootScripts(runs ? [runs, ...unique.filter((s) => s !== runs)] : unique, pm)
435
435
  const previewIsCli = /^(pnpm --filter \S+ (run )?preview|npm -w \S+ run preview)$/.test(scripts.preview ?? '')
436
436
  if (scripts.preview && !runs && !previewIsCli) delete newScripts.preview
437
- // Nor is a script the workspace already has for a site added again under another name.
438
- const held = new Set(Object.values(scripts))
437
+ // A per-site script under a name the CLI gives the site it runs (its package's, its project's), or
438
+ // one for a site that is gone, is the CLI's own, and regenerated below. One under another name is
439
+ // the person's, for a command the CLI writes too.
440
+ const cliNamed = (key, value) => {
441
+ const m = /^(dev|preview):(.+)$/.exec(key)
442
+ const target = m && cliScriptTarget(value)
443
+ if (!target) return false
444
+ const s = unique.find((o) => isSite(o, target))
445
+ return !s || m[2] === target || m[2] === s.name || m[2] === siteScriptName(s)
446
+ }
447
+ // Nor is a script the workspace already has under a name of the person's added again under another.
448
+ const held = new Set(Object.entries(scripts).filter(([k, v]) => !cliNamed(k, v)).map(([, v]) => v))
439
449
  for (const [key, command] of Object.entries(newScripts)) {
440
450
  if (!(key in scripts) && held.has(command)) delete newScripts[key]
441
451
  }
@@ -450,16 +460,15 @@ export async function updateRootScripts(rootDir, sites, pm = 'pnpm') {
450
460
  }
451
461
  }
452
462
 
453
- // ⭐ The per-site scripts this CLI writes are regenerated from the sites there are
454
- // now, and one it wrote for a site that is gone — renamed, moved, removed — goes.
455
- // A script whose command is not one the CLI writes is the user's, and stays. Known by its
456
- // command, since a project's site goes by the project's name (`siteScriptName`).
457
- // ⛔ Until 2026-10-13 they were only ever added: after `rename site blog journal`,
458
- // `dev:blog` still ran `uniweb dev blog`, a site that no longer existed.
463
+ // ⭐ The per-site scripts this CLI writes are regenerated from the sites there are now: one of
464
+ // its own the regenerated set doesn't hold goes — its site renamed, moved or removed, or the site's
465
+ // scripts named or run another way now (by its project's name; under npm, by its folder). A script
466
+ // under the person's own name for a command, or whose command the CLI doesn't write, stays.
467
+ // ⛔ Until 2026-10-13 they were only ever added: after `rename site blog journal`, `dev:blog`
468
+ // still ran `uniweb dev blog`. ⛔ From 2026-11-08 to 2026-11-09 only a gone site's went, so a
469
+ // renamed project kept its old pair beside the new one.
459
470
  for (const [key, value] of Object.entries(scripts)) {
460
- if (key in newScripts || !/^(dev|preview):./.test(key)) continue
461
- const target = cliScriptTarget(value)
462
- if (target && !unique.some((s) => isSite(s, target))) delete scripts[key]
471
+ if (!(key in newScripts) && cliNamed(key, value)) delete scripts[key]
463
472
  }
464
473
 
465
474
  pkg.scripts = { ...scripts, ...newScripts }
@@ -12,17 +12,14 @@ import { workspacePackages } from './workspace-packages.js'
12
12
  * The names of one scope two packages of the workspace define.
13
13
  *
14
14
  * @param {string} workspaceDir
15
- * @param {{ dir: string, kind: 'foundation'|'schemas', scope: string }} [self] - a package whose scope
16
- * was just settled, which its own files may not say yet (`register`)
17
15
  * @returns {Promise<{ ref: string, files: string[], differ: boolean }[]>}
18
16
  */
19
- export async function workspaceTypesDefinedTwice(workspaceDir, self = null) {
17
+ export async function workspaceTypesDefinedTwice(workspaceDir) {
20
18
  const packages = []
21
19
  for (const rel of workspacePackages(workspaceDir)) {
22
20
  const dir = join(workspaceDir, rel)
23
21
  const kind = classifyPackage(dir) === 'foundation' ? 'foundation' : isSchemasPackage(dir) ? 'schemas' : null
24
22
  if (kind) packages.push({ dir, kind })
25
23
  }
26
- if (self) packages.unshift(self)
27
24
  return typesDefinedTwice(packages)
28
25
  }