@antora/site-generator
Advanced tools
Comparing version 3.0.0-beta.4 to 3.0.0-beta.5
@@ -11,12 +11,11 @@ 'use strict' | ||
await context.notify('playbookBuilt') | ||
playbook = context.lockVariable('playbook') | ||
playbook = vars.lock('playbook') | ||
vars.siteAsciiDocConfig = fxns.resolveAsciiDocConfig(playbook) | ||
vars.siteCatalog = new SiteCatalog() | ||
await context.notify('beforeProcess') | ||
const siteAsciiDocConfig = context.lockVariable('siteAsciiDocConfig') | ||
const siteAsciiDocConfig = vars.lock('siteAsciiDocConfig') | ||
await Promise.all([ | ||
fxns.aggregateContent(playbook).then((contentAggregate) => | ||
context.notify('contentAggregated', Object.assign(vars, { contentAggregate })).then(() => { | ||
contentAggregate = context.removeVariable('contentAggregate') | ||
vars.contentCatalog = fxns.classifyContent(playbook, contentAggregate, siteAsciiDocConfig) | ||
vars.contentCatalog = fxns.classifyContent(playbook, vars.remove('contentAggregate'), siteAsciiDocConfig) | ||
}) | ||
@@ -27,4 +26,4 @@ ), | ||
await context.notify('contentClassified') | ||
const contentCatalog = context.lockVariable('contentCatalog') | ||
const uiCatalog = context.lockVariable('uiCatalog') | ||
const contentCatalog = vars.lock('contentCatalog') | ||
const uiCatalog = vars.lock('uiCatalog') | ||
fxns.convertDocuments(contentCatalog, siteAsciiDocConfig) | ||
@@ -34,9 +33,9 @@ await context.notify('documentsConverted') | ||
await context.notify('navigationBuilt') | ||
;((composePage) => { | ||
const navigationCatalog = context.removeVariable('navigationCatalog') | ||
;(({ composePage, create404Page }) => { | ||
const navigationCatalog = vars.remove('navigationCatalog') | ||
contentCatalog.getPages((page) => page.out && composePage(page, contentCatalog, navigationCatalog)) | ||
if (playbook.site.url) vars.siteCatalog.addFile(composePage(create404Page())) | ||
if (playbook.site.url) vars.siteCatalog.addFile(create404Page(siteAsciiDocConfig)) | ||
})(fxns.createPageComposer(playbook, contentCatalog, uiCatalog, playbook.env)) | ||
await context.notify('pagesComposed') | ||
vars.siteCatalog.addFiles(fxns.produceRedirects(playbook, contentCatalog)) | ||
vars.siteCatalog.addFiles(fxns.produceRedirects(playbook, contentCatalog.findBy({ family: 'alias' }))) | ||
await context.notify('redirectsProduced') | ||
@@ -49,4 +48,3 @@ if (playbook.site.url) { | ||
await context.notify('beforePublish') | ||
const siteCatalog = context.lockVariable('siteCatalog') | ||
return fxns.publishFiles(playbook, [contentCatalog, uiCatalog, siteCatalog]).then((publications) => { | ||
return fxns.publishFiles(playbook, [contentCatalog, uiCatalog, vars.lock('siteCatalog')]).then((publications) => { | ||
if (!playbook.runtime.quiet && process.stdout.isTTY) { | ||
@@ -62,3 +60,3 @@ const indexPath = contentCatalog.getSiteStartPage() ? '/index.html' : '' | ||
.notify('sitePublished', Object.assign(vars, { publications })) | ||
.then(() => context.removeVariable('publications')) | ||
.then(() => vars.remove('publications')) | ||
}) | ||
@@ -73,12 +71,2 @@ } catch (err) { | ||
function create404Page () { | ||
return { | ||
title: 'Page Not Found', | ||
mediaType: 'text/html', | ||
src: { stem: '404' }, | ||
out: { path: '404.html' }, | ||
pub: { url: '/404.html', rootPath: '' }, | ||
} | ||
} | ||
module.exports = generateSite |
@@ -5,2 +5,3 @@ 'use strict' | ||
const getLogger = require('@antora/logger') | ||
const noopNotify = async function notify () {} | ||
const userRequire = require('@antora/user-require-helper') | ||
@@ -62,2 +63,3 @@ | ||
} | ||
if (!this._eventsCount) Object.defineProperty(this, 'notify', { value: noopNotify }) | ||
} | ||
@@ -80,4 +82,5 @@ | ||
const fxns = this.#fxns | ||
const names = Object.assign({ publishSite: '' }, FUNCTION_PROVIDERS) | ||
Object.entries(updates).forEach(([name, fxn]) => { | ||
if (name in fxns) fxns[name] = fxn.bind(this) | ||
if (name in names && typeof fxn === 'function') fxns[name] = fxn.bind(this) | ||
}) | ||
@@ -121,12 +124,19 @@ } | ||
_init (playbook) { | ||
this._registerFunctions() | ||
this._registerExtensions(playbook, this._initVariables(playbook)) | ||
Object.defineProperties(this, { _init: {}, _initVariables: {}, _registerExtensions: {}, _registerFunctions: {} }) | ||
return { fxns: this.#fxns, vars: this.#vars } | ||
const fxns = (this.#fxns = Object.defineProperty({}, 'publishSite', { | ||
enumerable: true, | ||
get () { | ||
return this.publishFiles | ||
}, | ||
set (value) { | ||
this.publishFiles = value | ||
}, | ||
})) | ||
const vars = (this.#vars = { playbook }) | ||
this._registerExtensions(playbook, vars) | ||
this._registerFunctions(fxns) | ||
Object.defineProperties(this, { _init: {}, _registerExtensions: {}, _registerFunctions: {} }) | ||
const varsFacade = { lock: (name) => this.lockVariable(name), remove: (name) => this.removeVariable(name) } | ||
return { fxns, vars: new Proxy(vars, { get: (target, property) => varsFacade[property] || target[property] }) } | ||
} | ||
_initVariables (playbook) { | ||
return (this.#vars = { playbook }) | ||
} | ||
_registerExtensions (playbook, vars) { | ||
@@ -152,9 +162,7 @@ const extensions = (playbook.antora || {}).extensions || [] | ||
} | ||
if (this.eventNames().length) return | ||
const notify = async () => undefined | ||
Object.defineProperty(this, 'notify', { value: notify }) | ||
if (!this._eventsCount) Object.defineProperty(this, 'notify', { value: noopNotify }) | ||
} | ||
_registerFunctions () { | ||
this.#fxns = Object.entries( | ||
_registerFunctions (fxns) { | ||
Object.entries( | ||
Object.entries(FUNCTION_PROVIDERS).reduce((accum, [fxnName, moduleKey]) => { | ||
@@ -164,19 +172,9 @@ accum[moduleKey] = (accum[moduleKey] || []).concat(fxnName) | ||
}, {}) | ||
).reduce((accum, [moduleKey, fxnNames]) => { | ||
const defaultExport = this.require('@antora/' + moduleKey) | ||
const defaultExportName = defaultExport.name | ||
).forEach(([moduleKey, fxnNames]) => { | ||
let defaultExport | ||
fxnNames.forEach((fxnName) => { | ||
const fxn = fxnName === defaultExportName ? defaultExport : defaultExport[fxnName] | ||
accum[fxnName] = fxn.bind(this) | ||
if (fxnName in fxns) return | ||
if (!defaultExport) defaultExport = this.require('@antora/' + moduleKey) | ||
fxns[fxnName] = (fxnName === defaultExport.name ? defaultExport : defaultExport[fxnName]).bind(this) | ||
}) | ||
return accum | ||
}, {}) | ||
Object.defineProperty(this.#fxns, 'publishSite', { | ||
enumerable: true, | ||
get () { | ||
return this.publishFiles | ||
}, | ||
set (value) { | ||
this.publishFiles = value | ||
}, | ||
}) | ||
@@ -183,0 +181,0 @@ } |
{ | ||
"name": "@antora/site-generator", | ||
"version": "3.0.0-beta.4", | ||
"version": "3.0.0-beta.5", | ||
"description": "The Antora generator for producing and publishing static documentation sites with Antora.", | ||
@@ -18,18 +18,17 @@ "license": "MPL-2.0", | ||
"dependencies": { | ||
"@antora/asciidoc-loader": "3.0.0-beta.4", | ||
"@antora/content-aggregator": "3.0.0-beta.4", | ||
"@antora/content-classifier": "3.0.0-beta.4", | ||
"@antora/document-converter": "3.0.0-beta.4", | ||
"@antora/file-publisher": "3.0.0-beta.4", | ||
"@antora/logger": "3.0.0-beta.4", | ||
"@antora/navigation-builder": "3.0.0-beta.4", | ||
"@antora/page-composer": "3.0.0-beta.4", | ||
"@antora/redirect-producer": "3.0.0-beta.4", | ||
"@antora/site-mapper": "3.0.0-beta.4", | ||
"@antora/ui-loader": "3.0.0-beta.4", | ||
"@antora/asciidoc-loader": "3.0.0-beta.5", | ||
"@antora/content-aggregator": "3.0.0-beta.5", | ||
"@antora/content-classifier": "3.0.0-beta.5", | ||
"@antora/document-converter": "3.0.0-beta.5", | ||
"@antora/file-publisher": "3.0.0-beta.5", | ||
"@antora/logger": "3.0.0-beta.5", | ||
"@antora/navigation-builder": "3.0.0-beta.5", | ||
"@antora/page-composer": "3.0.0-beta.5", | ||
"@antora/redirect-producer": "3.0.0-beta.5", | ||
"@antora/site-mapper": "3.0.0-beta.5", | ||
"@antora/ui-loader": "3.0.0-beta.5", | ||
"@antora/user-require-helper": "~2.0" | ||
}, | ||
"devDependencies": { | ||
"@antora/playbook-builder": "3.0.0-beta.4", | ||
"node-git-server": "~0.6" | ||
"@antora/playbook-builder": "3.0.0-beta.5" | ||
}, | ||
@@ -51,4 +50,3 @@ "engines": { | ||
], | ||
"gitHead": "8a142499e9f1a9e0631777796e06dd6c010d3a90", | ||
"readmeFilename": "README.md" | ||
"gitHead": "a13d03df41654d4deb78211a5a54953ce2a35fb8" | ||
} |
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
1
28727
250
+ Added@antora/asciidoc-loader@3.0.0-beta.5(transitive)
+ Added@antora/content-aggregator@3.0.0-beta.5(transitive)
+ Added@antora/content-classifier@3.0.0-beta.5(transitive)
+ Added@antora/document-converter@3.0.0-beta.5(transitive)
+ Added@antora/file-publisher@3.0.0-beta.5(transitive)
+ Added@antora/logger@3.0.0-beta.5(transitive)
+ Added@antora/navigation-builder@3.0.0-beta.5(transitive)
+ Added@antora/page-composer@3.0.0-beta.5(transitive)
+ Added@antora/redirect-producer@3.0.0-beta.5(transitive)
+ Added@antora/site-mapper@3.0.0-beta.5(transitive)
+ Added@antora/ui-loader@3.0.0-beta.5(transitive)
+ Addedpino@7.5.1(transitive)
+ Addedsonic-boom@2.4.2(transitive)
- Removed@antora/asciidoc-loader@3.0.0-beta.4(transitive)
- Removed@antora/content-aggregator@3.0.0-beta.4(transitive)
- Removed@antora/content-classifier@3.0.0-beta.4(transitive)
- Removed@antora/document-converter@3.0.0-beta.4(transitive)
- Removed@antora/file-publisher@3.0.0-beta.4(transitive)
- Removed@antora/logger@3.0.0-beta.4(transitive)
- Removed@antora/navigation-builder@3.0.0-beta.4(transitive)
- Removed@antora/page-composer@3.0.0-beta.4(transitive)
- Removed@antora/redirect-producer@3.0.0-beta.4(transitive)
- Removed@antora/site-mapper@3.0.0-beta.4(transitive)
- Removed@antora/ui-loader@3.0.0-beta.4(transitive)
- Removedpino@7.4.1(transitive)
- Removedsonic-boom@2.3.2(transitive)
Updated@antora/logger@3.0.0-beta.5