@antora/content-classifier 3.1.1 → 3.1.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.
@@ -21,10 +21,9 @@ function classifyContent (playbook, aggregate, siteAsciiDocConfig = {}) {
21
21
  const contentCatalog = new ContentCatalog(playbook)
22
22
  aggregate
23
23
  .reduce((accum, componentVersionData) => {
24
- const { name, version } = componentVersionData
25
- // drop startPage to defer registration of start page
26
24
  // drop files since they aren't needed to register component version
27
- const { files, startPage, ...descriptor } = Object.assign({}, componentVersionData, {
25
+ // drop startPage to defer registration of start page
26
+ const { name, version, files, startPage, ...descriptor } = Object.assign({}, componentVersionData, {
28
27
  asciidoc: resolveAsciiDocConfig(siteAsciiDocConfig, componentVersionData),
29
28
  })
30
29
  return new Map(accum).set(
@@ -54,6 +54,8 @@ class ContentCatalog {
54
54
  * component version. A true value is a special case to tell this method to register the default start page and is
55
55
  * intended for testing.
56
56
  * @param {String} [descriptor.title=name] - The title for this component version.
57
+ *
58
+ * @returns {Object} The constructed component version object.
57
59
  */
58
60
  registerComponentVersion (name, version, descriptor = {}) {
59
61
  const { asciidoc, displayVersion, prerelease, startPage: startPageSpec, title } = descriptor
@@ -333,9 +335,11 @@ class ContentCatalog {
333
335
  const rel = this.resolvePage(startPageSpec)
334
336
  if (rel) {
335
337
  if (this.getById(ROOT_INDEX_PAGE_ID)) return
336
- const indexAlias = this.getById(ROOT_INDEX_ALIAS_ID)
337
- if (indexAlias) return indexAlias.synthetic ? Object.assign(indexAlias, { rel }) : undefined
338
- return this.addFile({ src: Object.assign({}, ROOT_INDEX_ALIAS_ID), rel, synthetic: true })
338
+ const rootIndexAlias = this.getById(ROOT_INDEX_ALIAS_ID)
339
+ if (rootIndexAlias) return rootIndexAlias.synthetic ? Object.assign(rootIndexAlias, { rel }) : undefined
340
+ if (rel.pub.url === (this.htmlUrlExtensionStyle === 'default' ? '/index.html' : '/')) return
341
+ const src = Object.assign({}, ROOT_INDEX_ALIAS_ID)
342
+ return this.addFile({ src, rel, synthetic: true }, { version: src.version })
339
343
  } else if (rel === false) {
340
344
  logger.warn('Start page specified for site has invalid syntax: %s', startPageSpec)
341
345
  } else if (startPageSpec.lastIndexOf(':') > startPageSpec.indexOf(':')) {
@@ -400,7 +404,7 @@ class ContentCatalog {
400
404
  * @param {ContentCatalog} catalog - The content catalog in which to resolve the page file.
401
405
  * @param {Object} [ctx={}] - The context to use to qualified the contextual page ID.
402
406
  *
403
- * @return {File} The virtual file to which the contextual page ID spec refers, or undefined if the
407
+ * @returns {File} The virtual file to which the contextual page ID spec refers, or undefined if the
404
408
  * file cannot be resolved.
405
409
  */
406
410
  resolvePage (spec, context = {}) {
@@ -21,7 +21,7 @@ const parseResourceId = require('./parse-resource-id')
21
21
  * The value "page" is used if not specified. This value is always used instead of family value provided by the ctx.
22
22
  * @param {Array<String>} [permittedFamilies=undefined] - An optional array of family names to allow.
23
23
  *
24
- * @return {File} The virtual file to which the contextual resource ID spec refers, undefined if
24
+ * @returns {File} The virtual file to which the contextual resource ID spec refers, undefined if
25
25
  * the file cannot be resolved, or false if the resource ID spec is invalid.
26
26
  */
27
27
  function resolveResource (spec, catalog, ctx = {}, defaultFamily = undefined, permittedFamilies = undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antora/content-classifier",
3
- "version": "3.1.1",
3
+ "version": "3.1.2",
4
4
  "description": "Organizes aggregated content into a virtual file catalog for use in an Antora documentation pipeline.",
5
5
  "license": "MPL-2.0",
6
6
  "author": "OpenDevise Inc. (https://opendevise.com)",
@@ -27,8 +27,8 @@
27
27
  "#constants": "./lib/constants.js"
28
28
  },
29
29
  "dependencies": {
30
- "@antora/asciidoc-loader": "3.1.1",
31
- "@antora/logger": "3.1.1",
30
+ "@antora/asciidoc-loader": "3.1.2",
31
+ "@antora/logger": "3.1.2",
32
32
  "mime-types": "~2.1",
33
33
  "vinyl": "~2.2"
34
34
  },