@antora/content-classifier
Advanced tools
Comparing version 2.3.0-beta.2 to 2.3.0-rc.1
@@ -148,4 +148,4 @@ 'use strict' | ||
getById ({ component, version, module, family, relative }) { | ||
return this[$files].get(generateKey({ component, version, module, family, relative })) | ||
getById ({ component, version, module: module_, family, relative }) { | ||
return this[$files].get(generateKey({ component, version, module: module_, family, relative })) | ||
} | ||
@@ -171,2 +171,5 @@ | ||
/** | ||
* @deprecated scheduled to be removed in Antora 3 | ||
*/ | ||
getComponentMap () { | ||
@@ -180,4 +183,11 @@ const accum = {} | ||
/** | ||
* @deprecated scheduled to be removed in Antora 3 | ||
*/ | ||
getComponentMapSortedBy (property) { | ||
return this.getComponentsSortedBy(property).reduce((accum, it) => (accum[it.name] = it) && accum, {}) | ||
const accum = {} | ||
for (const component of this.getComponentsSortedBy(property)) { | ||
accum[component.name] = component | ||
} | ||
return accum | ||
} | ||
@@ -281,40 +291,18 @@ | ||
exportToModel () { | ||
const target = this | ||
return new (class ContentCatalog { | ||
findBy (criteria) { | ||
return target.findBy(criteria) | ||
} | ||
getAll () { | ||
return target.getAll() | ||
} | ||
getById (id) { | ||
return target.getById(id) | ||
} | ||
getComponent (name) { | ||
return target.getComponent(name) | ||
} | ||
getComponentVersion (component, version) { | ||
return target.getComponentVersion(component, version) | ||
} | ||
getComponents () { | ||
return target.getComponents() | ||
} | ||
getPages () { | ||
return target.getPages() | ||
} | ||
resolvePage (spec, context = {}) { | ||
return target.resolvePage(spec, context) | ||
} | ||
resolveResource (spec, context = {}, defaultFamily = undefined, permittedFamilies = undefined) { | ||
return target.resolveResource(spec, context, defaultFamily, permittedFamilies) | ||
} | ||
})() | ||
return Object.assign( | ||
new (class ContentCatalogProxy {})(), | ||
[ | ||
this.findBy, | ||
this.getAll, | ||
this.getById, | ||
this.getComponent, | ||
this.getComponentVersion, | ||
this.getComponents, | ||
this.getComponentsSortedBy, | ||
this.getPages, | ||
this.getSiteStartPage, | ||
this.resolvePage, | ||
this.resolveResource, | ||
].reduce((accum, method) => (accum[method.name] = method.bind(this)) && accum, {}) | ||
) | ||
} | ||
@@ -328,4 +316,4 @@ } | ||
function generateKey ({ component, version, module, family, relative }) { | ||
return `${version}@${component}:${module}:${family}$${relative}` | ||
function generateKey ({ component, version, module: module_, family, relative }) { | ||
return `${version}@${component}:${module_}:${family}$${relative}` | ||
} | ||
@@ -351,6 +339,6 @@ | ||
const version = src.version === 'master' ? '' : src.version | ||
const module = src.module === 'ROOT' ? '' : src.module | ||
const module_ = src.module === 'ROOT' ? '' : src.module | ||
let basename = src.basename || path.basename(src.relative) | ||
const stem = src.stem || basename.substr(0, ((basename.lastIndexOf('.') + 1) || basename.length + 1) - 1) | ||
const stem = src.stem || basename.substr(0, (basename.lastIndexOf('.') + 1 || basename.length + 1) - 1) | ||
if (src.mediaType === 'text/asciidoc') basename = stem + '.html' | ||
@@ -371,3 +359,3 @@ | ||
const modulePath = path.join(component, version, module) | ||
const modulePath = path.join(component, version, module_) | ||
const dirname = path.join(modulePath, familyPathSegment, path.dirname(src.relative), indexifyPathSegment) | ||
@@ -374,0 +362,0 @@ const path_ = path.join(dirname, basename) |
@@ -37,3 +37,3 @@ 'use strict' | ||
let component = match[RESOURCE_ID_RX_GROUP.component] | ||
let module = match[RESOURCE_ID_RX_GROUP.module] | ||
let module_ = match[RESOURCE_ID_RX_GROUP.module] | ||
let family = match[RESOURCE_ID_RX_GROUP.family] | ||
@@ -43,7 +43,7 @@ let relative = match[RESOURCE_ID_RX_GROUP.relative] | ||
if (component) { | ||
if (!module) module = 'ROOT' | ||
if (!module_) module_ = 'ROOT' | ||
} else { | ||
component = ctx.component | ||
if (!version) version = ctx.version | ||
if (!module) module = ctx.module | ||
if (!module_) module_ = ctx.module | ||
} | ||
@@ -64,5 +64,5 @@ | ||
return { component, version, module, family, relative } | ||
return { component, version, module: module_, family, relative } | ||
} | ||
module.exports = parseResourceId |
{ | ||
"name": "@antora/content-classifier", | ||
"version": "2.3.0-beta.2", | ||
"version": "2.3.0-rc.1", | ||
"description": "Organizes aggregated content into a virtual file catalog for use in an Antora documentation pipeline.", | ||
@@ -19,7 +19,7 @@ "license": "MPL-2.0", | ||
"dependencies": { | ||
"@antora/asciidoc-loader": "2.3.0-beta.2", | ||
"@antora/asciidoc-loader": "2.3.0-rc.1", | ||
"vinyl": "~2.2" | ||
}, | ||
"devDependencies": { | ||
"@antora/content-aggregator": "2.3.0-beta.2" | ||
"@antora/content-aggregator": "2.3.0-rc.1" | ||
}, | ||
@@ -26,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
29895
708
+ Added@antora/asciidoc-loader@2.3.0-rc.1(transitive)
- Removed@antora/asciidoc-loader@2.3.0-beta.2(transitive)