@antora/content-aggregator
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -177,3 +177,4 @@ 'use strict' | ||
}) | ||
.catch((cloneErr) => { | ||
.catch(async (cloneErr) => { | ||
await fs.remove(dir) | ||
// FIXME triggering the error handler here causes assertion problems in the test suite | ||
@@ -229,3 +230,3 @@ //fetchOpts.emitter && fetchOpts.emitter.emit('error', cloneErr) | ||
const tags = await git.listTags(repo) | ||
for (let name of tags) { | ||
for (const name of tags) { | ||
if (matcher([name], tagPatterns).length) { | ||
@@ -272,3 +273,3 @@ // NOTE tags are stored using symbol keys to distinguish them from branches | ||
const remoteBranches = await git.listBranches(Object.assign({ remote }, repo)) | ||
for (let name of remoteBranches) { | ||
for (const name of remoteBranches) { | ||
// NOTE isomorphic-git includes HEAD in list of remote branches (see https://isomorphic-git.org/docs/listBranches) | ||
@@ -284,3 +285,3 @@ if (name !== 'HEAD' && matcher([name], branchPatterns).length) { | ||
const currentBranchName = await git.currentBranch(repo) | ||
for (let name of localBranches) { | ||
for (const name of localBranches) { | ||
if (matcher([name], branchPatterns).length) { | ||
@@ -294,3 +295,3 @@ refs.set(name, { name, qname: name, type: 'branch', isHead: name === currentBranchName }) | ||
if (localBranches.length) { | ||
for (let name of localBranches) { | ||
for (const name of localBranches) { | ||
if (matcher([name], branchPatterns).length) refs.set(name, { name, qname: name, type: 'branch' }) | ||
@@ -429,3 +430,3 @@ } | ||
depth-- | ||
for (let entry of tree.entries) { | ||
for (const entry of tree.entries) { | ||
if (filter(entry)) { | ||
@@ -478,9 +479,14 @@ const type = entry.type | ||
const data = yaml.safeLoad(descriptorFile.contents.toString()) | ||
if (data.name == null) { | ||
throw new Error(path.join(startPath, COMPONENT_DESC_FILENAME) + ' is missing a name') | ||
} else if (data.version == null) { | ||
throw new Error(path.join(startPath, COMPONENT_DESC_FILENAME) + ' is missing a version') | ||
if (data.name == null) throw new Error(path.join(startPath, COMPONENT_DESC_FILENAME) + ' is missing a name') | ||
const name = String(data.name) | ||
if (name === '.' || name === '..' || ~name.indexOf('/')) { | ||
throw new Error(`name in ${path.join(startPath, COMPONENT_DESC_FILENAME)} cannot have path segments: ${name}`) | ||
} | ||
data.name = String(data.name) | ||
data.version = String(data.version) | ||
if (data.version == null) throw new Error(path.join(startPath, COMPONENT_DESC_FILENAME) + ' is missing a version') | ||
const version = String(data.version) | ||
if (version === '.' || version === '..' || ~version.indexOf('/')) { | ||
throw new Error(`version in ${path.join(startPath, COMPONENT_DESC_FILENAME)} cannot have path segments: ${version}`) | ||
} | ||
data.name = name | ||
data.version = version | ||
return data | ||
@@ -487,0 +493,0 @@ } |
@@ -9,3 +9,3 @@ 'use strict' | ||
// NOTE ignoring 120000 (symlink) | ||
FILE_MODES: { '100644': 0o100666 & ~process.umask(), '100755': 0o100777 & ~process.umask() }, | ||
FILE_MODES: { 100644: 0o100666 & ~process.umask(), 100755: 0o100777 & ~process.umask() }, | ||
GIT_CORE: 'antora', | ||
@@ -12,0 +12,0 @@ GIT_OPERATION_LABEL_LENGTH: 8, |
@@ -0,1 +1,3 @@ | ||
'use strict' | ||
const { homedir } = require('os') | ||
@@ -21,11 +23,11 @@ const expandPath = require('@antora/expand-path-helper') | ||
if (this.entries) return this.entries | ||
return (this.entries = new Promise(async (resolve) => { | ||
let contents = this.contents | ||
let delimiter | ||
if (contents) { | ||
return (this.entries = new Promise((resolve) => { | ||
let contentsPromise, delimiter | ||
if (this.contents) { | ||
delimiter = /[,\n]/ | ||
contentsPromise = Promise.resolve(this.contents) | ||
} else { | ||
delimiter = '\n' | ||
let path = this.path || ospath.join(homedir(), '.git-credentials') | ||
contents = await fs.pathExists(path).then((exists) => { | ||
contentsPromise = fs.pathExists(path).then((exists) => { | ||
if (exists) { | ||
@@ -41,23 +43,28 @@ return fs.readFile(path, 'utf-8') | ||
}) | ||
if (!contents) return resolve({}) | ||
} | ||
resolve( | ||
contents | ||
.trim() | ||
.split(delimiter) | ||
.reduce((accum, url) => { | ||
try { | ||
const { username, password, hostname, pathname } = new URL(url) | ||
const credentials = password ? { username, password } : username ? { token: username } : undefined | ||
if (!credentials) return accum | ||
if (pathname === '/') { | ||
accum[hostname] = credentials | ||
} else { | ||
accum[hostname + pathname] = credentials | ||
if (!pathname.endsWith('.git')) accum[hostname + pathname + '.git'] = credentials | ||
} | ||
} catch (e) {} | ||
return accum | ||
}, {}) | ||
) | ||
contentsPromise.then((contents) => { | ||
if (contents) { | ||
resolve( | ||
contents | ||
.trim() | ||
.split(delimiter) | ||
.reduce((accum, url) => { | ||
try { | ||
const { username, password, hostname, pathname } = new URL(url) | ||
const credentials = password ? { username, password } : username ? { token: username } : undefined | ||
if (!credentials) return accum | ||
if (pathname === '/') { | ||
accum[hostname] = credentials | ||
} else { | ||
accum[hostname + pathname] = credentials | ||
if (!pathname.endsWith('.git')) accum[hostname + pathname + '.git'] = credentials | ||
} | ||
} catch (e) {} | ||
return accum | ||
}, {}) | ||
) | ||
} else { | ||
resolve({}) | ||
} | ||
}) | ||
})) | ||
@@ -64,0 +71,0 @@ } |
@@ -5,5 +5,5 @@ 'use strict' | ||
mimeTypes.types['adoc'] = 'text/asciidoc' | ||
mimeTypes.types.adoc = 'text/asciidoc' | ||
mimeTypes.extensions['text/asciidoc'] = ['adoc'] | ||
module.exports = mimeTypes |
{ | ||
"name": "@antora/content-aggregator", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Fetches and aggregates content from distributed sources for use in an Antora documentation pipeline.", | ||
@@ -20,20 +20,20 @@ "license": "MPL-2.0", | ||
"dependencies": { | ||
"@antora/expand-path-helper": "^1.0.0", | ||
"cache-directory": "^2.0.0", | ||
"fs-extra": "^7.0.1", | ||
"@antora/expand-path-helper": "~1.0", | ||
"cache-directory": "~2.0", | ||
"fs-extra": "~8.1", | ||
"isomorphic-git": "0.47.0", | ||
"js-yaml": "^3.12.0", | ||
"lodash": "^4.17.11", | ||
"matcher": "^1.1.1", | ||
"mime-types": "^2.1.21", | ||
"multi-progress": "^2.0.0", | ||
"through2": "^3.0.0", | ||
"vinyl": "^2.2.0", | ||
"vinyl-fs": "^3.0.3" | ||
"js-yaml": "~3.13", | ||
"lodash": "~4.17", | ||
"matcher": "~2.0", | ||
"mime-types": "~2.1", | ||
"multi-progress": "~2.0", | ||
"through2": "~3.0", | ||
"vinyl": "~2.2", | ||
"vinyl-fs": "~3.0" | ||
}, | ||
"devDependencies": { | ||
"deep-freeze": "^0.0.1" | ||
"deep-freeze-node": "~1.1" | ||
}, | ||
"engines": { | ||
"node": ">= 8.0.0" | ||
"node": ">=8.11.0" | ||
}, | ||
@@ -40,0 +40,0 @@ "files": [ |
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
34523
814
+ Addedescape-string-regexp@2.0.0(transitive)
+ Addedfs-extra@8.1.0(transitive)
+ Addedjs-yaml@3.13.1(transitive)
+ Addedmatcher@2.0.0(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedfs-extra@7.0.1(transitive)
- Removedjs-yaml@3.14.1(transitive)
- Removedmatcher@1.1.1(transitive)
Updatedcache-directory@~2.0
Updatedfs-extra@~8.1
Updatedjs-yaml@~3.13
Updatedlodash@~4.17
Updatedmatcher@~2.0
Updatedmime-types@~2.1
Updatedmulti-progress@~2.0
Updatedthrough2@~3.0
Updatedvinyl@~2.2
Updatedvinyl-fs@~3.0