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

@antora/assembler

Package Overview
Dependencies
Maintainers
0
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antora/assembler - npm Package Compare versions

Comparing version 1.0.0-alpha.9 to 1.0.0-alpha.10

2

lib/assemble-content.js

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

const PromiseQueue = require('./util/promise-queue')
const runCommand = require('./util/run-command')
const runCommand = require('@antora/run-command-helper')

@@ -9,0 +9,0 @@ async function assembleContent (playbook, contentCatalog, convertDocument, { siteCatalog, configSource }) {

'use strict'
const assembleContent = require('./assemble-content')
const runCommand = require('./util/run-command')
module.exports = { assembleContent, runCommand }
module.exports = { assembleContent }

@@ -13,10 +13,10 @@ 'use strict'

: fsp
.access((configSource = expandPath(configSource, { dot: playbook.dir })))
.then(
() => true,
() => false
)
.then((exists) =>
exists ? fsp.readFile(configSource).then((data) => camelCaseKeys(yaml.load(data), ['asciidoc'])) : {}
)
.access((configSource = expandPath(configSource, { dot: playbook.dir })))
.then(
() => true,
() => false
)
.then((exists) =>
exists ? fsp.readFile(configSource).then((data) => camelCaseKeys(yaml.load(data), ['asciidoc'])) : {}
)
).then((config) => {

@@ -46,7 +46,5 @@ if (config.enabled === false) return undefined

if (build.dir === '$' + '{playbook.output.dir}') {
//build.dir = playbook.output.dir
throw new Error('Not implemented')
} else {
build.dir = expandPath(build.dir || './build/assembler', { dot: playbook.dir })
}
build.dir = expandPath(build.dir || './build/assembler', { dot: playbook.dir })
build.cwd = playbook.dir // use playbook.dir for the purpose of finding and loading require scripts

@@ -62,3 +60,3 @@ if (!('clean' in build) && 'output' in playbook) build.clean = playbook.output.clean

function camelCaseKeys (o, stopPaths = [], p) {
function camelCaseKeys (o, stopPaths = [], p = undefined) {
if (Array.isArray(o)) return o.map((it) => camelCaseKeys(it, stopPaths, p))

@@ -65,0 +63,0 @@ if (o == null || o.constructor !== Object) return o

'use strict'
const File = require('vinyl')
const path = require('node:path/posix')

@@ -45,3 +44,3 @@ const sanitize = require('./util/sanitize')

)
return new File({
return new templateFile.constructor({
aggregate: true,

@@ -85,3 +84,3 @@ asciidoc: asciidocConfig,

return (outlineEntry.items || []).reduce(
(accum, item) => new Map([...accum, ...selectPagesInOutline(item, pages)]),
(accum, item) => selectPagesInOutline(item, pages).forEach((v, k) => accum.set(k, v)) ?? accum,
new Map(

@@ -138,2 +137,3 @@ page && [

const { component, version, module: module_, relative, origin } = page.src
const topicPrefix = ~relative.indexOf('/') ? path.dirname(relative) + '/' : ''
const doc = loadAsciiDoc(page, contentCatalog, asciidocConfig)

@@ -291,3 +291,3 @@ const refs = doc.getCatalog().refs

// Q: should we allow : as first character of target?
line = line.replace(/(?<![\\+])xref:([\p{Alpha}0-9_/.{#].*?)\[(|.*?[^\\])\]/gu, (m, target, text) => {
line = line.replace(/(?<![\\+])xref:((?:\.\/)?[\p{Alpha}0-9_/.{#].*?)\[(|.*?[^\\])\]/gu, (m, target, text) => {
let pagePart, fragment, targetPage

@@ -319,7 +319,13 @@ const hashIdx = target.indexOf('#')

return m
} else if (pagePart.indexOf(':') < 0) {
if (module_ !== 'ROOT') pagePart = `${module_}:${pagePart}`
} else if (pagePart.startsWith('ROOT:')) {
pagePart = pagePart.slice(5)
}
let targetModule
const colonIdx = pagePart.indexOf(':')
if (~colonIdx) {
targetModule = pagePart.slice(0, colonIdx)
pagePart = pagePart.slice(colonIdx + 1)
} else {
targetModule = module_
}
if (pagePart.startsWith('./')) pagePart = topicPrefix + pagePart.slice(2)
if (targetModule !== 'ROOT') pagePart = `${targetModule}:${pagePart}`
if (!(targetPage = pagesInOutline.get(pagePart))) {

@@ -436,3 +442,3 @@ if (siteUrl && (targetPage = contentCatalog.resolvePage(pagePart, page.src)) && targetPage.out) {

buffer.push(...lines.filter((it) => it !== undefined))
const attributeEntries = Object.entries(doc.attributes_defined_in_header || {})
const attributeEntries = Object.entries(doc.source_header_attributes?.$$smap || {})
if (attributeEntries.length) {

@@ -573,6 +579,6 @@ const resolvedAttributeEntries = attributeEntries.reduce(

if (~commaIdx) {
rawStyle = prevLine.slice(1, commaIdx - 1)
rawStyle = prevLine.slice(1, commaIdx)
if (~rawStyle.indexOf('=')) rawStyle = undefined
} else if (!~prevLine.indexOf('=')) {
rawStyle = prevLine.slice(1, prevLine.length - 2)
rawStyle = prevLine.slice(1, prevLine.length - 1)
}

@@ -579,0 +585,0 @@ if (rawStyle) {

'use strict'
const File = require('vinyl')
const filterComponentVersions = require('./filter-component-versions')

@@ -79,4 +78,6 @@ const produceAggregateDocument = require('./produce-aggregate-document')

const familySegment = (src.family ??= 'page') + 's'
const path = `modules/${(src.module ??= 'ROOT')}/${familySegment}/${src.relative}`
const moduleRootPath = Array(src.relative.split('/').length - 1)
const relativeSegments = src.relative.split('/')
const segments = ['modules', (src.module ??= 'ROOT'), familySegment, ...relativeSegments]
const path = segments.join('/')
const moduleRootPath = Array(relativeSegments.length - 1)
.fill('..')

@@ -93,4 +94,5 @@ .join('/')

.join('/')
return new File({
return {
path,
dirname: path.slice(0, path.lastIndexOf('/')),
contents: src.contents ?? Buffer.alloc(0),

@@ -100,22 +102,18 @@ src,

pub: { url: '/' + outPath, moduleRootPath },
})
}
}
function getAsciiDocConfigWithAsciidoctorReducerExtension (componentVersion) {
const asciidoctorReducerExtension = require('./asciidoctor/reducer-extension') // NOTE: must be required lazily
const asciidoctorReducerExtension = require('@asciidoctor/reducer') // NOTE: must be required lazily
const asciidocConfig = componentVersion.asciidoc
const extensions = asciidocConfig.extensions || []
if (extensions.length) {
return Object.assign({}, asciidocConfig, {
extensions: extensions.reduce(
(accum, candidate) => {
if (candidate !== asciidoctorReducerExtension) accum.push(candidate)
return accum
},
[asciidoctorReducerExtension]
),
sourcemap: true,
})
}
return Object.assign({}, asciidocConfig, { extensions: [asciidoctorReducerExtension], sourcemap: true })
const extensions = [asciidoctorReducerExtension]
const configuredExtensions = asciidocConfig.extensions || []
if (!configuredExtensions.length) return Object.assign({}, asciidocConfig, { extensions, sourcemap: true })
return Object.assign({}, asciidocConfig, {
extensions: configuredExtensions.reduce((accum, candidate) => {
if (candidate !== asciidoctorReducerExtension) accum.push(candidate)
return accum
}, extensions),
sourcemap: true,
})
}

@@ -122,0 +120,0 @@

{
"name": "@antora/assembler",
"version": "1.0.0-alpha.9",
"version": "1.0.0-alpha.10",
"description": "An extension library for Antora that assembles content from multiple pages into a single AsciiDoc file to converted and publish.",

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

"scripts": {
"test": "_mocha test",
"test": "node --test test/*-test.js",
"prepublishOnly": "npx -y downdoc --prepublish",

@@ -36,6 +36,7 @@ "postpublish": "npx -y downdoc --postpublish"

"dependencies": {
"@asciidoctor/reducer": "~1.1",
"@antora/expand-path-helper": "~2.0",
"@antora/run-command-helper": "~1.0",
"braces": "~3.0",
"picomatch": "~3.0",
"vinyl": "~2.2",
"js-yaml": "~4.1"

@@ -42,0 +43,0 @@ },

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