@antora/pdf-extension 1.0.0-rc.1 → 1.0.0-rc.10

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/converter.js CHANGED
@@ -6,21 +6,22 @@ const ospath = require('node:path')
6
6
  const DEFAULT_COMMAND = 'asciidoctor-pdf --sourcemap'
7
7
  const PACKAGE_NAME = require('../package.json').name
8
8
 
9
- async function convert (file, convertAttributes, buildConfig, { logCommand, runCommand }) {
10
- const { command, cwd = process.cwd(), attributeOptionFlag, outputOptionFlag, stderr = 'print' } = buildConfig
11
- const extraArgs = convertAttributes.toArgs(attributeOptionFlag || '-a')
12
- const stdout =
13
- outputOptionFlag === false
14
- ? 'buffer'
15
- : extraArgs.push(outputOptionFlag || '-o', convertAttributes.outfile) && 'print'
16
- logCommand?.(command, extraArgs, file, convertAttributes)
9
+ async function convert (file, conversionAttributes, buildConfig, { logCommand, runCommand }) {
10
+ const { command, cwd = process.cwd(), attributeOptionFlag, stderr = 'print' } = buildConfig
11
+ if (!command) return null
12
+ const outputOptionFlag = buildConfig.outputOptionFlag || (buildConfig.outputOptionFlag === false ? false : '-o')
13
+ const extraArgs = conversionAttributes.toArgs(attributeOptionFlag || '-a', outputOptionFlag)
14
+ const stdout = outputOptionFlag ? 'print' : 'buffer'
15
+ logCommand?.(command, extraArgs, file, conversionAttributes)
17
16
  return runCommand(command, extraArgs.concat('-'), { parse: true, cwd, stdin: file.contents, stdout, stderr })
18
17
  }
19
18
 
20
- function getDefaultCommand (cwd) {
21
- return fsp.access(ospath.join(cwd, 'Gemfile.lock')).then(
22
- () => `bundle exec ${DEFAULT_COMMAND}`,
23
- () => DEFAULT_COMMAND
19
+ function getDefaultCommand (cwd, playbook) {
20
+ const defaultCommand = playbook?.runtime.stacktrace ? `${DEFAULT_COMMAND} --trace` : DEFAULT_COMMAND
21
+ const bundleLockfile = playbook?.env.BUNDLE_LOCKFILE ?? `${playbook?.env.BUNDLE_GEMFILE ?? 'Gemfile'}.lock`
22
+ return fsp.access(ospath.resolve(cwd, bundleLockfile)).then(
23
+ () => `bundle exec ${defaultCommand}`,
24
+ () => defaultCommand
24
25
  )
25
26
  }
26
27
 
package/lib/index.js CHANGED
@@ -1,14 +1,8 @@
1
1
  'use strict'
2
2
 
3
+ const { configure: configureAssembler } = require('@antora/assembler')
3
4
  const converter = require('./converter')
4
5
 
5
6
  module.exports.register = function ({ config }, providers) {
6
- requireAssembler(this).configure(this, converter, config, providers)
7
- }
8
-
9
- function requireAssembler (context, packageName = '@antora/assembler') {
10
- try {
11
- return context.require(packageName) // when installed with Antora
12
- } catch {}
13
- return require(packageName) // when installed separate from Antora, perhaps in project
7
+ configureAssembler(this, converter, config, providers)
14
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antora/pdf-extension",
3
- "version": "1.0.0-rc.1",
3
+ "version": "1.0.0-rc.10",
4
4
  "description": "An Antora extension that uses Assembler to merge pages into assembly files, export them to the PDF format, and publish them with the site.",
5
5
  "license": "MPL-2.0",
6
6
  "author": "OpenDevise Inc. (https://opendevise.com)",
@@ -32,7 +32,7 @@
32
32
  "#package": "./package.json"
33
33
  },
34
34
  "dependencies": {
35
- "@antora/assembler": "1.0.0-rc.1"
35
+ "@antora/assembler": "1.0.0-rc.10"
36
36
  },
37
37
  "engines": {
38
38
  "node": ">=20.0.0"