@antora/asciidoc-loader
Advanced tools
Comparing version 3.0.0-alpha.7 to 3.0.0-alpha.8
@@ -9,9 +9,8 @@ 'use strict' | ||
const LoggerAdapter = require('./logger/adapter') | ||
const ospath = require('path') | ||
const { posix: path } = ospath | ||
const { posix: path } = require('path') | ||
const resolveIncludeFile = require('./include/resolve-include-file') | ||
const userRequire = require('@antora/user-require-helper') | ||
const BLANK_LINE_BUF = Buffer.from('\n\n') | ||
const DOCTITLE_MARKER_BUF = Buffer.from('= ') | ||
const DOT_RELATIVE_RX = new RegExp(`^\\.{1,2}[/${ospath.sep.replace('/', '').replace('\\', '\\\\')}]`) | ||
const { EXAMPLES_DIR_TOKEN, PARTIALS_DIR_TOKEN } = require('./constants') | ||
@@ -174,12 +173,5 @@ const EXTENSION_DSL_TYPES = Extensions.$constants(false).filter((name) => name.endsWith('Dsl')) | ||
if (extensions && extensions.length) { | ||
const userRequireContext = { dot: playbook.dir, paths: [playbook.dir || '', __dirname] } | ||
const scopedExtensions = extensions.reduce((accum, extensionPath) => { | ||
if (extensionPath.charAt() === '.' && DOT_RELATIVE_RX.test(extensionPath)) { | ||
// NOTE require resolves a dot-relative path relative to current file; resolve relative to playbook dir instead | ||
extensionPath = ospath.resolve(playbook.dir || '.', extensionPath) | ||
} else if (!ospath.isAbsolute(extensionPath)) { | ||
// NOTE appending node_modules prevents require from looking elsewhere before looking in these paths | ||
const paths = [playbook.dir || '.', ospath.dirname(__dirname)].map((root) => ospath.join(root, 'node_modules')) | ||
extensionPath = require.resolve(extensionPath, { paths }) | ||
} | ||
const extension = require(extensionPath) | ||
const extension = userRequire(extensionPath, userRequireContext) | ||
if ('register' in extension) { | ||
@@ -186,0 +178,0 @@ accum.push(extension) |
{ | ||
"name": "@antora/asciidoc-loader", | ||
"version": "3.0.0-alpha.7", | ||
"version": "3.0.0-alpha.8", | ||
"description": "Loads AsciiDoc content into an Asciidoctor Document object (AST) for use in an Antora documentation pipeline.", | ||
@@ -20,3 +20,4 @@ "license": "MPL-2.0", | ||
"dependencies": { | ||
"@antora/logger": "3.0.0-alpha.7", | ||
"@antora/logger": "3.0.0-alpha.8", | ||
"@antora/user-require-helper": "~2.0", | ||
"@asciidoctor/core": "~2.2" | ||
@@ -39,3 +40,3 @@ }, | ||
], | ||
"gitHead": "fbd597b3680474f2083cda8a7facf1e2848c08e0" | ||
"gitHead": "2e5695bea11fb5719989c329c97e66d36e29659f" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
1
54108
3
861
+ Added@antora/expand-path-helper@2.0.0(transitive)
+ Added@antora/logger@3.0.0-alpha.8(transitive)
+ Added@antora/user-require-helper@2.0.0(transitive)
- Removed@antora/expand-path-helper@1.0.0(transitive)
- Removed@antora/logger@3.0.0-alpha.7(transitive)
Updated@antora/logger@3.0.0-alpha.8