@antora/content-aggregator 3.0.0-beta.1 → 3.0.0-beta.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.
@@ -1,7 +1,5 @@
1
1
  'use strict'
2
2
 
3
- if (!Promise.allSettled) require('./promise-all-settled-polyfill')
4
-
5
3
  const camelCaseKeys = require('camelcase-keys')
6
4
  const { createHash } = require('crypto')
7
5
  const createHttpPlugin = require('./git-plugin-http')
@@ -17,7 +15,7 @@ const getCacheDir = require('cache-directory')
17
15
  const GitCredentialManagerStore = require('./git-credential-manager-store')
18
16
  const git = require('./git')
19
17
  const { NotFoundError, ObjectTypeError, UnknownTransportError, UrlParseError } = git.Errors
20
- const invariably = { true: () => true, false: () => false, void: () => undefined, emptyArray: () => [] }
18
+ const invariably = { false: () => false, void: () => undefined, emptyArray: () => [] }
21
19
  const { makeRe: makePicomatchRx } = require('picomatch')
22
20
  const MultiProgress = require('multi-progress')
23
21
  const ospath = require('path')
@@ -124,14 +122,14 @@ async function collectFiles (sourcesByUrl, loadOpts, concurrency) {
124
122
  })
125
123
  ),
126
124
  ])
127
- let rejected, started
125
+ let rejection, started
128
126
  const startedContinuations = []
129
127
  const recordRejection = (err) => {
130
- throw (rejected = true) && err
128
+ rejection = err
131
129
  }
132
130
  const runTask = (primary, continuation, idx) =>
133
131
  primary().then((value) => {
134
- if (!rejected) startedContinuations[idx] = continuation(value).catch(recordRejection)
132
+ if (!rejection) startedContinuations[idx] = continuation(value).catch(recordRejection)
135
133
  }, recordRejection)
136
134
  if (tasks.length > concurrency) {
137
135
  started = []
@@ -142,17 +140,16 @@ async function collectFiles (sourcesByUrl, loadOpts, concurrency) {
142
140
  )
143
141
  started.push(current)
144
142
  if (pending.push(current) < concurrency) continue
145
- if (await Promise.race(pending).then(invariably.true, invariably.false)) continue
146
- break
143
+ await Promise.race(pending)
144
+ if (rejection) break
147
145
  }
148
146
  } else {
149
147
  started = tasks.map(([primary, continuation], idx) => runTask(primary, continuation, idx))
150
148
  }
151
- return Promise.allSettled(started).then((outcomes) =>
152
- Promise.allSettled(startedContinuations).then((continuationOutcomes) => {
153
- const rejection = outcomes.push(...continuationOutcomes) && outcomes.find(({ status }) => status === 'rejected')
154
- if (rejection) throw rejection.reason
155
- return continuationOutcomes.map(({ value }) => value)
149
+ return Promise.all(started).then(() =>
150
+ Promise.all(startedContinuations).then((result) => {
151
+ if (rejection) throw rejection
152
+ return result
156
153
  })
157
154
  )
158
155
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antora/content-aggregator",
3
- "version": "3.0.0-beta.1",
3
+ "version": "3.0.0-beta.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)",
@@ -49,5 +49,5 @@
49
49
  "static site",
50
50
  "web publishing"
51
51
  ],
52
- "gitHead": "7c5ef1ea93dd489af533c80a936c736013c41769"
52
+ "gitHead": "5cd3f9cc70622e465cb44daf1aa2035ed5a35f54"
53
53
  }
@@ -1,11 +0,0 @@
1
- 'use strict'
2
-
3
- Promise.allSettled = (iterable) =>
4
- Promise.all(
5
- iterable.map((it) =>
6
- it.then(
7
- (value) => ({ status: 'fulfilled', value }),
8
- (reason) => ({ status: 'rejected', reason })
9
- )
10
- )
11
- )