@antora/assembler 1.0.0-rc.5 → 1.0.0-rc.7

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,7 @@
1
1
  'use strict'
2
2
 
3
- const fs = require('node:fs')
4
- const { promises: fsp } = fs
3
+ const compileConversionAttributes = require('./compile-conversion-attributes')
4
+ const fsp = require('node:fs/promises')
5
5
  const LazyReadable = require('./util/lazy-readable')
6
6
  const loadConfig = require('./load-config')
7
7
  const logCommand = require('./log-command')
@@ -11,22 +11,24 @@ const produceAssemblyFiles = require('./produce-assembly-files')
11
11
  const PromiseQueue = require('./util/promise-queue')
12
12
  const runCommand = require('@antora/run-command-helper')
13
13
 
14
- const invariably = { true: () => true, false: () => false, new: () => ({}), void: () => undefined }
14
+ const invariably = { new: () => ({}), null: () => null, void: () => undefined }
15
15
  const PACKAGE_NAME = require('../package.json').name
16
16
  const NEWLINE_RX = /(?:\r?\n)+/
17
17
 
18
- async function assembleContent (playbook, contentCatalog, converter, { configSource, navigationCatalog }) {
18
+ async function assembleContent (playbook, contentCatalog, converter, providers) {
19
+ const { configSource, navigationCatalog, componentVersionFilter } = providers
19
20
  const {
20
21
  convert = converter,
21
22
  getDefaultCommand,
22
23
  extname: targetExtname = '',
23
24
  backend: targetBackend = targetExtname.substring(1),
25
+ format: targetFormat = targetBackend,
24
26
  embedReferenceStyle = 'relative',
25
27
  mediaType: targetMediaType,
26
28
  loggerName = `${PACKAGE_NAME} [${targetBackend}-exporter]`,
27
29
  xmlCompliant,
28
30
  } = converter ?? {}
29
- const assemblerConfig = await loadConfig.call(this, configSource, playbook, '-' + targetBackend)
31
+ const assemblerConfig = await loadConfig.call(this, configSource, playbook, targetBackend ? '-' + targetBackend : '')
30
32
  if (assemblerConfig.enabled === false || !contentCatalog.publishableFamilies?.has('export')) return []
31
33
  const context = isBound(this)
32
34
  ? this
@@ -34,9 +36,10 @@ async function assembleContent (playbook, contentCatalog, converter, { configSou
34
36
  getFunctions: invariably.new,
35
37
  getLogger: invariably.void,
36
38
  getVariables: invariably.new,
39
+ require,
37
40
  }
38
41
  const generatorFunctions = context.getFunctions()
39
- const { loadAsciiDoc = require('@antora/asciidoc-loader') } = generatorFunctions
42
+ const { loadAsciiDoc = context.require('@antora/asciidoc-loader') } = generatorFunctions
40
43
  const { assembly: assemblyConfig, build: buildConfig } = assemblerConfig
41
44
  assemblyConfig.embedReferenceStyle = embedReferenceStyle
42
45
  if (xmlCompliant) assemblyConfig.xmlIds ??= true
@@ -47,13 +50,17 @@ async function assembleContent (playbook, contentCatalog, converter, { configSou
47
50
  buildConfig.dir ??= ospath.join(playbook.dir ?? process.cwd(), `build/assembler/${profile}`)
48
51
  intrinsicAttributes[`assembler-profile-${profile}`] = ''
49
52
  intrinsicAttributes['assembler-profile'] = profile
50
- if (targetBackend) {
51
- intrinsicAttributes[`assembler-backend-${targetBackend}`] = ''
52
- intrinsicAttributes['assembler-backend'] = targetBackend
53
- }
54
53
  } else {
55
54
  buildConfig.dir ??= ospath.join(playbook.dir ?? process.cwd(), 'build/assembler/_')
56
55
  }
56
+ if (targetBackend) {
57
+ intrinsicAttributes[`assembler-backend-${targetBackend}`] = ''
58
+ intrinsicAttributes['assembler-backend'] = targetBackend
59
+ }
60
+ if (targetFormat) {
61
+ intrinsicAttributes[`assembler-format-${targetFormat}`] = ''
62
+ intrinsicAttributes['assembler-format'] = targetFormat
63
+ }
57
64
  if (targetExtname) {
58
65
  const targetFiletype = targetExtname.substring(1)
59
66
  intrinsicAttributes[`assembler-filetype-${targetFiletype}`] = ''
@@ -64,11 +71,12 @@ async function assembleContent (playbook, contentCatalog, converter, { configSou
64
71
  loadAsciiDoc,
65
72
  contentCatalog,
66
73
  assemblerConfig,
67
- generateSelectAssemblyProfile(context, contentCatalog, assemblyConfig, intrinsicAttributes, navigationCatalog)
74
+ generateSelectAssemblerProfile(context, contentCatalog, assemblyConfig, intrinsicAttributes, navigationCatalog),
75
+ typeof componentVersionFilter === 'function' ? componentVersionFilter : undefined
68
76
  )
69
77
  if (!(assemblyFiles.length && typeof convert === 'function')) return assemblyFiles
70
78
  buildConfig.command ??= typeof getDefaultCommand === 'function' ? await getDefaultCommand(cwd, playbook) : null
71
- const { publishSite: publishFiles = require('@antora/site-publisher') } = generatorFunctions
79
+ const { publishSite: publishFiles = context.require('@antora/site-publisher') } = generatorFunctions
72
80
  await prepareWorkspace(publishFiles, assemblyFiles, buildConfig)
73
81
  const helpers = { logCommand: logCommand.bind(context, loggerName), runCommand }
74
82
  const boundConvert = convert.bind(context)
@@ -77,10 +85,9 @@ async function assembleContent (playbook, contentCatalog, converter, { configSou
77
85
  .add(
78
86
  assemblyFiles.map((doc) => async () => {
79
87
  const relativeToOutput = embedReferenceStyle === 'output-relative'
80
- const convertAttributes = prepareConvertAttributes(doc, targetExtname, relativeToOutput, assemblerConfig)
81
- if (buildConfig.mkdirs) await fsp.mkdir(convertAttributes.outdir, { recursive: true, force: true })
82
- return boundConvert(doc, convertAttributes, buildConfig, helpers).then((result) =>
83
- boundResolveFileOrContents(result, convertAttributes, buildConfig, loggerName).then((fileOrContents) =>
88
+ const attributes = await compileConversionAttributes(doc, targetExtname, assemblerConfig, relativeToOutput)
89
+ return boundConvert(doc, attributes, buildConfig, helpers).then((result) =>
90
+ boundResolveFileOrContents(result, attributes, buildConfig, loggerName).then((fileOrContents) =>
84
91
  coerceToExportFormat(doc, targetBackend, targetExtname, targetMediaType, fileOrContents)
85
92
  )
86
93
  )
@@ -128,11 +135,11 @@ async function assembleContent (playbook, contentCatalog, converter, { configSou
128
135
  }
129
136
 
130
137
  /**
131
- * Generates a function that selects the active assembly profile, initializes an assembly model using
138
+ * Generates a function that selects the active assembler profile, initializes an assembly model using
132
139
  * the keys from the profile as well as any inherited shared keys, builds the navigation for the assembly, and
133
140
  * returns the initialized assembly model. The assembly model is further populated after the call to this function.
134
141
  */
135
- function generateSelectAssemblyProfile (context, contentCatalog, baseModel, intrinsicAttributes, navigationCatalog) {
142
+ function generateSelectAssemblerProfile (context, contentCatalog, baseModel, intrinsicAttributes, navigationCatalog) {
136
143
  const logger = context.getLogger?.(PACKAGE_NAME)
137
144
  const { assemblerProfiles } = context.getVariables()
138
145
  if (!assemblerProfiles) {
@@ -143,7 +150,7 @@ function generateSelectAssemblyProfile (context, contentCatalog, baseModel, intr
143
150
  }
144
151
  }
145
152
  const boundSendToLog = sendToLog.bind(logger)
146
- const { buildAlternateNavigation = require('@antora/navigation-builder').buildAlternateNavigation } =
153
+ const { buildAlternateNavigation = context.require('@antora/navigation-builder').buildAlternateNavigation } =
147
154
  context.getFunctions()
148
155
  return (componentVersion) => {
149
156
  const componentVersionProfiles = assemblerProfiles.get(componentVersion.version + '@' + componentVersion.name)
@@ -172,61 +179,6 @@ function generateSelectAssemblyProfile (context, contentCatalog, baseModel, intr
172
179
  }
173
180
  }
174
181
 
175
- function prepareConvertAttributes (doc, targetExtname, relativeToOutput, assemblerConfig) {
176
- const {
177
- asciidoc: { attributes: docAttributes } = { attributes: {} },
178
- extname: docfilesuffix,
179
- path: reldocfile,
180
- src: { family, relative },
181
- } = doc
182
- const { cwd = process.cwd(), dir = cwd } = assemblerConfig.build
183
- const docname = family + '$' + relative.substring(0, relative.length - docfilesuffix.length)
184
- const docfile = ospath.join(dir, reldocfile)
185
- const outdir = ospath.dirname(docfile)
186
- const docdir = relativeToOutput ? dir : outdir
187
- const outfile = docfile.substring(0, docfile.length - docfilesuffix.length) + targetExtname
188
- const attributes = Object.assign({ revdate: `${assemblerConfig.assembly.revdate}@` }, docAttributes, {
189
- docdir,
190
- docfile,
191
- docfilesuffix,
192
- docname: `${docname}@`,
193
- imagesdir: '',
194
- outdir,
195
- outfile,
196
- outfilesuffix: targetExtname,
197
- toArgs (optionFlag) {
198
- const args = []
199
- for (let [name, val] of Object.entries(this)) {
200
- if (val) {
201
- val = name + '=' + val
202
- } else if (val === '') {
203
- if (name === 'asciidoctor-log-integration') {
204
- args.push('-r', require.resolve('#asciidoctor-log-adapter'))
205
- continue
206
- }
207
- val = name
208
- } else {
209
- val = `${name}!${val === false ? '@' : ''}`
210
- }
211
- args.push(optionFlag, val)
212
- }
213
- return args
214
- },
215
- })
216
- Object.defineProperty(attributes, 'outfilesuffix', {
217
- get () {
218
- return ospath.extname(this.outfile)
219
- },
220
- set (value) {
221
- const outfile = this.outfile
222
- const extname = ospath.extname(outfile)
223
- if (extname && outfile.endsWith(extname)) this.outfile = outfile.substring(0, outfile.length - extname.length)
224
- this.outfile += value
225
- },
226
- })
227
- return Object.defineProperty(attributes, 'toArgs', { enumerable: false })
228
- }
229
-
230
182
  function coerceToExportFormat (assemblyFile, targetBackend, targetExtname, targetMediaType, fileOrContents) {
231
183
  const file =
232
184
  fileOrContents == null || Buffer.isBuffer(fileOrContents) || typeof fileOrContents.pipe === 'function'
@@ -237,7 +189,8 @@ function coerceToExportFormat (assemblyFile, targetBackend, targetExtname, targe
237
189
  const { path: sourcePath, extname: sourceExtname } = file
238
190
  const relativeWithoutExtname = file.src.relative.substring(0, file.src.relative.length - sourceExtname.length)
239
191
  const newPath = sourcePath.substring(0, sourcePath.length - sourceExtname.length) + targetExtname
240
- Object.assign(file, { mediaType: (file.src.mediaType = targetMediaType), path: newPath })
192
+ Object.assign(file, { mediaType: (file.src.mediaType = targetMediaType), path: (file.src.path = newPath) })
193
+ delete file.src.abspath
241
194
  file.src.basename = path.basename((file.src.relative = relativeWithoutExtname + (file.src.extname = targetExtname)))
242
195
  return file
243
196
  }
@@ -260,8 +213,9 @@ function prepareWorkspace (publishFiles, assemblyFiles, buildConfig) {
260
213
  }
261
214
  if (keepSource) {
262
215
  for (const file of assemblyFiles) {
263
- file.src.contents = file.contents
264
216
  file.out = { path: file.path }
217
+ file.src.contents = file.contents
218
+ file.src.abspath = ospath.join(dir, file.path)
265
219
  files.push(file)
266
220
  }
267
221
  }
@@ -272,7 +226,7 @@ function prepareWorkspace (publishFiles, assemblyFiles, buildConfig) {
272
226
  })
273
227
  }
274
228
 
275
- async function resolveFileOrContents (convertResult, convertAttributes, buildConfig, loggerName) {
229
+ function resolveFileOrContents (convertResult, attributes, buildConfig, loggerName) {
276
230
  let fileOrContents
277
231
  if (convertResult?.status != null) {
278
232
  if ('file' in convertResult) {
@@ -284,7 +238,7 @@ async function resolveFileOrContents (convertResult, convertAttributes, buildCon
284
238
  }
285
239
  let logger, match
286
240
  if (buildConfig.stderrSink === 'log' && convertResult.stderr?.length && (logger = this.getLogger(loggerName))) {
287
- const docfile = convertAttributes.docfile
241
+ const docfile = attributes.docfile
288
242
  const command = buildConfig.command
289
243
  const file = { path: docfile }
290
244
  const stderr = convertResult.stderr.toString().trimEnd()
@@ -312,12 +266,11 @@ async function resolveFileOrContents (convertResult, convertAttributes, buildCon
312
266
  if (additionalLines.length > 1) logger.info({ command, file }, additionalLines.join('\n'))
313
267
  }
314
268
  } else if (convertResult !== undefined) {
315
- return convertResult
269
+ return Promise.resolve(convertResult)
316
270
  }
317
- if (fileOrContents !== undefined) return fileOrContents
318
- const outfile = convertAttributes.outfile
319
- const outfileExists = await fsp.access(outfile).then(invariably.true, invariably.false)
320
- return outfileExists ? new LazyReadable(() => fs.createReadStream(outfile)) : null
271
+ if (fileOrContents !== undefined) return Promise.resolve(fileOrContents)
272
+ const outfile = attributes.outfile
273
+ return fsp.access(outfile).then(() => new LazyReadable(outfile), invariably.null)
321
274
  }
322
275
 
323
276
  function isBound (obj) {
@@ -0,0 +1,73 @@
1
+ 'use strict'
2
+
3
+ const fsp = require('node:fs/promises')
4
+ const ospath = require('node:path')
5
+
6
+ async function compileConversionAttributes (doc, targetExtname, assemblerConfig, relativeToOutput = false) {
7
+ const {
8
+ asciidoc: { attributes: docAttributes } = { attributes: {} },
9
+ extname: docfilesuffix,
10
+ path: reldocfile,
11
+ src: { family, relative },
12
+ } = doc
13
+ const { cwd = process.cwd(), dir = cwd, mkdirs } = assemblerConfig.build
14
+ const docname = family + '$' + relative.substring(0, relative.length - docfilesuffix.length)
15
+ const docfile = ospath.join(dir, reldocfile)
16
+ const outdir = ospath.dirname(docfile)
17
+ const outfile = docfile.substring(0, docfile.length - docfilesuffix.length) + targetExtname
18
+ const attributes = Object.assign({ revdate: `${assemblerConfig.assembly.revdate}@` }, docAttributes, {
19
+ docdir: relativeToOutput ? dir : outdir,
20
+ docfile,
21
+ docfilesuffix,
22
+ docname: `${docname}@`,
23
+ imagesdir: '',
24
+ imagesoutdir: ospath.join(outdir, '..', '_images'),
25
+ outdir,
26
+ outfile,
27
+ outfilesuffix: targetExtname,
28
+ toArgs (attributeOptionFlag, outputOptionFlag) {
29
+ const args = []
30
+ let requireAsciidoctorLogAdapter
31
+ for (const [name, val] of Object.entries(this)) {
32
+ let optionValue
33
+ if (name === 'asciidoctor-log-integration') {
34
+ if ((val ?? false) !== false) requireAsciidoctorLogAdapter = val
35
+ continue
36
+ } else if ((val ?? false) === false) {
37
+ optionValue = `${name}!${val === false ? '=@' : ''}`
38
+ } else {
39
+ optionValue = val === '' ? name : name + '=' + val
40
+ }
41
+ args.push(attributeOptionFlag, optionValue)
42
+ }
43
+ if (requireAsciidoctorLogAdapter) args.push('-r', requireAsciidoctorLogAdapter)
44
+ if (outputOptionFlag) args.push(outputOptionFlag, this.outfile)
45
+ return args
46
+ },
47
+ })
48
+ Object.defineProperty(attributes, 'outfilesuffix', {
49
+ get () {
50
+ return ospath.extname(this.outfile)
51
+ },
52
+ set (value) {
53
+ const outfile = this.outfile
54
+ const extname = ospath.extname(outfile)
55
+ if (extname && outfile.endsWith(extname)) this.outfile = outfile.substring(0, outfile.length - extname.length)
56
+ this.outfile += value
57
+ },
58
+ })
59
+ Object.defineProperty(attributes, 'toArgs', { enumerable: false })
60
+ if (mkdirs) await fsp.mkdir(outdir, { recursive: true, force: true })
61
+ if (attributes['asciidoctor-log-integration'] != null) {
62
+ const scriptSourcePath = require.resolve('#asciidoctor-log-adapter')
63
+ let scriptTargetPath = scriptSourcePath
64
+ if (attributes['asciidoctor-log-integration'] === 'copy-to-build-dir') {
65
+ scriptTargetPath = ospath.join(dir, 'asciidoctor-log-adapter.rb')
66
+ await fsp.cp(scriptSourcePath, scriptTargetPath, { force: true, recursive: true })
67
+ }
68
+ attributes['asciidoctor-log-integration'] = scriptTargetPath
69
+ }
70
+ return attributes
71
+ }
72
+
73
+ module.exports = compileConversionAttributes
package/lib/configure.js CHANGED
@@ -7,25 +7,26 @@ function configure (context, ...args) {
7
7
  }
8
8
 
9
9
  function internalConfigure (converter, config = {}, providers = {}) {
10
- this.once('componentsRegistered', ({ contentCatalog, assemblerProfiles }) => {
11
- contentCatalog.publishableFamilies.add('export')
12
- if (assemblerProfiles) return
13
- this.updateVariables({ assemblerProfiles: getAssemblerProfiles(contentCatalog) })
14
- })
10
+ if (!this.listeners('beforeProcess').includes(enableKeepSource)) {
11
+ this.once('componentsRegistered', ({ contentCatalog, assemblerProfiles }) => {
12
+ contentCatalog.publishableFamilies.add('export')
13
+ if (!assemblerProfiles) this.updateVariables({ assemblerProfiles: getAssemblerProfiles(contentCatalog) })
14
+ })
15
15
 
16
- this.once('beforeProcess', enableKeepSource)
16
+ this.once('beforeProcess', enableKeepSource)
17
+ }
17
18
 
18
19
  this.once('navigationBuilt', async ({ playbook, contentCatalog }) => {
19
- const { assembleContent = require('./assemble-content'), ...assembleContentConfig } = providers
20
+ const { assembleContent = require('./assemble-content'), ...assembleContentProviders } = providers
20
21
  if (config.configSource?.constructor === Object) {
21
- assembleContentConfig.configSource = config.configSource
22
- await assembleContent.call(this, playbook, contentCatalog, converter, assembleContentConfig)
22
+ assembleContentProviders.configSource = config.configSource
23
+ await assembleContent.call(this, playbook, contentCatalog, converter, assembleContentProviders)
23
24
  } else {
24
25
  const singleConfig = !('configFiles' in config)
25
26
  const configFiles = singleConfig ? config.configFile : config.configFiles
26
27
  for (const configSource of Array.isArray(configFiles) ? configFiles : [configFiles]) {
27
- const assembleContentConfigWithConfigSource = Object.assign({}, assembleContentConfig, { configSource })
28
- await assembleContent.call(this, playbook, contentCatalog, converter, assembleContentConfigWithConfigSource)
28
+ const assembleContentProvidersWithConfigSource = Object.assign({}, assembleContentProviders, { configSource })
29
+ await assembleContent.call(this, playbook, contentCatalog, converter, assembleContentProvidersWithConfigSource)
29
30
  if (singleConfig) break
30
31
  }
31
32
  }
@@ -52,8 +53,9 @@ function getAssemblerProfiles (contentCatalog, assemblerProfiles = new Map()) {
52
53
  [...(componentVersion.origins ?? [])].find((it) => it.descriptor?.ext?.assembler)
53
54
  const assemblerConfig = getAssemblerConfigFromDescriptor(source?.descriptor)
54
55
  if (!assemblerConfig) return
55
- const componentVersionRef = `${componentVersion.version}@${componentVersion.name}`
56
- const filesByPath = componentVersion.files.reduce((accum, it) => accum.set(it.path, it), new Map())
56
+ const { name: componentName, version, files } = componentVersion
57
+ const componentVersionKey = `${version}@${componentName}`
58
+ const filesByPath = files.reduce((accum, it) => accum.set(it.path, it), new Map())
57
59
  const componentVersionProfiles = assemblerConfig.reduce((accum, entry) => {
58
60
  const data = {}
59
61
  const profile = entry.profile ?? undefined
@@ -68,8 +70,9 @@ function getAssemblerProfiles (contentCatalog, assemblerProfiles = new Map()) {
68
70
  data.navFiles = (nav.length ? [...new Set(nav)] : nav).reduce((navFiles, path_) => {
69
71
  const navFile = filesByPath.get(path_)
70
72
  if (navFile) {
71
- navFiles.push(initNavFile(navFile, component.name, componentVersion.version, navFiles.length))
73
+ navFiles.push(initNavFile(navFile, componentName, version, navFiles.length))
72
74
  } else {
75
+ const componentVersionRef = `${version === 'master' ? '' : version}@${componentName}`
73
76
  ;(data.messages ??= []).push([
74
77
  'warn',
75
78
  { source },
@@ -83,7 +86,7 @@ function getAssemblerProfiles (contentCatalog, assemblerProfiles = new Map()) {
83
86
  }
84
87
  return accum.set(profile, data)
85
88
  }, new Map())
86
- assemblerProfiles.set(componentVersionRef, componentVersionProfiles)
89
+ assemblerProfiles.set(componentVersionKey, componentVersionProfiles)
87
90
  })
88
91
  })
89
92
  return assemblerProfiles
package/lib/constants.js CHANGED
@@ -19,4 +19,5 @@ module.exports = Object.freeze({
19
19
  'rootLevel',
20
20
  'sectionMergeStrategy',
21
21
  ],
22
+ CAMEL_CASE_STOP_KEYS: ['asciidoc.attributes', 'assembly.attributes'],
22
23
  })
@@ -5,7 +5,7 @@ const { filterCollection, compilePattern } = require('./util/matcher')
5
5
  const VERSION_SEPARATOR_RX = /@(?!\()(?=(\w)?)/g
6
6
  const US = '\x1f'
7
7
 
8
- function filterComponentVersions (components, { names: patterns, prereleases = true }) {
8
+ function filterComponentVersions ({ names: patterns, prereleases = true }, components) {
9
9
  if (!patterns.length) return []
10
10
  const candidateMap = components.reduce((accum, { name: componentName, latest, versions }) => {
11
11
  for (const version of versions) {
package/lib/index.js CHANGED
@@ -3,4 +3,4 @@
3
3
  const assembleContent = require('./assemble-content')
4
4
  const configure = require('./configure')
5
5
 
6
- module.exports = { assembleContent, configure, configureAssembler: configure }
6
+ module.exports = { assembleContent, configure }
@@ -1,13 +1,13 @@
1
1
  'use strict'
2
2
 
3
+ const deepClone = require('./util/deep-clone')
3
4
  const expandPath = require('@antora/expand-path-helper')
4
5
  const fsp = require('node:fs/promises')
5
6
  const os = require('node:os')
6
7
  const ospath = require('node:path')
7
8
  const yaml = require('js-yaml')
8
9
 
9
- const { LEGACY_ASSEMBLY_KEYS } = require('./constants')
10
- const CAMEL_CASE_STOP_PATHS = ['asciidoc.attributes', 'assembly.attributes']
10
+ const { CAMEL_CASE_STOP_KEYS, LEGACY_ASSEMBLY_KEYS } = require('./constants')
11
11
  const PACKAGE_NAME = require('../package.json').name
12
12
  const YAML_SCHEMA = yaml.CORE_SCHEMA.withTags(yaml.mergeTag)
13
13
 
@@ -15,7 +15,7 @@ function loadConfig (configSource, playbook, preferredQualifier = '') {
15
15
  let resolvedConfigSource
16
16
  return (
17
17
  configSource?.constructor === Object
18
- ? Promise.resolve(configSource)
18
+ ? Promise.resolve(deepClone(configSource))
19
19
  : fileExists(
20
20
  (resolvedConfigSource = expandPath(configSource ?? `./antora-assembler${preferredQualifier}.yml`, {
21
21
  dot: playbook.dir,
@@ -38,7 +38,7 @@ function loadConfig (configSource, playbook, preferredQualifier = '') {
38
38
  return {}
39
39
  }
40
40
  return fsp.readFile(resolvedConfigSource).then((data) =>
41
- Object.assign(camelCaseKeys(yaml.load(data, { schema: YAML_SCHEMA }), CAMEL_CASE_STOP_PATHS), {
41
+ Object.assign(camelCaseKeys(yaml.load(data, { schema: YAML_SCHEMA }), CAMEL_CASE_STOP_KEYS), {
42
42
  file: resolvedConfigSource,
43
43
  })
44
44
  )
@@ -134,14 +134,14 @@ function loadConfig (configSource, playbook, preferredQualifier = '') {
134
134
  })
135
135
  }
136
136
 
137
- function camelCaseKeys (o, stopPaths = [], p = undefined) {
137
+ function camelCaseKeys (o, stopPaths, p = undefined) {
138
138
  if (Array.isArray(o)) return o.map((it) => camelCaseKeys(it, stopPaths, p))
139
139
  if (o == null || o.constructor !== Object) return o
140
140
  const pathPrefix = p ? p + '.' : ''
141
141
  const accum = {}
142
142
  for (const [k, v] of Object.entries(o)) {
143
143
  const camelKey = k.charAt() + k.substring(1).replace(/_([a-z])/g, (_, l) => l.toUpperCase())
144
- accum[camelKey] = ~stopPaths.indexOf(pathPrefix + camelKey) ? v : camelCaseKeys(v, stopPaths, pathPrefix + camelKey)
144
+ accum[camelKey] = stopPaths.includes(pathPrefix + camelKey) ? v : camelCaseKeys(v, stopPaths, pathPrefix + camelKey)
145
145
  }
146
146
  return accum
147
147
  }
@@ -1,14 +1,14 @@
1
1
  'use strict'
2
2
 
3
- function logCommand (loggerName, command, extraArgsOrAttributeOptionFlag, file, convertAttributes) {
3
+ function logCommand (loggerName, command, extraArgsOrAttributeOptionFlag, file, attributes) {
4
4
  const logger = this?.getLogger(loggerName)
5
5
  if (!logger?.isLevelEnabled('debug')) return
6
- const { docfile, 'assembler-filetype': filetype } = convertAttributes
6
+ const { docfile, 'assembler-filetype': filetype } = attributes
7
7
  const args = (
8
8
  Array.isArray(extraArgsOrAttributeOptionFlag)
9
9
  ? extraArgsOrAttributeOptionFlag
10
10
  : extraArgsOrAttributeOptionFlag
11
- ? convertAttributes.toArgs(extraArgsOrAttributeOptionFlag)
11
+ ? attributes.toArgs(extraArgsOrAttributeOptionFlag)
12
12
  : []
13
13
  ).map((it) => (~it.indexOf(' ') ? `'${it}'` : it))
14
14
  const ctx = { command: [command].concat(args).join(' '), file: { path: docfile } }