@antora/content-aggregator
Advanced tools
Comparing version 3.1.7 to 3.1.8
@@ -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": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
68336
1532
+ Addedfast-glob@~3.3
+ Added@antora/logger@3.1.8(transitive)
+ Added@nodelib/fs.scandir@2.1.5(transitive)
+ Added@nodelib/fs.stat@2.0.5(transitive)
+ Added@nodelib/fs.walk@1.2.8(transitive)
+ Addedb4a@1.6.7(transitive)
+ Addedbare-events@2.5.0(transitive)
+ Addedfast-fifo@1.3.2(transitive)
+ Addedfast-glob@3.3.2(transitive)
+ Addedfastq@1.17.1(transitive)
+ Addedglob-parent@5.1.2(transitive)
+ Addedhelp-me@5.0.0(transitive)
+ Addedmerge2@1.4.1(transitive)
+ Addedmicromatch@4.0.8(transitive)
+ Addedpicomatch@4.0.2(transitive)
+ Addedpino@9.2.0(transitive)
+ Addedpino-abstract-transport@1.2.0(transitive)
+ Addedpino-pretty@11.2.2(transitive)
+ Addedpino-std-serializers@7.0.0(transitive)
+ Addedprocess-warning@3.0.0(transitive)
+ Addedqueue-microtask@1.2.3(transitive)
+ Addedqueue-tick@1.0.1(transitive)
+ Addedreplace-ext@2.0.0(transitive)
+ Addedreusify@1.0.4(transitive)
+ Addedrun-parallel@1.2.0(transitive)
+ Addedsonic-boom@4.0.1(transitive)
+ Addedsplit2@4.2.0(transitive)
+ Addedstreamx@2.20.1(transitive)
+ Addedteex@1.0.1(transitive)
+ Addedtext-decoder@1.2.0(transitive)
+ Addedthread-stream@3.1.0(transitive)
+ Addedvinyl@3.0.0(transitive)
- Removedglob-stream@~7.0
- Removed@antora/logger@3.1.7(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbrace-expansion@1.1.112.0.1(transitive)
- Removedclone-buffer@1.0.0(transitive)
- Removedcloneable-readable@1.1.3(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removedduplexify@4.1.3(transitive)
- Removedextend@3.0.2(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedglob@7.2.38.1.0(transitive)
- Removedglob-parent@6.0.2(transitive)
- Removedglob-stream@7.0.0(transitive)
- Removedhelp-me@4.2.0(transitive)
- Removedinflight@1.0.6(transitive)
- Removedis-absolute@1.0.0(transitive)
- Removedis-negated-glob@1.0.0(transitive)
- Removedis-relative@1.0.0(transitive)
- Removedis-unc-path@1.0.0(transitive)
- Removedis-windows@1.0.2(transitive)
- Removedisarray@1.0.0(transitive)
- Removedjson-stable-stringify-without-jsonify@1.0.1(transitive)
- Removedminimatch@3.1.25.1.6(transitive)
- Removedordered-read-streams@1.0.1(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedpino@8.14.2(transitive)
- Removedpino-pretty@10.0.1(transitive)
- Removedpino-std-serializers@6.2.2(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedprocess-warning@2.3.2(transitive)
- Removedpumpify@2.0.1(transitive)
- Removedreadable-stream@2.3.8(transitive)
- Removedreplace-ext@1.0.1(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedsonic-boom@3.3.0(transitive)
- Removedstream-shift@1.0.3(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedthread-stream@2.7.0(transitive)
- Removedthrough2@4.0.2(transitive)
- Removedthrough2-filter@3.1.0(transitive)
- Removedto-absolute-glob@2.0.2(transitive)
- Removedunc-path-regex@0.1.2(transitive)
- Removedunique-stream@2.3.1(transitive)
- Removedvinyl@2.2.1(transitive)
Updated@antora/logger@3.1.8
Updatedpicomatch@~4.0
Updatedvinyl@~3.0