@heroiclands/package-build 23.12.8 → 24.0.0
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 +84 -0
- package/README.md +3 -2
- package/assets/preview/gitea.ini +12 -7
- package/assets/styles/content-base.css +293 -24
- package/bin/content-commands.mjs +370 -213
- package/bin/package-build-preview.mjs +2 -2
- 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 +110 -89
- package/docs/authoring/links-and-markup.md +469 -97
- package/docs/commands.md +259 -78
- package/docs/configuration.md +211 -103
- package/docs/content-format.md +4 -4
- package/docs/diagnostics.md +44 -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 +112 -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 +677 -319
- package/docs/reference/note-types.md +47 -10
- package/docs/reference/theme-pages.md +178 -108
- package/docs/source-preview.md +16 -2
- package/engine/anchors.mjs +2 -2
- package/engine/asset-shipping.mjs +22 -10
- package/engine/base-compiler.mjs +62 -104
- package/engine/changelog-lint.mjs +1 -1
- package/engine/code-fences.mjs +3 -3
- package/engine/content-address.mjs +1 -1
- package/engine/content-alerts.mjs +8 -4
- package/engine/content-blocks.mjs +29 -14
- package/engine/content-embeds.mjs +1 -1
- package/engine/content-expand.mjs +376 -0
- package/engine/content-figures.mjs +18 -11
- package/engine/content-format.yaml +8 -0
- package/engine/content-glyphs.mjs +213 -0
- package/engine/content-images.mjs +6 -7
- package/engine/content-index.mjs +1 -1
- 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 +376 -43
- package/engine/content-spans.mjs +6 -3
- package/engine/content-styles.mjs +91 -0
- package/engine/content-symbols.mjs +186 -0
- package/engine/content-verse.mjs +738 -0
- package/engine/core-report.mjs +169 -0
- package/engine/core-vocabulary.mjs +208 -0
- package/engine/dictionary-html.mjs +119 -0
- package/engine/dictionary-rows.mjs +15 -4
- package/engine/field-reference.mjs +5 -5
- package/engine/first-use.mjs +17 -27
- 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/key-case-collisions.mjs +136 -0
- package/engine/language-data.mjs +203 -6
- package/engine/language-rows.mjs +8 -2
- package/engine/language-terms.mjs +186 -16
- package/engine/language-words.mjs +12 -0
- package/engine/logographic.mjs +255 -0
- package/engine/map-lexicon.mjs +262 -47
- 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/names.mjs +36 -9
- package/engine/note-matter.mjs +66 -0
- package/engine/note-vocabulary.mjs +187 -3
- package/engine/pdf-build.mjs +69 -133
- package/engine/pdf-render.mjs +205 -58
- 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/read-stdin.mjs +29 -0
- package/engine/run-rows.mjs +2 -2
- package/engine/run-words.mjs +6 -112
- 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 +260 -315
- 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 +52 -525
- package/engine/site-render.mjs +593 -0
- package/engine/site-root.mjs +22 -13
- package/engine/site-search.mjs +161 -0
- package/engine/site-serve.mjs +273 -0
- package/engine/site-theme-banner.mjs +154 -0
- package/engine/site-theme-urls.mjs +125 -0
- package/engine/site-theme.mjs +926 -0
- package/engine/sql-tables.mjs +20 -3
- 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 +364 -0
- package/engine/word-rows.mjs +12 -2
- package/engine/word-terms.mjs +38 -4
- package/manifest.mjs +3 -4
- package/package.json +11 -8
- 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 +106 -14
- 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/code-fences.d.mts +3 -3
- 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 +70 -4
- 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/content-verse.d.mts +240 -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/dictionary-rows.d.mts +10 -0
- package/types/engine/field-reference.d.mts +2 -2
- 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/key-case-collisions.d.mts +28 -0
- package/types/engine/language-data.d.mts +0 -2
- package/types/engine/language-terms.d.mts +24 -2
- package/types/engine/logographic.d.mts +45 -0
- package/types/engine/map-lexicon.d.mts +66 -13
- 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/names.d.mts +34 -3
- package/types/engine/note-matter.d.mts +48 -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/read-stdin.d.mts +11 -0
- package/types/engine/run-rows.d.mts +2 -2
- package/types/engine/run-words.d.mts +0 -15
- 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-render.d.mts +171 -0
- package/types/engine/site-root.d.mts +12 -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/sql-tables.d.mts +4 -1
- 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 +83 -0
- 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/content-poetry.mjs +0 -240
- 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/content-poetry.d.mts +0 -58
- 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
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* `[{name, url, children?: [{name, url}]}]`, every `url` absolute. Checked
|
|
5
5
|
* on fetch and again on read: a file that is not a navigation would otherwise
|
|
6
|
-
* reach the
|
|
6
|
+
* reach the menu as `undefined` labels and links.
|
|
7
7
|
*
|
|
8
8
|
* @param {unknown} value - The parsed document.
|
|
9
9
|
* @param {string} where - What is being checked, for the error.
|
|
@@ -11,18 +11,6 @@
|
|
|
11
11
|
* @throws {TypeError} When the shape is not a navigation.
|
|
12
12
|
*/
|
|
13
13
|
export function checkNavigation(value: unknown, where?: string): NavigationEntry[];
|
|
14
|
-
/**
|
|
15
|
-
* The `[[menu.main]]` entries a navigation renders as.
|
|
16
|
-
*
|
|
17
|
-
* Entry for entry, in order; a dropdown is an entry with an `identifier` and
|
|
18
|
-
* its children are entries naming it as `parent`, which is how the theme's
|
|
19
|
-
* header partial draws one. Weights count from one within each level, so the
|
|
20
|
-
* order is the navigation's and not Hugo's alphabetical fallback.
|
|
21
|
-
*
|
|
22
|
-
* @param {readonly NavigationEntry[]} navigation - The navigation.
|
|
23
|
-
* @returns {MenuEntry[]} The menu entries.
|
|
24
|
-
*/
|
|
25
|
-
export function menuEntries(navigation: readonly NavigationEntry[]): MenuEntry[];
|
|
26
14
|
/**
|
|
27
15
|
* Where the fetched navigation sits.
|
|
28
16
|
*
|
|
@@ -64,137 +52,45 @@ export function fetchNavigation(config: object, { url, fetch }?: {
|
|
|
64
52
|
fetch?: typeof globalThis.fetch | undefined;
|
|
65
53
|
}): Promise<string>;
|
|
66
54
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* The theme ships inside this package at `hugo-theme/`, so the directory Hugo
|
|
71
|
-
* reads themes from is {@link PACKAGE_ROOT}. `theme` stays {@link THEME}, so
|
|
72
|
-
* Hugo opens `<themesDir>/hugo-theme/layouts`.
|
|
73
|
-
*
|
|
74
|
-
* Written as a path rather than assumed: `build/hugo/` and the installed
|
|
75
|
-
* package sit at whatever distance the install put them, and a worktree
|
|
76
|
-
* resolving its parent's install says so in the generated file.
|
|
77
|
-
*
|
|
78
|
-
* @param {string} rootDir - The repository root.
|
|
79
|
-
* @returns {string} The relative path, POSIX-separated.
|
|
80
|
-
*/
|
|
81
|
-
export function resolveThemesDir(rootDir: string): string;
|
|
82
|
-
/**
|
|
83
|
-
* The Hugo configuration, as an object.
|
|
84
|
-
*
|
|
85
|
-
* Pure: every input is handed in, so a test can describe the generated shape
|
|
86
|
-
* without a repository on disk. {@link generateHugoConfig} is the same function
|
|
87
|
-
* with the reading put back.
|
|
55
|
+
* What a site is, read from the configuration: its address, its title and the
|
|
56
|
+
* parameters its layouts read.
|
|
88
57
|
*
|
|
89
58
|
* `checkHomepage` runs first, before any value is composed — a missing or
|
|
90
59
|
* mismatched `package.json` `homepage` is a finding on every site build.
|
|
91
60
|
*
|
|
92
61
|
* @param {object} options - The sources.
|
|
93
62
|
* @param {object} options.config - The resolved build configuration.
|
|
94
|
-
* @
|
|
95
|
-
*
|
|
96
|
-
*
|
|
63
|
+
* @returns {{baseURL: string, title: string, params: Record<string, unknown>}}
|
|
64
|
+
* The site. `params` holds `description`, `author`, `cdnBaseURL`, `brand`,
|
|
65
|
+
* `notfound` and `scriptFonts`, each where the configuration states it.
|
|
97
66
|
* @throws {TypeError} When `homepage` fails `checkHomepage`, or the
|
|
98
67
|
* configuration declares no `site.title` or `packageBuild.manifest.title`, no
|
|
99
68
|
* `site.description`, or no `site.assets`.
|
|
100
69
|
*/
|
|
101
|
-
export function
|
|
70
|
+
export function siteSettings({ config }: {
|
|
102
71
|
config: object;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
* The configuration as the TOML Hugo reads.
|
|
108
|
-
*
|
|
109
|
-
* @param {Record<string, unknown>} generated - From {@link hugoConfig}.
|
|
110
|
-
* @returns {string} The file's contents.
|
|
111
|
-
*/
|
|
112
|
-
export function hugoToml(generated: Record<string, unknown>): string;
|
|
113
|
-
/**
|
|
114
|
-
* The Hugo configuration, every source read from the repository.
|
|
115
|
-
*
|
|
116
|
-
* Reads the cached navigation and the installed theme's location, and
|
|
117
|
-
* composes them with {@link hugoConfig}. Nothing is written, so a caller can
|
|
118
|
-
* run this before touching the output tree and fail with it intact.
|
|
119
|
-
*
|
|
120
|
-
* @param {object} config - The resolved build configuration.
|
|
121
|
-
* @returns {Record<string, any>} The configuration Hugo reads.
|
|
122
|
-
* @throws {Error} When any source is missing or wrong.
|
|
123
|
-
*/
|
|
124
|
-
export function generateHugoConfig(config: object): Record<string, any>;
|
|
125
|
-
/**
|
|
126
|
-
* Write `build/hugo/hugo.toml`.
|
|
127
|
-
*
|
|
128
|
-
* @param {object} config - The resolved build configuration.
|
|
129
|
-
* @param {Record<string, unknown>} [generated] - The configuration to write,
|
|
130
|
-
* when the caller already generated it. Generated here otherwise.
|
|
131
|
-
* @returns {{file: string}} The file written.
|
|
132
|
-
*/
|
|
133
|
-
export function writeHugoConfig(config: object, generated?: Record<string, unknown>): {
|
|
134
|
-
file: string;
|
|
72
|
+
}): {
|
|
73
|
+
baseURL: string;
|
|
74
|
+
title: string;
|
|
75
|
+
params: Record<string, unknown>;
|
|
135
76
|
};
|
|
136
|
-
/** The Hugo source directory, relative to the repository root. */
|
|
137
|
-
export const HUGO_SOURCE: "build/hugo";
|
|
138
|
-
/** The content mount `package-build site` writes, relative to the repository root. */
|
|
139
|
-
export const HUGO_CONTENT: "build/hugo/content";
|
|
140
77
|
/**
|
|
141
78
|
* The directory that is deployed, relative to the repository root.
|
|
142
79
|
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
80
|
+
* `package-build site build` renders into `<DEPLOY_ROOT>/<contentPackage>/`
|
|
81
|
+
* and writes `_headers` beside it and the search index inside it.
|
|
145
82
|
*/
|
|
146
83
|
export const DEPLOY_ROOT: "build/site";
|
|
147
|
-
/** The theme's directory name under `themesDir`. */
|
|
148
|
-
export const THEME: "hugo-theme";
|
|
149
|
-
/** The locale every site renders in. */
|
|
150
|
-
export const LOCALE: "en-us";
|
|
151
84
|
/**
|
|
152
85
|
* The brand chrome's own links, the same on every site.
|
|
153
86
|
*
|
|
154
|
-
* `logo` is
|
|
155
|
-
* the asset host rather than an address.
|
|
87
|
+
* `logo` is a path on the asset host rather than an address.
|
|
156
88
|
*/
|
|
157
89
|
export const BRAND: Readonly<{
|
|
158
90
|
logo: "images/brand/sohl-icon-white.webp";
|
|
159
91
|
licenseURL: "https://www.heroiclands.org/license/";
|
|
160
92
|
discordURL: "https://discord.gg/EwMfkNd3az";
|
|
161
93
|
}>;
|
|
162
|
-
/**
|
|
163
|
-
* The kinds no site renders.
|
|
164
|
-
*
|
|
165
|
-
* A site is its homepage and its pages: `home` and `page` are the only kinds,
|
|
166
|
-
* for every package and whatever its notes carry. A `section` is a listing
|
|
167
|
-
* Hugo would generate from a content directory; `taxonomy` and `term` are
|
|
168
|
-
* listings it would generate from `tags:`; `RSS` is a feed. Every structure
|
|
169
|
-
* between the homepage and the pages is authored instead, as a `doc` note
|
|
170
|
-
* carrying a content table — a tag is a field such a table filters on, not a
|
|
171
|
-
* page of its own.
|
|
172
|
-
*/
|
|
173
|
-
export const DISABLE_KINDS: readonly string[];
|
|
174
|
-
/**
|
|
175
|
-
* The markup settings the toolchain's own output requires.
|
|
176
|
-
*
|
|
177
|
-
* Pages are written with raw HTML in them — a `<figure>` for every image, a
|
|
178
|
-
* `<span>` marking an unresolved link — and Goldmark drops raw HTML unless
|
|
179
|
-
* told otherwise. A theme cannot supply this: Hugo does not merge a theme's
|
|
180
|
-
* `markup` block.
|
|
181
|
-
*
|
|
182
|
-
* `extensions.taskList` is off because the format has no checkbox: Goldmark
|
|
183
|
-
* enables it by default, which is the only reason a list item opened with
|
|
184
|
-
* `[ ]` renders a `<input type="checkbox">` here and the same two characters as
|
|
185
|
-
* plain text in the pack and the book. Off, a list item's text begins right
|
|
186
|
-
* after its marker on every surface.
|
|
187
|
-
*/
|
|
188
|
-
export const MARKUP: Readonly<{
|
|
189
|
-
goldmark: Readonly<{
|
|
190
|
-
renderer: Readonly<{
|
|
191
|
-
unsafe: true;
|
|
192
|
-
}>;
|
|
193
|
-
extensions: Readonly<{
|
|
194
|
-
taskList: false;
|
|
195
|
-
}>;
|
|
196
|
-
}>;
|
|
197
|
-
}>;
|
|
198
94
|
/** Where the navigation is published. */
|
|
199
95
|
export const NAVIGATION_URL: "https://www.heroiclands.org/nav.json";
|
|
200
96
|
/** The cached navigation's file name. */
|
|
@@ -216,19 +112,3 @@ export type NavigationEntry = {
|
|
|
216
112
|
*/
|
|
217
113
|
children?: NavigationEntry[] | undefined;
|
|
218
114
|
};
|
|
219
|
-
/**
|
|
220
|
-
* A Hugo menu entry, as `[[menu.main]]` states one.
|
|
221
|
-
*/
|
|
222
|
-
export type MenuEntry = {
|
|
223
|
-
name: string;
|
|
224
|
-
url: string;
|
|
225
|
-
weight: number;
|
|
226
|
-
/**
|
|
227
|
-
* - Set on an entry that has children.
|
|
228
|
-
*/
|
|
229
|
-
identifier?: string | undefined;
|
|
230
|
-
/**
|
|
231
|
-
* - Set on a child, naming its parent's identifier.
|
|
232
|
-
*/
|
|
233
|
-
parent?: string | undefined;
|
|
234
|
-
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text escaped for XML content and attribute values.
|
|
3
|
+
*
|
|
4
|
+
* @param {unknown} value - The text.
|
|
5
|
+
* @returns {string} The escaped text.
|
|
6
|
+
*/
|
|
7
|
+
export function escapeXml(value: unknown): string;
|
|
8
|
+
/**
|
|
9
|
+
* A date as an RFC 3339 timestamp, or `""` for a value that is no date.
|
|
10
|
+
*
|
|
11
|
+
* @param {unknown} value - A date, or a string a `Date` reads.
|
|
12
|
+
* @returns {string} The timestamp, in UTC.
|
|
13
|
+
*/
|
|
14
|
+
export function timestamp(value: unknown): string;
|
|
15
|
+
/**
|
|
16
|
+
* A site's sitemap.
|
|
17
|
+
*
|
|
18
|
+
* @param {Array<{loc: string, lastmod?: unknown}>} entries - Each page's full
|
|
19
|
+
* address, and the date it states where it states one.
|
|
20
|
+
* @returns {string} The document.
|
|
21
|
+
*/
|
|
22
|
+
export function sitemapXml(entries: Array<{
|
|
23
|
+
loc: string;
|
|
24
|
+
lastmod?: unknown;
|
|
25
|
+
}>): string;
|
|
26
|
+
/**
|
|
27
|
+
* A sitemap index naming other sitemaps.
|
|
28
|
+
*
|
|
29
|
+
* @param {readonly string[]} sitemaps - Each sitemap's full address.
|
|
30
|
+
* @returns {string} The document.
|
|
31
|
+
*/
|
|
32
|
+
export function sitemapIndexXml(sitemaps: readonly string[]): string;
|
|
33
|
+
/**
|
|
34
|
+
* The `robots.txt` of a site's root: every agent may read every page, and
|
|
35
|
+
* every sitemap is named.
|
|
36
|
+
*
|
|
37
|
+
* @param {readonly string[]} sitemaps - Each sitemap's full address, the
|
|
38
|
+
* sitemap index first.
|
|
39
|
+
* @returns {string} The file.
|
|
40
|
+
*/
|
|
41
|
+
export function robotsTxt(sitemaps: readonly string[]): string;
|
|
42
|
+
/**
|
|
43
|
+
* An Atom feed.
|
|
44
|
+
*
|
|
45
|
+
* The feed is dated by its newest entry, and an entry by its own date, so the
|
|
46
|
+
* feed changes only when a post does.
|
|
47
|
+
*
|
|
48
|
+
* @param {object} feed - The feed.
|
|
49
|
+
* @param {string} feed.title - The feed's title.
|
|
50
|
+
* @param {string} feed.id - The full address of the page the feed follows,
|
|
51
|
+
* which is also its id.
|
|
52
|
+
* @param {string} feed.self - The feed's own full address.
|
|
53
|
+
* @param {string} [feed.author] - Who writes the posts, where an entry names
|
|
54
|
+
* no author of its own.
|
|
55
|
+
* @param {Array<{title: string, url: string, date: unknown, author?: string,
|
|
56
|
+
* summary?: string, content?: string}>} feed.entries - The posts, each with
|
|
57
|
+
* its full address and its HTML `content`.
|
|
58
|
+
* @returns {string} The document.
|
|
59
|
+
*/
|
|
60
|
+
export function atomFeed({ title, id, self, author, entries }: {
|
|
61
|
+
title: string;
|
|
62
|
+
id: string;
|
|
63
|
+
self: string;
|
|
64
|
+
author?: string | undefined;
|
|
65
|
+
entries: Array<{
|
|
66
|
+
title: string;
|
|
67
|
+
url: string;
|
|
68
|
+
date: unknown;
|
|
69
|
+
author?: string;
|
|
70
|
+
summary?: string;
|
|
71
|
+
content?: string;
|
|
72
|
+
}>;
|
|
73
|
+
}): string;
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
* Build the address index a site's wikilink resolver reads.
|
|
3
3
|
*
|
|
4
4
|
* @param {readonly SiteEntry[]} entries - Every page the site will publish,
|
|
5
|
-
* each already knowing its own `url`.
|
|
5
|
+
* each already knowing its own `url`. An entry may carry the `anchors` its
|
|
6
|
+
* body declares, from a content-index record, in place of the body they are
|
|
7
|
+
* read from.
|
|
6
8
|
* @param {object} [options] - Cross-package inputs.
|
|
7
9
|
* @param {string} [options.package] - The builder's own content package.
|
|
8
10
|
* @param {string} [options.currentDate="720.1"] - Setting-wide neutral date for recurring events.
|
|
@@ -156,11 +158,11 @@ export type SiteEntry = {
|
|
|
156
158
|
/**
|
|
157
159
|
* URL segment.
|
|
158
160
|
*/
|
|
159
|
-
slug
|
|
161
|
+
slug?: string | undefined;
|
|
160
162
|
/**
|
|
161
163
|
* Source file's basename, e.g. `Climbing.md`.
|
|
162
164
|
*/
|
|
163
|
-
base
|
|
165
|
+
base?: string | undefined;
|
|
164
166
|
/**
|
|
165
167
|
* The page's published address.
|
|
166
168
|
*/
|
|
@@ -171,6 +173,12 @@ export type SiteEntry = {
|
|
|
171
173
|
* page is indexed as declaring none.
|
|
172
174
|
*/
|
|
173
175
|
body?: string | undefined;
|
|
176
|
+
/**
|
|
177
|
+
* The anchors the body declares, when the
|
|
178
|
+
* caller holds them already — a content-index
|
|
179
|
+
* record's — in place of reading `body`.
|
|
180
|
+
*/
|
|
181
|
+
anchors?: object[] | undefined;
|
|
174
182
|
};
|
|
175
183
|
/**
|
|
176
184
|
* The resolved index and everything a wikilink resolver reads beside it.
|
|
@@ -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,171 @@
|
|
|
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[], findings: object[]}} Every file
|
|
54
|
+
* written, the address of every page, and the layouts' findings.
|
|
55
|
+
* @throws {Error} When a page's address is outside the site, or a site served
|
|
56
|
+
* under a path asks for a sitemap index.
|
|
57
|
+
*/
|
|
58
|
+
export function writeSite({ site, pages, out, report, staticDir, only }: {
|
|
59
|
+
site: object;
|
|
60
|
+
pages: readonly object[];
|
|
61
|
+
out: string;
|
|
62
|
+
report?: ((finding: import("./site-theme.mjs").Finding) => void) | undefined;
|
|
63
|
+
staticDir?: string | undefined;
|
|
64
|
+
only?: ReadonlySet<string> | undefined;
|
|
65
|
+
}): {
|
|
66
|
+
files: string[];
|
|
67
|
+
pages: string[];
|
|
68
|
+
findings: object[];
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* A package's pages, from its site build.
|
|
72
|
+
*
|
|
73
|
+
* Each body is rendered by the `web` renderer from the markdown the build
|
|
74
|
+
* expanded, and each page carries what it tells the search; see
|
|
75
|
+
* {@link module:engine/site-search}. The site carries what the configuration
|
|
76
|
+
* asks for: `site.tags` as `tagPages`, `site.feed` as the feed's section, each
|
|
77
|
+
* package of `site.sitemaps` as its sitemap's address on the site's origin,
|
|
78
|
+
* and each of `site.mergeIndexes` as the path of its search bundle.
|
|
79
|
+
*
|
|
80
|
+
* @param {object} options - The inputs.
|
|
81
|
+
* @param {object} options.config - The resolved configuration.
|
|
82
|
+
* @param {object} options.built - What `buildSite` returned with `write: false`.
|
|
83
|
+
* @param {{baseURL: string, title: string, params: object}} options.settings -
|
|
84
|
+
* From {@link module:engine/site-config.siteSettings}.
|
|
85
|
+
* @param {readonly {name: string, url: string, children?: object[]}[]} [options.navigation] -
|
|
86
|
+
* The menu.
|
|
87
|
+
* @param {number} [options.year] - The year the footer states.
|
|
88
|
+
* @returns {{site: object, pages: object[], pageOf: (entry: object) => object}}
|
|
89
|
+
* What {@link writeSite} is given, and how one note the build rendered again
|
|
90
|
+
* becomes its page.
|
|
91
|
+
*/
|
|
92
|
+
export function packageSite({ config, built, settings, navigation, year }: {
|
|
93
|
+
config: object;
|
|
94
|
+
built: object;
|
|
95
|
+
settings: {
|
|
96
|
+
baseURL: string;
|
|
97
|
+
title: string;
|
|
98
|
+
params: object;
|
|
99
|
+
};
|
|
100
|
+
navigation?: readonly {
|
|
101
|
+
name: string;
|
|
102
|
+
url: string;
|
|
103
|
+
children?: object[];
|
|
104
|
+
}[] | undefined;
|
|
105
|
+
year?: number | undefined;
|
|
106
|
+
}): {
|
|
107
|
+
site: object;
|
|
108
|
+
pages: object[];
|
|
109
|
+
pageOf: (entry: object) => object;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* The directory a package's site is written to: its base path under the
|
|
113
|
+
* deployed root, so a site served at `/` is written at the root itself.
|
|
114
|
+
*
|
|
115
|
+
* @param {object} config - The resolved configuration.
|
|
116
|
+
* @param {string} root - The deployed root.
|
|
117
|
+
* @returns {string} The directory.
|
|
118
|
+
*/
|
|
119
|
+
export function siteDirectory(config: object, root: string): string;
|
|
120
|
+
/**
|
|
121
|
+
* Copy the script fonts the site's pages set their marked text in.
|
|
122
|
+
*
|
|
123
|
+
* @param {object} config - The resolved configuration.
|
|
124
|
+
* @param {string} out - The directory the site is written to.
|
|
125
|
+
* @returns {{findings: object[], count: number, dest?: string}} What checking
|
|
126
|
+
* the installed fonts found, and how many files were copied where. Nothing is
|
|
127
|
+
* copied when there is a finding, or when the package sets no script.
|
|
128
|
+
*/
|
|
129
|
+
export function deliverSiteFonts(config: object, out: string): {
|
|
130
|
+
findings: object[];
|
|
131
|
+
count: number;
|
|
132
|
+
dest?: string;
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Build a package's site from its content tree and write it.
|
|
136
|
+
*
|
|
137
|
+
* The site's address, title and menu are read before the tree is, so a site
|
|
138
|
+
* that cannot be described fails before anything is built. A gate that fires
|
|
139
|
+
* stops the build before anything is written; a note in error is written as
|
|
140
|
+
* its page shows it, with the finding in what is returned, which
|
|
141
|
+
* `siteBuildFailed` reads.
|
|
142
|
+
*
|
|
143
|
+
* @param {object} options - The inputs.
|
|
144
|
+
* @param {object} options.config - The resolved configuration.
|
|
145
|
+
* @param {string} options.out - The directory the site is written to, which
|
|
146
|
+
* is the package's own directory under the deployed root.
|
|
147
|
+
* @param {number} [options.year] - The year the footer states.
|
|
148
|
+
* @returns {Promise<{built: object, written: object|null, fonts: object|null,
|
|
149
|
+
* site?: object, pages?: object[], pageOf?: (entry: object) => object}>}
|
|
150
|
+
* What the build found, and, when it found nothing that stops it, what was
|
|
151
|
+
* written, the pages it was written from and how a note rendered again
|
|
152
|
+
* becomes its page. `written` is `null` when a gate fired.
|
|
153
|
+
* @throws {Error} When the site's settings or its cached menu cannot be read.
|
|
154
|
+
*/
|
|
155
|
+
export function buildPackageSite({ config, out, year }: {
|
|
156
|
+
config: object;
|
|
157
|
+
out: string;
|
|
158
|
+
year?: number | undefined;
|
|
159
|
+
}): Promise<{
|
|
160
|
+
built: object;
|
|
161
|
+
written: object | null;
|
|
162
|
+
fonts: object | null;
|
|
163
|
+
site?: object;
|
|
164
|
+
pages?: object[];
|
|
165
|
+
pageOf?: (entry: object) => object;
|
|
166
|
+
}>;
|
|
167
|
+
/**
|
|
168
|
+
* The files the layouts link that the theme ships as they are: the site and
|
|
169
|
+
* icon stylesheets, the spoiler script, the icon font and the theme's images.
|
|
170
|
+
*/
|
|
171
|
+
export const SITE_STATIC_DIR: string;
|
|
@@ -27,12 +27,16 @@ 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: {
|
|
@@ -59,7 +63,10 @@ export function indexSite(where: {
|
|
|
59
63
|
*
|
|
60
64
|
* @param {object} options - Options.
|
|
61
65
|
* @param {string} options.pkg - The content package name, which is also the
|
|
62
|
-
* directory
|
|
66
|
+
* directory the site is rendered into unless `base` says otherwise.
|
|
67
|
+
* @param {string} [options.base] - The path the site is served at, beginning
|
|
68
|
+
* and ending with `/`; the site is rendered into that path under `out`, so
|
|
69
|
+
* a site served at `/` is rendered at `out` itself.
|
|
63
70
|
* @param {string} options.out - The directory that is deployed.
|
|
64
71
|
* @param {boolean} [options.search] - Whether to build the search index;
|
|
65
72
|
* `site.search` in the configuration. Default `true`.
|
|
@@ -73,8 +80,9 @@ export function indexSite(where: {
|
|
|
73
80
|
* under the prefix; or, located at the rendered site, when the indexer
|
|
74
81
|
* fails.
|
|
75
82
|
*/
|
|
76
|
-
export function writeSiteRoot({ pkg, out, search, indexer }: {
|
|
83
|
+
export function writeSiteRoot({ pkg, base, out, search, indexer }: {
|
|
77
84
|
pkg: string;
|
|
85
|
+
base?: string | undefined;
|
|
78
86
|
out: string;
|
|
79
87
|
search?: boolean | undefined;
|
|
80
88
|
indexer?: SiteIndexer | undefined;
|
|
@@ -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";
|