@uniweb/build 0.15.1 → 0.15.2

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.15.1",
3
+ "version": "0.15.2",
4
4
  "description": "Build tooling for the Uniweb Component Web Platform",
5
5
  "type": "module",
6
6
  "exports": {
@@ -59,13 +59,13 @@
59
59
  "js-yaml": "^4.1.0",
60
60
  "sharp": "^0.33.2",
61
61
  "yaml": "^2.5.0",
62
- "@uniweb/theming": "0.1.12",
63
- "@uniweb/content-writer": "0.2.7"
62
+ "@uniweb/content-writer": "0.2.7",
63
+ "@uniweb/theming": "0.1.12"
64
64
  },
65
65
  "optionalDependencies": {
66
- "@uniweb/runtime": "0.8.33",
67
66
  "@uniweb/content-reader": "1.1.15",
68
- "@uniweb/schemas": "0.2.4"
67
+ "@uniweb/schemas": "0.2.4",
68
+ "@uniweb/runtime": "0.8.33"
69
69
  },
70
70
  "peerDependencies": {
71
71
  "vite": "^5.0.0 || ^6.0.0 || ^7.0.0",
@@ -51,9 +51,12 @@ import { generateCollectionIndex } from '../search/collections.js'
51
51
  * - `_pages/<route>.json` — only meaningful for static-host bundles
52
52
  * where they're served as static assets. Worker derives them from
53
53
  * `payload.locales[lang].pages[].sections` server-side.
54
- * - `sitemap.xml`, `robots.txt`, `search-index.json` worker generates
55
- * sitemap/robots at request time; search-index is currently
56
- * bundle-mode-only territory.
54
+ * - `sitemap.xml`, `robots.txt` — static-host bundle territory. Note these
55
+ * are simply absent from Uniweb-hosted sites today: nothing in platform
56
+ * generates them, at publish time or at request time.
57
+ * - `search-index.json` — the single-file bundle-mode form. Link mode emits
58
+ * the split `_search/{locale}/*.json` files instead (step 5 below), gated
59
+ * by `features: [search]`; those are what the hosting worker serves.
57
60
  *
58
61
  * @param {Object} params
59
62
  * @param {string} params.siteRoot - Absolute path to the site directory.
@@ -263,12 +263,18 @@ export function readIntelligenceConfig(siteRoot) {
263
263
  * @param {string} [options.base] - Base public path for deployment (e.g., '/demos/mysite/')
264
264
  * @returns {Promise<Object>} Vite configuration
265
265
  */
266
+ /** De-duplicate a list, keeping first-seen order. */
267
+ function unique(list) {
268
+ return [...new Set(list)]
269
+ }
270
+
266
271
  export async function defineSiteConfig(options = {}) {
267
272
  const {
268
273
  plugins: extraPlugins = [],
269
274
  server: serverOverrides = {},
270
275
  build: buildOverrides = {},
271
276
  resolve: resolveOverrides = {},
277
+ optimizeDeps: optimizeDepsOverrides = {},
272
278
  seo = {},
273
279
  assets = {},
274
280
  search = {},
@@ -575,9 +581,21 @@ export async function defineSiteConfig(options = {}) {
575
581
  ...buildOverrides
576
582
  },
577
583
 
584
+ // `include` and `exclude` are unioned with anything the site adds rather
585
+ // than replaced by it. Every other key here is a value a caller can
586
+ // reasonably want to override outright; these two are lists of things that
587
+ // must be true, and the framework's entries are load-bearing — React has to
588
+ // be prebundled or the site gets two copies of it. A site adding one
589
+ // package to `exclude` is asking for one more exclusion, not volunteering
590
+ // to restate the framework's list, and getting that wrong is silent: the
591
+ // dev server starts, and the failure surfaces somewhere unrelated.
578
592
  optimizeDeps: {
579
- include: ['react', 'react-dom', 'react-dom/client', 'react-dom/server', 'react-router-dom'],
580
- exclude: ['#foundation']
593
+ ...optimizeDepsOverrides,
594
+ include: unique([
595
+ 'react', 'react-dom', 'react-dom/client', 'react-dom/server', 'react-router-dom',
596
+ ...(optimizeDepsOverrides.include || [])
597
+ ]),
598
+ exclude: unique(['#foundation', ...(optimizeDepsOverrides.exclude || [])])
581
599
  },
582
600
 
583
601
  ...restOptions