@heroiclands/package-build 23.13.0 → 24.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +50 -0
- package/README.md +2 -1
- package/assets/preview/gitea.ini +12 -7
- package/assets/styles/content-base.css +150 -1
- package/bin/content-commands.mjs +356 -210
- package/bin/package-build.mjs +3 -2
- package/ci/check-banners.mjs +7 -7
- package/config.mjs +21 -6
- package/content-config.mjs +199 -80
- package/docs/api.md +93 -72
- package/docs/authoring/links-and-markup.md +316 -78
- package/docs/commands.md +248 -80
- package/docs/configuration.md +210 -102
- package/docs/content-format.md +2 -2
- package/docs/diagnostics.md +2 -2
- package/docs/getting-started.md +1 -1
- package/docs/guides/icons.md +1 -1
- package/docs/guides/module-project.md +5 -8
- package/docs/guides/release-and-deploy.md +2 -2
- package/docs/guides/site.md +155 -23
- package/docs/guides/system-project.md +1 -1
- package/docs/guides/writing-in-invented-scripts.md +1247 -0
- package/docs/index.md +1 -0
- package/docs/project-setup.md +28 -30
- package/docs/reference/format-details.md +589 -308
- package/docs/reference/note-types.md +40 -10
- package/docs/reference/theme-pages.md +127 -108
- package/docs/source-preview.md +15 -1
- package/engine/asset-shipping.mjs +22 -10
- package/engine/base-compiler.mjs +62 -104
- package/engine/changelog-lint.mjs +1 -1
- package/engine/content-address.mjs +1 -1
- package/engine/content-alerts.mjs +8 -4
- package/engine/content-blocks.mjs +26 -11
- package/engine/content-embeds.mjs +1 -1
- package/engine/content-expand.mjs +376 -0
- package/engine/content-figures.mjs +13 -6
- package/engine/content-format.yaml +8 -0
- package/engine/content-glyphs.mjs +213 -0
- package/engine/content-images.mjs +6 -7
- package/engine/content-links.mjs +3 -3
- package/engine/content-lint.mjs +1 -1
- package/engine/content-render.mjs +453 -0
- package/engine/content-scripts.mjs +326 -27
- package/engine/content-spans.mjs +4 -1
- package/engine/content-styles.mjs +91 -0
- package/engine/content-symbols.mjs +186 -0
- package/engine/content-verse.mjs +6 -18
- package/engine/core-report.mjs +169 -0
- package/engine/core-vocabulary.mjs +208 -0
- package/engine/dictionary-html.mjs +119 -0
- package/engine/field-reference.mjs +1 -1
- package/engine/frontmatter-lint.mjs +1 -1
- package/engine/heading-attributes.mjs +89 -0
- package/engine/helpers.mjs +61 -101
- package/engine/homepage.mjs +17 -29
- package/engine/html-minify.mjs +70 -0
- package/engine/index.mjs +8 -5
- package/engine/language-rows.mjs +8 -2
- package/engine/language-terms.mjs +115 -14
- package/engine/language-words.mjs +12 -0
- package/engine/logographic.mjs +255 -0
- package/engine/map-lexicon.mjs +221 -25
- package/engine/map-places.mjs +5 -4
- package/engine/markdown-expressions.mjs +0 -2
- package/engine/markdownlint-run.mjs +9 -3
- package/engine/markup-validation.mjs +21 -0
- package/engine/metre-declaration.mjs +134 -0
- package/engine/note-matter.mjs +2 -2
- package/engine/note-vocabulary.mjs +187 -3
- package/engine/pdf-build.mjs +68 -133
- package/engine/pdf-render.mjs +102 -44
- package/engine/post-fields.mjs +157 -0
- package/engine/preview-index.mjs +130 -0
- package/engine/preview-source.mjs +450 -0
- package/engine/project-init.mjs +5 -12
- package/engine/prose-config.mjs +3 -3
- package/engine/run-words.mjs +3 -2
- package/engine/script-emphasis-terms.mjs +38 -0
- package/engine/script-emphasis.mjs +295 -0
- package/engine/script-font-delivery.mjs +4 -4
- package/engine/site-build.mjs +265 -313
- package/engine/site-config.mjs +26 -238
- package/engine/site-files.mjs +175 -0
- package/engine/site-index.mjs +9 -4
- package/engine/site-preview.mjs +50 -523
- package/engine/site-reach.mjs +213 -0
- package/engine/site-render.mjs +668 -0
- package/engine/site-root.mjs +90 -39
- package/engine/site-search.mjs +161 -0
- package/engine/site-serve.mjs +274 -0
- package/engine/site-theme-banner.mjs +154 -0
- package/engine/site-theme-urls.mjs +125 -0
- package/engine/site-theme.mjs +939 -0
- package/engine/sql-tables.mjs +9 -6
- package/engine/text-maps.mjs +57 -10
- package/engine/typographer.mjs +248 -0
- package/engine/verse-metre.mjs +357 -0
- package/engine/wikilink-syntax.mjs +29 -47
- package/engine/wikilinks.mjs +758 -279
- package/engine/word-forms.mjs +39 -24
- package/engine/word-rows.mjs +12 -2
- package/engine/word-terms.mjs +29 -4
- package/manifest.mjs +3 -4
- package/package.json +10 -7
- package/{hugo-theme → site-theme}/data/banners.yaml +6 -10
- package/site-theme/layouts/base.hbs +31 -0
- package/site-theme/layouts/blog-list.hbs +30 -0
- package/site-theme/layouts/blog-post.hbs +40 -0
- package/site-theme/layouts/home.hbs +35 -0
- package/site-theme/layouts/list.hbs +20 -0
- package/site-theme/layouts/not-found.hbs +31 -0
- package/site-theme/layouts/page.hbs +7 -0
- package/site-theme/partials/copy-buttons.hbs +37 -0
- package/site-theme/partials/draft-notice.hbs +5 -0
- package/site-theme/partials/exturl.hbs +2 -0
- package/{hugo-theme/layouts/partials/footer.html → site-theme/partials/footer.hbs} +10 -7
- package/site-theme/partials/header.hbs +44 -0
- package/site-theme/partials/hero-banner.hbs +11 -0
- package/site-theme/partials/infobox-entry.hbs +2 -0
- package/site-theme/partials/infobox-section.hbs +31 -0
- package/site-theme/partials/infobox-value.hbs +2 -0
- package/site-theme/partials/infobox.hbs +18 -0
- package/site-theme/partials/list-members.hbs +9 -0
- package/site-theme/partials/nav-links.hbs +5 -0
- package/site-theme/partials/page-body.hbs +48 -0
- package/site-theme/partials/page-list.hbs +14 -0
- package/site-theme/partials/related.hbs +24 -0
- package/site-theme/partials/search-meta.hbs +6 -0
- package/site-theme/partials/search-names.hbs +2 -0
- package/site-theme/partials/search.hbs +52 -0
- package/site-theme/partials/tags.hbs +4 -0
- package/site-theme/partials/toc.hbs +7 -0
- package/{hugo-theme → site-theme}/static/css/style.css +14 -0
- package/stage.mjs +1 -2
- package/types/config.d.mts +8 -4
- package/types/content-config.d.mts +15 -15
- package/types/engine/asset-shipping.d.mts +5 -2
- package/types/engine/base-compiler.d.mts +20 -2
- package/types/engine/content-address.d.mts +1 -1
- package/types/engine/content-alerts.d.mts +8 -2
- package/types/engine/content-blocks.d.mts +11 -4
- package/types/engine/content-expand.d.mts +288 -0
- package/types/engine/content-figures.d.mts +11 -3
- package/types/engine/content-glyphs.d.mts +85 -0
- package/types/engine/content-images.d.mts +6 -7
- package/types/engine/content-links.d.mts +1 -1
- package/types/engine/content-render.d.mts +199 -0
- package/types/engine/content-scripts.d.mts +62 -0
- package/types/engine/content-spans.d.mts +1 -1
- package/types/engine/content-styles.d.mts +33 -0
- package/types/engine/content-symbols.d.mts +35 -0
- package/types/engine/core-report.d.mts +45 -0
- package/types/engine/core-vocabulary.d.mts +53 -0
- package/types/engine/dictionary-html.d.mts +8 -0
- package/types/engine/field-reference.d.mts +1 -1
- package/types/engine/heading-attributes.d.mts +20 -0
- package/types/engine/helpers.d.mts +3 -10
- package/types/engine/homepage.d.mts +11 -24
- package/types/engine/html-minify.d.mts +9 -0
- package/types/engine/index.d.mts +2 -1
- package/types/engine/language-terms.d.mts +24 -2
- package/types/engine/logographic.d.mts +45 -0
- package/types/engine/map-lexicon.d.mts +48 -8
- package/types/engine/map-places.d.mts +8 -0
- package/types/engine/markdown-expressions.d.mts +0 -2
- package/types/engine/metre-declaration.d.mts +39 -0
- package/types/engine/pdf-render.d.mts +6 -2
- package/types/engine/post-fields.d.mts +44 -0
- package/types/engine/preview-index.d.mts +72 -0
- package/types/engine/preview-source.d.mts +51 -0
- package/types/engine/script-emphasis-terms.d.mts +21 -0
- package/types/engine/script-emphasis.d.mts +84 -0
- package/types/engine/script-font-delivery.d.mts +4 -4
- package/types/engine/site-build.d.mts +71 -113
- package/types/engine/site-config.d.mts +14 -134
- package/types/engine/site-files.d.mts +73 -0
- package/types/engine/site-index.d.mts +11 -3
- package/types/engine/site-preview.d.mts +15 -19
- package/types/engine/site-reach.d.mts +76 -0
- package/types/engine/site-render.d.mts +173 -0
- package/types/engine/site-root.d.mts +14 -4
- package/types/engine/site-search.d.mts +54 -0
- package/types/engine/site-serve.d.mts +44 -0
- package/types/engine/site-theme-banner.d.mts +51 -0
- package/types/engine/site-theme-urls.d.mts +60 -0
- package/types/engine/site-theme.d.mts +127 -0
- package/types/engine/text-maps.d.mts +17 -3
- package/types/engine/typographer.d.mts +11 -0
- package/types/engine/verse-metre.d.mts +131 -0
- package/types/engine/wikilink-syntax.d.mts +30 -48
- package/types/engine/wikilinks.d.mts +330 -14
- package/types/engine/word-forms.d.mts +3 -2
- package/types/manifest.d.mts +3 -4
- package/types/stage.d.mts +1 -2
- package/types/vendor/markdownlint.d.mts +8 -0
- package/vendor/markdownlint.mjs +20388 -0
- package/engine/web-wikilinks.mjs +0 -594
- package/hugo-theme/layouts/404.html +0 -85
- package/hugo-theme/layouts/_default/baseof.html +0 -67
- package/hugo-theme/layouts/_default/list.html +0 -139
- package/hugo-theme/layouts/_default/single.html +0 -4
- package/hugo-theme/layouts/blog/list.html +0 -54
- package/hugo-theme/layouts/blog-post/single.html +0 -36
- package/hugo-theme/layouts/index.html +0 -75
- package/hugo-theme/layouts/partials/banner-url.html +0 -141
- package/hugo-theme/layouts/partials/cdn-url.html +0 -36
- package/hugo-theme/layouts/partials/dictionary-lists.html +0 -58
- package/hugo-theme/layouts/partials/draft-notice.html +0 -41
- package/hugo-theme/layouts/partials/draft-state.html +0 -26
- package/hugo-theme/layouts/partials/header.html +0 -35
- package/hugo-theme/layouts/partials/hero-banner.html +0 -85
- package/hugo-theme/layouts/partials/infobox/entry.html +0 -18
- package/hugo-theme/layouts/partials/infobox/items.html +0 -26
- package/hugo-theme/layouts/partials/infobox/section.html +0 -56
- package/hugo-theme/layouts/partials/infobox/value.html +0 -43
- package/hugo-theme/layouts/partials/infobox.html +0 -57
- package/hugo-theme/layouts/partials/page-body.html +0 -152
- package/hugo-theme/layouts/partials/related.html +0 -138
- package/hugo-theme/layouts/partials/search.html +0 -84
- package/hugo-theme/layouts/partials/site-url.html +0 -32
- package/hugo-theme/layouts/partials/tags.html +0 -30
- package/hugo-theme/layouts/partials/toc.html +0 -28
- package/hugo-theme/layouts/partials/warn-missing-banner.html +0 -3
- package/hugo-theme/layouts/shortcodes/cartouche.html +0 -64
- package/hugo-theme/layouts/shortcodes/exturl.html +0 -12
- package/hugo-theme/layouts/shortcodes/glyph.html +0 -43
- package/hugo-theme/layouts/shortcodes/pagelist.html +0 -63
- package/hugo-theme/theme.toml +0 -11
- package/types/engine/web-wikilinks.d.mts +0 -107
- /package/{hugo-theme → site-theme}/data/banner-kinds.yaml +0 -0
- /package/{hugo-theme → site-theme}/static/css/sohl-icons.css +0 -0
- /package/{hugo-theme → site-theme}/static/fonts/game-icons-kb.woff2 +0 -0
- /package/{hugo-theme → site-theme}/static/img/banners/takheperu-hieroglyphs.svg +0 -0
- /package/{hugo-theme → site-theme}/static/img/cartouches/takheperu.svg +0 -0
- /package/{hugo-theme → site-theme}/static/js/inline-spoilers.js +0 -0
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Render one complete buffer
|
|
2
|
+
* Render one complete buffer.
|
|
3
|
+
*
|
|
4
|
+
* Without `index` the buffer is rendered with no configuration, content index,
|
|
5
|
+
* filesystem or database: wikilinks, spans and expressions show as highlighted
|
|
6
|
+
* authored source. With `index` the buffer is expanded as the website expands
|
|
7
|
+
* a page and rendered as every target renders it, so links, embeds, marked
|
|
8
|
+
* text, icons and figure numbers read as they will on the page; only what a
|
|
9
|
+
* buffer cannot answer, such as a query, stays highlighted source.
|
|
10
|
+
*
|
|
3
11
|
* @param {string} text - Markdown, optionally beginning with YAML frontmatter.
|
|
4
|
-
* @param {{dark?: boolean, infobox?: boolean, file?: string, currentDate?: string
|
|
12
|
+
* @param {{dark?: boolean, infobox?: boolean, file?: string, currentDate?: string,
|
|
13
|
+
* index?: import("./preview-index.mjs").PreviewIndex}} [options] - Explicit palette, profile visibility, diagnostic filename, neutral current date (default "720.1") and the content index, from {@link module:engine/preview-index.previewIndex}.
|
|
5
14
|
* @returns {{ok: boolean, html: string, frontmatter: object, findings: object[]}} HTML and metadata with locally calculable ages; unavailable ages remain absent or null.
|
|
6
15
|
*/
|
|
7
|
-
export function renderPreview(text: string, { dark, infobox, file, currentDate }?: {
|
|
16
|
+
export function renderPreview(text: string, { dark, infobox, file, currentDate, index }?: {
|
|
8
17
|
dark?: boolean;
|
|
9
18
|
infobox?: boolean;
|
|
10
19
|
file?: string;
|
|
11
20
|
currentDate?: string;
|
|
21
|
+
index?: import("./preview-index.mjs").PreviewIndex;
|
|
12
22
|
}): {
|
|
13
23
|
ok: boolean;
|
|
14
24
|
html: string;
|
|
@@ -23,19 +33,5 @@ export function renderPreview(text: string, { dark, infobox, file, currentDate }
|
|
|
23
33
|
export function readPreviewCurrentDate(root: string): Promise<string>;
|
|
24
34
|
/** Both explicit palettes, scoped to the preview container. */
|
|
25
35
|
export function previewStyles(): string;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
eq: "local";
|
|
29
|
-
gt: "local";
|
|
30
|
-
gte: "local";
|
|
31
|
-
lt: "local";
|
|
32
|
-
lte: "local";
|
|
33
|
-
not: "local";
|
|
34
|
-
and: "local";
|
|
35
|
-
or: "local";
|
|
36
|
-
words: "local";
|
|
37
|
-
digits: "local";
|
|
38
|
-
sql: "dependent";
|
|
39
|
-
dateformat: "dependent";
|
|
40
|
-
ref: "reference";
|
|
41
|
-
}>;
|
|
36
|
+
export { PREVIEW_HELPERS };
|
|
37
|
+
import { PREVIEW_HELPERS } from "./preview-source.mjs";
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The internal targets a page links.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} html - A rendered page.
|
|
5
|
+
* @param {string} from - The page's own address, beginning with `/`.
|
|
6
|
+
* @param {string} base - The site's base path, beginning and ending with `/`.
|
|
7
|
+
* @returns {string[]} Absolute paths inside the base, without fragment or query.
|
|
8
|
+
*/
|
|
9
|
+
export function internalLinks(html: string, from: string, base: string): string[];
|
|
10
|
+
/**
|
|
11
|
+
* The address a link to a file names a page by: `…/index.html` is its
|
|
12
|
+
* directory, and a bare directory ends in a slash.
|
|
13
|
+
*
|
|
14
|
+
* @param {string} pathname - An absolute path.
|
|
15
|
+
* @returns {string} The page address it would be keyed by.
|
|
16
|
+
*/
|
|
17
|
+
export function pageAddress(pathname: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* The pages reachable from the homepage.
|
|
20
|
+
*
|
|
21
|
+
* @param {object} options - The inputs.
|
|
22
|
+
* @param {string} options.base - The site's base path, beginning and ending
|
|
23
|
+
* with `/`; the homepage is at the base.
|
|
24
|
+
* @param {(url: string) => string|undefined} options.html - A page's rendered
|
|
25
|
+
* HTML by its address, or `undefined` where the site has no such page.
|
|
26
|
+
* @param {(pathname: string) => readonly string[]} [options.expand] - The page
|
|
27
|
+
* addresses a linked non-page file, such as a feed, lists.
|
|
28
|
+
* @returns {Set<string>} The address of every reachable page, the homepage
|
|
29
|
+
* included.
|
|
30
|
+
*/
|
|
31
|
+
export function reachablePages({ base, html, expand }: {
|
|
32
|
+
base: string;
|
|
33
|
+
html: (url: string) => string | undefined;
|
|
34
|
+
expand?: ((pathname: string) => readonly string[]) | undefined;
|
|
35
|
+
}): Set<string>;
|
|
36
|
+
/**
|
|
37
|
+
* The page addresses an Atom feed lists, as paths.
|
|
38
|
+
*
|
|
39
|
+
* @param {string} xml - The feed.
|
|
40
|
+
* @returns {string[]} The `href` of every `<link>` that is an absolute URL,
|
|
41
|
+
* as its path.
|
|
42
|
+
*/
|
|
43
|
+
export function feedPaths(xml: string): string[];
|
|
44
|
+
/**
|
|
45
|
+
* A page body split at {@link GENERATED_MARK}.
|
|
46
|
+
*
|
|
47
|
+
* @param {string} html - A page body.
|
|
48
|
+
* @returns {{authored: string, generated: string}} The author's text, and the
|
|
49
|
+
* generated sections after it, `""` where there are none.
|
|
50
|
+
*/
|
|
51
|
+
export function splitContent(html: string): {
|
|
52
|
+
authored: string;
|
|
53
|
+
generated: string;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Generated sections with the entries that lead outside a set of pages taken
|
|
57
|
+
* out.
|
|
58
|
+
*
|
|
59
|
+
* An entry is a list item, a table row, or a link in a paragraph's comma
|
|
60
|
+
* separated run; a paragraph, list or table left with no entry goes, and so
|
|
61
|
+
* does a section left with nothing under its heading. A link to anything that
|
|
62
|
+
* is not a page of the site is kept, and so is text that was never a link.
|
|
63
|
+
*
|
|
64
|
+
* @param {string} html - The generated sections, rendered.
|
|
65
|
+
* @param {(href: string) => boolean} outside - Whether an `href` names a page
|
|
66
|
+
* of the site that is not reachable.
|
|
67
|
+
* @returns {string} The sections, or `""` when nothing is left.
|
|
68
|
+
*/
|
|
69
|
+
export function pruneGenerated(html: string, outside: (href: string) => boolean): string;
|
|
70
|
+
/**
|
|
71
|
+
* The comment that separates a page's authored text from the sections the
|
|
72
|
+
* build generated after it, in the HTML the renderer writes.
|
|
73
|
+
*
|
|
74
|
+
* @type {string}
|
|
75
|
+
*/
|
|
76
|
+
export const GENERATED_MARK: string;
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pages in the order a reader walks them: by `weight`, lightest first and an
|
|
3
|
+
* unweighted page last; then newest first by `date`; then by title; then by
|
|
4
|
+
* address. A page's own `weight` and `date` are read before its `params`'.
|
|
5
|
+
*
|
|
6
|
+
* @template {{title?: string, url: string, date?: unknown, weight?: number, params?: object}} T
|
|
7
|
+
* @param {readonly T[]} pages - The pages.
|
|
8
|
+
* @returns {T[]} A sorted copy.
|
|
9
|
+
*/
|
|
10
|
+
export function siteOrder<T extends {
|
|
11
|
+
title?: string;
|
|
12
|
+
url: string;
|
|
13
|
+
date?: unknown;
|
|
14
|
+
weight?: number;
|
|
15
|
+
params?: object;
|
|
16
|
+
}>(pages: readonly T[]): T[];
|
|
17
|
+
/**
|
|
18
|
+
* Every page of a site: the pages it is given, with their siblings, and the
|
|
19
|
+
* listings derived from them.
|
|
20
|
+
*
|
|
21
|
+
* @param {object} site - The site, as {@link writeSite} takes it.
|
|
22
|
+
* @param {readonly object[]} pages - The home page, the regular pages and any
|
|
23
|
+
* authored section pages.
|
|
24
|
+
* @returns {object[]} Every page, home first, then the regular pages, the
|
|
25
|
+
* sections, and the tag pages.
|
|
26
|
+
*/
|
|
27
|
+
export function siteTree(site: object, pages: readonly object[]): object[];
|
|
28
|
+
/**
|
|
29
|
+
* Write the files the layouts link: the theme's own, and the code stylesheet.
|
|
30
|
+
*
|
|
31
|
+
* @param {string} out - The directory the site is written to.
|
|
32
|
+
* @param {string} [staticDir] - The theme's own files.
|
|
33
|
+
* @returns {string[]} The files the theme generates, each written. The theme's
|
|
34
|
+
* own files are copied as a tree and not listed.
|
|
35
|
+
*/
|
|
36
|
+
export function writeThemeFiles(out: string, staticDir?: string): string[];
|
|
37
|
+
/**
|
|
38
|
+
* Draw a site and write it.
|
|
39
|
+
*
|
|
40
|
+
* @param {object} options - The inputs.
|
|
41
|
+
* @param {object} options.site - The site, as
|
|
42
|
+
* {@link module:engine/site-theme.createSiteTheme} takes it, with `tagPages`,
|
|
43
|
+
* `feed` and `sitemaps` as the module description sets out. `pages` and
|
|
44
|
+
* `pageExists` are filled in here.
|
|
45
|
+
* @param {readonly object[]} options.pages - The home page, the regular pages
|
|
46
|
+
* and any authored section pages, each as a layout is given it.
|
|
47
|
+
* @param {string} options.out - The directory written to. Emptied first.
|
|
48
|
+
* @param {(finding: import("./site-theme.mjs").Finding) => void} [options.report] -
|
|
49
|
+
* Receives each finding the layouts make.
|
|
50
|
+
* @param {string} [options.staticDir] - The theme's own files, copied first.
|
|
51
|
+
* @param {ReadonlySet<string>} [options.only] - The addresses of the pages to
|
|
52
|
+
* draw again into a site already written. Nothing else is touched.
|
|
53
|
+
* @returns {{files: string[], pages: string[], reachable: string[],
|
|
54
|
+
* findings: object[]}} Every file written, the address of every page, the
|
|
55
|
+
* address of each page reachable from the homepage, and the layouts' findings.
|
|
56
|
+
* @throws {Error} When a page's address is outside the site, or a site served
|
|
57
|
+
* under a path asks for a sitemap index.
|
|
58
|
+
*/
|
|
59
|
+
export function writeSite({ site, pages, out, report, staticDir, only }: {
|
|
60
|
+
site: object;
|
|
61
|
+
pages: readonly object[];
|
|
62
|
+
out: string;
|
|
63
|
+
report?: ((finding: import("./site-theme.mjs").Finding) => void) | undefined;
|
|
64
|
+
staticDir?: string | undefined;
|
|
65
|
+
only?: ReadonlySet<string> | undefined;
|
|
66
|
+
}): {
|
|
67
|
+
files: string[];
|
|
68
|
+
pages: string[];
|
|
69
|
+
reachable: string[];
|
|
70
|
+
findings: object[];
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* A package's pages, from its site build.
|
|
74
|
+
*
|
|
75
|
+
* Each body is rendered by the `web` renderer from the markdown the build
|
|
76
|
+
* expanded, and each page carries what it tells the search; see
|
|
77
|
+
* {@link module:engine/site-search}. The site carries what the configuration
|
|
78
|
+
* asks for: `site.tags` as `tagPages`, `site.feed` as the feed's section, each
|
|
79
|
+
* package of `site.sitemaps` as its sitemap's address on the site's origin,
|
|
80
|
+
* and each of `site.mergeIndexes` as the path of its search bundle.
|
|
81
|
+
*
|
|
82
|
+
* @param {object} options - The inputs.
|
|
83
|
+
* @param {object} options.config - The resolved configuration.
|
|
84
|
+
* @param {object} options.built - What `buildSite` returned with `write: false`.
|
|
85
|
+
* @param {{baseURL: string, title: string, params: object}} options.settings -
|
|
86
|
+
* From {@link module:engine/site-config.siteSettings}.
|
|
87
|
+
* @param {readonly {name: string, url: string, children?: object[]}[]} [options.navigation] -
|
|
88
|
+
* The menu.
|
|
89
|
+
* @param {number} [options.year] - The year the footer states.
|
|
90
|
+
* @returns {{site: object, pages: object[], pageOf: (entry: object) => object}}
|
|
91
|
+
* What {@link writeSite} is given, and how one note the build rendered again
|
|
92
|
+
* becomes its page.
|
|
93
|
+
*/
|
|
94
|
+
export function packageSite({ config, built, settings, navigation, year }: {
|
|
95
|
+
config: object;
|
|
96
|
+
built: object;
|
|
97
|
+
settings: {
|
|
98
|
+
baseURL: string;
|
|
99
|
+
title: string;
|
|
100
|
+
params: object;
|
|
101
|
+
};
|
|
102
|
+
navigation?: readonly {
|
|
103
|
+
name: string;
|
|
104
|
+
url: string;
|
|
105
|
+
children?: object[];
|
|
106
|
+
}[] | undefined;
|
|
107
|
+
year?: number | undefined;
|
|
108
|
+
}): {
|
|
109
|
+
site: object;
|
|
110
|
+
pages: object[];
|
|
111
|
+
pageOf: (entry: object) => object;
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* The directory a package's site is written to: its base path under the
|
|
115
|
+
* deployed root, so a site served at `/` is written at the root itself.
|
|
116
|
+
*
|
|
117
|
+
* @param {object} config - The resolved configuration.
|
|
118
|
+
* @param {string} root - The deployed root.
|
|
119
|
+
* @returns {string} The directory.
|
|
120
|
+
*/
|
|
121
|
+
export function siteDirectory(config: object, root: string): string;
|
|
122
|
+
/**
|
|
123
|
+
* Copy the script fonts the site's pages set their marked text in.
|
|
124
|
+
*
|
|
125
|
+
* @param {object} config - The resolved configuration.
|
|
126
|
+
* @param {string} out - The directory the site is written to.
|
|
127
|
+
* @returns {{findings: object[], count: number, dest?: string}} What checking
|
|
128
|
+
* the installed fonts found, and how many files were copied where. Nothing is
|
|
129
|
+
* copied when there is a finding, or when the package sets no script.
|
|
130
|
+
*/
|
|
131
|
+
export function deliverSiteFonts(config: object, out: string): {
|
|
132
|
+
findings: object[];
|
|
133
|
+
count: number;
|
|
134
|
+
dest?: string;
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* Build a package's site from its content tree and write it.
|
|
138
|
+
*
|
|
139
|
+
* The site's address, title and menu are read before the tree is, so a site
|
|
140
|
+
* that cannot be described fails before anything is built. A gate that fires
|
|
141
|
+
* stops the build before anything is written; a note in error is written as
|
|
142
|
+
* its page shows it, with the finding in what is returned, which
|
|
143
|
+
* `siteBuildFailed` reads.
|
|
144
|
+
*
|
|
145
|
+
* @param {object} options - The inputs.
|
|
146
|
+
* @param {object} options.config - The resolved configuration.
|
|
147
|
+
* @param {string} options.out - The directory the site is written to, which
|
|
148
|
+
* is the package's own directory under the deployed root.
|
|
149
|
+
* @param {number} [options.year] - The year the footer states.
|
|
150
|
+
* @returns {Promise<{built: object, written: object|null, fonts: object|null,
|
|
151
|
+
* site?: object, pages?: object[], pageOf?: (entry: object) => object}>}
|
|
152
|
+
* What the build found, and, when it found nothing that stops it, what was
|
|
153
|
+
* written, the pages it was written from and how a note rendered again
|
|
154
|
+
* becomes its page. `written` is `null` when a gate fired.
|
|
155
|
+
* @throws {Error} When the site's settings or its cached menu cannot be read.
|
|
156
|
+
*/
|
|
157
|
+
export function buildPackageSite({ config, out, year }: {
|
|
158
|
+
config: object;
|
|
159
|
+
out: string;
|
|
160
|
+
year?: number | undefined;
|
|
161
|
+
}): Promise<{
|
|
162
|
+
built: object;
|
|
163
|
+
written: object | null;
|
|
164
|
+
fonts: object | null;
|
|
165
|
+
site?: object;
|
|
166
|
+
pages?: object[];
|
|
167
|
+
pageOf?: (entry: object) => object;
|
|
168
|
+
}>;
|
|
169
|
+
/**
|
|
170
|
+
* The files the layouts link that the theme ships as they are: the site and
|
|
171
|
+
* icon stylesheets, the spoiler script, the icon font and the theme's images.
|
|
172
|
+
*/
|
|
173
|
+
export const SITE_STATIC_DIR: string;
|
|
@@ -27,17 +27,22 @@ export function noindexHeaders(): string[];
|
|
|
27
27
|
* that names their version, so a year's lifetime never serves a stale file.
|
|
28
28
|
*
|
|
29
29
|
* @param {object} [options] - Options.
|
|
30
|
-
* @param {string} [options.pkg] - The content package,
|
|
30
|
+
* @param {string} [options.pkg] - The content package, whose site is served at
|
|
31
|
+
* `/<pkg>/` unless `base` says otherwise.
|
|
32
|
+
* @param {string} [options.base] - The path the site is served at, beginning
|
|
33
|
+
* and ending with `/`.
|
|
31
34
|
* @param {boolean} [options.fonts] - Whether the site carries the fonts.
|
|
32
35
|
* @returns {string} The file's contents.
|
|
33
36
|
*/
|
|
34
|
-
export function headers({ pkg, fonts }?: {
|
|
37
|
+
export function headers({ pkg, base, fonts }?: {
|
|
35
38
|
pkg?: string | undefined;
|
|
39
|
+
base?: string | undefined;
|
|
36
40
|
fonts?: boolean | undefined;
|
|
37
41
|
}): string;
|
|
38
42
|
export function indexSite(where: {
|
|
39
43
|
site: string;
|
|
40
44
|
output: string;
|
|
45
|
+
base?: string;
|
|
41
46
|
}): Promise<{
|
|
42
47
|
pages: number;
|
|
43
48
|
}>;
|
|
@@ -59,7 +64,10 @@ export function indexSite(where: {
|
|
|
59
64
|
*
|
|
60
65
|
* @param {object} options - Options.
|
|
61
66
|
* @param {string} options.pkg - The content package name, which is also the
|
|
62
|
-
* directory
|
|
67
|
+
* directory the site is rendered into unless `base` says otherwise.
|
|
68
|
+
* @param {string} [options.base] - The path the site is served at, beginning
|
|
69
|
+
* and ending with `/`; the site is rendered into that path under `out`, so
|
|
70
|
+
* a site served at `/` is rendered at `out` itself.
|
|
63
71
|
* @param {string} options.out - The directory that is deployed.
|
|
64
72
|
* @param {boolean} [options.search] - Whether to build the search index;
|
|
65
73
|
* `site.search` in the configuration. Default `true`.
|
|
@@ -73,8 +81,9 @@ export function indexSite(where: {
|
|
|
73
81
|
* under the prefix; or, located at the rendered site, when the indexer
|
|
74
82
|
* fails.
|
|
75
83
|
*/
|
|
76
|
-
export function writeSiteRoot({ pkg, out, search, indexer }: {
|
|
84
|
+
export function writeSiteRoot({ pkg, base, out, search, indexer }: {
|
|
77
85
|
pkg: string;
|
|
86
|
+
base?: string | undefined;
|
|
78
87
|
out: string;
|
|
79
88
|
search?: boolean | undefined;
|
|
80
89
|
indexer?: SiteIndexer | undefined;
|
|
@@ -117,6 +126,7 @@ export const ORIGIN_SUFFIX: string;
|
|
|
117
126
|
export type SiteIndexer = (where: {
|
|
118
127
|
site: string;
|
|
119
128
|
output: string;
|
|
129
|
+
base?: string;
|
|
120
130
|
}) => Promise<{
|
|
121
131
|
pages: number;
|
|
122
132
|
}>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The continents and regions every place lies in.
|
|
3
|
+
*
|
|
4
|
+
* @param {Map<string, {shortcode: string, name: string, subType?: string, parents: string[]}>} places -
|
|
5
|
+
* Every place, by shortcode, as {@link module:engine/map-places.mapWorld} reads them.
|
|
6
|
+
* @returns {(shortcodes: Iterable<string>) => {continents: string[], regions: string[]}}
|
|
7
|
+
* The names of the continents and the outermost regions the given places lie
|
|
8
|
+
* in, each sorted.
|
|
9
|
+
*/
|
|
10
|
+
export function placeGeography(places: Map<string, {
|
|
11
|
+
shortcode: string;
|
|
12
|
+
name: string;
|
|
13
|
+
subType?: string;
|
|
14
|
+
parents: string[];
|
|
15
|
+
}>): (shortcodes: Iterable<string>) => {
|
|
16
|
+
continents: string[];
|
|
17
|
+
regions: string[];
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* The places a note lies in: itself for a place, its `homes` and its
|
|
21
|
+
* `locations` otherwise.
|
|
22
|
+
*
|
|
23
|
+
* @param {object} fm - The note's frontmatter.
|
|
24
|
+
* @returns {string[]} Shortcodes, lower case.
|
|
25
|
+
*/
|
|
26
|
+
export function notePlaces(fm: object): string[];
|
|
27
|
+
/**
|
|
28
|
+
* What a note's page tells the search.
|
|
29
|
+
*
|
|
30
|
+
* @param {object} fm - The page's frontmatter: the note's, with its `package`.
|
|
31
|
+
* @param {object} options - What the values resolve against.
|
|
32
|
+
* @param {(shortcodes: Iterable<string>) => {continents: string[], regions: string[]}} options.geography -
|
|
33
|
+
* From {@link placeGeography}.
|
|
34
|
+
* @param {object} [options.index] - The site's address index, which names the
|
|
35
|
+
* culture `data.culture` names.
|
|
36
|
+
* @returns {{filters: Array<{name: string, values: string[]}>, names: string[]}}
|
|
37
|
+
* Each filter with a value, in {@link SEARCH_FILTERS} order, and the names a
|
|
38
|
+
* search weights.
|
|
39
|
+
*/
|
|
40
|
+
export function searchMetadata(fm: object, { geography, index }: {
|
|
41
|
+
geography: (shortcodes: Iterable<string>) => {
|
|
42
|
+
continents: string[];
|
|
43
|
+
regions: string[];
|
|
44
|
+
};
|
|
45
|
+
index?: object | undefined;
|
|
46
|
+
}): {
|
|
47
|
+
filters: Array<{
|
|
48
|
+
name: string;
|
|
49
|
+
values: string[];
|
|
50
|
+
}>;
|
|
51
|
+
names: string[];
|
|
52
|
+
};
|
|
53
|
+
/** The filters a note's page carries, in the order a reader is offered them. */
|
|
54
|
+
export const SEARCH_FILTERS: readonly string[];
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serve a package's site, and keep it current.
|
|
3
|
+
*
|
|
4
|
+
* @param {object} options - The inputs.
|
|
5
|
+
* @param {object} options.config - The resolved configuration.
|
|
6
|
+
* @param {string} options.out - The site's directory under the deployed
|
|
7
|
+
* root, which the site is written to.
|
|
8
|
+
* @param {string} [options.root] - The deployed root, which is served. The
|
|
9
|
+
* directory above `out` by default; `out` itself for a site served at `/`.
|
|
10
|
+
* @param {string} [options.host] - The address to listen on.
|
|
11
|
+
* @param {number} [options.port] - The port; `0` takes any free one.
|
|
12
|
+
* @param {boolean} [options.search] - Build the search index after the first
|
|
13
|
+
* build, where the site has one.
|
|
14
|
+
* @param {number} [options.year] - The year the footer states.
|
|
15
|
+
* @param {(event: {kind: string, built?: object, files?: string[], findings?: object[], error?: unknown}) => void} [options.report] -
|
|
16
|
+
* Told of each build: `built` for a whole build, `page` for one note's page,
|
|
17
|
+
* `theme` for the theme, `failed` with what the build found, `error` with
|
|
18
|
+
* what it threw.
|
|
19
|
+
* @returns {Promise<{url: string, close: () => Promise<void>, settled: () => Promise<void>}>}
|
|
20
|
+
* The address of the site's home page, how to stop serving, and a promise
|
|
21
|
+
* for the moment every change seen so far has been written.
|
|
22
|
+
*/
|
|
23
|
+
export function serveSite({ config, out, root, host, port, search, year, report, }: {
|
|
24
|
+
config: object;
|
|
25
|
+
out: string;
|
|
26
|
+
root?: string | undefined;
|
|
27
|
+
host?: string | undefined;
|
|
28
|
+
port?: number | undefined;
|
|
29
|
+
search?: boolean | undefined;
|
|
30
|
+
year?: number | undefined;
|
|
31
|
+
report?: ((event: {
|
|
32
|
+
kind: string;
|
|
33
|
+
built?: object;
|
|
34
|
+
files?: string[];
|
|
35
|
+
findings?: object[];
|
|
36
|
+
error?: unknown;
|
|
37
|
+
}) => void) | undefined;
|
|
38
|
+
}): Promise<{
|
|
39
|
+
url: string;
|
|
40
|
+
close: () => Promise<void>;
|
|
41
|
+
settled: () => Promise<void>;
|
|
42
|
+
}>;
|
|
43
|
+
/** The address a served page listens on for the server's reloads. */
|
|
44
|
+
export const RELOAD_PATH: "/__package-build/reload";
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The banner data the theme ships.
|
|
3
|
+
*
|
|
4
|
+
* @returns {{banners: object, kinds: object}} The inventory and the kind mapping.
|
|
5
|
+
*/
|
|
6
|
+
export function shippedBannerData(): {
|
|
7
|
+
banners: object;
|
|
8
|
+
kinds: object;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* The address of a page's banner.
|
|
12
|
+
*
|
|
13
|
+
* @param {object} site - The site: `params.cdnBaseURL` and `basePath`.
|
|
14
|
+
* @param {object} fields - What the page states.
|
|
15
|
+
* @param {object} [fields.data] - The page's `data`, read for the resolved `banner`.
|
|
16
|
+
* @param {unknown} [fields.banner] - The hand-authored `banner` value.
|
|
17
|
+
* @param {string} [fields.type] - The note `type`.
|
|
18
|
+
* @param {string} [fields.subType] - The note `subType`.
|
|
19
|
+
* @param {string} [fields.category] - The page's `category`.
|
|
20
|
+
* @param {string} [fields.subtype] - The name to default to when no `type` is given.
|
|
21
|
+
* @param {string} [fields.context] - The page address, named in a report.
|
|
22
|
+
* @param {object} [options] - Options.
|
|
23
|
+
* @param {{banners: object, kinds: object}} [options.data] - The inventory and the
|
|
24
|
+
* kind mapping. The shipped ones by default.
|
|
25
|
+
* @param {(finding: {severity: string, message: string, page?: string}) => void} [options.report] -
|
|
26
|
+
* Receives each name that misses the inventory, once.
|
|
27
|
+
* @param {Set<string>} [options.reported] - The names already reported.
|
|
28
|
+
* @returns {string} The address, or `""` when the page has no banner.
|
|
29
|
+
*/
|
|
30
|
+
export function bannerUrl(site: object, fields: {
|
|
31
|
+
data?: object | undefined;
|
|
32
|
+
banner?: unknown;
|
|
33
|
+
type?: string | undefined;
|
|
34
|
+
subType?: string | undefined;
|
|
35
|
+
category?: string | undefined;
|
|
36
|
+
subtype?: string | undefined;
|
|
37
|
+
context?: string | undefined;
|
|
38
|
+
}, { data, report, reported }?: {
|
|
39
|
+
data?: {
|
|
40
|
+
banners: object;
|
|
41
|
+
kinds: object;
|
|
42
|
+
} | undefined;
|
|
43
|
+
report?: ((finding: {
|
|
44
|
+
severity: string;
|
|
45
|
+
message: string;
|
|
46
|
+
page?: string;
|
|
47
|
+
}) => void) | undefined;
|
|
48
|
+
reported?: Set<string> | undefined;
|
|
49
|
+
}): string;
|
|
50
|
+
/** The directory holding the banner inventory and the kind mapping. */
|
|
51
|
+
export const BANNER_DATA_DIR: string;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/** Whether an address names a host: `http://`, `https://` or `//`. */
|
|
2
|
+
export function isAbsoluteUrl(url: any): boolean;
|
|
3
|
+
/**
|
|
4
|
+
* The path a site is served under, with a leading and a trailing slash.
|
|
5
|
+
*
|
|
6
|
+
* @param {object} site - The site; `baseURL` is its address.
|
|
7
|
+
* @returns {string} `/` for a site at its origin's root, `/thalorna/` for one under a prefix.
|
|
8
|
+
*/
|
|
9
|
+
export function basePath(site: object): string;
|
|
10
|
+
/**
|
|
11
|
+
* A path inside the site, under its base path.
|
|
12
|
+
*
|
|
13
|
+
* A leading slash is dropped first: it would otherwise read as "from the
|
|
14
|
+
* origin" and leave the base path off.
|
|
15
|
+
*
|
|
16
|
+
* @param {object} site - The site.
|
|
17
|
+
* @param {string} [target] - The path; empty for the site's root.
|
|
18
|
+
* @returns {string} The address.
|
|
19
|
+
*/
|
|
20
|
+
export function relUrl(site: object, target?: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* An asset path, resolved against the site's asset host.
|
|
23
|
+
*
|
|
24
|
+
* An absolute address is returned as written. Otherwise the path is joined onto
|
|
25
|
+
* `params.cdnBaseURL`, and with none set it is a path inside the site.
|
|
26
|
+
*
|
|
27
|
+
* @param {object} site - The site; `params.cdnBaseURL` is the asset root.
|
|
28
|
+
* @param {string} target - The asset path.
|
|
29
|
+
* @returns {string} The address.
|
|
30
|
+
*/
|
|
31
|
+
export function cdnUrl(site: object, target: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* A link a consuming site supplied, resolved against the site it is rendered on.
|
|
34
|
+
*
|
|
35
|
+
* An absolute address, a fragment and a query are returned as written; anything
|
|
36
|
+
* else is a path inside the site.
|
|
37
|
+
*
|
|
38
|
+
* @param {object} site - The site.
|
|
39
|
+
* @param {string} [url] - The link; empty for the site's root.
|
|
40
|
+
* @returns {string} The address.
|
|
41
|
+
*/
|
|
42
|
+
export function siteUrl(site: object, url?: string): string;
|
|
43
|
+
/**
|
|
44
|
+
* A link from a page's data, with a scheme that could run script refused.
|
|
45
|
+
*
|
|
46
|
+
* @param {unknown} url - The link as the data states it.
|
|
47
|
+
* @returns {string} The link, or `#` when its scheme is not one a reader should follow.
|
|
48
|
+
*/
|
|
49
|
+
export function safeUrl(url: unknown): string;
|
|
50
|
+
/**
|
|
51
|
+
* The address of a tag's listing page.
|
|
52
|
+
*
|
|
53
|
+
* One function writes it for the link in a page's tag row and for the page the
|
|
54
|
+
* site build writes, so the two cannot disagree.
|
|
55
|
+
*
|
|
56
|
+
* @param {object} site - The site.
|
|
57
|
+
* @param {string} tag - The tag.
|
|
58
|
+
* @returns {string} The address.
|
|
59
|
+
*/
|
|
60
|
+
export function tagUrl(site: object, tag: string): string;
|