Socket
Socket
Sign inDemoInstall

@antora/content-aggregator

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-aggregator - npm Package Compare versions

Comparing version 3.1.7 to 3.1.8

91

lib/aggregate-content.js

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

const { NotFoundError, ObjectTypeError, UnknownTransportError, UrlParseError } = git.Errors
const globStream = require('glob-stream')
const { globStream } = require('fast-glob')
const { inspect } = require('util')

@@ -388,3 +388,3 @@ const invariably = require('./invariably')

/**
* Returns the current branch name unless the HEAD is detached.
* Returns the current branch name or undefined if the HEAD is detached.
*/

@@ -443,8 +443,9 @@ function getCurrentBranchName (repo, remote) {

return (worktreePath ? readFilesFromWorktree(origin) : readFilesFromGitTree(repo, ref.oid, startPath))
.then((files) =>
Object.assign(deepClone((origin.descriptor = loadComponentDescriptor(files, ref, version))), {
files: files.map((file) => assignFileProperties(file, origin)),
origins: [origin],
})
)
.then((files) => {
const batch = deepClone((origin.descriptor = loadComponentDescriptor(files, ref, version)))
if ('nav' in batch) batch.nav.origin = origin
batch.files = files.map((file) => assignFileProperties(file, origin))
batch.origins = [origin]
return batch
})
.catch((err) => {

@@ -474,15 +475,14 @@ const where = worktreePath || (worktreePath === false ? repo.gitdir : repo.url || repo.dir)

function srcFs (cwd, origin) {
return new Promise((resolve, reject, cache = Object.create(null), files = [], relpathStart = cwd.length + 1) =>
return new Promise((resolve, reject, files = []) =>
pipeline(
globStream(CONTENT_SRC_GLOB, Object.assign({ cache, cwd }, CONTENT_SRC_OPTS)),
forEach(({ path: abspathPosix }, _, done) => {
if ((cache[abspathPosix] || {}).constructor === Array) return done() // detects some directories
const abspath = posixify ? ospath.normalize(abspathPosix) : abspathPosix
const relpath = abspath.substr(relpathStart)
symlinkAwareStat(abspath).then(
(stat) => {
if (stat.isDirectory()) return done() // detects directories that slipped through cache check
globStream(CONTENT_SRC_GLOB, Object.assign({ cwd }, CONTENT_SRC_OPTS)),
forEach(({ path: relpath, dirent }, _, done) => {
if (dirent.isDirectory()) return done()
const relpathPosix = relpath
const abspath = posixify ? ospath.join(cwd, (relpath = ospath.normalize(relpath))) : cwd + '/' + relpath
fsp.stat(abspath).then(
(stat) =>
fsp.readFile(abspath).then(
(contents) => {
files.push(new File({ path: posixify ? posixify(relpath) : relpath, contents, stat, src: { abspath } }))
files.push(new File({ path: relpathPosix, contents, stat, src: { abspath } }))
done()

@@ -497,18 +497,24 @@ },

}
)
},
),
(statErr) => {
const logObject = { file: { abspath, origin } }
if (statErr.symlink) {
logger.error(
logObject,
(statErr.code === 'ELOOP' ? 'ELOOP: symbolic link cycle, ' : 'ENOENT: broken symbolic link, ') +
`${relpath} -> ${statErr.symlink}`
)
} else if (statErr.code === 'ENOENT') {
logger.warn(logObject, `ENOENT: file or directory disappeared, ${statErr.syscall} ${relpath}`)
if (dirent.isSymbolicLink()) {
fsp
.readlink(abspath)
.then(
(symlink) =>
(statErr.code === 'ELOOP' ? 'ELOOP: symbolic link cycle, ' : 'ENOENT: broken symbolic link, ') +
`${relpath} -> ${symlink}`,
() => statErr.message.replace(`'${abspath}'`, relpath)
)
.then((message) => {
logger.error(logObject, message)
done()
})
} else {
logger.error(logObject, statErr.message.replace(`'${abspath}'`, relpath))
statErr.code === 'ENOENT'
? logger.warn(logObject, `ENOENT: file or directory disappeared, ${statErr.syscall} ${relpath}`)
: logger.error(logObject, statErr.message.replace(`'${abspath}'`, relpath))
done()
}
done()
}

@@ -683,4 +689,9 @@ )

return git.readBlob(entry).then(({ blob: contents }) => {
contents = Buffer.from(contents.buffer)
const stat = Object.assign(new fs.Stats(), { mode: entry.mode, mtime: undefined, size: contents.byteLength })
const stat = {
mode: entry.mode,
size: (contents = Buffer.from(contents.buffer)).byteLength,
isDirectory: invariably.false,
isFile: invariably.true,
isSymbolicLink: invariably.false,
}
return new File({ path: entry.path, contents, stat })

@@ -697,3 +708,3 @@ })

try {
data = yaml.load(descriptorFile.contents.toString(), { schema: yaml.CORE_SCHEMA })
data = Object(yaml.load(descriptorFile.contents.toString(), { schema: yaml.CORE_SCHEMA }))
} catch (err) {

@@ -913,16 +924,2 @@ throw Object.assign(err, { message: `${COMPONENT_DESC_FILENAME} has invalid syntax; ${err.message}` })

function symlinkAwareStat (path_) {
return fsp.lstat(path_).then((lstat) => {
if (!lstat.isSymbolicLink()) return lstat
return fsp.stat(path_).catch((statErr) =>
fsp
.readlink(path_)
.catch(invariably.void)
.then((symlink) => {
throw Object.assign(statErr, { symlink })
})
)
})
}
function tagsSpecified (sources) {

@@ -929,0 +926,0 @@ return sources.some(({ tags }) => tags && (Array.isArray(tags) ? tags.length : true))

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

CONTENT_CACHE_FOLDER: 'content',
CONTENT_SRC_GLOB: '**/*[!~]',
CONTENT_SRC_OPTS: { follow: true, nomount: true, nosort: true, nounique: true, strict: false },
CONTENT_SRC_GLOB: '**/!(*~)',
CONTENT_SRC_OPTS: { dot: true, ignore: ['**/.*{,/**}'], objectMode: true, onlyFiles: false, unique: false },
FILE_MODES: { 100644: 0o100666 & ~process.umask(), 100755: 0o100777 & ~process.umask() },

@@ -10,0 +10,0 @@ GIT_CORE: 'antora',

@@ -19,11 +19,6 @@ 'use strict'

function makeMatcherRx (input, opts) {
if (input && ~input.indexOf('{')) input = input.replace(/^([^({]+)\./, '$1(?:.)')
return makeRe(input, opts)
}
module.exports = {
MATCH_ALL_RX: { test: () => true },
expandBraces,
makeMatcherRx,
makeMatcherRx: makeRe,
pathMatcherOpts: Object.assign({}, BASE_OPTS, { dot: false }),

@@ -30,0 +25,0 @@ refMatcherOpts: (cache) =>

{
"name": "@antora/content-aggregator",
"version": "3.1.7",
"version": "3.1.8",
"description": "Fetches and aggregates content from distributed sources for use in an Antora documentation pipeline.",

@@ -32,7 +32,7 @@ "license": "MPL-2.0",

"@antora/expand-path-helper": "~2.0",
"@antora/logger": "3.1.7",
"@antora/logger": "3.1.8",
"@antora/user-require-helper": "~2.0",
"braces": "~3.0",
"cache-directory": "~2.0",
"glob-stream": "~7.0",
"fast-glob": "~3.3",
"hpagent": "~1.2",

@@ -42,7 +42,7 @@ "isomorphic-git": "~1.25",

"multi-progress": "~4.0",
"picomatch": "~2.3",
"picomatch": "~4.0",
"progress": "~2.0",
"should-proxy": "~1.0",
"simple-get": "~4.0",
"vinyl": "~2.2"
"vinyl": "~3.0"
},

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