@antora/ui-loader
Advanced tools
Comparing version 3.2.0-alpha.6 to 3.2.0-alpha.8
@@ -87,5 +87,5 @@ 'use strict' | ||
: fsp.stat(cachePath).then( | ||
(stat) => new File({ path: cachePath, stat }), | ||
() => downloadBundle(bundleUrl, cachePath, createAgent(bundleUrl, playbook.network || {})) | ||
) | ||
(stat) => new File({ path: cachePath, stat }), | ||
() => downloadBundle(bundleUrl, cachePath, createAgent(bundleUrl, playbook.network || {})) | ||
) | ||
}) | ||
@@ -110,5 +110,5 @@ } else { | ||
: srcZip(bundleFile.path, { startPath: bundle.startPath }) | ||
.on('error', (err) => reject(Object.assign(err, { message: `not a valid zip file; ${err.message}` }))) | ||
.pipe(bufferizeContentsAndCollectFiles(resolve)) | ||
.on('error', reject) | ||
.on('error', (err) => reject(Object.assign(err, { message: `not a valid zip file; ${err.message}` }))) | ||
.pipe(bufferizeContentsAndCollectFiles(resolve)) | ||
.on('error', reject) | ||
).catch((err) => { | ||
@@ -208,24 +208,23 @@ const msg = | ||
? Promise.all( | ||
filesSpec.reduce((accum, { path: path_, contents: contents_ }) => { | ||
if (!path_) { | ||
return accum | ||
} else if (contents_) { | ||
if (~contents_.indexOf('\n') || !EXT_RX.test(contents_)) { | ||
accum.push(new MemoryFile({ path: path_, contents: Buffer.from(contents_) })) | ||
filesSpec.reduce((accum, { path: path_, contents: contents_ }) => { | ||
if (!path_) return accum | ||
if (contents_) { | ||
if (~contents_.indexOf('\n') || !EXT_RX.test(contents_)) { | ||
accum.push(new MemoryFile({ path: path_, contents: Buffer.from(contents_) })) | ||
} else { | ||
contents_ = expandPath(contents_, { dot: startDir }) | ||
accum.push( | ||
fsp | ||
.stat(contents_) | ||
.then((stat) => | ||
fsp.readFile(contents_).then((contents) => new File({ path: path_, contents, stat })) | ||
) | ||
) | ||
} | ||
} else { | ||
contents_ = expandPath(contents_, { dot: startDir }) | ||
accum.push( | ||
fsp | ||
.stat(contents_) | ||
.then((stat) => | ||
fsp.readFile(contents_).then((contents) => new File({ path: path_, contents, stat })) | ||
) | ||
) | ||
accum.push(new MemoryFile({ path: path_ })) | ||
} | ||
} else { | ||
accum.push(new MemoryFile({ path: path_ })) | ||
} | ||
return accum | ||
}, []) | ||
).then((files) => files.reduce((accum, file) => accum.set(file.path, file) && accum, new Map())) | ||
return accum | ||
}, []) | ||
).then((files) => files.reduce((accum, file) => accum.set(file.path, file) && accum, new Map())) | ||
: fsp.access((cwd = expandPath(filesSpec, { dot: startDir }))).then(() => srcFs(cwd)) | ||
@@ -236,5 +235,4 @@ ).catch((err) => { | ||
throw new Error(`Specified ui.supplemental_files directory does not exist: ${dir}`) | ||
} else { | ||
throw transformError(err, `Failed to read ui.supplemental_files ${cwd ? `directory: ${dir}` : 'entry'}`) | ||
} | ||
throw transformError(err, `Failed to read ui.supplemental_files ${cwd ? `directory: ${dir}` : 'entry'}`) | ||
}) | ||
@@ -254,8 +252,7 @@ } | ||
const staticFiles = config.staticFiles | ||
if (staticFiles && staticFiles.length) config.isStaticFile = picomatch(staticFiles, STATIC_FILE_MATCHER_OPTS) | ||
if (staticFiles?.length) config.isStaticFile = picomatch(staticFiles, STATIC_FILE_MATCHER_OPTS) | ||
if (outputDir !== undefined) config.outputDir = outputDir | ||
return config | ||
} else { | ||
return { outputDir } | ||
} | ||
return { outputDir } | ||
} | ||
@@ -274,3 +271,3 @@ | ||
function classifyFile (file, config) { | ||
if (config.isStaticFile && config.isStaticFile(file.path)) { | ||
if (typeof config.isStaticFile === 'function' && config.isStaticFile(file.path)) { | ||
file.type = 'static' | ||
@@ -324,10 +321,10 @@ file.out = resolveOut(file, '') | ||
? fsp | ||
.readlink(abspath) | ||
.then( | ||
(symlink) => | ||
(statErr.code === 'ELOOP' ? 'ELOOP: symbolic link cycle, ' : 'ENOENT: broken symbolic link, ') + | ||
.readlink(abspath) | ||
.then( | ||
(symlink) => | ||
(statErr.code === 'ELOOP' ? 'ELOOP: symbolic link cycle, ' : 'ENOENT: broken symbolic link, ') + | ||
`${relpath} -> ${symlink}`, | ||
() => statErr.message.replace(`'${abspath}'`, relpath) | ||
) | ||
.then((message) => done(Object.assign(statErr, { message }))) | ||
() => statErr.message.replace(`'${abspath}'`, relpath) | ||
) | ||
.then((message) => done(Object.assign(statErr, { message }))) | ||
: done(Object.assign(statErr, { message: statErr.message.replace(`'${abspath}'`, relpath) })) | ||
@@ -334,0 +331,0 @@ ) |
{ | ||
"name": "@antora/ui-loader", | ||
"version": "3.2.0-alpha.6", | ||
"version": "3.2.0-alpha.8", | ||
"description": "Downloads a UI bundle, if necessary, and loads the files into a UI catalog for use in an Antora documentation pipeline.", | ||
@@ -14,3 +14,7 @@ "license": "MPL-2.0", | ||
"homepage": "https://antora.org", | ||
"repository": "gitlab:antora/antora", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://gitlab.com/antora/antora.git", | ||
"directory": "packages/ui-loader" | ||
}, | ||
"bugs": { | ||
@@ -29,3 +33,3 @@ "url": "https://gitlab.com/antora/antora/issues" | ||
"dependencies": { | ||
"@antora/expand-path-helper": "~2.0", | ||
"@antora/expand-path-helper": "~3.0", | ||
"braces": "~3.0", | ||
@@ -32,0 +36,0 @@ "cache-directory": "~2.0", |
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
23313
1
518
+ Added@antora/expand-path-helper@3.0.0(transitive)
- Removed@antora/expand-path-helper@2.0.0(transitive)