New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@antora/content-classifier

Package Overview
Dependencies
Maintainers
2
Versions
88
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.0.3 to 3.1.0

29

lib/classify-content.js
'use strict'
const ContentCatalog = require('./content-catalog')
const collateAsciiDocAttributes = require('@antora/asciidoc-loader/config/collate-asciidoc-attributes')

@@ -37,3 +38,3 @@ /**

const { files, nav, startPage } = componentVersionData
delete componentVersionData.files // clean up memory
componentVersionData.files = undefined // clean up memory
files.forEach((file) => allocateSrc(file, name, version, nav) && contentCatalog.addFile(file))

@@ -134,25 +135,11 @@ contentCatalog.registerComponentVersionStartPage(name, componentVersion, startPage)

function resolveAsciiDocConfig (siteAsciiDocConfig, { asciidoc }) {
function resolveAsciiDocConfig (siteAsciiDocConfig, { asciidoc, origins = [] }) {
const scopedAttributes = (asciidoc || {}).attributes
if (scopedAttributes) {
const siteAttributes = siteAsciiDocConfig.attributes
if (siteAttributes) {
const attributes = Object.keys(scopedAttributes).reduce((accum, name) => {
if (name in siteAttributes) {
const currentVal = siteAttributes[name]
if (currentVal === false || String(currentVal).endsWith('@')) accum[name] = scopedAttributes[name]
} else {
accum[name] = scopedAttributes[name]
}
return accum
}, {})
return Object.keys(attributes).length
? Object.assign({}, siteAsciiDocConfig, { attributes: Object.assign({}, siteAttributes, attributes) })
: siteAsciiDocConfig
} else {
return Object.assign({}, siteAsciiDocConfig, { attributes: scopedAttributes })
}
} else {
return siteAsciiDocConfig
const initial = siteAsciiDocConfig.attributes
const mdc = { file: { path: 'antora.yml', origin: origins[origins.length - 1] } }
const attributes = collateAsciiDocAttributes(scopedAttributes, { initial, mdc, merge: true })
if (attributes !== initial) siteAsciiDocConfig = Object.assign({}, siteAsciiDocConfig, { attributes })
}
return siteAsciiDocConfig
}

@@ -159,0 +146,0 @@

@@ -14,2 +14,3 @@ 'use strict'

const SPACE_RX = / /g
const LOG_WRAP = '\n '

@@ -144,8 +145,8 @@ const $components = Symbol('components')

const details = [filesForFamily.get(key), file]
.map((it, idx) => ` ${idx + 1}: ${getFileLocation(it)}`)
.join('\n')
.map((it, idx) => `${idx + 1}: ${getFileLocation(it)}`)
.join(LOG_WRAP)
if (family === 'nav') {
throw new Error(`Duplicate nav in ${src.version}@${src.component}: ${file.path}\n${details}`)
throw new Error(`Duplicate nav in ${src.version}@${src.component}: ${file.path}${LOG_WRAP}${details}`)
} else {
throw new Error(`Duplicate ${family}: ${generateResourceSpec(src)}\n${details}`)
throw new Error(`Duplicate ${family}: ${generateResourceSpec(src)}${LOG_WRAP}${details}`)
}

@@ -194,2 +195,8 @@ }

removeFile (file) {
const src = file.src
const filesForFamily = this[$files].get(src.family)
return filesForFamily ? filesForFamily.delete(generateKey(src)) : false
}
findBy (criteria) {

@@ -360,6 +367,6 @@ const criteriaEntries = Object.entries(criteria)

? `Page cannot define alias that references itself: ${generateResourceSpec(src)}` +
` (specified as: ${spec})\n source: ${getFileLocation(existingPage)}`
: `Page alias cannot reference an existing page: ${generateResourceSpec(src)} (specified as: ${spec})\n` +
` source: ${getFileLocation(target)}\n` +
` existing page: ${getFileLocation(existingPage)}`
` (specified as: ${spec})${LOG_WRAP}source: ${getFileLocation(existingPage)}`
: `Page alias cannot reference an existing page: ${generateResourceSpec(src)} (specified as: ${spec})` +
`${LOG_WRAP}source: ${getFileLocation(target)}` +
`${LOG_WRAP}existing page: ${getFileLocation(existingPage)}`
)

@@ -375,3 +382,4 @@ }

throw new Error(
`Duplicate alias: ${generateResourceSpec(src)} (specified as: ${spec})\n source: ${getFileLocation(target)}`
`Duplicate alias: ${generateResourceSpec(src)} (specified as: ${spec})` +
`${LOG_WRAP}source: ${getFileLocation(target)}`
)

@@ -595,8 +603,10 @@ }

function getFileLocation ({ path: path_, src: { abspath, origin } }) {
return (
abspath ||
(origin ? `${path.join(origin.startPath, path_)} in ${origin.url} (ref: ${origin.branch || origin.tag})` : path_)
)
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})`
}
module.exports = ContentCatalog
{
"name": "@antora/content-classifier",
"version": "3.0.3",
"version": "3.1.0",
"description": "Organizes aggregated content into a virtual file catalog for use in an Antora documentation pipeline.",

@@ -18,4 +18,16 @@ "license": "MPL-2.0",

"main": "lib/index.js",
"exports": {
".": "./lib/index.js",
"./content-catalog": "./lib/content-catalog.js",
"./file": "./lib/file.js",
"./util/*": "./lib/util/*.js",
"./lib/util/*": "./lib/util/*.js",
"./package.json": "./package.json"
},
"imports": {
"#constants": "./lib/constants.js"
},
"dependencies": {
"@antora/logger": "3.0.3",
"@antora/asciidoc-loader": "3.1.0",
"@antora/logger": "3.1.0",
"mime-types": "~2.1",

@@ -25,3 +37,3 @@ "vinyl": "~2.2"

"engines": {
"node": ">=12.21.0"
"node": ">=16.0.0"
},

@@ -28,0 +40,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