@uniweb/build 0.25.2 → 0.26.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/build",
3
- "version": "0.25.2",
3
+ "version": "0.26.0",
4
4
  "description": "Build tooling for the Uniweb Component Web Platform",
5
5
  "type": "module",
6
6
  "exports": {
@@ -59,17 +59,17 @@
59
59
  "js-yaml": "^4.1.0",
60
60
  "sharp": "^0.35.3",
61
61
  "yaml": "^2.5.0",
62
- "@uniweb/projections": "^0.3.4",
63
- "@uniweb/schemas": "^0.2.10",
64
62
  "@uniweb/theming": "^0.1.15",
65
- "@uniweb/semantic-parser": "^1.3.0",
63
+ "@uniweb/schemas": "^0.2.10",
64
+ "@uniweb/semantic-parser": "^1.3.1",
65
+ "@uniweb/projections": "^0.3.5",
66
66
  "@uniweb/content-writer": "^0.3.4"
67
67
  },
68
68
  "optionalDependencies": {
69
+ "@uniweb/runtime": "^0.12.10",
69
70
  "@uniweb/schemas": "^0.2.10",
70
- "@uniweb/content-reader": "^1.2.4",
71
- "@uniweb/runtime": "^0.12.9",
72
- "@uniweb/semantic-parser": "^1.3.0"
71
+ "@uniweb/semantic-parser": "^1.3.1",
72
+ "@uniweb/content-reader": "^1.2.4"
73
73
  },
74
74
  "peerDependencies": {
75
75
  "vite": "^5.0.0 || ^6.0.0 || ^7.0.0",
@@ -78,7 +78,7 @@
78
78
  "@tailwindcss/vite": "^4.0.0",
79
79
  "@vitejs/plugin-react": "^4.0.0 || ^5.0.0",
80
80
  "vite-plugin-svgr": "^4.0.0",
81
- "@uniweb/core": "^0.11.2"
81
+ "@uniweb/core": "^0.12.0"
82
82
  },
83
83
  "peerDependenciesMeta": {
84
84
  "vite": {
package/src/uwx/index.js CHANGED
@@ -44,6 +44,7 @@ export {
44
44
  emitSiteSyncPackage,
45
45
  writeSiteEntityUuid,
46
46
  writeSiteOrg,
47
+ writeSiteBackend,
47
48
  extensionDeclaration,
48
49
  isExtensionUrl,
49
50
  isSiteRelativeExtensionUrl,
package/src/uwx/site.js CHANGED
@@ -947,3 +947,42 @@ export function writeSiteEntityUuid(siteRoot, uuid) {
947
947
  export function writeSiteOrg(siteRoot, handle) {
948
948
  return upsertYamlScalar(join(siteRoot, 'site.yml'), '$org', handle)
949
949
  }
950
+
951
+ /**
952
+ * Record the backend this project SYNCS WITH (`site.yml::$backend`), beside `$uuid`/`$org`.
953
+ *
954
+ * ⭐ It is not a tag on the site uuid — it is the project's **sync scope**. Four surfaces
955
+ * hold backend-minted identity, and this one fact is what makes all of them meaningful:
956
+ * `site.yml::$uuid`, every collection record's `$uuid` in its own source file,
957
+ * `assets.json`, and `.uniweb/sync-cache.json`. Change the backend and every one of them
958
+ * is foreign at once — which is why a mismatch is a stop, not a fallback
959
+ * (`assertSiteBackendScope` in the CLI).
960
+ *
961
+ * ⛔ **Written ONLY for a non-default backend.** The 98% case stays out of the file, and an
962
+ * absent value reads as the default — correct both for a project written before this key
963
+ * existed and for one synced against the default. Callers decide; this writer does not know
964
+ * the CLI's default. See `recordSiteBackend` (cli/src/backend/site-sync.js), which is where
965
+ * the "is it the default?" test lives.
966
+ *
967
+ * ⚠️ **The name is load-bearing. Five alternatives were considered and rejected (2026-08-24);
968
+ * do not re-propose one.** `origin` is wrong twice over — a site HAS an origin (its own
969
+ * served domain), and this lane is git-modeled, where `origin` names a remote rather than a
970
+ * URL. `remote` implies a multiplicity this design closes. `hosting` and `platform` name the
971
+ * hosting edge, which this package has no client for. `host` collides with
972
+ * `deploy.yml::targets.<n>.host` (the deploy adapter). A `uuid: <id>@<backend>` suffix was
973
+ * rejected too: it would make "this never reaches the backend" a discipline at every read
974
+ * site instead of a property, and `siteProjectToDocument` assigns `$uuid` straight onto the
975
+ * wire document.
976
+ *
977
+ * Safe as a plain YAML scalar: a URL's `:` is followed by `/` or a digit, never a space, so
978
+ * it needs no quoting (verified against js-yaml for apex, `localhost:8080` and host:port+path
979
+ * forms, 2026-08-24). This is the same class of hazard as `$org`'s leading `@`, which is
980
+ * stripped for exactly that reason — but it lands on the safe side.
981
+ *
982
+ * @param {string} siteRoot
983
+ * @param {string} origin - a bare origin, no trailing slash
984
+ * @returns {boolean} true if site.yml changed
985
+ */
986
+ export function writeSiteBackend(siteRoot, origin) {
987
+ return upsertYamlScalar(join(siteRoot, 'site.yml'), '$backend', origin)
988
+ }