@antora/playbook-builder 3.2.0-alpha.10 → 3.2.0-alpha.11
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.
- package/lib/solitary-convict.js +19 -6
- package/package.json +1 -1
package/lib/solitary-convict.js
CHANGED
|
@@ -130,16 +130,29 @@ function registerFormats (convict) {
|
|
|
130
130
|
},
|
|
131
131
|
coerce: (val, config, name) => {
|
|
132
132
|
const accum = config?.has(name) ? config.get(name) : []
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
133
|
+
const byId = {}
|
|
134
|
+
const byRequire = {}
|
|
135
|
+
let orderIdx = 0
|
|
136
|
+
const order = new Map()
|
|
137
|
+
for (const [idx, it] of accum.entries()) {
|
|
138
|
+
const ext = it.constructor === Object ? it : (accum[idx] = { require: it })
|
|
139
|
+
byRequire[ext.require] ??= ext
|
|
140
|
+
if ('id' in ext) byId[ext.id] ??= ext
|
|
141
|
+
order.set(it, orderIdx++)
|
|
142
|
+
}
|
|
143
|
+
for (let request of val.split(',')) {
|
|
144
|
+
const enable = request.charAt() === '!' ? (request = request.slice(1)) == null : true
|
|
145
|
+
let match
|
|
146
|
+
if ((match = byId[request] ?? byRequire[request])) {
|
|
147
|
+
if ((match.enabled ?? true) !== enable) match.enabled = enable
|
|
138
148
|
} else {
|
|
139
|
-
accum.push(
|
|
149
|
+
accum.push((match = byRequire[request] = { require: request }))
|
|
140
150
|
}
|
|
151
|
+
order.set(match, orderIdx++)
|
|
141
152
|
}
|
|
142
153
|
return accum
|
|
154
|
+
.sort((a, b) => order.get(a) - order.get(b))
|
|
155
|
+
.map((it) => (Object.keys(it).length === 1 && 'require' in it ? it.require : it))
|
|
143
156
|
},
|
|
144
157
|
})
|
|
145
158
|
convict.addFormat({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antora/playbook-builder",
|
|
3
|
-
"version": "3.2.0-alpha.
|
|
3
|
+
"version": "3.2.0-alpha.11",
|
|
4
4
|
"description": "Builds a playbook object from user input for configuring successive documentation components in an Antora pipeline.",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"author": "OpenDevise Inc. (https://opendevise.com)",
|