@antora/content-aggregator 3.2.0-alpha.11 → 3.2.0-alpha.12

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.
@@ -195,7 +195,7 @@ async function loadRepository (url, opts, result = {}) {
195
195
  authStatus = await git.getConfig(Object.assign({ path: 'remote.origin.private' }, repo))
196
196
  }
197
197
  } catch (gitErr) {
198
- await fsp['rm' in fsp ? 'rm' : 'rmdir'](dir, { recursive: true, force: true })
198
+ await fsp.rm(dir, { recursive: true, force: true })
199
199
  if (gitErr.rethrow) throw transformGitCloneError(gitErr, displayUrl)
200
200
  const fetchOpts = buildFetchOptions(repo, progress, displayUrl, credentials, gitPlugins, fetch, 'clone')
201
201
  await git
@@ -220,6 +220,7 @@ async function loadRepository (url, opts, result = {}) {
220
220
  if (dotgitStat.isDirectory()) {
221
221
  repo = { cache, dir, fs, gitdir: dotgit }
222
222
  } else if (dotgitStat.isFile()) {
223
+ // NOTE isomorphic-git will discover the gitdir, but we must do it eagerly to process worktree patterns correctly
223
224
  repo = await resolveRepositoryFromWorktree({ cache, dir, fs, gitdir: dotgit })
224
225
  } else {
225
226
  repo = { cache, dir, fs, gitdir: dir, noCheckout: true }
@@ -415,9 +416,11 @@ async function selectReferences (source, repo, remote) {
415
416
  if (currentBranch != null) return [currentBranch]
416
417
  return getCurrentBranchName(repo).then((branch) => (branch ? [branch] : []))
417
418
  })
418
- const worktrees = await findWorktrees(repo, worktreePatterns, useWorktree)
419
- let onMatch
420
- if ((useWorktree || worktreePatterns.length) && worktrees.size) {
419
+ let onMatch, worktrees
420
+ if (
421
+ (useWorktree || worktreePatterns.length) &&
422
+ (worktrees = await findWorktrees(repo, worktreePatterns, useWorktree)).size
423
+ ) {
421
424
  const headNames = new Map()
422
425
  worktrees.forEach(({ name, symbolicNames }, shortname) => {
423
426
  if (name) {
@@ -443,6 +446,7 @@ async function selectReferences (source, repo, remote) {
443
446
  const preferRemote = isBare && remoteBranches.length > 0
444
447
  for (const shortname of filterRefs(localBranches, branchPatterns, patternCache, onMatch)) {
445
448
  if (preferRemote && refs.has(shortname)) continue
449
+ worktrees ??= await findWorktrees(repo, worktreePatterns, useWorktree)
446
450
  const head = (worktrees.get(shortname) || { head: false }).head
447
451
  refs.set(shortname, { shortname, fullname: 'heads/' + shortname, type: 'branch', head })
448
452
  }
@@ -508,7 +512,9 @@ function collectFilesFromStartPath (startPath, repo, authStatus, ref, originUrl,
508
512
  return (worktreePath ? readFilesFromWorktree(origin) : readFilesFromGitTree(repo, ref.oid, startPath))
509
513
  .then((files) => {
510
514
  const batch = deepClone((origin.descriptor = loadComponentDescriptor(files, ref, version)))
511
- if ('nav' in batch && Array.isArray(batch.nav)) batch.nav.origin = origin
515
+ if ('nav' in batch && Array.isArray(batch.nav)) {
516
+ Object.defineProperty(batch.nav, 'origin', { configurable: true, value: origin, writable: true })
517
+ }
512
518
  batch.files = files.map((file) => assignFileProperties(file, origin))
513
519
  batch.origins = [origin]
514
520
  return batch
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antora/content-aggregator",
3
- "version": "3.2.0-alpha.11",
3
+ "version": "3.2.0-alpha.12",
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)",
@@ -33,13 +33,13 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@antora/expand-path-helper": "~3.0",
36
- "@antora/logger": "3.2.0-alpha.11",
36
+ "@antora/logger": "3.2.0-alpha.12",
37
37
  "@antora/user-require-helper": "~3.0",
38
38
  "braces": "~3.0",
39
39
  "cache-directory": "~2.0",
40
40
  "fast-glob": "~3.3",
41
41
  "hpagent": "~1.2",
42
- "isomorphic-git": "~1.25",
42
+ "isomorphic-git": "~1.37",
43
43
  "js-yaml": "~4.1",
44
44
  "multi-progress": "~4.0",
45
45
  "picomatch": "~4.0",
@@ -65,7 +65,7 @@
65
65
  "web publishing"
66
66
  ],
67
67
  "scripts": {
68
- "test": "_mocha",
68
+ "test": "node --test",
69
69
  "prepublishOnly": "npx -y downdoc@latest --prepublish",
70
70
  "postpublish": "npx -y downdoc@latest --postpublish"
71
71
  }