Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@antora/file-publisher

Package Overview
Dependencies
Maintainers
2
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antora/file-publisher - npm Package Compare versions

Comparing version 3.0.2 to 3.0.3

5

lib/publish-files.js

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

// Q: add getPublishableFiles / getOutFiles; return a stream? or getOutFilesAsStream?
const filesToPublish = (Array.isArray(catalogs) ? catalogs : [catalogs]).reduce((accum, catalog) => {
const files = (Array.isArray(catalogs) ? catalogs : [catalogs]).reduce((accum, catalog) => {
// the check for getAll on catalogs is @deprecated; scheduled to be removed in Antora 4

@@ -72,3 +72,4 @@ accum.push(...(catalog.getFiles || catalog.getAll).apply(catalog).filter((file) => file.out))

return Promise.all(publishers.map((publish) => publish(new ReadableOutputFileArray(filesToPublish), playbook)))
const cloneStreams = publishers.length > 1
return Promise.all(publishers.map((publish) => publish(new ReadableOutputFileArray(files, cloneStreams), playbook)))
}

@@ -75,0 +76,0 @@

23

lib/readable-output-file-array.js

@@ -13,5 +13,5 @@ 'use strict'

class ReadableOutputFileArray extends Readable {
constructor (array) {
constructor (array, cloneStreams) {
super({ objectMode: true })
this._array = array.slice().reverse()
this._array = array.map((it) => toOutputFile(it, cloneStreams)).reverse()
}

@@ -24,3 +24,3 @@

if (next === undefined) break
this.push(toOutputFile(next))
this.push(next)
}

@@ -31,7 +31,18 @@ if (size > -1) this.push(null)

function toOutputFile (file) {
// Q: do we also need to clone contents and stat?
return new File({ contents: file.contents, path: file.out.path, stat: file.stat })
// Q: do we also need to clone stat?
function toOutputFile (file, cloneStreams) {
const contents = file.contents
const outputFile = new File({ contents, path: file.out.path, stat: file.stat })
if (cloneStreams && outputFile.isStream()) {
const outputFileContents = outputFile.contents
if (outputFileContents !== contents) {
// NOTE: workaround for @antora/lunr-extension <= 1.0.0-alpha.8
if (!('get' in (Object.getOwnPropertyDescriptor(file, 'contents') || {}))) file.contents = outputFileContents
}
// NOTE: even the last occurrence must be cloned when using vinyl-fs even though cloneable-readable claims otherwise
outputFile.contents = outputFileContents.clone()
}
return outputFile
}
module.exports = ReadableOutputFileArray
{
"name": "@antora/file-publisher",
"version": "3.0.2",
"version": "3.0.3",
"description": "Publishes the publishable files in the virtual file catalog(s) to the destination(s) specified in the playbook.",

@@ -5,0 +5,0 @@ "license": "MPL-2.0",

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