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

@antora/ui-loader

Package Overview
Dependencies
Maintainers
2
Versions
86
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-alpha.7 to 3.0.0-alpha.8

12

lib/constants.js
'use strict'
module.exports = Object.freeze({
SUPPLEMENTAL_FILES_GLOB: '**/*',
UI_CACHE_FOLDER: 'ui',
UI_DESC_FILENAME: 'ui.yml',
UI_SRC_GLOB: '**/*[!~]',
UI_SRC_OPTS: {
dot: true,
follow: true,
ignore: ['.git/**'],
nomount: true,
nosort: true,
nounique: true,
removeBOM: false,
uniqueBy: (m) => m,
},
})

@@ -21,2 +21,6 @@ 'use strict'

}
isDot () {
return ('/' + this.history[this.history.length - 1]).indexOf('/.') > -1
}
}

@@ -23,0 +27,0 @@

49

lib/load-ui.js

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

const { UI_CACHE_FOLDER, UI_DESC_FILENAME, SUPPLEMENTAL_FILES_GLOB } = require('./constants')
const { UI_CACHE_FOLDER, UI_DESC_FILENAME, UI_SRC_GLOB, UI_SRC_OPTS } = require('./constants')
const URI_SCHEME_RX = /^https?:\/\//

@@ -83,3 +83,3 @@ const EXT_RX = /\.[a-z]{2,3}$/

} else {
const localPath = expandPath(bundleUrl, '~+', startDir)
const localPath = expandPath(bundleUrl, { dot: startDir })
resolveBundle = fsp

@@ -100,3 +100,3 @@ .stat(localPath)

? vfs
.src('**/*', { cwd: bundleFile.path, removeBOM: false })
.src(UI_SRC_GLOB, Object.assign({ cwd: bundleFile.path }, UI_SRC_OPTS))
.on('error', reject)

@@ -153,3 +153,3 @@ .pipe(relativizeFiles())

? getCacheDir('antora' + (process.env.NODE_ENV === 'test' ? '-test' : '')) || ospath.resolve('.antora/cache')
: expandPath(customCacheDir, '~+', startDir)
: expandPath(customCacheDir, { dot: startDir })
const cacheDir = ospath.join(baseCacheDir, UI_CACHE_FOLDER)

@@ -167,11 +167,7 @@ return fsp

const { HttpProxyAgent, HttpsProxyAgent } = require('hpagent')
const shouldProxy = require('should-proxy')
const proxy = url.startsWith('https:')
? { ProxyAgent: HttpsProxyAgent, url: httpsProxy }
: { ProxyAgent: HttpProxyAgent, url: httpProxy }
if (proxy.url && require('should-proxy')(url, { no_proxy: noProxy })) {
// see https://github.com/delvedor/hpagent/issues/18
const { protocol, hostname, port, username, password } = new URL(proxy.url)
const proxyUrl = { protocol, hostname, port, username: username || null, password: password || null }
return new proxy.ProxyAgent({ proxy: proxyUrl })
}
? { Agent: HttpsProxyAgent, url: httpsProxy }
: { Agent: HttpProxyAgent, url: httpProxy }
if (proxy.url && shouldProxy(url, { no_proxy: noProxy })) return new proxy.Agent({ proxy: proxy.url })
}

@@ -243,7 +239,6 @@ }

if (err) return next(err)
file.stat.size = (file.contents = contents).length
file.contents = contents
next(null, file)
})
} else {
file.stat.size = file.contents.length
next(null, file)

@@ -277,3 +272,3 @@ }

} else {
contents_ = expandPath(contents_, '~+', startDir)
contents_ = expandPath(contents_, { dot: startDir })
accum.push(

@@ -292,3 +287,3 @@ fsp

} else {
const cwd = expandPath(filesSpec, '~+', startDir)
const cwd = expandPath(filesSpec, { dot: startDir })
return fsp

@@ -300,3 +295,3 @@ .access(cwd)

vfs
.src(SUPPLEMENTAL_FILES_GLOB, { cwd, dot: true, removeBOM: false })
.src(UI_SRC_GLOB, Object.assign({ cwd, dot: true }, UI_SRC_OPTS))
.on('error', reject)

@@ -354,7 +349,6 @@ .pipe(relativizeFiles())

file.out = resolveOut(file, '')
} else if (file.local && ~('/' + file.relative).indexOf('/.')) {
} else if (file.isDot()) {
file = undefined
} else {
file.type = resolveType(file)
if (file.type === 'asset') file.out = resolveOut(file, config.outputDir)
} else if ((file.type = resolveType(file)) === 'asset') {
file.out = resolveOut(file, config.outputDir)
}

@@ -370,11 +364,6 @@ return file

const firstPathSegment = file.path.split('/', 1)[0]
if (firstPathSegment === 'layouts') {
return 'layout'
} else if (firstPathSegment === 'helpers') {
return 'helper'
} else if (firstPathSegment === 'partials') {
return 'partial'
} else {
return 'asset'
}
if (firstPathSegment === 'layouts') return 'layout'
if (firstPathSegment === 'helpers') return 'helper'
if (firstPathSegment === 'partials') return 'partial'
return 'asset'
}

@@ -381,0 +370,0 @@

@@ -11,19 +11,23 @@ 'use strict'

getFiles () {
return [...this[$files].values()]
const accum = []
for (const filesForType of this[$files].values()) {
for (const file of filesForType.values()) accum.push(file)
}
return accum
}
addFile (file) {
const key = generateKey(file)
if (this[$files].has(key)) {
let filesForType = this[$files].get(file.type)
if (!filesForType) this[$files].set(file.type, (filesForType = new Map()))
const key = file.path
if (filesForType.has(key)) {
throw new Error('Duplicate file')
}
this[$files].set(key, file)
filesForType.set(key, file)
return file
}
findByType (type) {
const accum = []
for (const candidate of this[$files].values()) {
if (candidate.type === type) accum.push(candidate)
}
return accum
const filesForType = this[$files].get(type)
return filesForType ? [...filesForType.values()] : []
}

@@ -37,6 +41,2 @@ }

function generateKey ({ type, path }) {
return type + '$' + path
}
module.exports = UiCatalog
{
"name": "@antora/ui-loader",
"version": "3.0.0-alpha.7",
"version": "3.0.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.",

@@ -20,6 +20,6 @@ "license": "MPL-2.0",

"dependencies": {
"@antora/expand-path-helper": "~1.0",
"@antora/expand-path-helper": "~2.0",
"cache-directory": "~2.0",
"camelcase-keys": "~6.2",
"gulp-vinyl-zip": "~2.2",
"gulp-vinyl-zip": "~2.5",
"hpagent": "~0.1.0",

@@ -49,3 +49,3 @@ "js-yaml": "~4.1",

],
"gitHead": "fbd597b3680474f2083cda8a7facf1e2848c08e0"
"gitHead": "2e5695bea11fb5719989c329c97e66d36e29659f"
}
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