@uniweb/build 0.16.15 → 0.16.16

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.
Files changed (2) hide show
  1. package/package.json +6 -6
  2. package/src/site/config.js +50 -23
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/build",
3
- "version": "0.16.15",
3
+ "version": "0.16.16",
4
4
  "description": "Build tooling for the Uniweb Component Web Platform",
5
5
  "type": "module",
6
6
  "exports": {
@@ -59,15 +59,15 @@
59
59
  "js-yaml": "^4.1.0",
60
60
  "sharp": "^0.35.3",
61
61
  "yaml": "^2.5.0",
62
- "@uniweb/theming": "0.1.15",
62
+ "@uniweb/content-writer": "0.3.3",
63
63
  "@uniweb/projections": "0.2.5",
64
- "@uniweb/content-writer": "0.3.3"
64
+ "@uniweb/theming": "0.1.15"
65
65
  },
66
66
  "optionalDependencies": {
67
- "@uniweb/runtime": "0.9.7",
68
67
  "@uniweb/content-reader": "1.2.2",
69
- "@uniweb/semantic-parser": "1.2.1",
70
- "@uniweb/schemas": "0.2.5"
68
+ "@uniweb/runtime": "0.9.7",
69
+ "@uniweb/schemas": "0.2.5",
70
+ "@uniweb/semantic-parser": "1.2.1"
71
71
  },
72
72
  "peerDependencies": {
73
73
  "vite": "^5.0.0 || ^6.0.0 || ^7.0.0",
@@ -113,22 +113,50 @@ export function detectFoundationType(foundation, siteRoot) {
113
113
  }
114
114
  }
115
115
 
116
- // Catalog registry ref:
117
- // `@org/name@version` → resolves via the registry CDN.
118
- // Link-mode by definition the foundation lives on the hosting edge and is
119
- // loaded at runtime. Surfacing this as `type: 'url'` makes Vite skip the
120
- // local-foundation bundling path and use the noop virtual module. Base URL
121
- // defaults to the production worker but is overridable via UNIWEB_REGISTRY_URL
122
- // for self-hosted / staging.
116
+ // Catalog registry ref: `@org/name@version`.
117
+ //
118
+ // A build does NOT turn this into a URL. Where a foundation is served is the
119
+ // host's to say a serve location is READ (from backend discovery, or from an
120
+ // upload plan's `serve_base`), never reconstructed. `@uniweb/cli`'s
121
+ // DISCOVERY_DEFAULTS carries no serve-root default for exactly this reason.
122
+ // A build is offline and backend-optional by design, so it has nothing to ask.
123
+ //
124
+ // A ref names a foundation in the Uniweb platform's catalog, and `uniweb
125
+ // publish` — the verb reserved for that target — has the platform resolve it,
126
+ // running no vite build. That is one hosting target among many. The others
127
+ // reach a host through `uniweb deploy --host=<adapter>` or `uniweb export`,
128
+ // and both need a concrete URL, which the site declares: the runtime accepts
129
+ // any URL, from any host.
130
+ //
131
+ // Until 2026-08-04 this returned `{base}/foundations/{ns}/{name}/{ver}/foundation.js`
132
+ // against a hardcoded host, overridable only through an env var that did not
133
+ // match the documented backend selection — so `--backend`, `uniweb login
134
+ // --backend` and the documented env var all left it pinned — and the artifact
135
+ // names were the pre-`entry.js` ones the build stopped emitting.
123
136
  const orgScopedMatch = /^@([a-z0-9_-]+)\/([a-z0-9_-]+)@(.+)$/.exec(name)
124
137
  if (orgScopedMatch) {
125
- const base = process.env.UNIWEB_REGISTRY_URL || 'https://site-router.uniweb-edge.workers.dev'
126
- const [, ns, fn, ver] = orgScopedMatch
127
- return {
128
- type: 'url',
129
- url: `${base}/foundations/${ns}/${fn}/${ver}/foundation.js`,
130
- cssUrl: `${base}/foundations/${ns}/${fn}/${ver}/assets/foundation.css`
131
- }
138
+ throw new Error(
139
+ [
140
+ `Foundation "${name}" is a catalog ref, and a build cannot resolve it to a URL.`,
141
+ `Where a foundation is served is the host's to declare, so the build does not guess it.`,
142
+ ``,
143
+ ` • Deploying to another host (\`uniweb deploy --host=<adapter>\`), or taking`,
144
+ ` the build anywhere (\`uniweb export\`)? Declare the served URL in site.yml —`,
145
+ ` the runtime accepts any URL, from any host:`,
146
+ ``,
147
+ ` foundation: https://<host>/<path>/entry.js`,
148
+ ``,
149
+ ` or the object form when the stylesheet sits elsewhere:`,
150
+ ``,
151
+ ` foundation: { url: 'https://…/entry.js', cssUrl: 'https://…/assets/style.css' }`,
152
+ ``,
153
+ ` • Iterating locally?`,
154
+ ` Reference the workspace foundation by package name.`,
155
+ ``,
156
+ ` • Targeting the Uniweb platform?`,
157
+ ` \`uniweb publish\` has the platform resolve the ref — no build-time URL needed.`
158
+ ].join('\n')
159
+ )
132
160
  }
133
161
 
134
162
  // Versionless scoped names (`@org/name`) are valid as *handles* — they
@@ -290,15 +318,14 @@ export async function defineSiteConfig(options = {}) {
290
318
  // Read site.yml
291
319
  const siteConfig = readSiteConfig(siteRoot)
292
320
 
293
- // Allow callers to override `foundation:` without modifying site.yml on
294
- // disk. Used by `uniweb deploy` to substitute a workspace-local file: ref
295
- // with the resolved registry ref (`@ns/name@ver`) for the duration of the
296
- // deploy build, so the site builds in runtime/link mode against the just-
297
- // published artifact instead of bundling the local source.
298
- const foundationOverride = process.env.UNIWEB_FOUNDATION_REF
299
- if (foundationOverride) {
300
- siteConfig.foundation = foundationOverride
301
- }
321
+ // `site.yml` is the only place a site's foundation is declared. A
322
+ // `UNIWEB_FOUNDATION_REF` env override lived here until 2026-08-04, silently
323
+ // substituting a different foundation for the duration of a build. It served
324
+ // the `uniweb deploy` auto-publish flow, which was removed; after that no
325
+ // command set it, so what remained was an invisible way for a site to be
326
+ // rendered by code its own config did not name. Removed rather than kept as a
327
+ // manual escape hatch — which foundation renders a site is exactly the thing
328
+ // that should never be true-but-unstated.
302
329
 
303
330
  // Determine base path for deployment (priority: option > env > site.yml)
304
331
  // Normalize: ensure leading slash, collapse repeated slashes, add trailing slash for Vite