@antora/content-aggregator 3.1.0 → 3.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -303,6 +303,8 @@ async function selectReferences (source, repo, remote) {
303
303
  ? worktreePatterns.map((pattern) => String(pattern))
304
304
  : splitRefPatterns(String(worktreePatterns))
305
305
  }
306
+ } else {
307
+ worktreePatterns = []
306
308
  }
307
309
  const branchPatternsString = String(branchPatterns)
308
310
  if (branchPatternsString === 'HEAD' || branchPatternsString === '.') {
@@ -459,17 +461,16 @@ function readFilesFromWorktree (origin) {
459
461
  }
460
462
 
461
463
  function srcFs (cwd, origin) {
462
- const relpathStart = cwd.length + 1
463
- return new Promise((resolve, reject, cache = Object.create(null), files = []) =>
464
+ return new Promise((resolve, reject, cache = Object.create(null), files = [], relpathStart = cwd.length + 1) =>
464
465
  pipeline(
465
466
  globStream(CONTENT_SRC_GLOB, Object.assign({ cache, cwd }, CONTENT_SRC_OPTS)),
466
467
  forEach(({ path: abspathPosix }, _, done) => {
467
- if (Array.isArray(cache[abspathPosix])) return done() // detects some directories, but not all
468
+ if ((cache[abspathPosix] || {}).constructor === Array) return done() // detects some directories
468
469
  const abspath = posixify ? ospath.normalize(abspathPosix) : abspathPosix
469
470
  const relpath = abspath.substr(relpathStart)
470
471
  symlinkAwareStat(abspath).then(
471
472
  (stat) => {
472
- if (stat.isDirectory()) return done() // detects remaining directories
473
+ if (stat.isDirectory()) return done() // detects directories that slipped through cache check
473
474
  fsp.readFile(abspath).then(
474
475
  (contents) => {
475
476
  files.push(new File({ path: posixify ? posixify(relpath) : relpath, contents, stat, src: { abspath } }))
@@ -824,11 +825,11 @@ function onGitComplete (err) {
824
825
  }
825
826
 
826
827
  function resolveCredentials (credentialsFromUrlHolder, url, auth) {
827
- const credentialsFromUrl = credentialsFromUrlHolder.get()
828
+ const credentialsFromUrl = credentialsFromUrlHolder.get() || {}
829
+ credentialsFromUrlHolder.clear()
828
830
  if ('Authorization' in auth.headers) {
829
- if (!credentialsFromUrl) return this.rejected({ url, auth })
830
- credentialsFromUrlHolder.clear()
831
- } else if (credentialsFromUrl) {
831
+ if (!('username' in credentialsFromUrl)) return this.rejected({ url, auth })
832
+ } else if ('username' in credentialsFromUrl) {
832
833
  return credentialsFromUrl
833
834
  } else {
834
835
  auth = undefined
@@ -852,13 +853,9 @@ function resolveCredentials (credentialsFromUrlHolder, url, auth) {
852
853
  * @returns {String} The generated folder name.
853
854
  */
854
855
  function generateCloneFolderName (url) {
855
- let normalizedUrl = url.toLowerCase()
856
- if (posixify) normalizedUrl = posixify(normalizedUrl)
857
- normalizedUrl = removeGitSuffix(normalizedUrl)
856
+ const normalizedUrl = removeGitSuffix(posixify ? posixify(url.toLowerCase()) : url.toLowerCase())
858
857
  const basename = normalizedUrl.split(ANY_SEPARATOR_RX).pop()
859
- const hash = createHash('sha1')
860
- hash.update(normalizedUrl)
861
- return basename + '-' + hash.digest('hex') + '.git'
858
+ return basename + '-' + createHash('sha1').update(normalizedUrl).digest('hex') + '.git'
862
859
  }
863
860
 
864
861
  /**
@@ -888,7 +885,7 @@ function resolveRemoteUrl (repo, remoteName) {
888
885
  * Checks whether the specified URL matches a directory on the local filesystem.
889
886
  *
890
887
  * @param {String} url - The URL to check.
891
- * @return {Boolean} A flag indicating whether the URL matches a directory on the local filesystem.
888
+ * @returns {Boolean} A flag indicating whether the URL matches a directory on the local filesystem.
892
889
  */
893
890
  function isDirectory (url) {
894
891
  return fsp.stat(url).then((stat) => stat.isDirectory(), invariably.false)
package/lib/constants.js CHANGED
@@ -4,7 +4,7 @@ module.exports = Object.freeze({
4
4
  COMPONENT_DESC_FILENAME: 'antora.yml',
5
5
  CONTENT_CACHE_FOLDER: 'content',
6
6
  CONTENT_SRC_GLOB: '**/*[!~]',
7
- CONTENT_SRC_OPTS: { follow: true, nomount: true, nosort: true, nounique: true, strict: false, uniqueBy: (m) => m },
7
+ CONTENT_SRC_OPTS: { follow: true, nomount: true, nosort: true, nounique: true, strict: false },
8
8
  FILE_MODES: { 100644: 0o100666 & ~process.umask(), 100755: 0o100777 & ~process.umask() },
9
9
  GIT_CORE: 'antora',
10
10
  GIT_OPERATION_LABEL_LENGTH: 8,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antora/content-aggregator",
3
- "version": "3.1.0",
3
+ "version": "3.1.2",
4
4
  "description": "Fetches and aggregates content from distributed sources for use in an Antora documentation pipeline.",
5
5
  "license": "MPL-2.0",
6
6
  "author": "OpenDevise Inc. (https://opendevise.com)",
@@ -29,13 +29,13 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@antora/expand-path-helper": "~2.0",
32
- "@antora/logger": "3.1.0",
32
+ "@antora/logger": "3.1.2",
33
33
  "@antora/user-require-helper": "~2.0",
34
34
  "braces": "~3.0",
35
35
  "cache-directory": "~2.0",
36
36
  "glob-stream": "~7.0",
37
- "hpagent": "~1.0",
38
- "isomorphic-git": "~1.19",
37
+ "hpagent": "~1.1",
38
+ "isomorphic-git": "~1.21",
39
39
  "js-yaml": "~4.1",
40
40
  "multi-progress": "~4.0",
41
41
  "picomatch": "~2.3",