uniweb 0.12.7 → 0.12.8

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": "0.12.7",
3
+ "version": "0.12.8",
4
4
  "description": "Create structured Vite + React sites with content/code separation",
5
5
  "type": "module",
6
6
  "bin": {
@@ -46,9 +46,9 @@
46
46
  "@uniweb/runtime": "0.8.11"
47
47
  },
48
48
  "peerDependencies": {
49
- "@uniweb/build": "0.13.4",
50
- "@uniweb/semantic-parser": "1.1.17",
51
- "@uniweb/content-reader": "1.1.10"
49
+ "@uniweb/build": "0.13.5",
50
+ "@uniweb/content-reader": "1.1.10",
51
+ "@uniweb/semantic-parser": "1.1.17"
52
52
  },
53
53
  "peerDependenciesMeta": {
54
54
  "@uniweb/build": {
@@ -165,10 +165,15 @@ The `uniweb` block in `package.json` carries platform-specific configuration tha
165
165
 
166
166
  | Field | Where used | Default | Purpose |
167
167
  |---|---|---|---|
168
- | `id` | `uniweb publish` | (set on first publish via the prompt, or via `--name`) | The foundation's published id — the bare-name segment in `~handle/<id>` or `@org/<id>`. Decoupled from `package.json::name` (a workspace concern), so renaming the foundation on the registry doesn't ripple through site dependencies. |
168
+ | `id` | `uniweb publish` | (set via `--name` or scoped `package.json::name`) | The foundation's published id — the bare-name segment in `@org/<id>`. Decoupled from `package.json::name` (a workspace concern), so renaming the foundation on the registry doesn't ripple through site dependencies. Only relevant for catalog-published foundations; site-bound foundations skip this. |
169
169
  | `namespace` | `uniweb publish` | (none — see scope resolution) | Legacy explicit org-namespace override. Equivalent to using a scoped `package.json::name` (`"@myorg/foundation"`). Rarely needed in modern foundations. |
170
170
  | `runtimePolicy` | `dist/runtime-pin.json` (foundation build) | `"auto-minor"` | Controls how sites using this foundation receive runtime updates. Three values: `"exact"`, `"auto-patch"`, `"auto-minor"`. See "Foundation runtime policy" below. |
171
171
 
172
+ **Catalog vs site-bound foundations.** Two distribution intents share the same `dist/foundation.js` artifact:
173
+
174
+ - A **catalog foundation** is a deliberate product — named, versioned, listed in the catalog, consumable by other developers' sites. Use `uniweb publish @org/name` for these. The CLI requires an explicit name argument so you don't accidentally catalog a foundation that was meant to be site-bound.
175
+ - A **site-bound foundation** powers exactly one site. Don't run `uniweb publish` for it. Just run `uniweb deploy` from the site directory — the CLI auto-publishes your local foundation as part of the deploy, under a registry slot scoped to the site itself, with no naming ceremony. The foundation isn't visible in the catalog and isn't owned by the developer who happened to run the deploy.
176
+
172
177
  **On the split between `package.json::name` and `uniweb.id`:** the workspace name is what pnpm uses for `file:` linking and what `site.yml::foundation` references. The published id is what the registry stores. Keeping them separate means renaming on the registry (e.g. `marketing` → `marketing-pro`) is a one-shot `uniweb publish --name marketing-pro` — it persists to `uniweb.id` without touching the workspace.
173
178
 
174
179
  These are the only fields the platform consumes today. Future platform features that need static configuration will land here too.
@@ -1,33 +1,44 @@
1
1
  /**
2
2
  * Build Command
3
3
  *
4
- * Builds foundations with schema generation, or sites in either link or
5
- * bundle mode.
4
+ * Builds foundations with schema generation, or sites.
6
5
  *
7
- * Site build modes:
8
- * --bundle (default for sites)
6
+ * Two site build pipelines are available, but they're INTERNAL vocabulary
7
+ * after Phase 2 of the CLI ergonomics overhaul. Users see `uniweb deploy`
8
+ * (uniweb-edge — runtime-linked) and `uniweb export` (third-party host —
9
+ * concatenated bundle); the build command itself just dispatches to whichever
10
+ * pipeline the caller requested.
11
+ *
12
+ * --bundle (internal; called by `uniweb export`)
9
13
  * Full vite + post-vite pipeline. Produces a static-host JS bundle
10
14
  * (`dist/index.html`, `dist/entry.js`, `_importmap/*`, `_pages/*` for
11
15
  * split mode, sitemap/robots/search-index, prerendered HTML when
12
- * configured). Targets non-Uniweb hosts (Netlify, Vercel, GitHub
13
- * Pages) and the future Uniweb bundled-mode hosting.
16
+ * configured). Foundation is loaded by URL when site.yml's foundation
17
+ * is a registry ref; statically inlined when it's a workspace-local
18
+ * ref with no auto-publish (the narrow self-contained case).
14
19
  *
15
- * --link
20
+ * --link (internal; called by `uniweb deploy`)
16
21
  * Data-only pipeline. No vite. Emits ONLY what the Uniweb-edge
17
22
  * deploy needs: `dist/site-content.json` (with full sections),
18
23
  * `dist/<lang>/site-content.json` per non-default locale,
19
24
  * `dist/data/*.json` (collections), and `dist/assets/<media>` (images,
20
- * fonts, video posters). Worker generates HTML at request time using
21
- * its own runtime + the foundation served from the registry the
22
- * site's JS bundle is dead weight on this path.
25
+ * fonts, video posters). Edge stitches runtime + foundation per
26
+ * request the site's JS bundle would be dead weight.
27
+ *
28
+ * Bare `uniweb build` for a site defaults to --bundle (the historical
29
+ * behavior). This is mostly useful for inspecting the build output during
30
+ * development; for shipping, use `uniweb deploy` or `uniweb export`.
23
31
  *
24
32
  * Usage:
25
33
  * uniweb build # Build current directory (sites default to --bundle)
26
34
  * uniweb build --target foundation # Explicitly build as foundation
27
35
  * uniweb build --target site # Explicitly build as site
28
- * uniweb build --link # Site: link-mode (data only, no vite)
29
- * uniweb build --bundle # Site: bundle-mode (full pipeline, today's behavior)
30
- * uniweb build --prerender # Bundle-mode site + SSG (static HTML)
36
+ * uniweb build --prerender # Force pre-rendering
37
+ * uniweb build --no-prerender # Skip pre-rendering
38
+ *
39
+ * Internal flags (called by `uniweb deploy` / `uniweb export`):
40
+ * --link # Data-only pipeline (Uniweb-edge)
41
+ * --bundle # Full vite pipeline (third-party hosts)
31
42
  */
32
43
 
33
44
  import { existsSync, readFileSync } from 'node:fs'
@@ -476,11 +487,11 @@ async function buildSiteLink(projectDir, options = {}) {
476
487
  success(`Translated collections for ${Object.keys(collectionOutputs).length} locale(s)`)
477
488
  }
478
489
  } catch (err) {
479
- if (process.env.DEBUG) console.error('Collection translation:', err.message)
490
+ if (process.env.UNIWEB_DEBUG) console.error('Collection translation:', err.message)
480
491
  }
481
492
  } catch (err) {
482
493
  error(`i18n build failed: ${err.message}`)
483
- if (process.env.DEBUG) console.error(err.stack)
494
+ if (process.env.UNIWEB_DEBUG) console.error(err.stack)
484
495
  log(`${colors.yellow}Continuing without localized content${colors.reset}`)
485
496
  }
486
497
  }
@@ -578,13 +589,13 @@ async function buildSite(projectDir, options = {}) {
578
589
  }
579
590
  } catch (err) {
580
591
  // Collection translation is optional, don't fail build
581
- if (process.env.DEBUG) {
592
+ if (process.env.UNIWEB_DEBUG) {
582
593
  console.error('Collection translation:', err.message)
583
594
  }
584
595
  }
585
596
  } catch (err) {
586
597
  error(`i18n build failed: ${err.message}`)
587
- if (process.env.DEBUG) {
598
+ if (process.env.UNIWEB_DEBUG) {
588
599
  console.error(err.stack)
589
600
  }
590
601
  // Don't fail the build, just warn
@@ -632,7 +643,7 @@ async function buildSite(projectDir, options = {}) {
632
643
  log(` • The foundation's dist/foundation.js exists (build the foundation first)`)
633
644
  }
634
645
 
635
- if (process.env.DEBUG) {
646
+ if (process.env.UNIWEB_DEBUG) {
636
647
  console.error(err.stack)
637
648
  }
638
649
  process.exit(1)
@@ -804,13 +815,12 @@ export async function build(args = []) {
804
815
  const prerenderFlag = args.includes('--prerender')
805
816
  const noPrerenderFlag = args.includes('--no-prerender')
806
817
 
807
- // Check for --link / --bundle flags. These select between two
808
- // mutually exclusive site build pipelines:
809
- // --link: data only, no vite (for Uniweb-edge hosting)
810
- // --bundle: full vite pipeline (for static hosts; today's behavior)
811
- // Bare `uniweb build` for a site defaults to --bundle for back-compat
812
- // with users targeting static hosts. `uniweb deploy` always passes one
813
- // of the two explicitly based on the resolved deploy mode.
818
+ // Internal flags called by `uniweb deploy` (always --link) and
819
+ // `uniweb export` (always --bundle). After Phase 2 of the CLI
820
+ // ergonomics overhaul, users don't see these flags directly; they
821
+ // pick the deploy target (deploy vs export) and the corresponding
822
+ // pipeline runs. Bare `uniweb build` for a site defaults to --bundle
823
+ // (mostly used during development to inspect the vite output).
814
824
  const linkFlag = args.includes('--link')
815
825
  const bundleFlag = args.includes('--bundle')
816
826
  if (linkFlag && bundleFlag) {