uniweb 1.30.0 → 1.30.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uniweb",
3
- "version": "1.30.0",
3
+ "version": "1.30.1",
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/core": "~1.6.9",
44
45
  "@uniweb/semantic-parser": "~1.13.2",
45
46
  "@uniweb/schemas": "~1.6.11",
46
- "@uniweb/core": "~1.6.8",
47
47
  "@uniweb/content-writer": "~1.3.1"
48
48
  },
49
49
  "peerDependencies": {
50
- "@uniweb/semantic-parser": "~1.13.2",
51
50
  "@uniweb/content-reader": "~1.5.9",
52
- "@uniweb/build": "~1.19.0"
51
+ "@uniweb/semantic-parser": "~1.13.2",
52
+ "@uniweb/build": "~1.19.1"
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
- **A type several foundations of one scope use is defined once.** A name in a scope is one type, so each foundation's `schemas/member.yml` under `@acme` is a definition of the same `@acme/member`, and a register of either changes it for the other's sites: `register` refuses one that differs from another in the workspace, and `doctor` names copies (`type-defined-twice`). Keep it in the scope's schemas package, or in the one foundation that owns it, and name it in full everywhere else: `data: { members: '@acme/member' }`, `schema: '@acme/member'` in `queries.yml`, and a site's records in `records/acme/member/` (in `records/member/` they're the foundation's own `@/member`, which it no longer defines). Route it with `schemas.config.js`: the scope's folder, or that one type, `'@acme/member': '../hub/src/schemas/member.yml'`.
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`.
140
140
 
141
141
  ```jsx
142
142
  function Article({ content, block }) { // data: { article: { schema: '@std/article', single: true } }
@@ -1716,11 +1716,11 @@ export function doctorFocus({ workspaceDir, projectDir, allSites, foundations, e
1716
1716
  }
1717
1717
 
1718
1718
  /**
1719
- * ⭐ ONE NAME IN A SCOPE IS ONE TYPE (`workspaceTypesDefinedTwice`): each data schema two packages of
1720
- * one scope here define — two foundations, or a foundation and the scope's schemas package. A register
1721
- * of either changes the type for the other's sites, and `uniweb register` refuses one whose definition
1722
- * differs, so differing copies are a warning and agreeing ones a recommendation: they come apart the
1723
- * first time one is edited.
1719
+ * A data schema two packages of the workspace each define under one scope — a copy, where using the
1720
+ * registered type by its full name was enough. Any foundation or site may use any registered data
1721
+ * schema; its scope is a namespace, so that names never collide, and never limits who uses it. So a
1722
+ * copy is a second definition of the one type `@acme/member` names, and the two come apart the first
1723
+ * time one is edited. A recommendation, never a failure: registering either is the registry's to judge.
1724
1724
  *
1725
1725
  * @param {{ workspaceDir: string, checkedDirs: string[]|null, issues: object[] }} ctx - `checkedDirs`,
1726
1726
  * the packages checked (`doctorFocus`); null for every one
@@ -1740,20 +1740,15 @@ export async function checkTypesDefinedTwice({ workspaceDir, checkedDirs, issues
1740
1740
  const id = 'type-defined-twice'
1741
1741
  issues.push({
1742
1742
  id,
1743
- type: t.differ ? 'warn' : 'info',
1743
+ type: 'info',
1744
1744
  message: `${t.ref} is defined ${t.files.length} times in the workspace${t.differ ? ', differently' : ''}`,
1745
1745
  files: t.files.map((f) => relative(workspaceDir, f))
1746
1746
  })
1747
- const say = t.differ ? warn : info
1748
- say(`[${id}] ${t.ref} is defined in ${t.files.length} places${t.differ ? ', and they differ' : ''}`)
1747
+ info(`[${id}] ${t.ref} is defined in ${t.files.length} places${t.differ ? ', and they differ' : ''}`)
1749
1748
  for (const f of t.files) log(` ${relative(workspaceDir, f)}`)
1750
1749
  log(
1751
- ` A name in a scope is one type, so a register of either changes it for the other's sites` +
1752
- (t.differ ? ` — \`uniweb register\` refuses this one.` : `, and copies come apart the first time one is edited.`)
1753
- )
1754
- log(
1755
- ` Keep it in one place — the scope's schemas package, or the foundation that owns it — and name it in full ` +
1756
- `elsewhere (${colors.green}${t.ref}${colors.reset}), with schemas.config.js routing the scope to its folder.`
1750
+ ` A registered data schema is usable by any foundation by its full name, so keep one definition and name ` +
1751
+ `it in full in the others (${colors.green}${t.ref}${colors.reset}); schemas.config.js gives a local build its file.`
1757
1752
  )
1758
1753
  }
1759
1754
  }
@@ -64,7 +64,6 @@ import {
64
64
  readFileSync,
65
65
  writeFileSync,
66
66
  readdirSync,
67
- realpathSync,
68
67
  statSync
69
68
  } from 'node:fs'
70
69
  import { execSync } from 'node:child_process'
@@ -101,20 +100,6 @@ import {
101
100
  } from '../utils/workspace.js'
102
101
  import { isNonInteractive, getCliPrefix } from '../utils/interactive.js'
103
102
  import { checkFlags } from '../utils/flag-guard.js'
104
- import { workspaceTypesDefinedTwice } from '../utils/workspace-types.js'
105
-
106
- // Is `path` inside `dir` (or `dir` itself)? By their real paths, as the type rule reads them.
107
- const realOf = (p) => {
108
- try {
109
- return realpathSync(p)
110
- } catch {
111
- return resolve(p)
112
- }
113
- }
114
- const isWithin = (dir, path) => {
115
- const rel = relative(realOf(dir), realOf(path))
116
- return rel === '' || (!rel.startsWith('..') && !rel.startsWith('/'))
117
- }
118
103
 
119
104
  const colors = {
120
105
  reset: '\x1b[0m',
@@ -618,31 +603,6 @@ export function foundationNeedsBuild(targetDir) {
618
603
  return { needs: false }
619
604
  }
620
605
 
621
- /**
622
- * ⭐ ONE NAME IN A SCOPE IS ONE TYPE (`workspaceTypesDefinedTwice`): a definition that differs from
623
- * another of the same name in this workspace is refused, since a register replaces what the type is for
624
- * the other package's sites too. Copies that agree register as one, and `uniweb doctor` names them.
625
- * Says why and returns true when it refuses.
626
- */
627
- async function typesRefused(targetDir, kind, scope) {
628
- if (!scope) return false
629
- const workspaceDir = findWorkspaceRoot(targetDir)
630
- if (!workspaceDir) return false
631
- const twice = (await workspaceTypesDefinedTwice(workspaceDir, { dir: targetDir, kind, scope }))
632
- .filter((t) => t.differ && t.files.some((f) => isWithin(targetDir, f)))
633
- if (!twice.length) return false
634
- error(`${twice.length === 1 ? 'A data schema this registers is' : `${twice.length} data schemas this registers are`} defined differently elsewhere in the workspace:`)
635
- for (const t of twice) {
636
- log(` ${colors.bright}${t.ref}${colors.reset}`)
637
- for (const f of t.files) log(` ${colors.dim}${relative(workspaceDir, f)}${colors.reset}`)
638
- }
639
- log('')
640
- log(` A name in ${scope} is one type: registering this would change it for the other's sites too.`)
641
- log(` Keep each in one place — the scope's schemas package, or the foundation that owns it — and name it`)
642
- log(` in full elsewhere (${twice[0].ref}), with ${colors.bright}schemas.config.js${colors.reset} routing ${scope} to its folder.`)
643
- return true
644
- }
645
-
646
606
  export async function register(args = []) {
647
607
  // See utils/flag-guard.js — an unrecognized flag is invisible to a
648
608
  // literal scan, so it silently keeps the default (production, for --backend).
@@ -753,8 +713,6 @@ async function runRegister(args = []) {
753
713
  if (!settled) return { exitCode: 2 }
754
714
  scope = settled.scope
755
715
  scopeSource = settled.source
756
- // Before the build: the type rule reads the source, and a refusal needs no build to say.
757
- if (await typesRefused(targetDir, 'foundation', scope)) return { exitCode: 2 }
758
716
  // Build-if-stale (`foundationNeedsBuild`): a missing or stale dist/ gets
759
717
  // (re)built before we read its schema. Preview paths
760
718
  // (--dry-run / -o) must not write to dist/, so they require a pre-built
@@ -845,9 +803,6 @@ async function runRegister(args = []) {
845
803
  // states its own floor and whoever resolves a whole site does the arithmetic.
846
804
  const runtime = standalone ? null : readRuntimePin(join(targetDir, 'dist'))
847
805
 
848
- // A schemas package's scope is known only now; a foundation's was before its build.
849
- if (standalone && (await typesRefused(targetDir, 'schemas', scope))) return { exitCode: 2 }
850
-
851
806
  const exporter = { tool: 'uniweb', version: cliVersion(), instance: 'build' }
852
807
  let doc
853
808
  try {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "generatedAt": "2026-11-08T22:27:32.223Z",
3
+ "generatedAt": "2026-11-09T01:10:38.607Z",
4
4
  "packages": {
5
5
  "@uniweb/api": {
6
6
  "version": "1.6.9"
7
7
  },
8
8
  "@uniweb/build": {
9
- "version": "1.19.0"
9
+ "version": "1.19.1"
10
10
  },
11
11
  "@uniweb/content-reader": {
12
12
  "version": "1.5.9"
@@ -15,7 +15,7 @@
15
15
  "version": "1.3.1"
16
16
  },
17
17
  "@uniweb/core": {
18
- "version": "1.6.8"
18
+ "version": "1.6.9"
19
19
  },
20
20
  "@uniweb/frame-bridge": {
21
21
  "version": "1.0.3"
@@ -24,7 +24,7 @@
24
24
  "version": "1.0.8"
25
25
  },
26
26
  "@uniweb/kit": {
27
- "version": "1.7.15"
27
+ "version": "1.7.16"
28
28
  },
29
29
  "@uniweb/loom": {
30
30
  "version": "1.1.3"
@@ -36,7 +36,7 @@
36
36
  "version": "1.2.13"
37
37
  },
38
38
  "@uniweb/runtime": {
39
- "version": "1.5.3"
39
+ "version": "1.5.4"
40
40
  },
41
41
  "@uniweb/scene": {
42
42
  "version": "1.0.1"
@@ -1,8 +1,7 @@
1
1
  /**
2
- * ⭐ ONE NAME IN A SCOPE IS ONE TYPE (`@uniweb/build`'s `typesDefinedTwice`, which says why): the data
3
- * schema names the workspace's packages of one scope each define — its foundations, extensions and
4
- * schemas packages — for `uniweb register` to refuse a definition that differs, and `uniweb doctor` to
5
- * name every one defined twice.
2
+ * The data schema names two packages of the workspace each define under one scope — its foundations,
3
+ * extensions and schemas packages — for `uniweb doctor` to recommend one definition, named in full
4
+ * elsewhere (`@uniweb/build`'s `typesDefinedTwice`, which says why).
6
5
  */
7
6
 
8
7
  import { join } from 'node:path'