@antora/ui-loader
Advanced tools
Comparing version 3.0.0-alpha.1 to 3.0.0-alpha.2
@@ -73,4 +73,4 @@ 'use strict' | ||
: fsp | ||
.access(cachePath) | ||
.then(() => cachePath) | ||
.stat(cachePath) | ||
.then((stat) => new File({ path: cachePath, stat })) | ||
.catch(() => downloadBundle(bundleUrl, cachePath)) | ||
@@ -81,24 +81,35 @@ }) | ||
resolveBundle = fsp | ||
.access(localPath) | ||
.then(() => localPath) | ||
.stat(localPath) | ||
.then((stat) => new File({ path: localPath, stat })) | ||
.catch(() => { | ||
throw new Error('Specified UI bundle does not exist: ' + bundleUrl) | ||
throw new Error( | ||
`Specified UI ${path.extname(localPath) ? 'bundle' : 'directory'} does not exist: ` + | ||
(bundleUrl === localPath ? bundleUrl : `${localPath} (resolved from url: ${bundleUrl})`) | ||
) | ||
}) | ||
} | ||
const files = await Promise.all([ | ||
resolveBundle.then((bundlePath) => | ||
resolveBundle.then((bundleFile) => | ||
new Promise((resolve, reject) => | ||
vzip | ||
.src(bundlePath) | ||
.on('error', (err) => { | ||
err.message = `not a valid zip file; ${err.message}` | ||
reject(err) | ||
}) | ||
.pipe(selectFilesStartingFrom(bundle.startPath)) | ||
.pipe(bufferizeContents()) | ||
.on('error', reject) | ||
.pipe(collectFiles(resolve)) | ||
bundleFile.isDirectory() | ||
? vfs | ||
.src('**/*', { cwd: bundleFile.path, removeBOM: false }) | ||
.on('error', reject) | ||
.pipe(relativizeFiles()) | ||
.pipe(collectFiles(resolve)) | ||
: vzip | ||
.src(bundleFile.path) | ||
.on('error', (err) => { | ||
err.message = `not a valid zip file; ${err.message}` | ||
reject(err) | ||
}) | ||
.pipe(selectFilesStartingFrom(bundle.startPath)) | ||
.pipe(bufferizeContents()) | ||
.on('error', reject) | ||
.pipe(collectFiles(resolve)) | ||
).catch((err) => { | ||
const wrapped = new Error(`Failed to read UI bundle: ${bundlePath} (resolved from url: ${bundleUrl})`) | ||
const wrapped = new Error( | ||
`Failed to read UI ${bundleFile.isDirectory() ? 'directory' : 'bundle'}: ` + | ||
(bundleUrl === bundleFile.path ? bundleUrl : `${bundleFile.path} (resolved from url: ${bundleUrl})`) | ||
) | ||
wrapped.stack += '\nCaused by: ' + (err.stack || 'unknown') | ||
@@ -110,5 +121,3 @@ throw wrapped | ||
]).then(([bundleFiles, supplementalFiles]) => mergeFiles(bundleFiles, supplementalFiles)) | ||
const config = loadConfig(files, outputDir) | ||
const catalog = new UiCatalog() | ||
@@ -170,3 +179,3 @@ files.forEach((file) => classifyFile(file, config) && catalog.addFile(file)) | ||
.then(() => fsp.writeFile(to, body)) | ||
.then(() => resolve(to)) | ||
.then(() => resolve(new File({ path: to, stat: { isDirectory: () => false } }))) | ||
) | ||
@@ -308,3 +317,3 @@ ) | ||
files.delete(UI_DESC_FILENAME) | ||
const config = camelCaseKeys(yaml.safeLoad(configFile.contents.toString()), { deep: true }) | ||
const config = camelCaseKeys(yaml.load(configFile.contents.toString()), { deep: true }) | ||
if (outputDir !== undefined) config.outputDir = outputDir | ||
@@ -311,0 +320,0 @@ const staticFiles = config.staticFiles |
{ | ||
"name": "@antora/ui-loader", | ||
"version": "3.0.0-alpha.1", | ||
"version": "3.0.0-alpha.2", | ||
"description": "Downloads a UI bundle, if necessary, and loads the files into a UI catalog for use in an Antora documentation pipeline.", | ||
@@ -10,3 +10,4 @@ "license": "MPL-2.0", | ||
"Sarah White <sarah@opendevise.com>", | ||
"Hubert SABLONNIÈRE <hubert.sablonniere@gmail.com>" | ||
"Hubert SABLONNIÈRE <hubert.sablonniere@gmail.com>", | ||
"Guillaume Grossetie <g.grossetie@gmail.com>" | ||
], | ||
@@ -21,8 +22,8 @@ "homepage": "https://antora.org", | ||
"@antora/expand-path-helper": "~1.0", | ||
"bl": "~4.0", | ||
"bl": "~5.0", | ||
"cache-directory": "~2.0", | ||
"camelcase-keys": "~6.2", | ||
"got": "~11.7", | ||
"got": "~11.8", | ||
"gulp-vinyl-zip": "~2.2", | ||
"js-yaml": "~3.14", | ||
"js-yaml": "~4.0", | ||
"minimatch-all": "~1.1", | ||
@@ -47,3 +48,3 @@ "vinyl": "~2.2", | ||
], | ||
"gitHead": "337ff6d2ed11e1f4d0a8ef993ddc8eaac7a73e9f" | ||
"gitHead": "997231474334311f3e5ff55d68534f5ae6e5d7ee" | ||
} |
@@ -11,4 +11,4 @@ # Antora UI Loader | ||
Copyright (C) 2017-2020 [OpenDevise Inc.](https://opendevise.com) and the [Antora Project](https://antora.org). | ||
Copyright (C) 2017-present [OpenDevise Inc.](https://opendevise.com) and the [Antora Project](https://antora.org). | ||
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). |
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
33963
429
+ Added@sindresorhus/is@4.6.0(transitive)
+ Addedargparse@2.0.1(transitive)
+ Addedbl@5.0.0(transitive)
+ Addedbuffer@6.0.3(transitive)
+ Addedgot@11.8.6(transitive)
+ Addedjs-yaml@4.0.0(transitive)
- Removed@sindresorhus/is@3.1.2(transitive)
- Removedargparse@1.0.10(transitive)
- Removedbl@4.0.4(transitive)
- Removedbuffer@5.7.1(transitive)
- Removedesprima@4.0.1(transitive)
- Removedgot@11.7.0(transitive)
- Removedjs-yaml@3.14.1(transitive)
- Removedsprintf-js@1.0.3(transitive)
Updatedbl@~5.0
Updatedgot@~11.8
Updatedjs-yaml@~4.0