@antora/playbook-builder 3.1.2 → 3.2.0-alpha.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.
package/README.md CHANGED
@@ -10,4 +10,4 @@ Its site generator aggregates documents from versioned content repositories and
10
10
 
11
11
  Copyright (C) 2017-present [OpenDevise Inc.](https://opendevise.com) and the [Antora Project](https://antora.org).
12
12
 
13
- Use of this software is granted under the terms of the [Mozilla Public License Version 2.0](https://www.mozilla.org/en-US/MPL/2.0/) (MPL-2.0).
13
+ Use of this software is granted under the terms of the [Mozilla Public License Version 2.0](https://www.mozilla.org/en-US/MPL/2.0/) (MPL-2.0).
@@ -52,8 +52,8 @@ function registerFormats (convict) {
52
52
  if (config == null) return val
53
53
  const accum = config.has(name) ? config.get(name) : {}
54
54
  let match
55
- ARGS_SCANNER_RX.lastIndex = 0
56
- while ((match = ARGS_SCANNER_RX.exec(val))) {
55
+ const scanner = new RegExp(ARGS_SCANNER_RX)
56
+ while ((match = scanner.exec(val))) {
57
57
  const [, k, v] = match
58
58
  if (k) accum[k] = v ? (v === '-' ? '-' : yaml.load(v, { schema: yaml.CORE_SCHEMA })) : ''
59
59
  }
@@ -77,8 +77,8 @@ function registerFormats (convict) {
77
77
  if (config == null) return val
78
78
  const accum = config.has(name) ? config.get(name) : {}
79
79
  let match
80
- ARGS_SCANNER_RX.lastIndex = 0
81
- while ((match = ARGS_SCANNER_RX.exec(val))) {
80
+ const scanner = new RegExp(ARGS_SCANNER_RX)
81
+ while ((match = scanner.exec(val))) {
82
82
  const [, k, v] = match
83
83
  if (k) {
84
84
  let parsed
@@ -97,7 +97,7 @@ function registerFormats (convict) {
97
97
  convict.addFormat({
98
98
  name: 'require-array',
99
99
  validate: (val) => {
100
- if (!Array.isArray(val)) throw new Error('must be of type Array')
100
+ if (!Array.isArray(val)) throw new Error('must be an array')
101
101
  },
102
102
  coerce: (val, config, name) => {
103
103
  const accum = config && config.has(name) ? config.get(name) : []
@@ -117,7 +117,7 @@ function registerFormats (convict) {
117
117
  name: 'boolean-or-string',
118
118
  validate: (val) => {
119
119
  if (!(val == null || val.constructor === String || val.constructor === Boolean)) {
120
- throw new Error('must be a boolean or string')
120
+ throw new Error('must be a boolean, string, or null')
121
121
  }
122
122
  },
123
123
  })
@@ -159,6 +159,7 @@ function registerFormats (convict) {
159
159
  }
160
160
  if (~parsedUrl.pathname.indexOf('%20')) throw new Error('pathname segment must not contain spaces')
161
161
  },
162
+ coerce: (val) => (val.length > 1 && val.charAt(val.length - 1) === '/' ? val.slice(0, -1) : val),
162
163
  })
163
164
  }
164
165
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antora/playbook-builder",
3
- "version": "3.1.2",
3
+ "version": "3.2.0-alpha.2",
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)",