@antora/ui-loader
Advanced tools
Comparing version 2.3.0-alpha.1 to 2.3.0-alpha.2
@@ -136,5 +136,5 @@ 'use strict' | ||
function downloadBundle (url, to) { | ||
return get(url, { encoding: null }) | ||
return get(url, { resolveBodyOnly: true, responseType: 'buffer' }) | ||
.then( | ||
({ body }) => | ||
(body) => | ||
new Promise((resolve, reject) => | ||
@@ -207,3 +207,3 @@ new ReadableFile(new MemoryFile({ path: ospath.basename(to), contents: body })) | ||
const files = new Map() | ||
return map((file, _, next) => files.set(file.path, file) && next(), () => done(files)) | ||
return map((file, _, next) => files.set(file.path, file) && next(), () => done(files)) // prettier-ignore | ||
} | ||
@@ -210,0 +210,0 @@ |
'use strict' | ||
const _ = require('lodash') | ||
const $files = Symbol('files') | ||
const $generateId = Symbol('generateId') | ||
class UiCatalog { | ||
constructor () { | ||
this[$files] = {} | ||
this[$files] = new Map() | ||
} | ||
getFiles () { | ||
return Object.values(this[$files]) | ||
getAll () { | ||
return [...this[$files].values()] | ||
} | ||
addFile (file) { | ||
const id = this[$generateId](file) | ||
if (id in this[$files]) { | ||
const key = generateKey(file) | ||
if (this[$files].has(key)) { | ||
throw new Error('Duplicate file') | ||
} | ||
this[$files][id] = file | ||
this[$files].set(key, file) | ||
} | ||
findByType (type) { | ||
return _.filter(this[$files], { type }) | ||
const accum = [] | ||
for (const entry of this[$files]) { | ||
const candidate = entry[1] | ||
if (candidate.type === type) accum.push(candidate) | ||
} | ||
return accum | ||
} | ||
} | ||
[$generateId] (file) { | ||
return [file.type, ...file.path.split('/')] | ||
} | ||
/** | ||
* @deprecated superceded by getAll | ||
*/ | ||
UiCatalog.prototype.getFiles = UiCatalog.prototype.getAll | ||
function generateKey ({ type, path }) { | ||
return `${type}$${path}` | ||
} | ||
module.exports = UiCatalog |
{ | ||
"name": "@antora/ui-loader", | ||
"version": "2.3.0-alpha.1", | ||
"version": "2.3.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.", | ||
@@ -24,6 +24,5 @@ "license": "MPL-2.0", | ||
"fs-extra": "~8.1", | ||
"got": "~9.6", | ||
"gulp-vinyl-zip": "~2.1 >=2.1.3", | ||
"got": "~10.0", | ||
"gulp-vinyl-zip": "~2.2", | ||
"js-yaml": "~3.13", | ||
"lodash": "~4.17", | ||
"minimatch-all": "~1.1", | ||
@@ -30,0 +29,0 @@ "through2": "~3.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
15457
12
391
+ Added@sindresorhus/is@1.2.0(transitive)
+ Added@szmarczak/http-timer@3.1.1(transitive)
+ Added@types/cacheable-request@6.0.3(transitive)
+ Added@types/http-cache-semantics@4.0.4(transitive)
+ Added@types/keyv@3.1.4(transitive)
+ Added@types/node@22.10.0(transitive)
+ Added@types/responselike@1.0.3(transitive)
+ Addedcacheable-lookup@0.2.2(transitive)
+ Addedcacheable-request@7.0.4(transitive)
+ Addeddecompress-response@5.0.0(transitive)
+ Addedgot@10.0.4(transitive)
+ Addedgulp-vinyl-zip@2.2.1(transitive)
+ Addedjson-buffer@3.0.1(transitive)
+ Addedkeyv@4.5.4(transitive)
+ Addedmimic-response@2.1.0(transitive)
+ Addednormalize-url@6.1.0(transitive)
+ Addedp-cancelable@2.1.1(transitive)
+ Addedresponselike@2.0.1(transitive)
+ Addedto-readable-stream@2.1.0(transitive)
+ Addedtype-fest@0.8.1(transitive)
+ Addedundici-types@6.20.0(transitive)
- Removedlodash@~4.17
- Removed@sindresorhus/is@0.14.0(transitive)
- Removed@szmarczak/http-timer@1.1.2(transitive)
- Removedcacheable-request@6.1.0(transitive)
- Removeddecompress-response@3.3.0(transitive)
- Removedduplexer@0.1.2(transitive)
- Removedevent-stream@3.3.4(transitive)
- Removedfrom@0.1.7(transitive)
- Removedget-stream@4.1.0(transitive)
- Removedgot@9.6.0(transitive)
- Removedgulp-vinyl-zip@2.1.3(transitive)
- Removedjson-buffer@3.0.0(transitive)
- Removedkeyv@3.1.0(transitive)
- Removedlodash@4.17.21(transitive)
- Removedlowercase-keys@1.0.1(transitive)
- Removedmap-stream@0.1.0(transitive)
- Removednormalize-url@4.5.1(transitive)
- Removedp-cancelable@1.1.0(transitive)
- Removedpause-stream@0.0.11(transitive)
- Removedprepend-http@2.0.0(transitive)
- Removedresponselike@1.0.2(transitive)
- Removedsplit@0.3.3(transitive)
- Removedstream-combiner@0.0.4(transitive)
- Removedto-readable-stream@1.0.0(transitive)
- Removedurl-parse-lax@3.0.0(transitive)
Updatedgot@~10.0
Updatedgulp-vinyl-zip@~2.2