@uniweb/build 1.7.3 → 1.7.5

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/build",
3
- "version": "1.7.3",
3
+ "version": "1.7.5",
4
4
  "description": "Build tooling for the Uniweb Component Web Platform",
5
5
  "type": "module",
6
6
  "exports": {
@@ -56,12 +56,12 @@
56
56
  "js-yaml": "^4.1.0",
57
57
  "sharp": "^0.35.3",
58
58
  "yaml": "^2.5.0",
59
- "@uniweb/schemas": "~1.6.2",
60
- "@uniweb/content-reader": "~1.5.4",
61
- "@uniweb/theming": "~1.2.1",
62
59
  "@uniweb/content-writer": "~1.3.0",
60
+ "@uniweb/content-reader": "~1.5.4",
63
61
  "@uniweb/semantic-parser": "~1.12.2",
64
- "@uniweb/projections": "~1.1.6"
62
+ "@uniweb/projections": "~1.1.6",
63
+ "@uniweb/theming": "~1.2.1",
64
+ "@uniweb/schemas": "~1.6.5"
65
65
  },
66
66
  "optionalDependencies": {
67
67
  "@uniweb/runtime": "~1.1.15"
@@ -24,10 +24,37 @@
24
24
  // ⛔ `package.json::uniweb.scope` held it until then, a second home for half of one
25
25
  // fact, and the halves disagreed: a foundation named `@acme/fnd` registered its data
26
26
  // schemas under whatever `uniweb.scope` said (measured: `@proximify/member`).
27
+ //
28
+ // ⛔ `@uniweb` IS RESERVED (2026-10-23 [Diego]) — on npm it is the framework's own
29
+ // packages, and on every Uniweb backend it is a system-level account. A foundation
30
+ // named `@uniweb/…` reads as the framework's, and no one may publish into it, so it is
31
+ // refused here, where every name is checked, rather than by a backend after a build.
27
32
 
28
33
  /** Names that say where the code lives, not what the foundation is. */
29
34
  export const FORBIDDEN_FOUNDATION_NAMES = new Set(['src', 'foundation'])
30
35
 
36
+ /** Scopes nothing registers under: neither a foundation nor a data schema. */
37
+ export const RESERVED_SCOPES = new Set(['uniweb'])
38
+
39
+ const RESERVED_SCOPE_WHY =
40
+ "it names the Uniweb framework's own packages and the system account of every Uniweb " +
41
+ 'backend, so nothing registers under it'
42
+
43
+ /**
44
+ * Can anything register under this scope? `@acme`, `acme` or `@acme/…`.
45
+ *
46
+ * @param {unknown} scope
47
+ * @returns {string|null} why it cannot, or null when it can
48
+ */
49
+ export function checkRegistrationScope(scope) {
50
+ const handle = String(scope ?? '')
51
+ .trim()
52
+ .replace(/^@/, '')
53
+ .replace(/\/.*$/, '')
54
+ .toLowerCase()
55
+ return RESERVED_SCOPES.has(handle) ? `@${handle} is reserved: ${RESERVED_SCOPE_WHY}` : null
56
+ }
57
+
31
58
  // One segment of a name: lowercase letters, digits and inner hyphens.
32
59
  const SEGMENT = /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/
33
60
 
@@ -63,6 +90,9 @@ export function checkFoundationName(name) {
63
90
  if (FORBIDDEN_FOUNDATION_NAMES.has(bare)) {
64
91
  return `"${bare}" names the folder, not the foundation — and every project in an org would register the same one`
65
92
  }
93
+ if (scope !== null && checkRegistrationScope(scope)) {
94
+ return `"${name}" is named under @${scope.toLowerCase()}, which is reserved: ${RESERVED_SCOPE_WHY}`
95
+ }
66
96
  if (!SEGMENT.test(bare) || (scope !== null && !SEGMENT.test(scope))) {
67
97
  return `"${name}" is not a foundation name — use lowercase letters, digits and hyphens (like "marketing")`
68
98
  }
package/src/index.js CHANGED
@@ -18,8 +18,10 @@ export {
18
18
  export {
19
19
  foundationNameOf,
20
20
  checkFoundationName,
21
+ checkRegistrationScope,
21
22
  splitFoundationName,
22
23
  FORBIDDEN_FOUNDATION_NAMES,
24
+ RESERVED_SCOPES,
23
25
  } from './foundation-name.js'
24
26
 
25
27
  // Data-conformance checking (your content vs the schemas your foundation declares)
@@ -479,6 +479,9 @@ function lowerLeaf(field, resolve, optResolve, { multiple = false, path = '' } =
479
479
  // The level on the entry it points to that opens this entry, for `read` — by link
480
480
  // [Diego, 2026-10-14]. `@uniweb/schemas` admits it only here, as read, edit or admin.
481
481
  if (field.readable_with) out.readable_with = field.readable_with
482
+ // A reference a purchase travels along, to what it names [backend, 2026-10-21]. Only `true`
483
+ // is sent: `@uniweb/schemas` drops `false`, which says what leaving it out says.
484
+ if (field.sold_with === true) out.sold_with = true
482
485
  return out
483
486
  }
484
487
 
@@ -30,7 +30,7 @@ import { normalizeFoundationSchema } from '@uniweb/schemas/foundation'
30
30
  import { parseOptionsRef } from '@uniweb/schemas/format'
31
31
  import { qualifyRef } from '@uniweb/schemas/refs'
32
32
  import { toDataSchemaDeclaration, optionsSectionPath } from './data-schema.js'
33
- import { checkFoundationName, splitFoundationName } from '../foundation-name.js'
33
+ import { checkFoundationName, checkRegistrationScope, splitFoundationName } from '../foundation-name.js'
34
34
 
35
35
  const FOUNDATION_SCHEMA = '@uniweb/foundation-schema'
36
36
  const DATA_SCHEMA = '@uniweb/data-schema'
@@ -110,6 +110,10 @@ export function buildRegistryPackage({ schema, foundationDir, scope, exporter, e
110
110
  * @returns {Object} the `.uwx` document (uwx/1; only data-schema entities, no uuids).
111
111
  */
112
112
  export function buildSchemaOnlyPackage({ schemas, scope, exporter, exportedAt } = {}) {
113
+ // ⛔ The producer's own guard, as `buildInfo`'s name check is for a foundation:
114
+ // `uniweb register` refuses a reserved scope before it gets here.
115
+ const reserved = checkRegistrationScope(scope)
116
+ if (reserved) throw new Error(`buildSchemaOnlyPackage: ${reserved}`)
113
117
  const { entities } = buildDataSchemaEntities(schemas || {}, scope)
114
118
  if (entities.length === 0) {
115
119
  throw new Error('buildSchemaOnlyPackage: no data schemas to register (expected a map of "@/<name>" -> schema).')