@antora/content-classifier
Advanced tools
Comparing version 2.3.0-alpha.2 to 2.3.0-beta.1
@@ -26,4 +26,4 @@ 'use strict' | ||
delete descriptor.files | ||
descriptor.asciidoc = resolveAsciiDocConfig(siteAsciiDocConfig, descriptor) | ||
files.forEach((file) => allocateSrc(file, name, version, nav) && catalog.addFile(file)) | ||
descriptor.asciidocConfig = resolveAsciiDocConfig(siteAsciiDocConfig, descriptor) | ||
catalog.registerComponentVersion(name, version, descriptor) | ||
@@ -30,0 +30,0 @@ return catalog |
@@ -24,3 +24,3 @@ 'use strict' | ||
registerComponentVersion (name, version, descriptor = {}) { | ||
const { asciidocConfig, displayVersion, prerelease, title, startPage: startPageSpec } = descriptor | ||
const { asciidoc, displayVersion, prerelease, title, startPage: startPageSpec } = descriptor | ||
let startPage = this.resolvePage(startPageSpec || 'index.adoc', { component: name, version, module: 'ROOT' }) | ||
@@ -51,4 +51,4 @@ if (!startPage) { | ||
} | ||
if (asciidocConfig) componentVersion.asciidocConfig = asciidocConfig | ||
const component = this.getComponent(name) | ||
if (asciidoc) componentVersion.asciidoc = asciidoc | ||
const component = this[$components].get(name) | ||
if (component) { | ||
@@ -72,2 +72,7 @@ const componentVersions = component.versions | ||
{ | ||
asciidoc: { | ||
get: function () { | ||
return this.latest.asciidoc | ||
}, | ||
}, | ||
// NOTE alias latestVersion to latest for backwards compatibility | ||
@@ -93,2 +98,3 @@ latestVersion: { | ||
} | ||
return componentVersion | ||
} | ||
@@ -108,2 +114,4 @@ | ||
publishable = true | ||
} else if ('out' in file) { | ||
delete file.out | ||
} else if ( | ||
@@ -120,2 +128,3 @@ (actingFamily === 'page' || actingFamily === 'image' || actingFamily === 'attachment') && | ||
this[$files].set(key, file) | ||
return file | ||
} | ||
@@ -126,4 +135,3 @@ | ||
const accum = [] | ||
for (const entry of this[$files]) { | ||
const candidate = entry[1] | ||
for (const candidate of this[$files].values()) { | ||
const candidateSrc = candidate.src | ||
@@ -140,4 +148,3 @@ if (criteriaEntries.every(([key, val]) => candidateSrc[key] === val)) accum.push(candidate) | ||
getByPath ({ component, version, path: path_ }) { | ||
for (const entry of this[$files]) { | ||
const candidate = entry[1] | ||
for (const candidate of this[$files].values()) { | ||
if (candidate.path === path_ && candidate.src.component === component && candidate.src.version === version) { | ||
@@ -183,7 +190,12 @@ return candidate | ||
getPages () { | ||
getPages (filter) { | ||
const accum = [] | ||
for (const entry of this[$files]) { | ||
const candidate = entry[1] | ||
if (candidate.src.family === 'page') accum.push(candidate) | ||
if (filter) { | ||
for (const candidate of this[$files].values()) { | ||
if (candidate.src.family === 'page' && filter(candidate)) accum.push(candidate) | ||
} | ||
} else { | ||
for (const candidate of this[$files].values()) { | ||
if (candidate.src.family === 'page') accum.push(candidate) | ||
} | ||
} | ||
@@ -217,3 +229,3 @@ return accum | ||
} else if (!src.version) { | ||
// QUESTION is this correct to assume? | ||
// QUESTION should we skip registering alias in this case? | ||
src.version = 'master' | ||
@@ -249,3 +261,3 @@ } | ||
resolvePage (spec, context = {}) { | ||
return resolveResource(spec, this, context, 'page', ['page']) | ||
return this.resolveResource(spec, context, 'page', ['page']) | ||
} | ||
@@ -276,2 +288,6 @@ | ||
getComponentVersion (component, version) { | ||
return target.getComponentVersion(component, version) | ||
} | ||
getComponents () { | ||
@@ -278,0 +294,0 @@ return target.getComponents() |
@@ -52,3 +52,3 @@ 'use strict' | ||
} | ||
if (family === 'page' && !relative.endsWith('.adoc')) relative += '.adoc' | ||
if ((family === 'page' || family === 'alias') && !relative.endsWith('.adoc')) relative += '.adoc' | ||
@@ -55,0 +55,0 @@ if (component) { |
@@ -38,5 +38,8 @@ 'use strict' | ||
return catalog.getById(id) | ||
return ( | ||
catalog.getById(id) || | ||
(id.family === 'page' ? (catalog.getById(Object.assign({}, id, { family: 'alias' })) || {}).rel : undefined) | ||
) | ||
} | ||
module.exports = resolveResource |
{ | ||
"name": "@antora/content-classifier", | ||
"version": "2.3.0-alpha.2", | ||
"version": "2.3.0-beta.1", | ||
"description": "Organizes aggregated content into a virtual file catalog for use in an Antora documentation pipeline.", | ||
@@ -19,6 +19,7 @@ "license": "MPL-2.0", | ||
"dependencies": { | ||
"@antora/asciidoc-loader": "2.3.0-beta.1", | ||
"vinyl": "~2.2" | ||
}, | ||
"devDependencies": { | ||
"@antora/content-aggregator": "2.3.0-alpha.2" | ||
"@antora/content-aggregator": "2.3.0-beta.1" | ||
}, | ||
@@ -25,0 +26,0 @@ "engines": { |
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
29688
710
2
+ Added@antora/asciidoc-loader@2.3.0-beta.1(transitive)
+ Addedasciidoctor.js@1.5.9(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedglob@6.0.4(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedopal-runtime@1.0.11(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedwrappy@1.0.2(transitive)
+ Addedxmlhttprequest@1.8.0(transitive)