New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@antora/ui-loader

Package Overview
Dependencies
Maintainers
2
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antora/ui-loader - npm Package Compare versions

Comparing version 3.0.0-beta.3 to 3.0.0-beta.4

2

lib/file.js

@@ -43,3 +43,3 @@ 'use strict'

this.push(this._file)
this._file = null
this.push((this._file = null))
}

@@ -46,0 +46,0 @@ }

@@ -5,3 +5,2 @@ 'use strict'

const camelCaseKeys = require('camelcase-keys')
const concat = require('simple-concat')
const { createHash } = require('crypto')

@@ -18,4 +17,5 @@ const expandPath = require('@antora/expand-path-helper')

const posixify = ospath.sep === '\\' ? (p) => p.replace(/\\/g, '/') : undefined
const { pipeline, Transform } = require('stream')
const map = (transform, flush = undefined) => new Transform({ objectMode: true, transform, flush })
const { pipeline, Transform, Writable } = require('stream')
const forEach = (write, final) => new Writable({ objectMode: true, write, final })
const map = (transform) => new Transform({ objectMode: true, transform })
const UiCatalog = require('./ui-catalog')

@@ -45,3 +45,3 @@ const yaml = require('js-yaml')

* from the bundle into memory, skipping any files that fall outside of the
* start path specified in the ui.startPath property of the playbook. Finally,
* start path specified in the ui.startPath property of the playbook. Finally,
* it classifies the files and adds them to a UiCatalog, which is then

@@ -109,3 +109,3 @@ * returned.

bundleFile.isDirectory()
? srcFs(bundleFile.path).then(resolve, reject)
? srcFs(ospath.join(bundleFile.path, bundle.startPath || '', '.')).then(resolve, reject)
: vzip

@@ -193,3 +193,3 @@ .src(bundleFile.path)

)
.on('finish', function () {
.on('finish', () =>
fsp

@@ -199,3 +199,3 @@ .mkdir(ospath.dirname(to), { recursive: true })

.then(() => resolve(new File({ path: to, stat: { isDirectory: () => false } })))
})
)
})

@@ -243,7 +243,8 @@ }).catch((err) => {

if (file.isStream()) {
concat(file.contents, (err, contents) => {
if (err) return next(err)
file.contents = contents
next(null, file)
})
const buffer = []
pipeline(
file.contents,
forEach((chunk, _, done) => buffer.push(chunk) && done()),
(err) => (err ? next(err) : next(null, Object.assign(file, { contents: Buffer.concat(buffer) })))
)
} else {

@@ -255,10 +256,9 @@ next(null, file)

function collectFiles (done) {
const files = new Map()
return map(
(file, _, next) => {
function collectFiles (resolve, files = new Map()) {
return forEach(
(file, _, done) => {
files.set(file.path, file)
next()
done()
},
() => done(files)
(done) => done() || resolve(files)
)

@@ -294,9 +294,9 @@ }

const cwd = expandPath(filesSpec, { dot: startDir })
return fsp
.access(cwd)
.then(() => srcFs(cwd))
.catch((err) => {
return fsp.access(cwd).then(
() => srcFs(cwd),
(err) => {
// Q: should we skip unreadable files?
throw Object.assign(err, { message: `problem encountered while reading ui.supplemental_files: ${err.message}` })
})
}
)
}

@@ -352,11 +352,13 @@ }

function srcFs (cwd) {
return new Promise((resolve, reject, cache = {}, files = new Map()) =>
const relpathStart = cwd.length + 1
return new Promise((resolve, reject, cache = Object.create(null), files = new Map()) =>
pipeline(
globStream(UI_SRC_GLOB, Object.assign({ cache, cwd }, UI_SRC_OPTS)),
map(({ path: abspathPosix }, _, next) => {
forEach(({ path: abspathPosix }, _, done) => {
if (Array.isArray(cache[abspathPosix])) return done() // detects some directories, but not all
const abspath = posixify ? ospath.normalize(abspathPosix) : abspathPosix
const relpath = abspath.substr(cwd.length + 1)
const relpath = abspath.substr(relpathStart)
symlinkAwareStat(abspath).then(
(stat) => {
if (stat.isDirectory()) return next()
if (stat.isDirectory()) return done() // detects remaining directories
fsp.readFile(abspath).then(

@@ -366,6 +368,6 @@ (contents) => {

files.set(path_, new File({ cwd, path: path_, contents, stat, local: true }))
next()
done()
},
(readErr) => {
next(Object.assign(readErr, { message: readErr.message.replace(`'${abspath}'`, relpath) }))
done(Object.assign(readErr, { message: readErr.message.replace(`'${abspath}'`, relpath) }))
}

@@ -383,3 +385,3 @@ )

}
next(statErr)
done(statErr)
}

@@ -386,0 +388,0 @@ )

{
"name": "@antora/ui-loader",
"version": "3.0.0-beta.3",
"version": "3.0.0-beta.4",
"description": "Downloads a UI bundle, if necessary, and loads the files into a UI catalog for use in an Antora documentation pipeline.",

@@ -24,2 +24,3 @@ "license": "MPL-2.0",

"camelcase-keys": "~7.0",
"glob-stream": "~7.0",
"gulp-vinyl-zip": "~2.5",

@@ -30,3 +31,2 @@ "hpagent": "~0.1.0",

"should-proxy": "~1.0",
"simple-concat": "~1.0",
"simple-get": "~4.0",

@@ -50,3 +50,4 @@ "vinyl": "~2.2"

],
"gitHead": "45da95a2e2dea538379d2d9f42013d2208fb86c3"
"gitHead": "8a142499e9f1a9e0631777796e06dd6c010d3a90",
"readmeFilename": "README.md"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc