@antora/content-classifier
Advanced tools
Comparing version 3.2.0-alpha.4 to 3.2.0-alpha.5
@@ -5,2 +5,4 @@ 'use strict' | ||
const collateAsciiDocAttributes = require('@antora/asciidoc-loader/config/collate-asciidoc-attributes') | ||
const logger = require('./logger') | ||
const summarizeFileLocation = require('./util/summarize-file-location') | ||
@@ -46,2 +48,3 @@ /** | ||
const { name: component, version, files = [], nav, startPage } = componentVersion | ||
const navResolved = nav && (nav.resolved = new Set()) | ||
for (let file, i = 0, len = files.length; i < len; i++) { | ||
@@ -51,2 +54,9 @@ allocateSrc((file = files[i]), component, version, nav) && contentCatalog.addFile(file, componentVersion) | ||
} | ||
if (navResolved && nav.length > navResolved.size && new Set(nav).size > navResolved.size) { | ||
const loc = summarizeFileLocation({ path: 'antora.yml', src: { origin: nav.origin } }) | ||
for (const filepath of nav) { | ||
if (navResolved.has(filepath)) continue | ||
logger.warn('Could not resolve nav entry for %s@%s defined in %s: %s', version, component, loc, filepath) | ||
} | ||
} | ||
contentCatalog.registerComponentVersionStartPage(component, componentVersion, startPage) | ||
@@ -67,5 +77,5 @@ } | ||
const filepath = file.path | ||
const navInfo = nav && getNavInfo(filepath, nav) | ||
const pathSegments = filepath.split('/') | ||
if (navInfo) { | ||
let navInfo | ||
if (nav && (navInfo = getNavInfo(filepath, nav))) { | ||
if (extname !== '.adoc') return // ignore file | ||
@@ -80,3 +90,3 @@ file.nav = navInfo | ||
} else { | ||
// relative to root | ||
// relative to content source root | ||
file.src.relative = filepath | ||
@@ -88,3 +98,3 @@ } | ||
case 'pages': | ||
// pages/_partials location for partials is @deprecated; special designation scheduled to be removed in Antora 4 | ||
// pages/_partials location for partials is @deprecated; special designation scheduled for removal in Antora 4 | ||
if (pathSegments[3] === '_partials') { | ||
@@ -152,3 +162,3 @@ file.src.family = 'partial' | ||
const index = nav.findIndex((candidate) => candidate === filepath) | ||
if (~index) return { index } | ||
if (~index) return nav.resolved.add(filepath) && { index } | ||
} | ||
@@ -155,0 +165,0 @@ |
@@ -8,4 +8,5 @@ 'use strict' | ||
const parseResourceId = require('./util/parse-resource-id') | ||
const { posix: path } = require('path') | ||
const { posix: path } = require('node:path') | ||
const resolveResource = require('./util/resolve-resource') | ||
const summarizeFileLocation = require('./util/summarize-file-location') | ||
const versionCompare = require('./util/version-compare-desc') | ||
@@ -79,2 +80,3 @@ | ||
} | ||
// NOTE if no AsciiDoc attributes are defined in the component descriptor, asciidoc is the siteAsciiDocConfig object | ||
if (asciidoc) componentVersion.asciidoc = asciidoc | ||
@@ -152,6 +154,6 @@ const component = this[$components].get(name) | ||
const details = [filesForFamily.get(key), file] | ||
.map((it, idx) => `${idx + 1}: ${getFileLocation(it)}`) | ||
.map((it, idx) => `${idx + 1}: ${summarizeFileLocation(it)}`) | ||
.join(LOG_WRAP) | ||
if (family === 'nav') { | ||
throw new Error(`Duplicate nav in ${version}@${component}: ${file.path}${LOG_WRAP}${details}`) | ||
throw new Error(`Duplicate nav file: ${file.path} in ${version}@${component}${LOG_WRAP}${details}`) | ||
} else { | ||
@@ -404,6 +406,6 @@ throw new Error(`Duplicate ${family}: ${generateResourceSpec(src)}${LOG_WRAP}${details}`) | ||
? `Page cannot define alias that references itself: ${generateResourceSpec(src)}` + | ||
` (specified as: ${spec})${LOG_WRAP}source: ${getFileLocation(existingPage)}` | ||
` (specified as: ${spec})${LOG_WRAP}source: ${summarizeFileLocation(existingPage)}` | ||
: `Page alias cannot reference an existing page: ${generateResourceSpec(src)} (specified as: ${spec})` + | ||
`${LOG_WRAP}source: ${getFileLocation(target)}` + | ||
`${LOG_WRAP}existing page: ${getFileLocation(existingPage)}` | ||
`${LOG_WRAP}source: ${summarizeFileLocation(target)}` + | ||
`${LOG_WRAP}existing page: ${summarizeFileLocation(existingPage)}` | ||
) | ||
@@ -420,3 +422,3 @@ } | ||
`Duplicate alias: ${generateResourceSpec(src)} (specified as: ${spec})` + | ||
`${LOG_WRAP}source: ${getFileLocation(target)}` | ||
`${LOG_WRAP}source: ${summarizeFileLocation(target)}` | ||
) | ||
@@ -639,11 +641,2 @@ } | ||
function getFileLocation ({ path: path_, src: { abspath, origin } }) { | ||
if (!origin) return abspath || path_ | ||
const { url, gitdir, worktree, refname, tag, reftype = tag ? 'tag' : 'branch', remote, startPath } = origin | ||
let details = `${reftype}: ${refname}` | ||
if ('worktree' in origin) details += worktree ? ' <worktree>' : remote ? ` <remotes/${remote}>` : '' | ||
if (startPath) details += ` | start path: ${startPath}` | ||
return `${abspath || path.join(startPath, path_)} in ${'worktree' in origin ? worktree || gitdir : url} (${details})` | ||
} | ||
function getComponentVersionFiles (componentVersionId) { | ||
@@ -650,0 +643,0 @@ return this.findBy(componentVersionId) |
{ | ||
"name": "@antora/content-classifier", | ||
"version": "3.2.0-alpha.4", | ||
"version": "3.2.0-alpha.5", | ||
"description": "Organizes aggregated content into a virtual file catalog for use in an Antora documentation pipeline.", | ||
@@ -30,9 +30,9 @@ "license": "MPL-2.0", | ||
"dependencies": { | ||
"@antora/asciidoc-loader": "3.2.0-alpha.4", | ||
"@antora/logger": "3.2.0-alpha.4", | ||
"@antora/asciidoc-loader": "3.2.0-alpha.5", | ||
"@antora/logger": "3.2.0-alpha.5", | ||
"mime-types": "~2.1", | ||
"vinyl": "~2.2" | ||
"vinyl": "~3.0" | ||
}, | ||
"engines": { | ||
"node": ">=16.0.0" | ||
"node": ">=18.0.0" | ||
}, | ||
@@ -39,0 +39,0 @@ "files": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
47046
13
1007
+ Added@antora/asciidoc-loader@3.2.0-alpha.5(transitive)
+ Added@antora/logger@3.2.0-alpha.5(transitive)
+ Addedbare-events@2.5.0(transitive)
+ Addedfast-fifo@1.3.2(transitive)
+ Addedhelp-me@5.0.0(transitive)
+ Addedpino@9.2.0(transitive)
+ Addedpino-abstract-transport@1.2.0(transitive)
+ Addedpino-pretty@11.2.2(transitive)
+ Addedpino-std-serializers@7.0.0(transitive)
+ Addedprocess-warning@3.0.0(transitive)
+ Addedqueue-tick@1.0.1(transitive)
+ Addedreplace-ext@2.0.0(transitive)
+ Addedsonic-boom@4.0.1(transitive)
+ Addedsplit2@4.2.0(transitive)
+ Addedstreamx@2.20.2(transitive)
+ Addedteex@1.0.1(transitive)
+ Addedtext-decoder@1.2.1(transitive)
+ Addedthread-stream@3.1.0(transitive)
+ Addedvinyl@3.0.0(transitive)
- Removed@antora/asciidoc-loader@3.2.0-alpha.4(transitive)
- Removed@antora/logger@3.2.0-alpha.4(transitive)
- Removedbrace-expansion@2.0.1(transitive)
- Removedclone-buffer@1.0.0(transitive)
- Removedcloneable-readable@1.1.3(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removedglob@8.1.0(transitive)
- Removedhelp-me@4.2.0(transitive)
- Removedisarray@1.0.0(transitive)
- Removedminimatch@5.1.6(transitive)
- Removedpino@8.14.2(transitive)
- Removedpino-pretty@10.0.1(transitive)
- Removedpino-std-serializers@6.2.2(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedprocess-warning@2.3.2(transitive)
- Removedreadable-stream@2.3.83.6.2(transitive)
- Removedreplace-ext@1.0.1(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedsonic-boom@3.3.0(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedthread-stream@2.7.0(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedvinyl@2.2.1(transitive)
Updated@antora/logger@3.2.0-alpha.5
Updatedvinyl@~3.0