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

@antora/navigation-builder

Package Overview
Dependencies
Maintainers
2
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antora/navigation-builder - npm Package Compare versions

Comparing version 1.0.3 to 1.1.0

8

lib/build-navigation.js

@@ -16,3 +16,3 @@ 'use strict'

* unordered lists, which are used to build the navigation trees. It then
* combines those trees in sorted order as a navigation menu, which gets
* combines those trees in sorted order as a navigation set, which gets
* stored in the navigation catalog by component/version pair.

@@ -31,3 +31,3 @@ *

function buildNavigation (contentCatalog, asciidocConfig = {}) {
const navFiles = contentCatalog.findBy({ family: 'navigation' })
const navFiles = contentCatalog.findBy({ family: 'nav' })
if (!(navFiles && navFiles.length)) return new NavigationCatalog()

@@ -38,5 +38,5 @@ asciidocConfig = Object.assign({}, asciidocConfig, { relativizePageRefs: false })

.map((navFile) => loadNavigationFile(navFile, contentCatalog, asciidocConfig))
.reduce((accum, treeSet) => accum.concat(treeSet), [])
.reduce((accum, trees) => accum.concat(trees), [])
.reduce((catalog, { component, version, tree }) => {
catalog.addTree(component, version, tree)
contentCatalog.getComponentVersion(component, version).navigation = catalog.addTree(component, version, tree)
return catalog

@@ -43,0 +43,0 @@ }, new NavigationCatalog())

'use strict'
const $menus = Symbol('menus')
const $sets = Symbol('sets')
const $generateId = Symbol('generateId')

@@ -8,3 +8,3 @@

constructor () {
this[$menus] = {}
this[$sets] = {}
}

@@ -14,22 +14,16 @@

const id = this[$generateId](component, version)
const menu = id in this[$menus] ? this[$menus][id] : (this[$menus][id] = [])
const navigation = id in this[$sets] ? this[$sets][id] : (this[$sets][id] = [])
// NOTE retain order on insert
const insertIdx = menu.findIndex((candidate) => candidate.order >= tree.order)
~insertIdx ? menu.splice(insertIdx, 0, tree) : menu.push(tree)
const insertIdx = navigation.findIndex((candidate) => candidate.order >= tree.order)
~insertIdx ? navigation.splice(insertIdx, 0, tree) : navigation.push(tree)
return navigation
}
//getMenus () {
// return _.map(this[$menus], (trees, id) => {
// const [component, version] = id.split(':')
// return { component, version, trees }
// })
//}
getMenu (component, version) {
getNavigation (component, version) {
const id = this[$generateId](component, version)
return this[$menus][id]
return this[$sets][id]
}
[$generateId] (component, version) {
return component + ':' + version
return version + '@' + component
}

@@ -36,0 +30,0 @@ }

{
"name": "@antora/navigation-builder",
"version": "1.0.3",
"version": "1.1.0",
"description": "Builds a navigation catalog from navigation files for adding site navigation to pages in an Antora documentation pipeline.",

@@ -18,3 +18,3 @@ "license": "MPL-2.0",

"dependencies": {
"@antora/asciidoc-loader": "1.0.3"
"@antora/asciidoc-loader": "1.1.0"
},

@@ -21,0 +21,0 @@ "engines": {

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