Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@antora/content-classifier

Package Overview
Dependencies
Maintainers
0
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antora/content-classifier - npm Package Compare versions

Comparing version 3.2.0-alpha.4 to 3.2.0-alpha.5

lib/util/summarize-file-location.js

20

lib/classify-content.js

@@ -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": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc