@uniweb/build 0.14.20 → 0.14.21

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.14.20",
3
+ "version": "0.14.21",
4
4
  "description": "Build tooling for the Uniweb Component Web Platform",
5
5
  "type": "module",
6
6
  "exports": {
@@ -63,8 +63,8 @@
63
63
  "@uniweb/theming": "0.1.4"
64
64
  },
65
65
  "optionalDependencies": {
66
- "@uniweb/content-reader": "1.1.12",
67
66
  "@uniweb/runtime": "0.8.20",
67
+ "@uniweb/content-reader": "1.1.12",
68
68
  "@uniweb/schemas": "0.2.4"
69
69
  },
70
70
  "peerDependencies": {
@@ -295,6 +295,16 @@ const CONTENT_PROFILES = {
295
295
  'document.yml': { contentDir: 'content', defaultMode: 'pages', orderField: 'content' }
296
296
  }
297
297
 
298
+ // Short profile aliases, so a caller that knows its own context can select
299
+ // the profile explicitly (collectSiteContent's `profile` option) instead of
300
+ // inferring it from the config filename. unipress — always a document tool —
301
+ // uses this so an author can name a variant config anything (book.yml,
302
+ // print.yml) without it being misread as a site.
303
+ const PROFILE_ALIASES = {
304
+ document: CONTENT_PROFILES['document.yml'],
305
+ site: CONTENT_PROFILES['site.yml']
306
+ }
307
+
298
308
  function getContentProfile(configFile) {
299
309
  return CONTENT_PROFILES[configFile] || CONTENT_PROFILES['site.yml']
300
310
  }
@@ -1974,17 +1984,18 @@ async function collectLayouts(layoutDir, siteRoot, layoutNames = new Set()) {
1974
1984
  * @param {Object} options - Collection options
1975
1985
  * @param {string} options.foundationPath - Path to foundation directory (for theme vars)
1976
1986
  * @param {string} [options.configFile='site.yml'] - Name of the top-level config file inside sitePath. Defaults to 'site.yml'. Document tools (unipress) pass 'document.yml'.
1987
+ * @param {'document'|'site'} [options.profile] - Explicit content profile, authoritative over the filename. Lets a tool that knows its context (unipress → 'document') read an arbitrarily named config with the right directory/mode/ordering. Falls back to the configFile-derived profile when omitted.
1977
1988
  * @returns {Promise<Object>} Site content object with assets manifest
1978
1989
  */
1979
1990
  export async function collectSiteContent(sitePath, options = {}) {
1980
- const { foundationPath, configFile = 'site.yml' } = options
1991
+ const { foundationPath, configFile = 'site.yml', profile: profileName } = options
1981
1992
 
1982
1993
  // Read site config and raw theme config
1983
1994
  const siteConfig = await readYamlFile(join(sitePath, configFile))
1984
1995
 
1985
1996
  // Profile selects workspace-root defaults: site.yml → pages/ + page mode +
1986
1997
  // pages: ordering; document.yml → content/ + folder mode + content: ordering.
1987
- const profile = getContentProfile(configFile)
1998
+ const profile = (profileName && PROFILE_ALIASES[profileName]) || getContentProfile(configFile)
1988
1999
 
1989
2000
  // Resolve content paths from <config>.paths: group, defaulting per profile.
1990
2001
  // Backward compatibility: when the document profile's `content/` is missing